From 451d4fe40194ac3cd4dc79afa48636b8a9a3a301 Mon Sep 17 00:00:00 2001 From: PRDT Finance <87976805+PRDTfinance@users.noreply.github.com> Date: Mon, 14 Aug 2023 09:36:56 +0200 Subject: [PATCH 001/855] Update index.js Added new classic contracts --- projects/prdt/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/prdt/index.js b/projects/prdt/index.js index 2a7560fb5ed8..f9c7471af6cd 100644 --- a/projects/prdt/index.js +++ b/projects/prdt/index.js @@ -11,6 +11,7 @@ const config = { predictionBTC: "0x3Df33217F0f82c99fF3ff448512F22cEf39CC208", predictionPRO: "0x599974D3f2948b50545Fb5aa77C9e0bddc230ADE", predictionPROV2: "0x22dB94d719659d7861612E0f43EE28C9FF9909C7", + predictionclassicV3: "0x00199E444155f6a06d74CF36315419d39b874f5c", }), }, polygon: { @@ -19,6 +20,7 @@ const config = { predictionMATIC: "0x59e0aD27d0F58A15128051cAA1D2917aA71AB864", predictionPRO: "0x764C3Ea13e7457261E5C1AaD597F281f3e738240", predictionPROV2: "0x8251E5EBc2d2C20f6a116144800D569FAF75d746", + predictionclassicv3: "0x9f9564BE7b566dfE4B091a83a591752102aF3F33", }), }, }; From d6ba99c8de252231f6d3b4ac04b00ee090a35a92 Mon Sep 17 00:00:00 2001 From: merlincdj <39942523+merlincdj@users.noreply.github.com> Date: Mon, 14 Aug 2023 21:37:01 +0800 Subject: [PATCH 002/855] feat: WOOFi add Linea and Base --- projects/woofi.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/projects/woofi.js b/projects/woofi.js index f3bd2151c285..bb8453bae1c4 100644 --- a/projects/woofi.js +++ b/projects/woofi.js @@ -44,7 +44,7 @@ const wooPPConfig = { ADDRESSES.arbitrum.USDT, ], optimism: [ - ADDRESSES.tombchain.FTM, // WETH + ADDRESSES.optimism.WETH_1, // WETH '0x68f180fcCe6836688e9084f035309E29Bf0A2095', // WBTC ADDRESSES.optimism.OP, // OP ADDRESSES.optimism.USDC, // USDC @@ -60,6 +60,14 @@ const wooPPConfig = { ADDRESSES.polygon_zkevm.WETH, ADDRESSES.polygon_zkevm.USDC, ], + linea: [ + ADDRESSES.linea.WETH, + ADDRESSES.linea.USDC, + ], + base: [ + ADDRESSES.base.WETH, + ADDRESSES.base.USDbC, + ], } const chainConfig = { @@ -117,6 +125,18 @@ const chainConfig = { stakingContract: null, stakingContractV2: null, }, + linea: { + wooPPContract: '0xF5d215d9C84778F85746D15762DaF39B9E83a2d6', + woo: null, + stakingContract: null, + stakingContractV2: null, + }, + base: { + wooPPContract: '0xb130a49065178465931d4f887056328CeA5D723f', + woo: null, + stakingContract: null, + stakingContractV2: null, + }, } Object.keys(chainConfig).forEach(chain => { From 76182039f5a50d73feec68d007fc212a3e7a4d53 Mon Sep 17 00:00:00 2001 From: PRDT Finance <87976805+PRDTfinance@users.noreply.github.com> Date: Thu, 23 Nov 2023 08:41:24 +0100 Subject: [PATCH 003/855] Update to add USDC to TVL Added USDC to TVL --- projects/prdt/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/prdt/index.js b/projects/prdt/index.js index f9c7471af6cd..6a64307dc647 100644 --- a/projects/prdt/index.js +++ b/projects/prdt/index.js @@ -2,6 +2,8 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs"); const USDTpolygon = ADDRESSES.polygon.USDT; const USDTbsc = ADDRESSES.bsc.USDT; +const USDCpolygon = ADDRESSES.polygon.USDC; +const USDCbsc = ADDRESSES.bsc.USDC; const config = { bsc: { @@ -28,8 +30,8 @@ const config = { module.exports = {}; module.exports = { - bsc: { tvl: sumTokensExport({ chain: "bsc", owners: config.bsc.owners, tokens: [nullAddress, USDTbsc] }) }, + bsc: { tvl: sumTokensExport({ chain: "bsc", owners: config.bsc.owners, tokens: [nullAddress, USDTbsc, USDCbsc] }) }, polygon: { - tvl: sumTokensExport({ chain: "polygon", owners: config.polygon.owners, tokens: [nullAddress, USDTpolygon] }), + tvl: sumTokensExport({ chain: "polygon", owners: config.polygon.owners, tokens: [nullAddress, USDTpolygon, USDCpolygon] }), }, }; From 932a89ef63b5e8226ad543dec4fe4980b1533911 Mon Sep 17 00:00:00 2001 From: PRDT Finance <87976805+PRDTfinance@users.noreply.github.com> Date: Thu, 7 Dec 2023 09:24:08 +0100 Subject: [PATCH 004/855] Added ETH contract TVL --- projects/prdt/index.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/projects/prdt/index.js b/projects/prdt/index.js index 6a64307dc647..354af526b6d2 100644 --- a/projects/prdt/index.js +++ b/projects/prdt/index.js @@ -4,8 +4,15 @@ const USDTpolygon = ADDRESSES.polygon.USDT; const USDTbsc = ADDRESSES.bsc.USDT; const USDCpolygon = ADDRESSES.polygon.USDC; const USDCbsc = ADDRESSES.bsc.USDC; +const USDTeth = ADDRESSES.ethereum.USDT; +const USDCeth = ADDRESSES.ethereum.USDC; const config = { + ethereum: { + owners: Object.values({ + predictionPROV2: "0x062EB9830D1f1f0C64ac598eC7921f0cbD6d4841", + }), + }, bsc: { owners: Object.values({ predictionBNB: "0x31B8A8Ee92961524fD7839DC438fd631D34b49C6", @@ -27,9 +34,10 @@ const config = { }, }; -module.exports = {}; - module.exports = { + ethereum: { + tvl: sumTokensExport({ chain: "ethereum", owners: config.ethereum.owners, tokens: [nullAddress, USDTeth, USDCeth] }), + }, bsc: { tvl: sumTokensExport({ chain: "bsc", owners: config.bsc.owners, tokens: [nullAddress, USDTbsc, USDCbsc] }) }, polygon: { tvl: sumTokensExport({ chain: "polygon", owners: config.polygon.owners, tokens: [nullAddress, USDTpolygon, USDCpolygon] }), From c97dcc3a7817193bd538db256ac978340886afa8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 7 Dec 2023 09:38:05 +0100 Subject: [PATCH 005/855] code refactor --- projects/prdt/index.js | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/projects/prdt/index.js b/projects/prdt/index.js index 354af526b6d2..d0705872bd2b 100644 --- a/projects/prdt/index.js +++ b/projects/prdt/index.js @@ -1,17 +1,12 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs"); -const USDTpolygon = ADDRESSES.polygon.USDT; -const USDTbsc = ADDRESSES.bsc.USDT; -const USDCpolygon = ADDRESSES.polygon.USDC; -const USDCbsc = ADDRESSES.bsc.USDC; -const USDTeth = ADDRESSES.ethereum.USDT; -const USDCeth = ADDRESSES.ethereum.USDC; +const { sumTokensExport, } = require("../helper/unwrapLPs"); const config = { ethereum: { owners: Object.values({ predictionPROV2: "0x062EB9830D1f1f0C64ac598eC7921f0cbD6d4841", }), + tokens: [ADDRESSES.null, ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.USDC], }, bsc: { owners: Object.values({ @@ -22,6 +17,7 @@ const config = { predictionPROV2: "0x22dB94d719659d7861612E0f43EE28C9FF9909C7", predictionclassicV3: "0x00199E444155f6a06d74CF36315419d39b874f5c", }), + tokens: [ADDRESSES.null, ADDRESSES.bsc.USDT, ADDRESSES.bsc.USDC], }, polygon: { owners: Object.values({ @@ -31,15 +27,11 @@ const config = { predictionPROV2: "0x8251E5EBc2d2C20f6a116144800D569FAF75d746", predictionclassicv3: "0x9f9564BE7b566dfE4B091a83a591752102aF3F33", }), + tokens: [ADDRESSES.null, ADDRESSES.polygon.USDT, ADDRESSES.polygon.USDC], }, }; -module.exports = { - ethereum: { - tvl: sumTokensExport({ chain: "ethereum", owners: config.ethereum.owners, tokens: [nullAddress, USDTeth, USDCeth] }), - }, - bsc: { tvl: sumTokensExport({ chain: "bsc", owners: config.bsc.owners, tokens: [nullAddress, USDTbsc, USDCbsc] }) }, - polygon: { - tvl: sumTokensExport({ chain: "polygon", owners: config.polygon.owners, tokens: [nullAddress, USDTpolygon, USDCpolygon] }), - }, -}; + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl: sumTokensExport(config[chain]) } +}) From 60ad5d90a274c8dc2a229daceab6b77fde88ffc1 Mon Sep 17 00:00:00 2001 From: PRDT Finance <87976805+PRDTfinance@users.noreply.github.com> Date: Thu, 18 Jan 2024 13:07:31 +0100 Subject: [PATCH 006/855] PRDT-Add ARB Added Arb --- projects/prdt/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/projects/prdt/index.js b/projects/prdt/index.js index d0705872bd2b..19a9b6564ab9 100644 --- a/projects/prdt/index.js +++ b/projects/prdt/index.js @@ -8,6 +8,12 @@ const config = { }), tokens: [ADDRESSES.null, ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.USDC], }, + arbitrum: { + owners: Object.values({ + predictionPROV2: "0x062EB9830D1f1f0C64ac598eC7921f0cbD6d4841", + }), + tokens: [ADDRESSES.null, ADDRESSES.arbitrum.USDT, ADDRESSES.arbitrum.USDC], + }, bsc: { owners: Object.values({ predictionBNB: "0x31B8A8Ee92961524fD7839DC438fd631D34b49C6", From f511a7399acb8979809e91992f7cd3798b438eb0 Mon Sep 17 00:00:00 2001 From: merlincdj <39942523+merlincdj@users.noreply.github.com> Date: Thu, 1 Feb 2024 18:17:33 +0800 Subject: [PATCH 007/855] chore: add mantle --- projects/woofi.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/projects/woofi.js b/projects/woofi.js index bb8453bae1c4..4a9d7352fa5d 100644 --- a/projects/woofi.js +++ b/projects/woofi.js @@ -17,6 +17,7 @@ const wooPPConfig = { '0x4691937a7508860F876c9c0a2a617E7d9E945D4B', // WOO ADDRESSES.bsc.USDT, // USDT ADDRESSES.bsc.BUSD, // BUSD + '0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82', // CAKE ], avax: [ ADDRESSES.avax.WAVAX, // WAVAX @@ -68,6 +69,12 @@ const wooPPConfig = { ADDRESSES.base.WETH, ADDRESSES.base.USDbC, ], + mantle: [ + ADDRESSES.mantle.WMNT, + ADDRESSES.mantle.WETH, + ADDRESSES.mantle.USDT, + ADDRESSES.mantle.USDC, + ], } const chainConfig = { @@ -137,6 +144,12 @@ const chainConfig = { stakingContract: null, stakingContractV2: null, }, + mantle: { + wooPPContract: '0x9D1A92e601db0901e69bd810029F2C14bCCA3128', + woo: null, + stakingContract: null, + stakingContractV2: null, + } } Object.keys(chainConfig).forEach(chain => { From 3bf58f6929cffccea0be65f48e4fec5a7f2141ff Mon Sep 17 00:00:00 2001 From: HS Date: Thu, 29 Feb 2024 11:12:36 +0700 Subject: [PATCH 008/855] add cellana aptos tvl --- projects/cellana/index.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 projects/cellana/index.js diff --git a/projects/cellana/index.js b/projects/cellana/index.js new file mode 100644 index 000000000000..975a229858f2 --- /dev/null +++ b/projects/cellana/index.js @@ -0,0 +1,38 @@ +const sdk = require("@defillama/sdk"); +const { default: BigNumber } = require("bignumber.js"); +const { getResources, getTableData, } = require("../helper/chain/aptos"); +const { transformBalances } = require("../helper/portedTokens"); +const toHex = (str) => Buffer.from(str, 'utf-8').toString('hex'); + +let resourcesCache + +async function _getResources() { + if (!resourcesCache) resourcesCache = getResources("0x3b38735644d0be8ac37ebd84a1e42fa5c2487495ef8782f6c694b1a147f82426") + return resourcesCache +} +const extractCoinAddress = (str) => str.slice(str.indexOf("<") + 1, str.lastIndexOf(">")); +const reserveContrainerFilter = (i) => i.type.includes("0x1::coin::CoinStore") + +module.exports = { + timetravel: false, + methodology: + "Counts the lamports in each coin container in the Aries contract account.", + aptos: { + tvl: async () => { + const balances = {}; + const data = await _getResources() + const coinContainers = data.filter(reserveContrainerFilter) + .map((i) => ({ + lamports: i.data.coin.value, + tokenAddress: extractCoinAddress(i.type), + })); + + coinContainers.forEach(({ lamports, tokenAddress }) => { + sdk.util.sumSingleBalance(balances, tokenAddress, lamports); + }); + + return transformBalances("aptos", balances); + }, + + }, +}; From 779a6c4a9b60e0ba986a5b2aa0dd197fdc08405d Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 29 Feb 2024 11:00:57 +0100 Subject: [PATCH 009/855] minor fix --- projects/cellana/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/projects/cellana/index.js b/projects/cellana/index.js index 975a229858f2..1de1562fcbb7 100644 --- a/projects/cellana/index.js +++ b/projects/cellana/index.js @@ -1,8 +1,6 @@ const sdk = require("@defillama/sdk"); -const { default: BigNumber } = require("bignumber.js"); -const { getResources, getTableData, } = require("../helper/chain/aptos"); +const { getResources, } = require("../helper/chain/aptos"); const { transformBalances } = require("../helper/portedTokens"); -const toHex = (str) => Buffer.from(str, 'utf-8').toString('hex'); let resourcesCache @@ -15,6 +13,7 @@ const reserveContrainerFilter = (i) => i.type.includes("0x1::coin::CoinStore") module.exports = { timetravel: false, + misrepresentedTokens: true, methodology: "Counts the lamports in each coin container in the Aries contract account.", aptos: { From 8b29c5a0de01802a48ae6512d5ca25c1b9d616d1 Mon Sep 17 00:00:00 2001 From: local dev Date: Tue, 5 Mar 2024 09:34:32 +0700 Subject: [PATCH 010/855] Fix err text and add CELL token balance --- projects/cellana/index.js | 65 ++++++++++++++++++++++++++++++++++----- 1 file changed, 57 insertions(+), 8 deletions(-) diff --git a/projects/cellana/index.js b/projects/cellana/index.js index 1de1562fcbb7..0cdd66cc667f 100644 --- a/projects/cellana/index.js +++ b/projects/cellana/index.js @@ -1,25 +1,72 @@ const sdk = require("@defillama/sdk"); +const http = require('../helper/http') +const BigNumber = require("bignumber.js"); const { getResources, } = require("../helper/chain/aptos"); const { transformBalances } = require("../helper/portedTokens"); - +const { aQuery } = require('../helper/chain/aptos') +const coinGecKoApi = 'https://api.coingecko.com/api/v3/simple/price?ids=aptos%2Captos&vs_currencies=usd'; +async function query(api) { + return http.get(`${api}`) +} +const util = require("util") let resourcesCache - -async function _getResources() { - if (!resourcesCache) resourcesCache = getResources("0x3b38735644d0be8ac37ebd84a1e42fa5c2487495ef8782f6c694b1a147f82426") +const CELL_fungible_asset_address = '0x2ebb2ccac5e027a87fa0e2e5f656a3a4238d6a48d93ec9b610d570fc0aa0df12' +const APT_fungible_asset_address = '0xedc2704f2cef417a06d1756a04a16a9fa6faaed13af469be9cdfcac5a21a8e2e' +async function _getResources(address) { + if (!resourcesCache) resourcesCache = getResources(address) return resourcesCache } const extractCoinAddress = (str) => str.slice(str.indexOf("<") + 1, str.lastIndexOf(">")); const reserveContrainerFilter = (i) => i.type.includes("0x1::coin::CoinStore") +async function _getCELLbalances() { + const balances = {} + const data = await getResources('0x4bf51972879e3b95c4781a5cdcb9e1ee24ef483e7d22f2d903626f126df62bd1') + const { aptos } = await query(coinGecKoApi); + const aptosPrice = aptos.usd; + const poolsAddresses = data.find(i => i.type.includes('::liquidity_pool::LiquidityPoolConfigs'))?.data.all_pools?.inline_vec + for (const pool of poolsAddresses) { + const fungibleAssetPoolStore = (await getResources(pool.inner)).find(i => i.type.includes('liquidity_pool::LiquidityPool'))?.data + const fungibleAssetAddressToken1 = fungibleAssetPoolStore?.token_store_1?.inner + const fungibleAssetAddressToken2 = fungibleAssetPoolStore?.token_store_2?.inner + + const fungibleAssetTokenStore_1 = (await getResources(fungibleAssetAddressToken1)).find(i => i.type.includes('fungible_asset::FungibleStore'))?.data + const fungibleAssetTokenStore_2 = (await getResources(fungibleAssetAddressToken2)).find(i => i.type.includes('fungible_asset::FungibleStore'))?.data + const token_1_address = fungibleAssetTokenStore_1?.metadata?.inner + const token_2_address = fungibleAssetTokenStore_2?.metadata?.inner + // sdk.util.sumSingleBalance(balances, fungibleAssetTokenStore_1?.metadata?.inner, fungibleAssetTokenStore_1?.balance||0); + // sdk.util.sumSingleBalance(balances, fungibleAssetTokenStore_2?.metadata?.inner, fungibleAssetTokenStore_2?.balance||0); + if (token_1_address == CELL_fungible_asset_address) { + const cell_balance = fungibleAssetTokenStore_1?.balance; + sdk.util.sumSingleBalance(balances, token_1_address, cell_balance || 0); + + // //caculator CELL price + // if (token_2_address == APT_fungible_asset_address) { + // const apt_balance = fungibleAssetTokenStore_2?.balance; + // const cell_price = (new BigNumber(apt_balance)).div(new BigNumber(cell_balance)).toNumber() * aptosPrice + // } + + } else if (token_2_address == CELL_fungible_asset_address) { + const cell_balance = fungibleAssetTokenStore_2?.balance; + sdk.util.sumSingleBalance(balances, token_2_address, cell_balance || 0); + + } + + return balances; + + } + + +} module.exports = { timetravel: false, misrepresentedTokens: true, methodology: - "Counts the lamports in each coin container in the Aries contract account.", + "Counts the lamports in each coin container in the Cellena contract account.", aptos: { tvl: async () => { const balances = {}; - const data = await _getResources() + const data = await _getResources('0x3b38735644d0be8ac37ebd84a1e42fa5c2487495ef8782f6c694b1a147f82426') const coinContainers = data.filter(reserveContrainerFilter) .map((i) => ({ lamports: i.data.coin.value, @@ -29,8 +76,10 @@ module.exports = { coinContainers.forEach(({ lamports, tokenAddress }) => { sdk.util.sumSingleBalance(balances, tokenAddress, lamports); }); - - return transformBalances("aptos", balances); + let cellBlanaces = await _getCELLbalances(); + sdk.util.mergeBalances(balances, cellBlanaces) + const response = await transformBalances("aptos", balances); + return response; }, }, From 0011f9cae351b7b7b2f02b9a735912849875d631 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 6 Mar 2024 00:11:28 +0100 Subject: [PATCH 011/855] minor refactor --- projects/cellana/index.js | 45 +++++++++++---------------------------- 1 file changed, 12 insertions(+), 33 deletions(-) diff --git a/projects/cellana/index.js b/projects/cellana/index.js index 9e2e3ca31ad3..9da5f3efd55b 100644 --- a/projects/cellana/index.js +++ b/projects/cellana/index.js @@ -1,12 +1,5 @@ -const sdk = require("@defillama/sdk"); -const http = require('../helper/http') const { getResources, } = require("../helper/chain/aptos"); -const { transformBalances } = require("../helper/portedTokens"); -const coinGecKoApi = 'https://api.coingecko.com/api/v3/simple/price?ids=aptos%2Captos&vs_currencies=usd'; -async function query(api) { - return http.get(`${api}`) -} -const util = require("util") +const ADDRESSES = require('../helper/coreAssets.json') const CELL_fungible_asset_address = '0x2ebb2ccac5e027a87fa0e2e5f656a3a4238d6a48d93ec9b610d570fc0aa0df12' const APT_fungible_asset_address = '0xedc2704f2cef417a06d1756a04a16a9fa6faaed13af469be9cdfcac5a21a8e2e' @@ -15,14 +8,12 @@ async function _getResources() { if (!resourcesCache) resourcesCache = getResources("0x3b38735644d0be8ac37ebd84a1e42fa5c2487495ef8782f6c694b1a147f82426") return resourcesCache } + const extractCoinAddress = (str) => str.slice(str.indexOf("<") + 1, str.lastIndexOf(">")); const reserveContrainerFilter = (i) => i.type.includes("0x1::coin::CoinStore") -async function _getCELLbalances() { - const balances = {} +async function _getCELLbalances(api) { const data = await getResources('0x4bf51972879e3b95c4781a5cdcb9e1ee24ef483e7d22f2d903626f126df62bd1') - const { aptos } = await query(coinGecKoApi); - const aptosPrice = aptos.usd; const poolsAddresses = data.find(i => i.type.includes('::liquidity_pool::LiquidityPoolConfigs'))?.data.all_pools?.inline_vec for (const pool of poolsAddresses) { const fungibleAssetPoolStore = (await getResources(pool.inner)).find(i => i.type.includes('liquidity_pool::LiquidityPool'))?.data @@ -33,25 +24,16 @@ async function _getCELLbalances() { const fungibleAssetTokenStore_2 = (await getResources(fungibleAssetAddressToken2)).find(i => i.type.includes('fungible_asset::FungibleStore'))?.data const token_1_address = fungibleAssetTokenStore_1?.metadata?.inner const token_2_address = fungibleAssetTokenStore_2?.metadata?.inner - // sdk.util.sumSingleBalance(balances, fungibleAssetTokenStore_1?.metadata?.inner, fungibleAssetTokenStore_1?.balance||0); - // sdk.util.sumSingleBalance(balances, fungibleAssetTokenStore_2?.metadata?.inner, fungibleAssetTokenStore_2?.balance||0); if (token_1_address == CELL_fungible_asset_address) { - const cell_balance = fungibleAssetTokenStore_1?.balance; - sdk.util.sumSingleBalance(balances, token_1_address, cell_balance || 0); - // //caculator CELL price - // if (token_2_address == APT_fungible_asset_address) { - // const apt_balance = fungibleAssetTokenStore_2?.balance; - // const cell_price = (new BigNumber(apt_balance)).div(new BigNumber(cell_balance)).toNumber() * aptosPrice - // } - + addBalance(token_2_address, fungibleAssetTokenStore_2?.balance || 0); } else if (token_2_address == CELL_fungible_asset_address) { - const cell_balance = fungibleAssetTokenStore_2?.balance; - sdk.util.sumSingleBalance(balances, token_2_address, cell_balance || 0); - + addBalance(token_1_address, fungibleAssetTokenStore_1?.balance || 0); } - return balances; - + async function addBalance(token, balance) { + if (token === APT_fungible_asset_address) + api.add(ADDRESSES.aptos.APT, balance) + } } @@ -62,8 +44,7 @@ module.exports = { methodology: "Counts the lamports in each coin container in the Cellena contract account.", aptos: { - tvl: async () => { - const balances = {}; + tvl: async (_, _1, _2, { api }) => { const data = await _getResources() const coinContainers = data.filter(reserveContrainerFilter) .map((i) => ({ @@ -72,11 +53,9 @@ module.exports = { })); coinContainers.forEach(({ lamports, tokenAddress }) => { - sdk.util.sumSingleBalance(balances, tokenAddress, lamports); + api.add(tokenAddress, lamports); }); - let cellBlanaces = await _getCELLbalances(); - sdk.util.mergeBalances(balances, cellBlanaces) - return transformBalances("aptos", balances); + await _getCELLbalances(api) } } } \ No newline at end of file From 1ed70f46c7683a49fc86e8882e3a5670e625aa03 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 6 Mar 2024 00:13:24 +0100 Subject: [PATCH 012/855] lint fix --- projects/cellana/index.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/projects/cellana/index.js b/projects/cellana/index.js index 9da5f3efd55b..5d2acc955e99 100644 --- a/projects/cellana/index.js +++ b/projects/cellana/index.js @@ -29,15 +29,14 @@ async function _getCELLbalances(api) { } else if (token_2_address == CELL_fungible_asset_address) { addBalance(token_1_address, fungibleAssetTokenStore_1?.balance || 0); } - - async function addBalance(token, balance) { - if (token === APT_fungible_asset_address) - api.add(ADDRESSES.aptos.APT, balance) - } } - + async function addBalance(token, balance) { + if (token === APT_fungible_asset_address) + api.add(ADDRESSES.aptos.APT, balance) + } } + module.exports = { timetravel: false, misrepresentedTokens: true, From 39554b34d09404db0626c17e6000b05e6f2be322 Mon Sep 17 00:00:00 2001 From: Lim Yee Han Date: Thu, 25 Apr 2024 03:50:49 +0900 Subject: [PATCH 013/855] Update replHelper contract address --- projects/repl/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/repl/index.js b/projects/repl/index.js index 2d9fd0bc3154..5a350506d4ce 100644 --- a/projects/repl/index.js +++ b/projects/repl/index.js @@ -9,7 +9,7 @@ const WFIL_WPFIL_POOL_ADDRESS = '0x443A6243A36Ef0ae1C46523d563c15abD787F4E9'; const PFIL_CONTRACT = '0xAaa93ac72bECfbBc9149f293466bbdAa4b5Ef68C'; const WPFIL_CONTRACT = '0x57E3BB9F790185Cfe70Cc2C15Ed5d6B84dCf4aDb'; const WFIL_CONTRACT = '0x60E1773636CF5E4A227d9AC24F20fEca034ee25A'; -const REPL_HELPER_CONTRACT = '0x52d41C90ce592229F9fC0dA6Ef7b7cc26472B4E9'; +const REPL_HELPER_CONTRACT = '0x65846aECBF23385F76B73ef1EDD1ebdFf7Ac258D'; // Total Assets of Miners pledged to the protocol const getMinerAssets = (agents) => { From a813d5479447ec74737bfae99f7cbeb2eae8e37e Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Tue, 21 May 2024 13:14:43 +0100 Subject: [PATCH 014/855] add zklink to logx (#10300) * add zklink to logx * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/logx/index.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/projects/logx/index.js b/projects/logx/index.js index 43af074153b0..a90d5d4e53fa 100644 --- a/projects/logx/index.js +++ b/projects/logx/index.js @@ -1,3 +1,5 @@ +const { nullAddress } = require("../helper/tokenMapping") + module.exports = { methodology: "USDC.e in the vault", } @@ -9,7 +11,8 @@ const config = { manta: '0x53c6decad02cB6C535a7078B686650c951aD6Af5', telos: '0x082321F9939373b02Ad54ea214BF6e822531e679', fuse: '0x082321F9939373b02Ad54ea214BF6e822531e679', - mode: ['0x34b83A3759ba4c9F99c339604181bf6bBdED4C79', '0x082321F9939373b02Ad54ea214BF6e822531e679'] + mode: ['0x34b83A3759ba4c9F99c339604181bf6bBdED4C79', '0x082321F9939373b02Ad54ea214BF6e822531e679'], + zklink: ['0x75940cDa18F14D1F97562fc2A6dBCe31CBe03870'] } Object.keys(config).forEach(chain => { @@ -20,7 +23,12 @@ Object.keys(config).forEach(chain => { const ownerTokens = [] for (const v of vault) { const tokens = await api.fetchList({ lengthAbi: 'allWhitelistedTokensLength', itemAbi: 'allWhitelistedTokens', target: v }) - ownerTokens.push([tokens, v]) + ownerTokens.push([tokens.map(i => { + switch (i.toLowerCase()) { + case '0x000000000000000000000000000000000000800a': return nullAddress + default: return i + } + }), v]) } return api.sumTokens({ ownerTokens }) } From 0165a049fd2c9d03da521016fdd795d5ecc2fac9 Mon Sep 17 00:00:00 2001 From: MirthFutures <69535002+MirthFutures@users.noreply.github.com> Date: Tue, 21 May 2024 08:15:02 -0400 Subject: [PATCH 015/855] Add Beefy to Mode Chain (#10304) * Add Beefy Gnosis * Update index.js * Add Mode to Beefy --------- Co-authored-by: Real Shaman <85087525+realdealshaman@users.noreply.github.com> --- projects/beefy/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/beefy/index.js b/projects/beefy/index.js index 0354c2068027..2422c214110a 100644 --- a/projects/beefy/index.js +++ b/projects/beefy/index.js @@ -50,6 +50,7 @@ const chains = { mantle: 5000, canto: 7700, base: 8453, + mode: 34443, arbitrum: 42161, celo: 42220, oasis: 42262, From 48991f9585372d6f5bf9b09e1707cacbc85585a2 Mon Sep 17 00:00:00 2001 From: Valdislav Dihtiarenko <66130898+Digtyarenk0@users.noreply.github.com> Date: Tue, 21 May 2024 14:18:19 +0200 Subject: [PATCH 016/855] update: added missing tokens in primex-finance (#10302) * feat: ethereum contracts * fix: default tokens * Add missed tokens --------- Co-authored-by: Eugene Mormul --- projects/primex-finance/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/primex-finance/index.js b/projects/primex-finance/index.js index 875ca18e3382..1fb8033cf77f 100644 --- a/projects/primex-finance/index.js +++ b/projects/primex-finance/index.js @@ -8,11 +8,16 @@ const config = { positionManager: '0x02bcaA4633E466d151b34112608f60A82a4F6035', traderBalanceVault: '0x0801896C67CF024606BcC92bd788d6Eb077CC74F', defaultTokens: { + MATIC: ADDRESSES.polygon.WMATIC_1, + WMATIC: ADDRESSES.polygon.WMATIC_2, WETH: ADDRESSES.polygon.WETH_1, WBTC: ADDRESSES.polygon.WBTC, - WMATIC: ADDRESSES.polygon.WMATIC_2, USDC: ADDRESSES.polygon.USDC, USDT: ADDRESSES.polygon.USDT, + AAVE: "0xD6DF932A45C0f255f85145f286eA0b292B21C90B", + DAI: ADDRESSES.polygon.DAI, + LINK: "0x53E0bca35eC356BD5ddDFebbD1Fc0fD03FaBad39", + GNS: "0xE5417Af564e4bFDA1c483642db72007871397896", EPMX: "0xDc6D1bd104E1efa4A1bf0BBCf6E0BD093614E31A" }, aaveTokens: { @@ -32,6 +37,7 @@ const config = { USDC: ADDRESSES.arbitrum.USDC_CIRCLE, USDT: ADDRESSES.arbitrum.USDT, WETH: ADDRESSES.arbitrum.WETH, + ETH: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", WBTC: ADDRESSES.arbitrum.WBTC, ARB: ADDRESSES.arbitrum.ARB, DAI: ADDRESSES.arbitrum.DAI, @@ -60,6 +66,7 @@ const config = { traderBalanceVault: '0x156e2fC8e1906507412BEeEB6640Bf999a1Ea76b', defaultTokens: { WETH: ADDRESSES.ethereum.WETH, + ETH: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", WBTC: ADDRESSES.ethereum.WBTC, USDC: ADDRESSES.ethereum.USDC, USDT: ADDRESSES.ethereum.USDT, From 340b07702319612827d4f82ddb2a70afdb8ee7ef Mon Sep 17 00:00:00 2001 From: NovaSwap | Dev Date: Tue, 21 May 2024 20:46:28 +0800 Subject: [PATCH 017/855] Added Novaswap adapter (#10301) * Added novaswap adapter * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/env.js | 1 + projects/novaswap/index.js | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 projects/novaswap/index.js diff --git a/projects/helper/env.js b/projects/helper/env.js index 67e111830f15..58d3a3c34f98 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -16,6 +16,7 @@ const DEFAULTS = { BTR_RPC_MULTICALL: '0xc8818aaeaBF0dF9f3f3ffF54Ab185705177A6234', DEFICHAIN_EVM_RPC_MULTICALL: '0x7fEf77CDe3B41221Cff54B84Ea89D2EBc6b53352', BOUNCEBIT_RPC_MULTICALL: '0x493d616f5F9a64e5B3D527120E406439bdF29272', + ZKLINK_RPC_MULTICALL: '0xa8738F57538E3Bb73872d1133F2358c7Fe56FD35', } const ENV_KEYS = [ diff --git a/projects/novaswap/index.js b/projects/novaswap/index.js new file mode 100644 index 000000000000..1859081eacf1 --- /dev/null +++ b/projects/novaswap/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + zklink: { factory: '0xf8D35842f37800E349A993503372fb9E2CBb7E3d', fromBlock: 1676253 }, +}) \ No newline at end of file From e2880f3af9c11b33af87b8e3a98885cf0b816425 Mon Sep 17 00:00:00 2001 From: charq <73696209+buchaoqun@users.noreply.github.com> Date: Tue, 21 May 2024 20:47:42 +0800 Subject: [PATCH 018/855] add mirro ceffu balance (#10305) * Changed to get all vault raise balances * Add judgment * add network * del console log * fix bug * fix bug * Update index.js * update subgraph url * fix bug * revert * Excluding Fof Funds * add other Deposit * add solvbtc Solv Funds del solvbtc * update graphql query * add mirro balance --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Co-authored-by: qwen-solv --- projects/solv-protocol-funds/index.js | 140 ++++++++++++++++++++++++-- 1 file changed, 134 insertions(+), 6 deletions(-) diff --git a/projects/solv-protocol-funds/index.js b/projects/solv-protocol-funds/index.js index e67465e04d23..bac24c4908f6 100644 --- a/projects/solv-protocol-funds/index.js +++ b/projects/solv-protocol-funds/index.js @@ -3,7 +3,7 @@ const { default: BigNumber } = require("bignumber.js"); const { getConfig } = require("../helper/cache"); const { cachedGraphQuery } = require("../helper/cache"); const { sumTokens2, } = require("../helper/unwrapLPs"); -const { getAmounts } = require("./iziswap") +const { getAmounts } = require("./iziswap"); // The Graph const graphUrlList = { @@ -19,15 +19,17 @@ const slotListUrl = 'https://raw.githubusercontent.com/solv-finance-dev/solv-pro const addressUrl = 'https://raw.githubusercontent.com/solv-finance-dev/slov-protocol-defillama/main/solv-funds.json'; async function tvl(api) { - let address = (await getConfig('solv-protocol/funds', addressUrl)); + const address = (await getConfig('solv-protocol/funds', addressUrl)); + const graphData = await getGraphData(api.timestamp, api.chain, api); await gm(api, address); await mux(api, address); await klp(api, address); await iziswap(api, address); await lendle(api, address); - await vaultBalance(api); - // await otherDeposit(api, address); + await vaultBalance(api, graphData); + await otherDeposit(api, address); + await ceffuBalance(api, address, graphData); return api.getBalances(); } @@ -286,9 +288,8 @@ async function lendle(api, address) { api.add(lendleData.account.ethAddress, balance) } -async function vaultBalance(api) { +async function vaultBalance(api, graphData) { const network = api.chain; - const graphData = await getGraphData(api.timestamp, network, api); const solvbtcListUrl = 'https://raw.githubusercontent.com/solv-finance-dev/slov-protocol-defillama/main/solvbtc.json'; let solvbtc = (await getConfig('solv-protocol/solvbtc', solvbtcListUrl)); @@ -333,6 +334,133 @@ async function vaultBalance(api) { } } +async function ceffuBalance(api, address, graphData) { + if (!address[api.chain] || !address[api.chain]["ceffu"]) { + return; + } + let ceffuData = address[api.chain]["ceffu"]; + + let pools = []; + for (const graph of graphData.pools) { + if (graph['openFundShareSlot'] == ceffuData['slot']) { + pools.push(graph) + } + } + if (pools.length > 0) { + const poolConcretes = await concrete(pools, api); + const nav = await api.multiCall({ + abi: abi.getSubscribeNav, + calls: pools.map((index) => ({ + target: index.navOracle, + params: [index.poolId, api.timestamp * 1000] + })), + }) + + const poolTotalValues = await api.multiCall({ + abi: abi.slotTotalValue, + calls: pools.map((index) => ({ + target: poolConcretes[index.contractAddress], + params: [index.openFundShareSlot] + })), + }) + + const poolBaseInfos = await api.multiCall({ + abi: abi.slotBaseInfo, + calls: pools.map((index) => ({ + target: poolConcretes[index.contractAddress], + params: [index.openFundShareSlot] + })), + }) + + const poolDecimalList = await api.multiCall({ + abi: abi.decimals, + calls: poolBaseInfos.map(i => i[1]), + }) + + let vaults = {}; + for (const key in pools) { + if (poolBaseInfos[key][1] && pools[key]["vault"]) { + vaults[`${pools[key]["vault"].toLowerCase()}-${poolBaseInfos[key][1].toLowerCase()}`] = [poolBaseInfos[key][1], pools[key]["vault"]] + } + } + + const balances = await api.multiCall({ + abi: abi.balanceOf, + calls: Object.values(vaults).map((index) => ({ + target: index[0], + params: [index[1]] + })), + }) + + let vaultbalances = {}; + for (let i = 0; i < Object.keys(vaults).length; i++) { + vaultbalances[Object.keys(vaults)[i]] = balances[i]; + } + + for (let i = 0; i < poolTotalValues.length; i++) { + const decimals = poolDecimalList[i]; + let balance = BigNumber(poolTotalValues[i]).div(BigNumber(10).pow(18 - decimals)).times(BigNumber(nav[i].nav_).div(BigNumber(10).pow(decimals))).toNumber(); + if (pools[i]['vault'] && poolBaseInfos[i][1] && vaultbalances[`${pools[i]['vault'].toLowerCase()}-${poolBaseInfos[i][1].toLowerCase()}`]) { + balance = BigNumber(balance).minus(vaultbalances[`${pools[i]['vault'].toLowerCase()}-${poolBaseInfos[i][1].toLowerCase()}`]).toNumber(); + vaultbalances[`${pools[i]['vault'].toLowerCase()}-${poolBaseInfos[i][1].toLowerCase()}`] = undefined + } + + if (ceffuData["ceffus"]) { + let ceffus = []; + for (const deposit of ceffuData["ceffus"]["depositAddress"]) { + for (const tokenAddress of ceffuData["ceffus"]["tokens"]) { + ceffus.push({ tokenAddress, deposit }) + } + } + + const balances = await api.multiCall({ + abi: abi.balanceOf, + calls: Object.values(ceffus).map((index) => ({ + target: index["tokenAddress"], + params: [index["deposit"]] + })), + }) + for (const balanceOf of balances) { + balance = BigNumber(balance).minus(balanceOf).toNumber(); + } + } + + if (balance > 0) { + api.add(poolBaseInfos[i][1], balance) + } + } + } +} + + +async function getGraphSoltData(timestamp, chain, api, slot) { + console.log("slot", slot) + const poolSlotDataQuery = `query PoolOrderInfos { + poolOrderInfos(first: 1000 where:{fundraisingEndTime_gt:${timestamp}, openFundShareSlot:"${slot["slot"]}") { + marketContractAddress + contractAddress + navOracle + poolId + vault + openFundShareSlot + } + }`; + + console.log("slotDataQuery", poolSlotDataQuery); + let data; + if (graphUrlList[chain]) { + data = (await cachedGraphQuery(`solv-protocol/funds-graph-data/${chain}`, graphUrlList[chain], poolSlotDataQuery, { api, fetchById: true })); + } + + let poolList = []; + if (data != undefined && data.poolOrderInfos != undefined) { + poolList = data.poolOrderInfos; + } + + return { + pools: poolList + }; +} async function getGraphData(timestamp, chain, api) { let rwaSlot = (await getConfig('solv-protocol/slots', slotListUrl)); From 9b8d0c7afe9b7952bbe991bc85e2c98dc76ef483 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 21 May 2024 14:58:04 +0200 Subject: [PATCH 019/855] davos: track ceMATIC --- projects/davos-protocol/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/projects/davos-protocol/index.js b/projects/davos-protocol/index.js index 6cdac9fca1ce..d5f310e020a6 100644 --- a/projects/davos-protocol/index.js +++ b/projects/davos-protocol/index.js @@ -1,3 +1,4 @@ +const { nullAddress } = require('../helper/unwrapLPs') const config = { arbitrum: { @@ -31,6 +32,11 @@ Object.keys(config).forEach(chain => { const { mvts,} = config[chain] module.exports[chain] = { tvl: async (api) => { + if (chain === 'polygon') { + const token = '0x77F4C841cb87fDFa43aB909cf56f7710Af648a8e' + const deposits = await api.call({ abi: 'function deposits(address) view returns (uint256)', target: '0xdd0BdF5749e300f946cdb1dDFE1ffa828eC0dB72', params: token }) + api.add(nullAddress, deposits) + } const assets = await api.multiCall({ abi: 'address:asset', calls: mvts}) return api.sumTokens({ tokensAndOwners2: [assets, mvts]}) } From f1819b96e658c10defa3c9b85a6382bec240ea89 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 21 May 2024 15:55:37 +0200 Subject: [PATCH 020/855] minor fix --- projects/satoshi-protocol/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/satoshi-protocol/index.js b/projects/satoshi-protocol/index.js index 4ac9b74b2c4d..61dbc5640900 100644 --- a/projects/satoshi-protocol/index.js +++ b/projects/satoshi-protocol/index.js @@ -1,3 +1,5 @@ +const { sumTokens2 } = require("../helper/unwrapLPs") + const TROVE_MANAGER_LIST = [ '0x0598Ef47508Ec11a503670Ac3B642AAE8EAEdEFA', // WBTC Collateral '0xa794a7Fd668FE378E095849caafA8C8dC7E84780', // wstBTC Collateral @@ -5,7 +7,7 @@ const TROVE_MANAGER_LIST = [ async function tvl(api) { const tokens = await api.multiCall({ abi: 'address:collateralToken', calls: TROVE_MANAGER_LIST}) - return api.sumTokens({ tokensAndOwners2: [tokens, TROVE_MANAGER_LIST]}) + return sumTokens2({ api, tokensAndOwners2: [tokens, TROVE_MANAGER_LIST]}) } module.exports = { From 9b83aacf9b665488bdf82f2dfc383f73acdbe734 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Tue, 21 May 2024 20:17:49 +0100 Subject: [PATCH 021/855] add bouncebit chain to meson (#10312) --- projects/meson/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/meson/index.js b/projects/meson/index.js index fa1314556470..240504c5e574 100644 --- a/projects/meson/index.js +++ b/projects/meson/index.js @@ -98,7 +98,8 @@ const config = { optimism: { id: 'opt'}, polygon_zkevm: { id: 'zkevm'}, era: { id: 'zksync'}, - btr: { id: 'bitlayer'} + btr: { id: 'bitlayer'}, + bouncebit: { id: 'bb'} } async function addCoinfg(id, ownerTokens) { From 0ce848758e125ea233212867a3a7f57519fad611 Mon Sep 17 00:00:00 2001 From: lilian ludford Date: Tue, 21 May 2024 16:40:30 -0400 Subject: [PATCH 022/855] USDY: adding aptos tvl + combining usdyc tvl with usdy (#10311) * adding aptos * adding usdyc to usdy * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/ondofinance/index.js | 60 +++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 16 deletions(-) diff --git a/projects/ondofinance/index.js b/projects/ondofinance/index.js index 2820739e11a9..84e2339b5494 100644 --- a/projects/ondofinance/index.js +++ b/projects/ondofinance/index.js @@ -1,5 +1,6 @@ -const { getTokenSupply } = require('../helper/solana'); +const { getTokenSupply } = require("../helper/solana"); const sui = require("../helper/chain/sui"); +const { aQuery } = require("../helper/chain/aptos"); module.exports = { methodology: "Sums the total supplies of Ondo's issued tokens.", @@ -11,23 +12,27 @@ const config = { USDY: "A1KLoBrKBde8Ty9qtNQUtq3C2ortoC3u7twggz7sEto6", }, ethereum: { - OUSG: '0x1B19C19393e2d034D8Ff31ff34c81252FcBbee92', - USDY: '0x96F6eF951840721AdBF46Ac996b59E0235CB985C', - USDYc: '0xe86845788d6e3e5c2393ade1a051ae617d974c09', + OUSG: "0x1B19C19393e2d034D8Ff31ff34c81252FcBbee92", + USDY: "0x96F6eF951840721AdBF46Ac996b59E0235CB985C", + USDYc: "0xe86845788d6e3e5c2393ade1a051ae617d974c09", }, polygon: { - OUSG: '0xbA11C5effA33c4D6F8f593CFA394241CfE925811', + OUSG: "0xbA11C5effA33c4D6F8f593CFA394241CfE925811", }, mantle: { USDY: "0x5bE26527e817998A7206475496fDE1E68957c5A6", }, sui: { - USDY: "0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY" - } -} + USDY: "0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY", + }, + aptos: { + USDY: "0xcfea864b32833f157f042618bd845145256b1bf4c0da34a7013b76e42daa53cc", + }, +}; async function getUSDYTotalSupplySUI() { - const USDY_TREASURY_CAP_OBJECT_ID = '0x9dca9f57a78fa7f132f95a0cf5c4d1b796836145ead7337da6b94012db62267a'; + const USDY_TREASURY_CAP_OBJECT_ID = + "0x9dca9f57a78fa7f132f95a0cf5c4d1b796836145ead7337da6b94012db62267a"; let treasuryCapInfo = await sui.getObject(USDY_TREASURY_CAP_OBJECT_ID); return treasuryCapInfo.fields.total_supply.fields.value; } @@ -39,23 +44,46 @@ Object.keys(config).forEach((chain) => { module.exports[chain] = { tvl: async (api) => { let supplies; - if (chain === 'solana') { - supplies = await Promise.all(fundAddresses.map(getTokenSupply)) - .catch(error => { + if (chain === "solana") { + supplies = await Promise.all(fundAddresses.map(getTokenSupply)).catch( + (error) => { throw error; - }); + } + ); - const scaledSupplies = supplies.map(supply => supply * 1_000_000); + const scaledSupplies = supplies.map((supply) => supply * 1_000_000); api.addTokens(fundAddresses, scaledSupplies); } else if (chain === "sui") { let usdySupply = await getUSDYTotalSupplySUI(); api.addTokens(fundAddresses, [usdySupply]); + } else if (chain === "aptos") { + const { + data: { supply, decimals }, + } = await aQuery( + `/v1/accounts/${config.aptos.USDY}/resource/0x1::coin::CoinInfo<${config.aptos.USDY}::usdy::USDY>` + ); + + const aptosSupply = + supply.vec[0].integer.vec[0].value / Math.pow(10, decimals); + + api.addTokens(config.ethereum.USDY, aptosSupply * 1e18, { skipChain: true, }); } else { - supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: fundAddresses }); + supplies = await api.multiCall({ + abi: "erc20:totalSupply", + calls: fundAddresses, + }); + if (chain === "ethereum") { + const usdycIndex = fundAddresses.indexOf(config.ethereum.USDYc); + const usdyIndex = fundAddresses.indexOf(config.ethereum.USDY); + // add USDYc supply to USDY supply + supplies[usdyIndex] = + parseInt(supplies[usdyIndex]) + parseInt(supplies[usdycIndex]); + fundAddresses.splice(usdycIndex, 1); + supplies.splice(usdycIndex, 1); + } api.addTokens(fundAddresses, supplies); } return api.getBalances(); }, }; }); - From d5858c69b4b302c6913e265074c1c45e22620cbc Mon Sep 17 00:00:00 2001 From: 0xSacha <90143060+0xSacha@users.noreply.github.com> Date: Tue, 21 May 2024 22:45:33 +0200 Subject: [PATCH 023/855] Feat/add nimbora yield (#10315) * add nimbora-yield * fix(nimbora-yield): update methodology --- projects/nimbora-yield/index.js | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 projects/nimbora-yield/index.js diff --git a/projects/nimbora-yield/index.js b/projects/nimbora-yield/index.js new file mode 100644 index 000000000000..246218de50ea --- /dev/null +++ b/projects/nimbora-yield/index.js @@ -0,0 +1,35 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { call, parseAddress } = require('../helper/chain/starknet') +const { getConfig } = require('../helper/cache') + +const totalAssetsAbi = { + "name": "total_assets", + "type": "function", + "inputs": [], + "outputs": [ + { + "name": "totalAssets", + "type": "Uint256" + } + ], + "stateMutability": "view" +} + + + +async function tvl(api) { + const strategyData = await getConfig('nimbora', "https://backend.nimbora.io/yield-dex/strategies") + for (let index = 0; index < strategyData.length; index++) { + const strategyInfo = strategyData[index]; + const underlying = parseAddress(strategyInfo.underlying) == "0x05574eb6b8789a91466f902c380d978e472db68170ff82a5b650b95a58ddf4ad" ? ADDRESSES.starknet.DAI : parseAddress(strategyInfo.underlying); + const strategyTvl = await call({ target: strategyInfo.tokenManager, abi: totalAssetsAbi }); + api.add(underlying, strategyTvl) + } +} + +module.exports = { + methodology: 'Computed by summing the total assets held by each strategy.', + starknet: { + tvl + }, +} From 0cc357a90a050265c58a8ef0ab2cc298cefb975a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 22 May 2024 02:25:23 +0530 Subject: [PATCH 024/855] Add grace adapter and refactor code (#10316) * add grace adapter * code refactor --------- Co-authored-by: nourharidy --- projects/grace/index.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 projects/grace/index.js diff --git a/projects/grace/index.js b/projects/grace/index.js new file mode 100644 index 000000000000..46ed6066e70e --- /dev/null +++ b/projects/grace/index.js @@ -0,0 +1,24 @@ +const CORE_CONTRACT = '0x1522ad0a3250eb0f64e0acfe090ca40949330cc1'; + +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 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 poolUnderlyings = await api.multiCall({ abi: 'address:asset', calls: pools }) + const borrowed = await api.multiCall({ abi: 'uint256:totalDebt', calls: pools }) + api.add(poolUnderlyings, borrowed) +} + +module.exports = { + methodology: 'Fetches the list of pools and collaterals from the Core and sums up their balances', + start: 14684731, + base: { + tvl, borrowed + } +}; \ No newline at end of file From 2349c183dddefc7057a77617ee3a6b7e3ad68ba3 Mon Sep 17 00:00:00 2001 From: MaxwellBlock <87404816+MaxwellBlock@users.noreply.github.com> Date: Wed, 22 May 2024 04:57:10 +0800 Subject: [PATCH 025/855] submit allspark adapter (#10313) submit allspark adapter --- projects/allspark/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/allspark/index.js diff --git a/projects/allspark/index.js b/projects/allspark/index.js new file mode 100644 index 000000000000..e59b148d7b70 --- /dev/null +++ b/projects/allspark/index.js @@ -0,0 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const {staking} = require("../helper/staking"); + +module.exports = { + methodology: 'allspark counts the staking values as tvl', + start: 1690371, + zklink:{ + tvl: staking( + ["0xD06B5A208b736656A8F9cD04ed43744C738BD8A9"], + [ADDRESSES.null] + ) + } +}; From 85e9a81efb21ebce01bd04c81cd72bb3389b02fc Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 22 May 2024 03:43:31 +0100 Subject: [PATCH 026/855] add new addresses --- projects/lyra-v2/index.js | 46 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/projects/lyra-v2/index.js b/projects/lyra-v2/index.js index 5a38db8b51be..667113cf9a6b 100644 --- a/projects/lyra-v2/index.js +++ b/projects/lyra-v2/index.js @@ -3,6 +3,48 @@ const ADDRESSES = require('../helper/coreAssets.json') module.exports = { ethereum: { - tvl: sumTokensExport({ owner: '0x6d303cee7959f814042d31e0624fb88ec6fbcc1d', tokens: [ADDRESSES.ethereum.USDC] }) - } + tvl: sumTokensExport({ tokensAndOwners: [ + [ADDRESSES.ethereum.USDC, '0x6d303cee7959f814042d31e0624fb88ec6fbcc1d'], + [ADDRESSES.ethereum.WETH, '0xD4efe33C66B8CdE33B8896a2126E41e5dB571b7e'], + [ADDRESSES.ethereum.WBTC, '0x3Eec7c855aF33280F1eD38b93059F5aa5862E3ab'], + [ADDRESSES.ethereum.USDT, '0x5e98A25d8d6FF69A8992d6Aa57948dFB77D4ECBa'], + [ADDRESSES.ethereum.SNX, '0x7D7aC8d55A9bD4152b703011f3E61AB3bB0A5592'], + [ADDRESSES.ethereum.WSTETH, '0xeBB5D642aA8ccDeE98373D6aC3ee0602b63824b3'], + ['0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee', '0x8180EcCC825b692ef65FF099a0A387743788bf78'], // weETH + ['0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0', '0x4BB4C3CDc7562f08e9910A0C7D8bB7e108861eB4'] // rswETH + ], + }) + }, + optimism: { + tvl: sumTokensExport({ tokensAndOwners: [ + [ADDRESSES.optimism.USDC_CIRCLE, '0xDEf0bfBdf7530C75AB3C73f8d2F64d9eaA7aA98e'], + [ADDRESSES.optimism.USDC, '0xBb9CF28Bc1B41c5c7c76Ee1B2722C33eBB8fbD8C'], + [ADDRESSES.optimism.WETH, '0xdD4c717a69763176d8B7A687728e228597eAB86d'], + [ADDRESSES.optimism.WBTC, '0xE5967877065f111a556850d8f05b8DaD88edCEc9'], + [ADDRESSES.optimism.USDT, '0x44343AE5e9319b61c9DaD7876919eFdB03241b02'], + ['0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4', '0x8574CBC539c26Df9ec11bA283218268101ff10e1'], // snx + [ADDRESSES.optimism.WSTETH, '0xAA8f9D05599F1a5d5929c40342c06a5Da063a4dE'] + ] + }) + }, + base: { + tvl: sumTokensExport({ tokensAndOwners: [ + [ADDRESSES.base.USDC, '0x4e798659b9846F1da7B6D6B5d09d581270aB6FEC'], + ['0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452', '0x2805B908a0F9CA58a2b3b7900341b4EBd0B994e9'], //wstETH + [ADDRESSES.base.WETH, '0xBd282333710B9C7e33E8a37d027885A7C079Ae23'], + ] + }) + }, + arbitrum: { + tvl: sumTokensExport({ tokensAndOwners: [ + [ADDRESSES.arbitrum.USDC_CIRCLE, '0x5e027ad442e031424b5a2C0ad6f656662Be32882'], + [ADDRESSES.arbitrum.USDC, '0xFB7B06538d837e4212D72E2A38e6c074F9076E0B'], + [ADDRESSES.arbitrum.WETH, '0x8e9f58E6c206CB9C98aBb9F235E0f02D65dFc922'], + [ADDRESSES.arbitrum.WBTC, '0x3D20c6A2b719129af175E0ff7B1875DEb360896f'], + [ADDRESSES.arbitrum.USDT, '0xb2Cb9aDA6e00118dA8E83a6A53dF1EC6331A60a6'], + [ADDRESSES.arbitrum.WSTETH, '0x8574CBC539c26Df9ec11bA283218268101ff10e1'], + ['0x35751007a407ca6FEFfE80b3cB397736D2cf4dbe', '0x3FBFD80EF7591658d1D7DdEC067F413eFd6f985c'] + ] + }) + }, } \ No newline at end of file From 05f894182bfc0ba77e90a19e154d08d33e946772 Mon Sep 17 00:00:00 2001 From: Winson Cheng <83229800+0xKMG@users.noreply.github.com> Date: Wed, 22 May 2024 13:33:10 +0800 Subject: [PATCH 027/855] add vaultka's token (VKA) staking info (#10319) --- projects/vaultka/index.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/projects/vaultka/index.js b/projects/vaultka/index.js index 85c31daa45f7..4d85a4af3c5b 100644 --- a/projects/vaultka/index.js +++ b/projects/vaultka/index.js @@ -1,6 +1,6 @@ //import utils const ADDRESSES = require("../helper/coreAssets.json"); - +const { staking } = require("../helper/staking"); // 19/12/2023 ALP Leverage Vault // 29/11/2023 GMXV2 Leverage(Neutral) Vault // 12/11/2023 GLP Compound Vault @@ -108,16 +108,12 @@ module.exports = { }); const contractAbis = { - stakedVlpBalance: - "function getStakedVlpBalance() public view returns (uint256)", - stakedHlpBalance: - "function userTokenAmount(address user) public view returns (uint256)", - stakedAlpBalance: - "function userInfo(address account) external view returns (uint256, uint256)", + stakedVlpBalance: "function getStakedVlpBalance() public view returns (uint256)", + stakedHlpBalance: "function userTokenAmount(address user) public view returns (uint256)", + stakedAlpBalance: "function userInfo(address account) external view returns (uint256, uint256)", alpPrice: "function getAlpPrice() external view returns (uint256)", // klpPrice: "function getKlpPrice(bool) external view returns (uint256)", - balanceOf: - "function balanceOf(address) external view returns (uint256)", + balanceOf: "function balanceOf(address) external view returns (uint256)", }; const StakedVLPBal = await api.call({ @@ -167,5 +163,6 @@ module.exports = { api.add(ADDRESSES.arbitrum.USDC, alpValue); api.add(ADDRESSES.arbitrum.USDC, klpValue); }, + staking: staking("0xA6f217d92A1F23C0454792cb7Bf81c74C8416550", "0xAFccb724e3aec1657fC9514E3e53A0E71e80622D"), }, }; From 476cc44dea31ee902fe16db8e3abbd13fdd109d9 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 22 May 2024 12:41:12 +0530 Subject: [PATCH 028/855] "Add TVL and borrowed data for Huma pool" (#10322) * added Huma pool TVL * added a missing pool * reading v2 pool addresses from the factory * removed extra semicolons * split borrowed from tvl --------- Co-authored-by: PlayJoker --- projects/huma/index.js | 67 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 projects/huma/index.js diff --git a/projects/huma/index.js b/projects/huma/index.js new file mode 100644 index 000000000000..fd27dc2d2253 --- /dev/null +++ b/projects/huma/index.js @@ -0,0 +1,67 @@ +const abiPool = { + "checkPool": "function checkPool(uint256 poolId_) view returns ((uint256 poolId, address poolAddress, string poolName, uint8 poolStatus, address poolConfigAddress, address poolTimelock))", +} + +const config = { + celo: { + factory: '0x85c8dC49B8DaA709e65dd2182e500E8AC3CaA6C7', + v1Pools: ['0xa190a0ab76f58b491cc36205b268e8cf5650c576'], + }, + polygon: { + v1Pools: ['0xe8926adbfadb5da91cd56a7d5acc31aa3fdf47e5', '0x95533e56f397152b0013a39586bc97309e9a00a7', '0x3EBc1f0644A69c565957EF7cEb5AEafE94Eb6FcE'], + } +} + +module.exports = { + methodology: 'sum all tvls from all pools', + start: 1716248276, //2023-05-01 +} + +Object.keys(config).forEach(chain => { + const { factory, v1Pools, } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const allTokens = [] + const allOwners = [] + const v1Data = await api.multiCall({ abi: 'function getCoreData() view returns (address uToken, address, address, address)', calls: v1Pools}) + allTokens.push(...v1Data.map(i => i.uToken)) + allOwners.push(...v1Pools) + + if (factory) { + const poolData = await api.fetchList({ lengthAbi: 'poolId', itemAbi: abiPool.checkPool, target: factory, startFromOne: true}) + const pools = poolData.filter(p => p.poolStatus === '1').map(p => p.poolAddress) + const poolConfigs = await api.multiCall({ abi: 'address:poolConfig', calls: pools}) + const tokens = await api.multiCall({ abi: 'address:underlyingToken', calls: poolConfigs}) + const owners = await api.multiCall({ abi: 'address:poolSafe', calls: pools}) + allTokens.push(...tokens) + allOwners.push(...owners) + } + return api.sumTokens({ tokensAndOwners2: [allTokens, allOwners] }) + }, + borrowed: async (api) => { + const allTokens = [] + const allOwners = [] + const v1Data = await api.multiCall({ abi: 'function getCoreData() view returns (address uToken, address, address, address)', calls: v1Pools}) + const v1Bals = await api.multiCall({ abi: 'uint256:totalPoolValue', calls: v1Pools}) + api.add(v1Data.map(i => i.uToken), v1Bals) + allTokens.push(...v1Data.map(i => i.uToken)) + allOwners.push(...v1Pools) + + if (factory) { + const poolData = await api.fetchList({ lengthAbi: 'poolId', itemAbi: abiPool.checkPool, target: factory, startFromOne: true}) + const pools = poolData.filter(p => p.poolStatus === '1').map(p => p.poolAddress) + const poolConfigs = await api.multiCall({ abi: 'address:poolConfig', calls: pools}) + const tokens = await api.multiCall({ abi: 'address:underlyingToken', calls: poolConfigs}) + const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: pools}) + api.add(tokens, bals) + const owners = await api.multiCall({ abi: 'address:poolSafe', calls: pools}) + allTokens.push(...tokens) + allOwners.push(...owners) + } + + const calls = allTokens.map((t, i) => ({ target: t, params: allOwners[i] })) + const tokenBals = (await api.multiCall({ abi: 'erc20:balanceOf', calls, })).map(i => i * -1) // subtract token balance in pools + api.add(allTokens, tokenBals) + } + } +}) \ No newline at end of file From b9dc6731a52c5a438dcf3c588a1fd19f03c7d8a9 Mon Sep 17 00:00:00 2001 From: penpad-dev <168410560+penpad-dev@users.noreply.github.com> Date: Wed, 22 May 2024 15:21:55 +0800 Subject: [PATCH 029/855] add TVL assets and update category Yield Aggregator (#10320) * add assets add other assets * Update index.js * Update coreAssets.json --- projects/helper/coreAssets.json | 5 +++-- projects/penpad/index.js | 23 +++++++++++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index d5ba1ab6e70e..eee6a5af45c6 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1560,7 +1560,8 @@ "scroll": { "WETH": "0x5300000000000000000000000000000000000004", "USDT": "0xf55bec9cafdbe8730f096aa55dad6d22d44099df", - "USDC": "0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4" + "USDC": "0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4", + "STONE": "0x80137510979822322193FC997d400D5A6C747bf7" }, "darwinia": { "RING": "0xe7578598aac020abfb918f33a20fad5b71d670b4" @@ -1774,4 +1775,4 @@ "btr": { "ETH": "0xef63d4e178b3180beec9b0e143e0f37f4c93f4c2" } -} \ No newline at end of file +} diff --git a/projects/penpad/index.js b/projects/penpad/index.js index 39973ca3ca9a..0ef51da7aa34 100644 --- a/projects/penpad/index.js +++ b/projects/penpad/index.js @@ -1,10 +1,25 @@ - const ADDRESSES = require('../helper/coreAssets.json'); -const { staking } = require('../helper/staking'); +const { sumTokensExport } = require('../helper/unknownTokens'); module.exports = { methodology: 'Counts liquidty on the staking', scroll: { - tvl: staking('0x8F53fA7928305Fd4f78c12BA9d9DE6B2420A2188', ADDRESSES.null), + tvl: sumTokensExport({ + tokensAndOwners: [ + [ADDRESSES.null, '0x8F53fA7928305Fd4f78c12BA9d9DE6B2420A2188'], + [ADDRESSES.scroll.WETH, '0x88844c8f2b895792532AaE2a0F877208248F3585'], + [ADDRESSES.scroll.USDT, '0xC72a7a21e3E12594c75Bc6418224E812e16a027E'], + [ADDRESSES.scroll.USDC, '0xDc1FCFe40A5Cf9745cef0B75428eE28E81D7cC56'], + [ADDRESSES.scroll.STONE, '0x20DE0435e5674Ef15E78adA570159984524B9E8F'], + [ + '0xc4d46E8402F476F269c379677C99F18E22Ea030e', + '0x0C530882C0900b13FC6E8312B52c26e7a5b8e505', + ], // pufETH + [ + '0xa25b25548B4C98B0c7d3d27dcA5D5ca743d68b7F', + '0x27D2B6cEcd759D289B0227966cC6Fe69Cc2b0424', + ], // wrsETH + ], + }), }, -} +}; From e0b1b943b60042ccc6dfc0fbf19a06187da395cd Mon Sep 17 00:00:00 2001 From: enoch-roots <117774949+enoch-roots@users.noreply.github.com> Date: Wed, 22 May 2024 02:28:37 -0500 Subject: [PATCH 030/855] add superposition project adapter (#10309) * add superposition project adapter * split borrowed from tvl --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/superposition/index.js | 51 +++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 projects/superposition/index.js diff --git a/projects/superposition/index.js b/projects/superposition/index.js new file mode 100644 index 000000000000..b6ecf4c48d72 --- /dev/null +++ b/projects/superposition/index.js @@ -0,0 +1,51 @@ +const { getResources } = require("../helper/chain/aptos"); + +const spRootAddress = + "0xccd1a84ccea93531d7f165b90134aa0415feb30e8757ab1632dac68c0055f5c2"; + +let resourcesCache; + +async function _getResources() { + if (!resourcesCache) resourcesCache = getResources(spRootAddress); + return resourcesCache; +} + +const brokersFilter = (i) => + i.type.includes(`${spRootAddress}::broker::Broker`); + +function processBrokerData(brokerDataArray, isBorrowed = false) { + const result = {}; + + brokerDataArray.map((item) => { + const { type, data } = item; + result[type] = !isBorrowed ? parseInt(data.available) : parseInt(data.borrowed) + }); + + return result; +} + +function simplifyKeys(balanceData, api) { + Object.entries(balanceData).forEach(([key, value]) => { + const newKey = key.match(/<([^>]+)>/)[1]; + api.add(newKey, value); + }); +} + +module.exports = { + timetravel: false, + methodology: "Aggregates TVL from all brokers in the Superposition protocol.", + aptos: { + tvl: async (api) => { + const resources = await _getResources(); + const brokers = resources.filter(brokersFilter); + const balanceData = processBrokerData(brokers); + simplifyKeys(balanceData, api); + }, + borrowed: async (api) => { + const resources = await _getResources(); + const brokers = resources.filter(brokersFilter); + const balanceData = processBrokerData(brokers, true); + simplifyKeys(balanceData, api); + }, + }, +}; From 6586ced106305deb647634772881ecc3702a8f81 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 22 May 2024 13:36:28 +0530 Subject: [PATCH 031/855] Update staking stats and add TVL (#10324) * Updated staking stats to include staked TLX and added TVL. * code refactor --------- Co-authored-by: pauljpritz-temp --- projects/tlx/index.js | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/projects/tlx/index.js b/projects/tlx/index.js index fd11ed7196c4..24f65216b89e 100644 --- a/projects/tlx/index.js +++ b/projects/tlx/index.js @@ -1,9 +1,15 @@ -const { sumTokens2 } = require("../helper/unwrapLPs"); +const helperAbi = { + "leveragedTokenData": "function leveragedTokenData() view returns (tuple(address addr, string symbol, uint256 totalSupply, string targetAsset, uint256 targetLeverage, bool isLong, bool isActive, uint256 rebalanceThreshold, uint256 exchangeRate, bool canRebalance, bool hasPendingLeverageUpdate, uint256 remainingMargin, uint256 leverage, uint256 assetPrice, uint256 userBalance)[])" +} + const contracts = { tlx: "0xD9cC3D70E730503E7f28c1B407389198c4B75FA2", + sUSD: "0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9", locker: "0xc068c3261522c97ff719dc97c98c63a1356fef0f", -} + staker: "0xc30877315f3b621a8f7bcda27819ec29429f3817", + leveragedTokenHelper: "0xBdAF7A2C4ee313Be468B9250609ba8496131B1f0", +}; async function staking(api) { const lockedTlxBalance = await api.call({ @@ -11,15 +17,34 @@ async function staking(api) { target: contracts.locker, }); - api.addToken(contracts.tlx, lockedTlxBalance) - return sumTokens2({ api }) + const stakedTlxBalance = await api.call({ + abi: "uint256:totalStaked", + target: contracts.staker, + }); + + api.addToken(contracts.tlx, lockedTlxBalance); + api.addToken(contracts.tlx, stakedTlxBalance); +} + +async function tvl(api) { + // documentation: https://docs.tlx.fi/more/deployed-contracts + // factory - 0x5dd85f51e9fd6ade8ecc216c07919ecd443eb14d + const res = await api.call({ + abi: helperAbi.leveragedTokenData, + target: contracts.leveragedTokenHelper, + }); + const totalSusd = res.reduce((acc, token) => { + return acc + (token.totalSupply * token.exchangeRate) / 1e18; + }, 0); + api.addToken(contracts.sUSD, totalSusd); } module.exports = { start: 1712731500, - methodology: "Total TLX locked in the genesis locker contract.", + methodology: + "Total TLX locked in the genesis locker contract and total TLX staked in the staking contract. TVL is computed as the total margin deposited across the protocol's leveraged tokens.", optimism: { - tvl: () => ({}), + tvl: tvl, staking: staking, }, }; From 82c50a4d268d7d6b52fa7678931659b34a2c01b4 Mon Sep 17 00:00:00 2001 From: Qu33zZ <81550263+Qu33zZ@users.noreply.github.com> Date: Wed, 22 May 2024 11:13:13 +0300 Subject: [PATCH 032/855] add ponzi.market adapter (#10299) * feat: add ponzi.market adapter * fix: add onchain tvl calculation * code refactor --------- Co-authored-by: QueezZ Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/ponzi-market/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 projects/ponzi-market/index.js diff --git a/projects/ponzi-market/index.js b/projects/ponzi-market/index.js new file mode 100644 index 000000000000..5c95816f6bb6 --- /dev/null +++ b/projects/ponzi-market/index.js @@ -0,0 +1,22 @@ +const { getLogs2 } = require('../helper/cache/getLogs') +const { nullAddress } = require('../helper/tokenMapping') + +const config = { + arbitrum: { factory: '0xfCd5dA8c2682e5d17235A5010A01bf6B51B2841D', fromBlock: 186066057 }, +} + +module.exports = { + methodology: + "Ponzi Market's TVL equals to the sum of all ETH balances of all game contracts", +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const logs = await getLogs2({ api, factory, eventAbi: "event CreateGame(address contractAddress, uint256 id, uint256 initialDeposit, address creator, uint256 fee, string name, uint256 roi, uint256 maxDeposit, uint256 minDeposit, string file)", fromBlock, }) + const pools = logs.map(log => log.contractAddress) + return api.sumTokens({ owners: pools, tokens: [nullAddress]}) + } + } +}) \ No newline at end of file From d54a1ad1c2095d9c81983ac707f938cff49aeac3 Mon Sep 17 00:00:00 2001 From: danielliu029 Date: Wed, 22 May 2024 16:25:21 +0800 Subject: [PATCH 033/855] Add WoofWoofWest (#10303) * Create index.js * Update index.js --- projects/woofwoofwest/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/woofwoofwest/index.js diff --git a/projects/woofwoofwest/index.js b/projects/woofwoofwest/index.js new file mode 100644 index 000000000000..9a48181fb2af --- /dev/null +++ b/projects/woofwoofwest/index.js @@ -0,0 +1,12 @@ +const { sumTokens2, } = require('../helper/unwrapLPs') + +async function tvl(api) { + +return sumTokens2({ owners: [ + '0x97886860D6F569C02c7DFAcE8030EFB5052dF353', + ], tokens: ['0xff204e2681a6fa0e2c3fade68a1b28fb90e4fc5f'], api, }) //wbtc +} + +module.exports = { + btr: { tvl, } +} \ No newline at end of file From 9a8be08bf487881ef74de4403a51de954945ffe6 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 22 May 2024 13:55:38 +0530 Subject: [PATCH 034/855] Revert "Add WoofWoofWest (#10303)" (#10325) This reverts commit d54a1ad1c2095d9c81983ac707f938cff49aeac3. --- projects/woofwoofwest/index.js | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 projects/woofwoofwest/index.js diff --git a/projects/woofwoofwest/index.js b/projects/woofwoofwest/index.js deleted file mode 100644 index 9a48181fb2af..000000000000 --- a/projects/woofwoofwest/index.js +++ /dev/null @@ -1,12 +0,0 @@ -const { sumTokens2, } = require('../helper/unwrapLPs') - -async function tvl(api) { - -return sumTokens2({ owners: [ - '0x97886860D6F569C02c7DFAcE8030EFB5052dF353', - ], tokens: ['0xff204e2681a6fa0e2c3fade68a1b28fb90e4fc5f'], api, }) //wbtc -} - -module.exports = { - btr: { tvl, } -} \ No newline at end of file From 97dd24659af0a3b196fdeed4154ec9ceb4b5629f Mon Sep 17 00:00:00 2001 From: Gull Network <165013002+GullNetwork@users.noreply.github.com> Date: Wed, 22 May 2024 16:26:29 +0800 Subject: [PATCH 035/855] Update GullNetwork adapter include liquidity (#10321) * GullNetwork adapter include liquidity * split adapter --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/gullnetwork-amm/index.js | 6 ++++++ projects/gullnetwork/index.js | 31 +++++++++++++++++++++++++------ 2 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 projects/gullnetwork-amm/index.js diff --git a/projects/gullnetwork-amm/index.js b/projects/gullnetwork-amm/index.js new file mode 100644 index 000000000000..441fa41b4755 --- /dev/null +++ b/projects/gullnetwork-amm/index.js @@ -0,0 +1,6 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + manta: { tvl: getUniTVL({ factory: '0x31a78894a2B5dE2C4244cD41595CD0050a906Db3', useDefaultCoreAssets: true, }) } +} \ No newline at end of file diff --git a/projects/gullnetwork/index.js b/projects/gullnetwork/index.js index 7c2553ee150a..b48859486b57 100644 --- a/projects/gullnetwork/index.js +++ b/projects/gullnetwork/index.js @@ -1,21 +1,40 @@ +const FACTORY_SINGLETON_ADDR = '0xFc6387f581d2A827F183A9ea68f07063F99744dE' -const FACTORY_SINGLETON_ADDR = '0xFc6387f581d2A827F183A9ea68f07063F99744dE'; +const getStakingVaultTvl = async (api, stakingVaultFactory) => { + if (!stakingVaultFactory) return + const vaults = await api.fetchList({ lengthAbi: 'length', itemAbi: 'stakingVaults', target: stakingVaultFactory }) + const stakedTokens = await api.multiCall({ calls: vaults, abi: 'address:stakedToken' }) + await api.sumTokens({ tokensAndOwners2: [stakedTokens, vaults] }) +} + +const getRewardTvl = async (api, rewardFactory) => { + if (!rewardFactory) return + const stakeRewarders = await api.fetchList({ lengthAbi: 'uint:stakeRewarderLength', itemAbi: 'stakeRewarders', target: rewardFactory }) + const tokensAndOwners = [] + await Promise.all(stakeRewarders.map(async (stakeRewarder) => { + const rewardTokens_ = await api.fetchList({ lengthAbi: 'rewardLength', itemAbi: 'rewardTokens', target: stakeRewarder }) + tokensAndOwners.push(...rewardTokens_.map(token => [token, stakeRewarder])) + })) + await api.sumTokens({ tokensAndOwners }) +} const tvl = async (api) => { - const vaults = await api.fetchList({ lengthAbi: 'length', itemAbi: 'stakingVaults', target: FACTORY_SINGLETON_ADDR }) - const stakedTokens = await api.multiCall({ calls: vaults, abi: 'address:stakedToken', }) - return api.sumTokens({ tokensAndOwners2: [stakedTokens, vaults] }); + const { stakingVaultFactory = FACTORY_SINGLETON_ADDR, rewardFactory } = config[api.chain] + await getStakingVaultTvl(api, stakingVaultFactory) + await getRewardTvl(api, rewardFactory) } module.exports = { start: 1710844331, // May-17-2024 12:45:31 PM +UTC - methodology: 'GullNetwork TVL including total values of assets staked in our staking vaults.', + methodology: 'GullNetwork TVL including total values of assets staked in our staking vaults, and assets in the liquidity pool.', } const config = { ethereum: {}, bsc: {}, - manta: {}, + manta: { + rewardFactory: '0x2a18164B5e84d9C1B03ddbb5A1982A35cF75E506' + }, base: {}, } From 4db3aff42afeacd395b015b8d7813d20908949cf Mon Sep 17 00:00:00 2001 From: yyexdev Date: Wed, 22 May 2024 16:27:03 +0800 Subject: [PATCH 036/855] add yyex (#10280) --- projects/yyex/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 projects/yyex/index.js diff --git a/projects/yyex/index.js b/projects/yyex/index.js new file mode 100644 index 000000000000..a2bcfaf620e9 --- /dev/null +++ b/projects/yyex/index.js @@ -0,0 +1,9 @@ +const { gmxExports } = require("../helper/gmx"); + +module.exports = { + btr: { + tvl: gmxExports({ + vault: "0x16Aa605Ca2cBE921AAC6C4838c1109b3cf9d444F", + }), + }, +}; From 3d5a3ce4f1b6943e329ca599f5f8d172aa89f4e2 Mon Sep 17 00:00:00 2001 From: conquerorzzz <160872432+conquerorzzz@users.noreply.github.com> Date: Wed, 22 May 2024 19:45:29 +0800 Subject: [PATCH 037/855] add nxfi tvl (#10308) * add nxfi tvl * code refactor * add nxfi borrowed * add nxfi tvl and borrow * skip library --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/nxfi/idl.js | 524 +++++++++++++++++++++++++++++++++++++++++ projects/nxfi/index.js | 41 ++++ 2 files changed, 565 insertions(+) create mode 100644 projects/nxfi/idl.js create mode 100644 projects/nxfi/index.js diff --git a/projects/nxfi/idl.js b/projects/nxfi/idl.js new file mode 100644 index 000000000000..266eb8dc3f5e --- /dev/null +++ b/projects/nxfi/idl.js @@ -0,0 +1,524 @@ +module.exports = { + "version": "0.1.0", + "name": "nxlend", + "instructions": [], + "accounts": [ + { + "name": "Reserve", + "type": { + "kind": "struct", + "fields": [ + { + "name": "market", + "type": "publicKey" + }, + { + "name": "tokenMint", + "type": "publicKey" + }, + { + "name": "tokenDecimals", + "type": "u8" + }, + { + "name": "aliPadding1", + "type": { + "array": [ + "i8", + 7 + ] + } + }, + { + "name": "creditDebit", + "type": { + "defined": "ReserveCreditDebit" + } + }, + { + "name": "tokenInfo", + "type": { + "defined": "ReserveToken" + } + }, + { + "name": "treasury", + "type": { + "defined": "ReserveTreasury" + } + }, + { + "name": "marketFee", + "type": { + "defined": "MarketFee" + } + }, + { + "name": "setting", + "type": { + "defined": "ReserveSetting" + } + }, + { + "name": "emissionsFlags", + "docs": [ + "Emissions Config Flags", + "", + "- EMISSIONS_FLAG_BORROW_ACTIVE: 1", + "- EMISSIONS_FLAG_LENDING_ACTIVE: 2", + "" + ], + "type": "u64" + }, + { + "name": "emissionsRate", + "docs": [ + "Emissions APR.", + "Number of emitted tokens (emissions_mint) per 1e(reserve.mint_decimal) tokens (reserve mint) (native amount) per 1 YEAR." + ], + "type": "u64" + }, + { + "name": "emissionsRemaining", + "type": { + "defined": "WrappedI80F48" + } + }, + { + "name": "emissionsMint", + "type": "publicKey" + }, + { + "name": "padding0", + "type": { + "array": [ + "u128", + 28 + ] + } + }, + { + "name": "padding1", + "type": { + "array": [ + "u128", + 32 + ] + } + } + ] + } + } + ], + "types": [ + { + "name": "InterestModel", + "type": { + "kind": "struct", + "fields": [ + { + "name": "rateChangeUr1", + "type": { + "defined": "WrappedI80F48" + } + }, + { + "name": "irUr1", + "type": { + "defined": "WrappedI80F48" + } + }, + { + "name": "rateChangeUr2", + "type": { + "defined": "WrappedI80F48" + } + }, + { + "name": "irUr2", + "type": { + "defined": "WrappedI80F48" + } + }, + { + "name": "maxIr", + "type": { + "defined": "WrappedI80F48" + } + }, + { + "name": "treasuryBaseApr", + "type": { + "defined": "WrappedI80F48" + } + }, + { + "name": "treasuryAdditionRatio", + "type": { + "defined": "WrappedI80F48" + } + }, + { + "name": "marketFeeBase", + "type": { + "defined": "WrappedI80F48" + } + }, + { + "name": "marketAdditionRatio", + "type": { + "defined": "WrappedI80F48" + } + }, + { + "name": "padding", + "type": { + "array": [ + "u128", + 8 + ] + } + } + ] + } + }, + { + "name": "ReserveToken", + "type": { + "kind": "struct", + "fields": [ + { + "name": "tokenAccount", + "type": "publicKey" + }, + { + "name": "tokenAccountBump", + "type": "u8" + }, + { + "name": "tokenAccountAuthorityBump", + "type": "u8" + }, + { + "name": "aliPadding1", + "type": { + "array": [ + "i8", + 6 + ] + } + } + ] + } + }, + { + "name": "ReserveTreasury", + "type": { + "kind": "struct", + "fields": [ + { + "name": "treasuryTokenAccount", + "type": "publicKey" + }, + { + "name": "treasuryTokenAccountBump", + "type": "u8" + }, + { + "name": "treasuryAuthorityBump", + "type": "u8" + }, + { + "name": "aliPadding1", + "type": { + "array": [ + "i8", + 6 + ] + } + }, + { + "name": "unpayedTreasuryFee", + "type": { + "defined": "WrappedI80F48" + } + } + ] + } + }, + { + "name": "MarketFee", + "type": { + "kind": "struct", + "fields": [ + { + "name": "marketFeeTokenAccount", + "type": "publicKey" + }, + { + "name": "marketFeeAccountBump", + "type": "u8" + }, + { + "name": "marketFeeAuthorityBump", + "type": "u8" + }, + { + "name": "aliPadding1", + "type": { + "array": [ + "i8", + 6 + ] + } + }, + { + "name": "unpayedMarketFee", + "type": { + "defined": "WrappedI80F48" + } + } + ] + } + }, + { + "name": "ReserveCreditDebit", + "type": { + "kind": "struct", + "fields": [ + { + "name": "assetNtokenRatio", + "type": { + "defined": "WrappedI80F48" + } + }, + { + "name": "debtNtokenRatio", + "type": { + "defined": "WrappedI80F48" + } + }, + { + "name": "reserveDebtNtokenAmount", + "type": { + "defined": "WrappedI80F48" + } + }, + { + "name": "reserveAssetNtokenAmount", + "type": { + "defined": "WrappedI80F48" + } + }, + { + "name": "updateTimeOfInterest", + "type": "i64" + } + ] + } + }, + { + "name": "ReserveSetting", + "type": { + "kind": "struct", + "fields": [ + { + "name": "assetValueRatio", + "type": { + "defined": "WrappedI80F48" + } + }, + { + "name": "assetValueLiqRatio", + "type": { + "defined": "WrappedI80F48" + } + }, + { + "name": "debtValueRatioHighRisk", + "type": { + "defined": "WrappedI80F48" + } + }, + { + "name": "debtValueRatioMidRisk", + "type": { + "defined": "WrappedI80F48" + } + }, + { + "name": "debtValueRatioLowRisk", + "type": { + "defined": "WrappedI80F48" + } + }, + { + "name": "debtValueLiqRatio", + "type": { + "defined": "WrappedI80F48" + } + }, + { + "name": "capacity", + "type": "u64" + }, + { + "name": "interestSetting", + "type": { + "defined": "InterestModel" + } + }, + { + "name": "reserveType", + "type": { + "defined": "ReserveType" + } + }, + { + "name": "operationalState", + "type": { + "defined": "ReserveOperationalState" + } + }, + { + "name": "aliPadding1", + "type": { + "array": [ + "i8", + 5 + ] + } + }, + { + "name": "oracleType", + "type": { + "defined": "OracleType" + } + }, + { + "name": "oracleKeys", + "type": { + "array": [ + "publicKey", + 5 + ] + } + }, + { + "name": "maxBorrowable", + "type": "u64" + }, + { + "name": "maxExposure", + "docs": [ + "USD denominated limit for calculating asset value for initialization nxlend requirements.", + "Example, if total SOL deposits are equal to $1M and the limit it set to $500K,", + "then SOL assets will be discounted by 50%.", + "", + "In other words the max value of liabilities that can be backed by the asset is $500K.", + "This is useful for limiting the damage of orcale attacks.", + "", + "Value is UI USD value, for example value 100 -> $100" + ], + "type": "u64" + }, + { + "name": "maxPriceAge", + "type": "u64" + }, + { + "name": "padding", + "type": { + "array": [ + "u64", + 6 + ] + } + } + ] + } + }, + { + "name": "WrappedI80F48", + "type": { + "kind": "struct", + "fields": [ + { + "name": "value", + "type": "i128" + } + ] + } + }, + { + "name": "ReserveOperationalState", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Paused" + }, + { + "name": "Operational" + }, + { + "name": "ReduceOnly" + } + ] + } + }, + { + "name": "ReserveType", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Collateral" + }, + { + "name": "NoCollaAddup" + } + ] + } + }, + { + "name": "ReserveVaultType", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Liquidity" + }, + { + "name": "Insurance" + }, + { + "name": "Fee" + } + ] + } + }, + { + "name": "OracleType", + "type": { + "kind": "enum", + "variants": [ + { + "name": "None" + }, + { + "name": "PythEma" + }, + { + "name": "SwitchboardV2" + } + ] + } + } + ], + "events": [], + "errors": [], + "metadata": { + "address": "7YYkqwXp812NMe6nWny2JAGsm6b3CVvbQKiMo8SuaPMg" + } +} \ No newline at end of file diff --git a/projects/nxfi/index.js b/projects/nxfi/index.js new file mode 100644 index 000000000000..041e5deb2244 --- /dev/null +++ b/projects/nxfi/index.js @@ -0,0 +1,41 @@ +const { Program } = require("@project-serum/anchor"); +const { getProvider, sumTokens2, } = require("../helper/solana"); + +const idl = require('./idl') + +function i80f48ToNumber(i80f48) { + if (i80f48.value) i80f48 = i80f48.value + // Create a mask with the lower 48 bits set to 1 + const mask = BigInt((1n << 48n) - 1n) + + // Shift right by 48 bits to get the integer part + const integerPart = BigInt(i80f48) >> BigInt(48) + + // Use bitwise AND to get the fractional part + const fractionalPart = BigInt(i80f48) & mask + + // Convert to regular numbers and add together + return Number(integerPart) + Number(fractionalPart) / Number(1n << 48n) +} + +async function tvl() { + const provider = getProvider() + const program = new Program(idl, 'NxFiv1eeKtKT6dQEP2erBwz2DSKCTdb8WSsxVDwVGJ1', provider) + const reserves = await program.account.reserve.all() + return sumTokens2({ tokenAccounts: reserves.map(r => r.account.tokenInfo.tokenAccount.toString()) }); +} +async function borrowed(api) { + const provider = getProvider() + const program = new Program(idl, 'NxFiv1eeKtKT6dQEP2erBwz2DSKCTdb8WSsxVDwVGJ1', provider) + const reserves = await program.account.reserve.all() + reserves.map(r=>{ + const amount = i80f48ToNumber(r.account.creditDebit.debtNtokenRatio) * i80f48ToNumber(r.account.creditDebit.reserveDebtNtokenAmount) + const mint = r.account.tokenMint.toString() + api.add(mint, amount) + }) +} + +module.exports = { + timetravel: false, + solana: { tvl,borrowed }, +} From e11d70fa3e37ea81a95c733aebfa74c57d8ad380 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Wed, 22 May 2024 13:45:53 +0100 Subject: [PATCH 038/855] add mode chain to velo (#10328) --- projects/velodrome-v2/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/projects/velodrome-v2/index.js b/projects/velodrome-v2/index.js index b21a9461fd55..40e4f0b7f0bd 100644 --- a/projects/velodrome-v2/index.js +++ b/projects/velodrome-v2/index.js @@ -8,6 +8,12 @@ module.exports = { allPairs: 'function allPools(uint256) view returns (address)', }, { useDefaultCoreAssets: true, hasStablePools: true, permitFailure: true, }), }, + mode: { + tvl: uniTvlExport("0x31832f2a97Fd20664D76Cc421207669b55CE4BC0", undefined, undefined, { + allPairsLength: 'uint256:allPoolsLength', + allPairs: 'function allPools(uint256) view returns (address)', + }, { useDefaultCoreAssets: true, hasStablePools: true, permitFailure: true, }), + }, hallmarks: [ [1687465883, "v2 Migration on OP Mainnet"], // https://twitter.com/VelodromeFi/status/1671979216039202816 ] From 6ebbfa221ab512b32d68ebf9a38279b5ac98b5c1 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Wed, 22 May 2024 13:48:13 +0100 Subject: [PATCH 039/855] add bob to velo (#10330) --- projects/velodrome-v2/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/projects/velodrome-v2/index.js b/projects/velodrome-v2/index.js index 40e4f0b7f0bd..eba9afb904b8 100644 --- a/projects/velodrome-v2/index.js +++ b/projects/velodrome-v2/index.js @@ -14,6 +14,12 @@ module.exports = { allPairs: 'function allPools(uint256) view returns (address)', }, { useDefaultCoreAssets: true, hasStablePools: true, permitFailure: true, }), }, + bob: { + tvl: uniTvlExport("0x31832f2a97Fd20664D76Cc421207669b55CE4BC0", undefined, undefined, { + allPairsLength: 'uint256:allPoolsLength', + allPairs: 'function allPools(uint256) view returns (address)', + }, { useDefaultCoreAssets: true, hasStablePools: true, permitFailure: true, }), + }, hallmarks: [ [1687465883, "v2 Migration on OP Mainnet"], // https://twitter.com/VelodromeFi/status/1671979216039202816 ] From 4d85f09152f3df96c6f0abe9aa3104709478ae4f Mon Sep 17 00:00:00 2001 From: Bit-Genie <168055389+Bit-Genie@users.noreply.github.com> Date: Wed, 22 May 2024 21:22:42 +0800 Subject: [PATCH 040/855] Add New Contracts (#10329) * Add new contracts * Add New Contracts --------- Co-authored-by: Arvin Co-authored-by: Your Name --- projects/bitgenie/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/bitgenie/index.js b/projects/bitgenie/index.js index 8653bd7faff3..94c85ffa8019 100644 --- a/projects/bitgenie/index.js +++ b/projects/bitgenie/index.js @@ -12,6 +12,10 @@ const stakingContracts = [ "0x0b0659bC906cB62179FDD2B6008BA729baa79126", "0xF57A28168401f9c386c7723C2BA4e579A2F3818a", "0x82cf7644BD07002217EFB2563D361a0b0c245978", + "0x8Ab52b92C31bd16e9e091c42FaCA01358717b8A4", + "0x0Bf2C32E2045b50AD772E8F758484aF3BbA75738", + "0xeC986eE93884ca3e20AA8a11C72f5c57085893F3", + "0xFf090ED319D3B89DD3ee2CB94F590272A6866cD9", ]; From 448d52d4aeb36091efbf7c79f9b2119d7cb8bbc3 Mon Sep 17 00:00:00 2001 From: Adolf998 <154962952+Adolf998@users.noreply.github.com> Date: Wed, 22 May 2024 21:38:29 +0800 Subject: [PATCH 041/855] update bouncebit-premium & bouncebitTvl (#10294) --- projects/bouncebit-premium/index.js | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/projects/bouncebit-premium/index.js b/projects/bouncebit-premium/index.js index e60eea7a28a5..9af68c13fa4a 100644 --- a/projects/bouncebit-premium/index.js +++ b/projects/bouncebit-premium/index.js @@ -1,8 +1,23 @@ -const { sumTokensExport } = require('../helper/sumTokens'); +const { sumTokens, sumTokensExport } = require('../helper/sumTokens'); const BBTC = '0xF5e11df1ebCf78b6b6D26E04FF19cD786a1e81dC' const BBUSD = '0x77776b40C3d75cb07ce54dEA4b2Fd1D07F865222' -const stBBTC = '0x7F150c293c97172C75983BD8ac084c187107eA19' +// const stBBTC = '0x7F150c293c97172C75983BD8ac084c187107eA19' + +const stBBTC_STAKE_ABI = + "function totalStaked() view returns (uint256)"; + +async function bouncebitTvl(api, ...args) { + const stBBTCStaked = await api.call({ abi: stBBTC_STAKE_ABI, target: '0x7F26aB9263E33de947654F44C5AB439090cfAaf7'}) + // stBBTC + api.add(BBTC, stBBTCStaked) + return sumTokens({ + owners: ["0xd4def93a10ada7e14cAdc6920b6CDE01148D1813", "0x426CD147ff93f31BB18F1Acd19DAb9c32d934131"], + tokens: [BBTC, BBUSD], + api, + ...args + }) +} module.exports = { ethereum: { @@ -18,9 +33,6 @@ module.exports = { }), }, bouncebit: { - tvl: sumTokensExport({ - owners: ["0xd4def93a10ada7e14cAdc6920b6CDE01148D1813", "0x426CD147ff93f31BB18F1Acd19DAb9c32d934131", '0x7F26aB9263E33de947654F44C5AB439090cfAaf7'], - tokens: [BBTC, BBUSD, stBBTC] - }), + tvl: bouncebitTvl }, }; From dd671d34c67fc7bff54a7de7509cca8a677e98bc Mon Sep 17 00:00:00 2001 From: northern05 <42889528+northern05@users.noreply.github.com> Date: Wed, 22 May 2024 18:20:23 +0300 Subject: [PATCH 042/855] Add LendOS (#10331) * add ilend * code refactor * add ilend v2 * add lendOS * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/lendOS/index.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 projects/lendOS/index.js diff --git a/projects/lendOS/index.js b/projects/lendOS/index.js new file mode 100644 index 000000000000..92b4491083b3 --- /dev/null +++ b/projects/lendOS/index.js @@ -0,0 +1,7 @@ +const { aaveExports } = require('../helper/aave'); +const methodologies = require('../helper/methodologies'); + +module.exports = { + methodology: methodologies.lendingMarket, + neon_evm: aaveExports('', undefined, undefined, ['0x3A1ca459F21D8FAcF9A30bC4773f5dBf07C1191d'], { v3: true, }), +} \ No newline at end of file From 852fa6971c547e2e489c059e6b786751dea57b69 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 22 May 2024 21:11:01 +0200 Subject: [PATCH 043/855] wagmi: track staking --- projects/wagmi-com/index.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/projects/wagmi-com/index.js b/projects/wagmi-com/index.js index ae95ac05fccf..8fc560dd6975 100644 --- a/projects/wagmi-com/index.js +++ b/projects/wagmi-com/index.js @@ -1,3 +1,4 @@ +const { staking } = require('../helper/staking') const { uniV3Export, uniV3GraphExport } = require("../helper/uniswapV3"); module.exports = uniV3Export({ @@ -8,4 +9,14 @@ module.exports = uniV3Export({ metis: { factory: '0x8112E18a34b63964388a3B2984037d6a2EFE5B8A', fromBlock: 9740222, }, }) -module.exports.kava = { tvl: uniV3GraphExport({ name: 'wagmi-kava', graphURL: 'https://kava.graph.wagmi.com/subgraphs/name/v3', minTVLUSD: 0 }) } \ No newline at end of file +module.exports.kava = { tvl: uniV3GraphExport({ name: 'wagmi-kava', graphURL: 'https://kava.graph.wagmi.com/subgraphs/name/v3', minTVLUSD: 0 }) } + +const stakingConfig = { + metis: { swagmi: '0x5fb3983adc4dcc82a610a91d2e329f6401352558', wagmi: '0xaf20f5f19698f1d19351028cd7103b63d30de7d7', }, + kava: { swagmi: '0x3690d1a9fb569c21372f8091527ab44f1dc9630f', wagmi: '0xaf20f5f19698f1d19351028cd7103b63d30de7d7', }, +} + +Object.keys(stakingConfig).forEach(chain => { + const { swagmi, wagmi, } = stakingConfig[chain] + module.exports[chain].staking = staking(swagmi, wagmi) +}) \ No newline at end of file From e6d00514d9f865c5e74304be43e782e0258821c3 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 22 May 2024 21:21:45 +0200 Subject: [PATCH 044/855] track unlockd-v2 --- projects/unlockd-v2/index.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 projects/unlockd-v2/index.js diff --git a/projects/unlockd-v2/index.js b/projects/unlockd-v2/index.js new file mode 100644 index 000000000000..7d6cee91da71 --- /dev/null +++ b/projects/unlockd-v2/index.js @@ -0,0 +1,30 @@ +const methodologies = require("../helper/methodologies.js"); +const uTokenAbi = { + "totalAvailableSupply": "function totalAvailableSupply(address) view returns (uint256)", + "getScaledTotalDebtMarket": "function getScaledTotalDebtMarket(address) view returns (uint256)" +} +const addresses = { + UTokenVault: "0x25299e9Ec27c242465587B8A2Aa70bcE02636cDA", + USDC: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" +} + +async function tvl(api) { + return api.sumTokens({ owner: addresses.UTokenVault, token: addresses.USDC }) +} + +async function borrowed(api) { + const scaledDebt = await api.call({ + target: addresses.UTokenVault, + params: addresses.USDC, + abi: uTokenAbi.getScaledTotalDebtMarket + }); + api.add(addresses.USDC, scaledDebt) +} + +module.exports = { + methodology: methodologies.lendingMarket, + ethereum: { + tvl, + borrowed, + }, +}; From c3a914e98727c849032b69e7036d75632d64f4fc Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 23 May 2024 00:58:56 +0530 Subject: [PATCH 045/855] Add LineHub Protocol (#10335) * Add LineHub Protocol * refactor --------- Co-authored-by: 0xR <0xr@metavault.org> Co-authored-by: 0xR <99395193+0xrmvdao@users.noreply.github.com> --- projects/linehub-v2/index.js | 12 ++++++++++++ projects/linehub-v3/index.js | 5 +++++ 2 files changed, 17 insertions(+) create mode 100644 projects/linehub-v2/index.js create mode 100644 projects/linehub-v3/index.js diff --git a/projects/linehub-v2/index.js b/projects/linehub-v2/index.js new file mode 100644 index 000000000000..28159d8de6d8 --- /dev/null +++ b/projects/linehub-v2/index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require("../helper/unknownTokens"); + +module.exports = { + misrepresentedTokens: true, + linea: { + tvl: getUniTVL({ + factory: "0x7811DeF28977060784cC509641f2DD23584b7671", + useDefaultCoreAssets: true, + fetchBalances: true, + }), + }, +}; diff --git a/projects/linehub-v3/index.js b/projects/linehub-v3/index.js new file mode 100644 index 000000000000..6a555fdd5ea6 --- /dev/null +++ b/projects/linehub-v3/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + linea: { factory: '0x6c379d538f2f7cb642851e154a8e572d63238df4', fromBlock: 407280, }, +}) From 8598288804f276c801a980d91c182c779ff9c081 Mon Sep 17 00:00:00 2001 From: Daniel <110973578+DanielZhangReal@users.noreply.github.com> Date: Thu, 23 May 2024 14:34:03 +0800 Subject: [PATCH 046/855] feat: add manta cedefi (#10341) --- projects/manta-cedefi/index.js | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 projects/manta-cedefi/index.js diff --git a/projects/manta-cedefi/index.js b/projects/manta-cedefi/index.js new file mode 100644 index 000000000000..6900413f5889 --- /dev/null +++ b/projects/manta-cedefi/index.js @@ -0,0 +1,37 @@ +const tokens = [ + { + name: "mBTC", + address: "0x1468177DbCb2a772F3d182d2F1358d442B553089", + decimals: 18, + coinGeckoId: "bitcoin", + }, + { + name: "mETH", + address: "0xACCBC418a994a27a75644d8d591afC22FaBA594e", + decimals: 18, + coinGeckoId: "ethereum", + }, + { + name: "mUSD", + address: "0x649d4524897cE85A864DC2a2D5A11Adb3044f44a", + decimals: 18, + coinGeckoId: "tether", + }, +]; + +async function tvl(api) { + const balances = await api.multiCall({ + abi: "erc20:totalSupply", + calls: tokens.map((item) => item.address), + }); + return tokens.reduce((total, item, index) => { + total[item.coinGeckoId] = balances[index] / 10 ** tokens[index].decimals; + return total; + }, {}); +} + +module.exports = { + manta: { + tvl, + }, +}; From b421d9858df91d14ea8546fcb5e082ac56800567 Mon Sep 17 00:00:00 2001 From: Jasper <104004836+j-vp@users.noreply.github.com> Date: Thu, 23 May 2024 08:38:45 +0200 Subject: [PATCH 047/855] add slipstream handling (#10340) * add slipstream handling * remove slipstream abi from arcadia abi & add nftposmgr links --- projects/arcadia-finance-v2/index.js | 7 +- .../arcadia-finance-v2/slipstreamNftABI.json | 5 + projects/helper/unwrapLPs.js | 109 +++++++++++++++++- 3 files changed, 116 insertions(+), 5 deletions(-) create mode 100644 projects/arcadia-finance-v2/slipstreamNftABI.json diff --git a/projects/arcadia-finance-v2/index.js b/projects/arcadia-finance-v2/index.js index 7341b5eb241a..9cbaf0aebfc4 100644 --- a/projects/arcadia-finance-v2/index.js +++ b/projects/arcadia-finance-v2/index.js @@ -8,11 +8,12 @@ const config = { usdcPool: "0x3ec4a293Fb906DD2Cd440c20dECB250DeF141dF1", }, uniNFT: '0x03a520b32c04bf3beef7beb72e919cf822ed34f1', + slipNFT: '0x827922686190790b37229fd06084350e74485b72' }, } async function tvl(api) { - let { factory, pools, uniNFT, } = config[api.chain]; + let { factory, pools, uniNFT, slipNFT, } = config[api.chain]; pools = Object.values(pools); const uTokens = await api.multiCall({ abi: "address:asset", calls: pools }) await api.sumTokens({ tokensAndOwners2: [uTokens, pools] }) @@ -20,8 +21,8 @@ async function tvl(api) { 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] }) - return sumTokens2({ api, owners: accounts, resolveUniV3: true }) + await api.sumTokens({ ownerTokens, blacklistedTokens: [uniNFT, slipNFT] }) + return sumTokens2({ api, owners: accounts, resolveUniV3: true, resolveSlipstream: true }) } module.exports = { diff --git a/projects/arcadia-finance-v2/slipstreamNftABI.json b/projects/arcadia-finance-v2/slipstreamNftABI.json new file mode 100644 index 000000000000..8a88c4ea6edd --- /dev/null +++ b/projects/arcadia-finance-v2/slipstreamNftABI.json @@ -0,0 +1,5 @@ +{ + "positions": "function positions(uint256 tokenId) view returns (uint96 nonce, address operator, address token0, address token1, int24 tickSpacing, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)", + "slot0": "function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, bool unlocked)", + "getPool": "function getPool(address, address, int24) view returns (address)" +} \ No newline at end of file diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index 4d3293e30259..b6eef6184f8f 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -11,6 +11,7 @@ const creamAbi = require('./abis/cream.json') const { isLP, log, sliceIntoChunks, isICHIVaultToken, createIncrementArray } = require('./utils') const { sumArtBlocks, whitelistedNFTs, } = require('./nft') const wildCreditABI = require('../wildcredit/abi.json'); +const slipstreamNftABI = require('../arcadia-finance-v2/slipstreamNftABI.json'); const { covalentGetTokens, } = require("./token"); const SOLIDLY_VE_NFT_ABI = require('./abis/solidlyVeNft.json'); @@ -302,6 +303,105 @@ async function unwrapUniswapV3NFT({ balances, owner, nftAddress, block, chain = } } +async function unwrapSlipstreamNFTs({ balances = {}, nftsAndOwners = [], block, chain = 'base', owner, nftAddress, owners, blacklistedTokens = [], whitelistedTokens = [], uniV3ExtraConfig = {} }) { + // https://velodrome.finance/security#contracts + // https://aerodrome.finance/security#contracts + if (!nftsAndOwners.length) { + if (!nftAddress) + switch (chain) { + case 'optimism': nftAddress = '0xbB5DFE1380333CEE4c2EeBd7202c80dE2256AdF4'; break; + case 'base': nftAddress = '0x827922686190790b37229fd06084350e74485b72'; break; + default: throw new Error('missing default uniswap nft address chain: ' + chain) + } + + if ((!owners || !owners.length) && owner) + owners = [owner] + owners = getUniqueAddresses(owners, chain) + if (Array.isArray(nftAddress)) + nftsAndOwners = nftAddress.map(nft => owners.map(o => [nft, o])).flat() + else + nftsAndOwners = owners.map(o => [nftAddress, o]) + } + await Promise.all(nftsAndOwners.map(([nftAddress, owner]) => unwrapSlipstreamNFT({ balances, owner, nftAddress, block, chain, blacklistedTokens, whitelistedTokens, uniV3ExtraConfig, }))) + return balances +} + +async function unwrapSlipstreamNFT({ balances, owner, nftAddress, block, chain = 'base', blacklistedTokens = [], whitelistedTokens = [], uniV3ExtraConfig = {}, }) { + + blacklistedTokens = getUniqueAddresses(blacklistedTokens, chain) + whitelistedTokens = getUniqueAddresses(whitelistedTokens, chain) + let nftIdFetcher = uniV3ExtraConfig.nftIdFetcher ?? nftAddress + + const nftPositions = (await sdk.api.erc20.balanceOf({ target: nftIdFetcher, owner, block, chain })).output + const factoryKey = getFactoryKey(chain, nftAddress) + if (!factories[factoryKey]) factories[factoryKey] = sdk.api.abi.call({ target: nftAddress, abi: wildCreditABI.factory, block, chain }) + let factory = (await factories[factoryKey]).output + + const positionIds = (await sdk.api.abi.multiCall({ + block, chain, abi: wildCreditABI.tokenOfOwnerByIndex, target: nftIdFetcher, + calls: Array(Number(nftPositions)).fill(0).map((_, index) => ({ params: [owner, index] })), + })).output.map(positionIdCall => positionIdCall.output) + + const positions = (await sdk.api.abi.multiCall({ + block, chain, abi: slipstreamNftABI.positions, target: nftAddress, + calls: positionIds.map((position) => ({ params: [position] })), + })).output.map(positionsCall => positionsCall.output) + + const lpInfo = {} + positions.forEach(position => lpInfo[getKey(position)] = position) + const lpInfoArray = Object.values(lpInfo) + + const poolInfos = (await sdk.api.abi.multiCall({block, chain, + abi: slipstreamNftABI.getPool, target: factory, + calls: lpInfoArray.map((info) => ({ params: [info.token0, info.token1, info.tickSpacing] })), + })).output.map(positionsCall => positionsCall.output) + + const slot0 = await sdk.api.abi.multiCall({ block, chain, abi: slipstreamNftABI.slot0, calls: poolInfos.map(i => ({ target: i })) }) + + slot0.output.forEach((slot, i) => lpInfoArray[i].tick = slot.output.tick) + + positions.map(addV3PositionBalances) + return balances + + function getKey(position) { + let { token0, token1, tickSpacing } = position + token0 = token0.toLowerCase() + token1 = token1.toLowerCase() + return `${token0}-${token1}-${tickSpacing}` + } + + function addV3PositionBalances(position) { + 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 = +lpInfo[getKey(position)].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) + } + + addToken({ balances, token: token0, amount: amount0, chain, blacklistedTokens, whitelistedTokens }) + addToken({ balances, token: token1, amount: amount1, chain, blacklistedTokens, whitelistedTokens }) + } +} + function addToken({ balances, token, amount, chain, blacklistedTokens = [], whitelistedTokens = [] }) { const addr = normalizeAddress(token, chain) if (blacklistedTokens.length && blacklistedTokens.includes(addr)) return; @@ -695,6 +795,7 @@ async function sumTokens2({ abis = {}, api, resolveUniV3 = false, + resolveSlipstream = false, uniV3WhitelistedTokens = [], uniV3nftsAndOwners = [], resolveArtBlocks = false, @@ -774,6 +875,10 @@ async function sumTokens2({ if (resolveUniV3 || uniV3nftsAndOwners.length || Object.keys(uniV3ExtraConfig).length) await unwrapUniswapV3NFTs({ balances, chain, block, owner, owners, blacklistedTokens, whitelistedTokens: uniV3WhitelistedTokens, nftsAndOwners: uniV3nftsAndOwners, uniV3ExtraConfig, }) + + 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)) @@ -835,8 +940,8 @@ async function sumTokens2({ } } -function sumTokensExport({ balances, tokensAndOwners, tokensAndOwners2, tokens, owner, owners, transformAddress, unwrapAll, resolveLP, blacklistedLPs, blacklistedTokens, skipFixBalances, ownerTokens, resolveUniV3, resolveArtBlocks, resolveNFTs, fetchCoValentTokens, logCalls, ...args }) { - return async (api) => sumTokens2({ api, balances, tokensAndOwners, tokensAndOwners2, tokens, owner, owners, transformAddress, unwrapAll, resolveLP, blacklistedLPs, blacklistedTokens, skipFixBalances, ownerTokens, resolveUniV3, resolveArtBlocks, resolveNFTs, fetchCoValentTokens, ...args, }) +function sumTokensExport({ balances, tokensAndOwners, tokensAndOwners2, tokens, owner, owners, transformAddress, unwrapAll, resolveLP, blacklistedLPs, blacklistedTokens, skipFixBalances, ownerTokens, resolveUniV3, resolveSlipstream, resolveArtBlocks, resolveNFTs, fetchCoValentTokens, logCalls, ...args }) { + return async (api) => sumTokens2({ api, balances, tokensAndOwners, tokensAndOwners2, tokens, owner, owners, transformAddress, unwrapAll, resolveLP, blacklistedLPs, blacklistedTokens, skipFixBalances, ownerTokens, resolveUniV3, resolveSlipstream, resolveArtBlocks, resolveNFTs, fetchCoValentTokens, ...args, }) } async function unwrapBalancerToken({ api, chain, block, balancerToken, owner, balances, isBPool = false, isV2 = true }) { From 39e0b3a450e0198b2330c2f04220250f3855e53a Mon Sep 17 00:00:00 2001 From: rogi-sh <46889545+rogi-sh@users.noreply.github.com> Date: Thu, 23 May 2024 11:01:38 +0200 Subject: [PATCH 048/855] add javsphere to token mappings to get price from coingecko (#10347) * add javsphere to token mappings to get price from coingecko * dusd back --------- Co-authored-by: igorshelkovenkov --- projects/helper/tokenMapping.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 20b905a54177..cf7dd4bf6145 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -41,6 +41,7 @@ const fixBalancesTokens = { '0xff00000000000000000000000000000000000003': { coingeckoId: "tether", decimals: 18 }, '0xff00000000000000000000000000000000000001': { coingeckoId: "ethereum", decimals: 18 }, '0xff0000000000000000000000000000000000000f': { coingeckoId: "decentralized-usd", decimals: 18 }, + '0x66F3Cf265D2D146A0348F6fC67E3Da0835e0968E': { coingeckoId: "javsphere", decimals: 18 }, }, ace: { [nullAddress]: { coingeckoId: "endurance", decimals: 18 }, From 4ae39c68c84e994397af6f3a59537f91a31c7da7 Mon Sep 17 00:00:00 2001 From: Javokhir Artykov <55207018+cxxnm@users.noreply.github.com> Date: Thu, 23 May 2024 14:07:11 +0500 Subject: [PATCH 049/855] chore: new pool added (#10344) Co-authored-by: Javokhir Artykov --- projects/azuro/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/azuro/index.js b/projects/azuro/index.js index 300286103d58..606edfa18a78 100644 --- a/projects/azuro/index.js +++ b/projects/azuro/index.js @@ -8,6 +8,7 @@ const config = { xdai: { factory: '0x8ea1a7241537f10fa73363fdc6380f3fc8619c03', fromBlock: 26026402, tokensAndOwners: [[ADDRESSES.xdai.WXDAI, '0xac004b512c33D029cf23ABf04513f1f380B3FD0a']], // v1 }, + chz: { factory: '0xC57DC3acf7834D0dc4B2F73a5fb81dD9609D347A', fromBlock: 12285532 } } async function tvl(api) { @@ -17,7 +18,8 @@ async function tvl(api) { module.exports = { xdai: { tvl }, polygon: { tvl }, - methodology: `TVL is the total amount of WXDAI and USDC held on Liquidity pools’ smart-contracts.` + chz: { tvl }, + methodology: `TVL is the total amount of WXDAI, USDC, USDT and CHZ held on Liquidity pools’ smart-contracts.` } Object.keys(config).forEach(chain => { From 92e4fe62ad450e628c89cc47bbaf46e13cc2cc33 Mon Sep 17 00:00:00 2001 From: silvercondor <32993765+silvercondor@users.noreply.github.com> Date: Thu, 23 May 2024 17:43:42 +0800 Subject: [PATCH 050/855] fix: split dex & lend tvl (#10346) --- projects/native-lend/index.js | 25 +++++++++++++++++++++++++ projects/native/index.js | 25 ------------------------- 2 files changed, 25 insertions(+), 25 deletions(-) create mode 100644 projects/native-lend/index.js diff --git a/projects/native-lend/index.js b/projects/native-lend/index.js new file mode 100644 index 000000000000..f333843a7735 --- /dev/null +++ b/projects/native-lend/index.js @@ -0,0 +1,25 @@ + +const { getCompoundV2Tvl } = require("../helper/compound") + +module.exports = { + methodology: + "includes the liquidity provided to the infrasturcture and ecosystem of Native", +}; + +const config = { + arbitrum: { + vault: "0x795E5cCdd008637EB98c64958d3b8Ba3e6DE2d2B", + fromBlock: 211430925, + }, + zklink: { + vault: "0x4AC97E2727B0e92AE32F5796b97b7f98dc47F059", + vaultFromBlock: 452, + }, +}; + +Object.keys(config).forEach((chain) => { + const { vault, vaultFromBlock } = config[chain]; + module.exports[chain] = { + tvl: getCompoundV2Tvl(vault, chain) + }; +}); diff --git a/projects/native/index.js b/projects/native/index.js index 7ce6e10ca042..f4a16b19152b 100644 --- a/projects/native/index.js +++ b/projects/native/index.js @@ -26,8 +26,6 @@ const config = { avax: { factory: "0x85b0F66E83515ff4e825DfCAa58E040E08278EF9", fromBlock: 34309521, - vault: "0xbe5D56B08055d7b6e9f780DfeA262512a2D2d950", - vaultFromBlock: 42536874, }, mantle: { factory: "0x4c34BA0103b8417e1Fc4D0F6645828B2d6d207F9", @@ -44,8 +42,6 @@ const config = { zklink: { factory: "0x335c04321E88631A99F78fD7D7C4f49A921ed924", fromBlock: 443, - vault: "0x4AC97E2727B0e92AE32F5796b97b7f98dc47F059", - vaultFromBlock: 452, }, }; @@ -53,27 +49,6 @@ Object.keys(config).forEach((chain) => { const { factory, fromBlock, vault, vaultFromBlock } = config[chain]; module.exports[chain] = { tvl: async (api) => { - // tvl from aqua - // read from AquaVault to get allMarkets and the token list - // sum the balance of those tokens in the vault - if (vault) { - const lpTokenCreationLogs = await getLogs({ - api, - target: vault, - topic: "MarketListed(address)", - eventAbi: "event MarketListed(address lpToken)", - onlyArgs: true, - fromBlock: vaultFromBlock, - }); - const lpTokens = lpTokenCreationLogs.map((i) => i.lpToken); - // get underlying of each ctoken - const underlyingTokens = await api.multiCall({ - abi: "address:underlying", - calls: lpTokens, - }); - // get balances in vault - await sumTokens2({ api, owner: vault, tokens: underlyingTokens }); - } // tvl from factory const poolCreationLogs = await getLogs({ api, From df236f23700f078481580d301a3104b8bea96bd6 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 23 May 2024 15:10:29 +0200 Subject: [PATCH 051/855] add tvl adapters --- projects/alien-finance/index.js | 15 +++++++++++---- projects/arcana/index.js | 11 +++++++++++ projects/gasturbo-io-dex/index.js | 3 +++ projects/helper/cache/uniswap.js | 3 +-- projects/helper/chains.json | 1 + projects/helper/env.js | 2 ++ projects/helper/tokenMapping.js | 6 ++++++ projects/macaron-xyz/index.js | 6 +++++- projects/manta-cedefi/index.js | 9 ++++----- projects/native-lend/index.js | 29 +++++++++++++---------------- projects/pearl-v2/index.js | 11 +++++++++++ 11 files changed, 68 insertions(+), 28 deletions(-) create mode 100644 projects/arcana/index.js create mode 100644 projects/gasturbo-io-dex/index.js create mode 100644 projects/pearl-v2/index.js diff --git a/projects/alien-finance/index.js b/projects/alien-finance/index.js index 2ccc980a9259..1b189a2e47bf 100644 --- a/projects/alien-finance/index.js +++ b/projects/alien-finance/index.js @@ -1,11 +1,18 @@ -const { sumTokensExport } = require("../helper/unwrapLPs") -const ADDRESSES = require('../helper/coreAssets.json') - const owner = "0x50454acC07bf8fC78100619a1b68e9E8d28cE022" module.exports = { blast: { - tvl: sumTokensExport({ owner, tokens: [ADDRESSES.blast.USDB, ADDRESSES.blast.WETH]}), + tvl, borrowed, }, start: 1709630412, }; + +async function tvl(api) { + const tokens = await api.call({ abi: 'address[]:getAllMarkets', target: owner}) + return api.sumTokens({ owner, tokens}) +} +async function borrowed(api) { + const tokens = await api.call({ abi: 'address[]:getAllMarkets', target: owner}) + const bals = await api.multiCall({ abi: 'function getTotalBorrow(address) view returns (uint256)', calls: tokens, target: owner}) + api.add(tokens, bals) +} \ No newline at end of file diff --git a/projects/arcana/index.js b/projects/arcana/index.js new file mode 100644 index 000000000000..cdcf40739fe8 --- /dev/null +++ b/projects/arcana/index.js @@ -0,0 +1,11 @@ + +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) + +} \ No newline at end of file diff --git a/projects/gasturbo-io-dex/index.js b/projects/gasturbo-io-dex/index.js new file mode 100644 index 000000000000..8181f05a1172 --- /dev/null +++ b/projects/gasturbo-io-dex/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('arbitrum', '0x7e299DdF7E12663570dBfA8F3F20CB54f8fD04fA') \ No newline at end of file diff --git a/projects/helper/cache/uniswap.js b/projects/helper/cache/uniswap.js index fb804fa65e7a..b2edf4eff7ac 100644 --- a/projects/helper/cache/uniswap.js +++ b/projects/helper/cache/uniswap.js @@ -29,8 +29,7 @@ function getUniTVL({ coreAssets, blacklist = [], factory, blacklistedTokens, let chain = api?.chain if (!chain) chain = _chain - // const supply = await api.call({ abi: 'erc20:totalSupply', target: ADDRESSES.area.WAREA }) - // console.log(await sdk.api.eth.getBalance({ target: ADDRESSES.area.WAREA, chain: api.chain }), supply) + // console.log(await api.call({ target: factory, abi: 'address:factory' })) factory = normalizeAddress(factory, chain) blacklist = (blacklistedTokens || blacklist).map(i => normalizeAddress(i, chain)) const key = `${factory}-${chain}` diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 0b3671661b52..dcd914774206 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -238,6 +238,7 @@ "quasar", "quicksilver", "radixdlt", + "real", "reef", "regen", "rei", diff --git a/projects/helper/env.js b/projects/helper/env.js index 58d3a3c34f98..80961520a73b 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -17,6 +17,8 @@ const DEFAULTS = { DEFICHAIN_EVM_RPC_MULTICALL: '0x7fEf77CDe3B41221Cff54B84Ea89D2EBc6b53352', BOUNCEBIT_RPC_MULTICALL: '0x493d616f5F9a64e5B3D527120E406439bdF29272', ZKLINK_RPC_MULTICALL: '0xa8738F57538E3Bb73872d1133F2358c7Fe56FD35', + REAL_RPC: 'https://real.drpc.org', + REAL_RPC_MULTICALL: '0xcA11bde05977b3631167028862bE2a173976CA11', } const ENV_KEYS = [ diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index cf7dd4bf6145..9066558f75a8 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -110,6 +110,12 @@ const fixBalancesTokens = { }, bevm: { '0x2967e7bb9daa5711ac332caf874bd47ef99b3820': { coingeckoId: 'wrapped-stbtc', decimals: 18 }, + }, + real: { + '0x0000000000000000000000000000000000000000': { coingeckoId: 'bitcoin', decimals: 18 }, + '0x90c6e93849e06ec7478ba24522329d14a5954df4': { coingeckoId: 'ethereum', decimals: 18 }, + '0x75d0cbf342060b14c2fc756fd6e717dfeb5b1b70': { coingeckoId: 'dai', decimals: 18 }, + '0x83fedbc0b85c6e29b589aa6bdefb1cc581935ecd': { coingeckoId: 'mountain-protocol-usdm', decimals: 18 }, } } diff --git a/projects/macaron-xyz/index.js b/projects/macaron-xyz/index.js index fa3a611c858f..7be61a438645 100644 --- a/projects/macaron-xyz/index.js +++ b/projects/macaron-xyz/index.js @@ -1,3 +1,7 @@ const { uniTvlExport } = require('../helper/unknownTokens') +const { mergeExports } = require('../helper/utils') -module.exports = uniTvlExport('btr', '0x05daB9D11A0e14E68862cd08A73A7362Bb93a331') \ No newline at end of file +module.exports = mergeExports([ + uniTvlExport('btr', '0x05daB9D11A0e14E68862cd08A73A7362Bb93a331'), + uniTvlExport('btr', '0x1037E9078df7ab09B9AF78B15D5E7aaD7C1AfDd0'), +]) \ No newline at end of file diff --git a/projects/manta-cedefi/index.js b/projects/manta-cedefi/index.js index 6900413f5889..ea9ca86f2b0c 100644 --- a/projects/manta-cedefi/index.js +++ b/projects/manta-cedefi/index.js @@ -24,14 +24,13 @@ async function tvl(api) { abi: "erc20:totalSupply", calls: tokens.map((item) => item.address), }); - return tokens.reduce((total, item, index) => { - total[item.coinGeckoId] = balances[index] / 10 ** tokens[index].decimals; - return total; - }, {}); + tokens.forEach((token, index) => { + api.addCGToken(token.coinGeckoId, balances[index] / 10 ** tokens[index].decimals); + }) } module.exports = { manta: { tvl, }, -}; +} \ No newline at end of file diff --git a/projects/native-lend/index.js b/projects/native-lend/index.js index f333843a7735..8a05ce289fd1 100644 --- a/projects/native-lend/index.js +++ b/projects/native-lend/index.js @@ -1,25 +1,22 @@ -const { getCompoundV2Tvl } = require("../helper/compound") +const { compoundExports2 } = require("../helper/compound"); +const { lendingMarket } = require("../helper/methodologies"); module.exports = { - methodology: - "includes the liquidity provided to the infrasturcture and ecosystem of Native", + methodology: lendingMarket }; const config = { - arbitrum: { - vault: "0x795E5cCdd008637EB98c64958d3b8Ba3e6DE2d2B", - fromBlock: 211430925, - }, - zklink: { - vault: "0x4AC97E2727B0e92AE32F5796b97b7f98dc47F059", - vaultFromBlock: 452, - }, + arbitrum: "0x795E5cCdd008637EB98c64958d3b8Ba3e6DE2d2B", + zklink: "0x4AC97E2727B0e92AE32F5796b97b7f98dc47F059", }; Object.keys(config).forEach((chain) => { - const { vault, vaultFromBlock } = config[chain]; - module.exports[chain] = { - tvl: getCompoundV2Tvl(vault, chain) - }; -}); + const comptroller = config[chain]; + module.exports[chain] = compoundExports2({ comptroller }) + module.exports[chain].tvl = async (api) => { + const markets = await api.call({ abi: 'address[]:getAllMarkets', target: comptroller }) + const tokens = await api.multiCall({ abi: 'address:underlying', calls: markets}) + return api.sumTokens({ owner: comptroller, tokens }) + } +}) \ No newline at end of file diff --git a/projects/pearl-v2/index.js b/projects/pearl-v2/index.js new file mode 100644 index 000000000000..cb27a24cc661 --- /dev/null +++ b/projects/pearl-v2/index.js @@ -0,0 +1,11 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +const ownTokens = [ + '0xaec9e50e3397f9ddc635c6c429c8c7eca418a143', + '0x4644066f535ead0cde82d209df78d94572fcbf14', + '0x25ea98ac87a38142561ea70143fd44c4772a16b6', +] + +module.exports = uniV3Export({ + 'real': { factory: '0xeF0b0a33815146b599A8D4d3215B18447F2A8101', fromBlock: 33062, blacklistedTokens: ownTokens,} +}) \ No newline at end of file From c987f263f5041c281f64b33c69f651c0b12f2ccb Mon Sep 17 00:00:00 2001 From: NikolasHai <113891786+NikolasHai@users.noreply.github.com> Date: Thu, 23 May 2024 16:02:45 +0200 Subject: [PATCH 052/855] add adapter for ckUSDC (#10348) * add adapter for ckUSDC * rename * rename * merge ckETH & ckUSDC --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/cketh/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/cketh/index.js b/projects/cketh/index.js index d9e7d0c8baa7..c524a6a1afee 100644 --- a/projects/cketh/index.js +++ b/projects/cketh/index.js @@ -1,8 +1,15 @@ const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); +const { get } = require('../helper/http') +const ADDRESSES = require('../helper/coreAssets.json') const contract = "0xb25eA1D493B49a1DeD42aC5B1208cC618f9A9B80"; async function tvl(api) { + var end = api.timestamp + let start = end - 24 * 60 * 60; + const { data } = await get(`https://icrc-api.internetcomputer.org/api/v1/ledgers/xevnm-gaaaa-aaaar-qafnq-cai/total-supply?start=${start}&end=${end}&step=1`); + let [_, bal] = data.pop() + api.add(ADDRESSES.ethereum.USDC, bal/1e2) return sumTokens2({ tokens: [nullAddress], owner: contract, api }); } From 8ceeab53565d3e7028f110b42fc497d32ebafc69 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 23 May 2024 15:57:44 +0100 Subject: [PATCH 053/855] add polygon psm --- projects/qidao/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/qidao/index.js b/projects/qidao/index.js index 3c9e276e1f3e..54fb14c59e42 100644 --- a/projects/qidao/index.js +++ b/projects/qidao/index.js @@ -174,6 +174,7 @@ const config = { "0x169d47043cc0c94c39fa327941c56cb0344dc508", "0xb5b31e6a13ae856bc30b3c76b16edad9f432b54f" ], + psm: ["0xdEffF862C76C6f9c7164B44f860fAe64C2A92aF5"], toa: [ [nullAddress, '0xa3fa99a148fa48d14ed51d610c367c61876997f1'], // vaults From 399a3cf318e3a188b3d3232dd85b1242b0a2be8c Mon Sep 17 00:00:00 2001 From: Michalis Kargakis Date: Thu, 23 May 2024 17:58:29 -0400 Subject: [PATCH 054/855] Track CHAR for Toucan Protocol (#10351) CHAR is newly listed on Coingecko at https://www.coingecko.com/en/coins/biochar --- projects/toucan-protocol/config.js | 4 ++++ projects/toucan-protocol/index.js | 15 +++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/projects/toucan-protocol/config.js b/projects/toucan-protocol/config.js index 21fe7468ca14..4afefe84d10b 100644 --- a/projects/toucan-protocol/config.js +++ b/projects/toucan-protocol/config.js @@ -1,8 +1,12 @@ const ADDRESSES = require('../helper/coreAssets.json') const CONFIG_DATA = { + base: { + char: "0x20b048fA035D5763685D695e66aDF62c5D9F5055", + }, celo: { bct: "0x0CcB0071e8B8B716A2a5998aB4d97b83790873Fe", nct: ADDRESSES.celo.NCT, + char: "0x50E85c754929840B58614F48e29C64BC78C58345", }, polygon: { bct: "0x2F800Db0fdb5223b3C3f354886d907A671414A7F", diff --git a/projects/toucan-protocol/index.js b/projects/toucan-protocol/index.js index 4f14b10255ba..97a3add6ab6d 100644 --- a/projects/toucan-protocol/index.js +++ b/projects/toucan-protocol/index.js @@ -3,17 +3,21 @@ const { CONFIG_DATA } = require("./config"); const getCalculationMethod = (chain) => { return async (api,) => { - const supplyCalls = [CONFIG_DATA[chain].bct, CONFIG_DATA[chain].nct]; + const supplyCalls = [] + Object.keys(CONFIG_DATA[chain]).map((key) => { + supplyCalls.push(CONFIG_DATA[chain][key]); + }) - let [bct, nct] = await api.multiCall({ abi: 'erc20:totalSupply', calls: supplyCalls, }) + let [bct, nct, char] = await api.multiCall({ abi: 'erc20:totalSupply', calls: supplyCalls, }) // If the current block is later than the date BCT was transferred to KlimaDAO, return 0 if (api.timestamp > 1709828986) bct = 0 return { - 'toucan-protocol-base-carbon-tonne': bct / 1e18, - 'toucan-protocol-nature-carbon-tonne': nct / 1e18, + 'toucan-protocol-base-carbon-tonne': (bct ?? 0) / 1e18, + 'toucan-protocol-nature-carbon-tonne': (nct ?? 0) / 1e18, + 'biochar': (char ?? 0) / 1e18, }; }; }; @@ -34,6 +38,9 @@ const getRegenCredits = () => { module.exports = { start: 1634842800, + base: { + tvl: getCalculationMethod("base") + }, celo: { tvl: getCalculationMethod("celo") }, From 580c1b20d72cf2a6bb09feb6201b0fc72dbf813a Mon Sep 17 00:00:00 2001 From: Michalis Kargakis Date: Fri, 24 May 2024 01:14:35 -0400 Subject: [PATCH 055/855] Fix processing CHAR and other Toucan tokens (#10353) 399a3cf was incorrectly setting supplies in the destructured variables (bct, nct, char) as for some networks (eg., base) not all three tokens are found. Here I am fixing this issue so now the final struct returned by getCalculationMethod is created dynamically and always contains the exact tokens with the correct info. --- projects/toucan-protocol/config.js | 13 +++++++++++ projects/toucan-protocol/index.js | 37 ++++++++++++++++++++++-------- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/projects/toucan-protocol/config.js b/projects/toucan-protocol/config.js index 4afefe84d10b..670406ffa6b1 100644 --- a/projects/toucan-protocol/config.js +++ b/projects/toucan-protocol/config.js @@ -16,7 +16,20 @@ const CONFIG_DATA = { nct_bridge: "0xdC1Dfa22824Af4e423a558bbb6C53a31c3c11DCC" }, }; +const TOKEN_DATA = { + bct: { + coingecko: "toucan-protocol-base-carbon-tonne", + validUntil: 1709828986, + }, + nct: { + coingecko: "toucan-protocol-nature-carbon-tonne", + }, + char: { + coingecko: "biochar", + }, +}; module.exports = { CONFIG_DATA, + TOKEN_DATA, }; diff --git a/projects/toucan-protocol/index.js b/projects/toucan-protocol/index.js index 97a3add6ab6d..441843bc51d2 100644 --- a/projects/toucan-protocol/index.js +++ b/projects/toucan-protocol/index.js @@ -1,27 +1,44 @@ const sdk = require('@defillama/sdk') -const { CONFIG_DATA } = require("./config"); +const { CONFIG_DATA, TOKEN_DATA } = require("./config"); const getCalculationMethod = (chain) => { return async (api,) => { const supplyCalls = [] + const tokenInfo = [] Object.keys(CONFIG_DATA[chain]).map((key) => { supplyCalls.push(CONFIG_DATA[chain][key]); + tokenInfo.push(TOKEN_DATA[key]); }) - let [bct, nct, char] = await api.multiCall({ abi: 'erc20:totalSupply', calls: supplyCalls, }) + const resp = await api.multiCall({ abi: 'erc20:totalSupply', calls: supplyCalls, }) + const tokensArray = resp.map((obj, i) => { + const validUntil = tokenInfo[i].validUntil + if (validUntil && api.timestamp > validUntil) + tokenInfo[i].totalSupply = 0 + else + tokenInfo[i].totalSupply = obj + + return { + [tokenInfo[i].coingecko]: dropDecimals(tokenInfo[i].totalSupply), + }; + }); - // If the current block is later than the date BCT was transferred to KlimaDAO, return 0 - if (api.timestamp > 1709828986) - bct = 0 + const tokens = tokensArray.reduce((acc, cur) => { + for (const entry of Object.entries(cur)) { + const [key, value] = entry; + acc[key] = value; + } + return acc; + } , {}); - return { - 'toucan-protocol-base-carbon-tonne': (bct ?? 0) / 1e18, - 'toucan-protocol-nature-carbon-tonne': (nct ?? 0) / 1e18, - 'biochar': (char ?? 0) / 1e18, - }; + return tokens; }; }; +const dropDecimals = (num) => { + return (num ?? 0) / 1e18; +} + const getRegenCredits = () => { return async () => { const transferred = (await sdk.api.abi.call({ From 5ed24cd5ba7250accb727d532d5f33d6c7057709 Mon Sep 17 00:00:00 2001 From: tony Date: Fri, 24 May 2024 14:37:38 +0800 Subject: [PATCH 056/855] add openocean on rootstock chain (#10357) --- projects/openocean.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/openocean.js b/projects/openocean.js index 7232c7407446..16e2e255f88e 100644 --- a/projects/openocean.js +++ b/projects/openocean.js @@ -9,6 +9,7 @@ const config = { manta: { factory: '0x8D2B7e5501Eb6D92F8e349f2FEbe785DD070bE74', }, avax: { factory: '0x042AF448582d0a3cE3CFa5b65c2675e88610B18d', s: ['0x4C431b568e8baAB20F004BB16E44570e8E0cD6D7', '0x0ebd9537a25f56713e34c45b38f421a1e7191469'], }, ethereum: { factory: '0x1f8c25f8da3990ecd3632ee4f02c2ea37755c3c6', s: ['0xb99d38eb69214e493b1183ffa3d561fc9f75d519', '0x7778360f035c589fce2f4ea5786cbd8b36e5396b'], }, + rsk: { factory: '0x6Dd434082EaB5cD134B33719ec1ff05fe985B97b', }, } module.exports = { misrepresentedTokens: true } From aa6980aa184c6184e3b68f4989f5934eaaf80515 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 24 May 2024 09:30:26 +0200 Subject: [PATCH 057/855] Add defusion feature and refactor code (#10360) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add defusion * code refactor --------- Co-authored-by: khiêm <87562184+khiemsoft@users.noreply.github.com> --- projects/defusion/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/defusion/index.js diff --git a/projects/defusion/index.js b/projects/defusion/index.js new file mode 100644 index 000000000000..90c12c6ed196 --- /dev/null +++ b/projects/defusion/index.js @@ -0,0 +1,8 @@ +async function tvl(api) { + const supply = await api.call({ abi: 'erc20:totalSupply', target: '0xCdde1f5D971A369eB952192F9a5C367f33a0A891'}) + api.add('0xC054751BdBD24Ae713BA3Dc9Bd9434aBe2abc1ce', supply) +} + +module.exports.tomochain = { + tvl +} From 8cd4ae02cc8c0f705d28e168bc860bca3dc1bb40 Mon Sep 17 00:00:00 2001 From: Sujith Somraaj <35634175+sujithsomraaj@users.noreply.github.com> Date: Fri, 24 May 2024 13:00:46 +0530 Subject: [PATCH 058/855] chore: add fantom for superform (#10358) --- projects/superform/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/projects/superform/index.js b/projects/superform/index.js index 3d9fd185f8c7..16122439a96f 100644 --- a/projects/superform/index.js +++ b/projects/superform/index.js @@ -1,9 +1,10 @@ -const superform_chains = ["ethereum", "polygon", "bsc", "avax", "arbitrum", "optimism", "base"]; +const superform_chains = ["ethereum", "polygon", "bsc", "avax", "arbitrum", "optimism", "base", "fantom"]; const factory_contract = "0xD85ec15A9F814D6173bF1a89273bFB3964aAdaEC"; +const fantom_factory_contract = "0xbc85043544CC2b3Fd095d54b6431822979BBB62A"; async function tvl(api) { - const forms = await api.fetchList({ lengthAbi: 'getSuperformCount', itemAbi: "function superforms(uint256) external view returns(uint256)", target: factory_contract }) - const getSuperformRes = await api.multiCall({ abi: "function getSuperform(uint256) external view returns(address, uint32, uint64)", calls: forms, target: factory_contract }) + 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 }) From db16487b55642fe8d57d4a829b3b0545c4420ac2 Mon Sep 17 00:00:00 2001 From: silvercondor <32993765+silvercondor@users.noreply.github.com> Date: Fri, 24 May 2024 15:40:22 +0800 Subject: [PATCH 059/855] chore: update new deployments (#10361) --- projects/native-lend/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/native-lend/index.js b/projects/native-lend/index.js index 8a05ce289fd1..bc24c5182be8 100644 --- a/projects/native-lend/index.js +++ b/projects/native-lend/index.js @@ -9,6 +9,10 @@ module.exports = { const config = { arbitrum: "0x795E5cCdd008637EB98c64958d3b8Ba3e6DE2d2B", zklink: "0x4AC97E2727B0e92AE32F5796b97b7f98dc47F059", + bsc: "0x3ba16AC2A67D126BF1DBa0a81E6C75073EFd95d9", + mantle:"0x48A6FE0Fa8DfF6D290Bd21aB6BCC1DDAeb9f2D0e", + ethereum:"0x3ba16AC2A67D126BF1DBa0a81E6C75073EFd95d9" + }; Object.keys(config).forEach((chain) => { From 3628c6c895dbf30a6b981207be068743550a88a3 Mon Sep 17 00:00:00 2001 From: javerett <90236351+javerett@users.noreply.github.com> Date: Fri, 24 May 2024 01:34:22 -0700 Subject: [PATCH 060/855] Add C3 Exchange (#10355) * Add C3 Exchange * Correct mapping for USDC to Avalanche * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/c3/index.js | 55 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 projects/c3/index.js diff --git a/projects/c3/index.js b/projects/c3/index.js new file mode 100644 index 000000000000..53e741f5980a --- /dev/null +++ b/projects/c3/index.js @@ -0,0 +1,55 @@ +const { sumTokens } = require("../helper/chain/algorand") +const { chainExports } = require("../helper/exports") + +const coreContractAddress = 'XGE65UPXAFATPMTKGPA2VNHLMDY2URHD7NNPI3XJ3ZOXEAU6E4ZGH7PWZY' + +const chainMap = { + 'algorand': { + 'algorand:1': { name: 'algorand', decimals: 6 }, + }, + 'avax': { + 'algorand:893309613': { name: 'avalanche-2', decimals: 8 }, + 'algorand:1007352535': { name: 'usd-coin', decimals: 6 }, + }, + 'bitcoin': { + 'algorand:1058926737': { name: 'bitcoin', decimals: 8 }, + }, + 'ethereum': { + 'algorand:887406851': { name: 'ethereum', decimals: 8 }, + }, + 'arbitrum': { + 'algorand:1221549217': { name: 'arbitrum', decimals: 8 }, + }, + 'bsc': { + 'algorand:891648844': { name: 'binancecoin', decimals: 8 }, + }, + 'solana': { + 'algorand:887648583': { name: 'solana', decimals: 8 }, + 'algorand:1684682524': { name: 'pyth-network', decimals: 6 }, + 'algorand:1703994770': { name: 'wormhole', decimals: 6 }, + }, +} + +function chainTvl(chain) { + return async () => { + // Read contract token balances + const contractData = await sumTokens({ owner: coreContractAddress }) + + // Remap assets to their common names and normalize values + const result = {} + for (const asset in contractData) { + // Skip if asset is not mapped + const assetData = chainMap[chain]?.[asset] + if (assetData !== undefined) { + // Normalize value to the correct number of decimals for the asset + const normalized = contractData[asset] / (10 ** assetData.decimals) + result[assetData.name] = normalized.toString() + } + } + + return result + } +} + +module.exports = chainExports(chainTvl, Object.keys(chainMap)) +module.exports.methodology = 'Calculates the TVL from the contract, then remaps assets for accurate value source' From 4fe386b93b3e8e800c32cc73161ac83c534164d0 Mon Sep 17 00:00:00 2001 From: Nico Szerman Date: Fri, 24 May 2024 05:42:59 -0300 Subject: [PATCH 061/855] Add Sailing's new trading bots portfolios Adapter (#10352) * added new tickers * parallelized execution * fixed adapter * changes * wip sailingprotocol-portfolios * wip sailing portfolios * wip * wip adapter * sailing-portfolios gg * removed unnecessary * polish * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/sailing-portfolios/index.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 projects/sailing-portfolios/index.js diff --git a/projects/sailing-portfolios/index.js b/projects/sailing-portfolios/index.js new file mode 100644 index 000000000000..4eefd2366bd4 --- /dev/null +++ b/projects/sailing-portfolios/index.js @@ -0,0 +1,19 @@ +const portfoliosTrackers = { + 'kava': '0x12c90425dD549DEdD455E223a897E438E2Dc0bbc', +}; + +async function tvl(api) { + const portfoliosTracker = portfoliosTrackers[api.chain] + const portfolios = await api.call({ + target: portfoliosTracker, + abi: 'function getTrackedPortfolios() external view returns (address[] memory)', + }) + const tokens = await api.multiCall({ abi: 'address[]:getPortfolioAssets', calls: portfolios}) + const ownerTokens = portfolios.map((portfolio, i) => [tokens[i], portfolio]) + return api.sumTokens({ ownerTokens }) +} + +module.exports = { + kava: { tvl, }, + methodology: 'The assets in the balancer are detected and counted.' +} From 3cc80492a31f83d3031225103393bf480aa942c9 Mon Sep 17 00:00:00 2001 From: 0xIldefonso <102725012+0xildefonso@users.noreply.github.com> Date: Fri, 24 May 2024 17:00:33 +0800 Subject: [PATCH 062/855] add unirouter tvl on b2 (#10362) --- projects/unirouter/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 projects/unirouter/index.js diff --git a/projects/unirouter/index.js b/projects/unirouter/index.js new file mode 100644 index 000000000000..dafc73bc3961 --- /dev/null +++ b/projects/unirouter/index.js @@ -0,0 +1,15 @@ +const ADDRESSES = require("../helper/coreAssets.json"); + +async function unirouterLSDTvl(api) { + const uBTCBalance = await api.call({ + abi: "erc20:totalSupply", + target: "0x796e4D53067FF374B89b2Ac101ce0c1f72ccaAc2", + }); + return await api.add(ADDRESSES.null, uBTCBalance); +} + +module.exports = { + bsquared: { + tvl: unirouterLSDTvl, + }, +}; From 5f71fb591b34c5c72cf3e4fe24ae9bccac332c94 Mon Sep 17 00:00:00 2001 From: ST3V3 Date: Fri, 24 May 2024 18:01:58 +0900 Subject: [PATCH 063/855] add linea, blast chains to mitosis tvl (#10363) --- projects/mitosis/index.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/projects/mitosis/index.js b/projects/mitosis/index.js index 07f53e976767..5da1d01b9dce 100644 --- a/projects/mitosis/index.js +++ b/projects/mitosis/index.js @@ -1,4 +1,12 @@ -const chains = ["ethereum", "arbitrum", "optimism", "mode", "manta"]; +const chains = [ + "ethereum", + "arbitrum", + "optimism", + "mode", + "manta", + "blast", + "linea", +]; const WEETH_ADDRESS = { ethereum: "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee", @@ -6,18 +14,23 @@ const WEETH_ADDRESS = { optimism: "0x346e03f8cce9fe01dcb3d0da3e9d00dc2c0e08f0", mode: "0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A", manta: "0x77b6F99970f488cFA8bd41892900b6Ce881C2300", + blast: "0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A", + linea: "0x1bf74c010e6320bab11e2e5a532b5ac15e0b8aa6", }; const CAP_ADDRESS = { ethereum: "0x451d791b6e9a9b8c9237bb55e58a7757342b16f9", + blast: "0x096430ef0a653c067df32e93ff77090e084169de", + linea: "0xcd32876b9b483eb75e8ca74935e4b51725f33a91", }; chains.forEach((chain) => { module.exports[chain] = { tvl: async (api) => { - const cap = CAP_ADDRESS[chain] ?? '0xb883ee478d3b7fea8a5357a3c3e27e2d2292b1d2' - const tvl = await api.call({ abi: 'uint256:load', target: cap, }) - api.add(WEETH_ADDRESS[chain], tvl) + const cap = + CAP_ADDRESS[chain] ?? "0xb883ee478d3b7fea8a5357a3c3e27e2d2292b1d2"; + const tvl = await api.call({ abi: "uint256:load", target: cap }); + api.add(WEETH_ADDRESS[chain], tvl); }, }; }); From 5bcabdb25e8a15c6daa0a4b5f37a8ae308c2049e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 24 May 2024 11:51:06 +0200 Subject: [PATCH 064/855] track splice-fi --- projects/splice-fi/index.js | 63 +++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 projects/splice-fi/index.js diff --git a/projects/splice-fi/index.js b/projects/splice-fi/index.js new file mode 100644 index 000000000000..19c5c84c352c --- /dev/null +++ b/projects/splice-fi/index.js @@ -0,0 +1,63 @@ +const { getLogs } = require("../helper/cache/getLogs"); + +const config = { + mode: { + factoryV3: "0x9e6d12097339ddd5402FDD39fc0Ef86Eec54AB39", + fromBlockV3: 7764229, + }, +} + +Object.keys(config).forEach((chain) => { + const { factoryV3, fromBlockV3 } = config[chain]; + module.exports[chain] = { + tvl: async (api) => { + const logsV3 = await getLogs({ + api, + target: factoryV3, + topic: [ + "0xae811fae25e2770b6bd1dcb1475657e8c3a976f91d1ebf081271db08eef920af", + ], + eventAbi: + "event CreateNewMarket (address indexed market, address indexed PT, int256 scalarRoot, int256 initialAnchor, uint256 lnFeeRateRoot)", + onlyArgs: true, + fromBlock: fromBlockV3, + }) + + const pt = logsV3.map((i) => i.PT) + let sy = [ + ...new Set( + ( + await api.multiCall({ + abi: "address:SY", + calls: pt, + }) + ).map((s) => s.toLowerCase()) + ), + ]; + + const [data, supply, decimals] = await Promise.all([ + api.multiCall({ + abi: "function assetInfo() view returns (uint8 assetType , address uAsset , uint8 decimals )", + calls: sy, + }), + api.multiCall({ abi: "erc20:totalSupply", calls: sy }), + api.multiCall({ abi: "erc20:decimals", calls: sy }), + ]); + + const tokenAssetTypeSy = sy.filter((_, i) => data[i].assetType === "0"); + const exchangeRates = await api.multiCall({ + abi: "function exchangeRate() view returns (uint256 res)", + calls: tokenAssetTypeSy, + }); + + data.forEach((v, i) => { + let value = supply[i] * 10 ** (v.decimals - decimals[i]); + let index = tokenAssetTypeSy.indexOf(sy[i]); + if (index !== -1) { + value = (value * exchangeRates[index]) / 10 ** 18; + } + api.add(v.uAsset.toLowerCase(), value); + }); + }, + }; +}); From b322192cdbba2d0288e5daea213c636373ce0550 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 24 May 2024 12:33:39 +0200 Subject: [PATCH 065/855] trax yfx v4 --- projects/yfx-v4/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 projects/yfx-v4/index.js diff --git a/projects/yfx-v4/index.js b/projects/yfx-v4/index.js new file mode 100644 index 000000000000..fb9094f965f1 --- /dev/null +++ b/projects/yfx-v4/index.js @@ -0,0 +1,15 @@ +const manager = '0x29bd0372A8A087e4d34d4098259Cd298d554BAc4'; +const vault = '0x50b516a9DB620aB67A33d895DAF4Bd1c294b9517'; + +async function tvl(api) { + let pools = await api.call({ target: manager, abi: "address[]:getAllPools", }); + const tokens = await api.multiCall({ abi: 'address:getBaseAsset', calls: pools }) + return api.sumTokens({ owner: vault, tokens }) +} + +module.exports = { + methodology: 'Count balance of each pool from the Vault', + arbitrum: { + tvl, + }, +} \ No newline at end of file From fd027d3d68c0d70084ea88e184cc6866f774708b Mon Sep 17 00:00:00 2001 From: Barak Uri <140400738+dev-uri@users.noreply.github.com> Date: Fri, 24 May 2024 16:06:49 +0300 Subject: [PATCH 066/855] feat: add Rollspace (#10368) * feat: add Rollspace * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/rollspace/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/rollspace/index.js diff --git a/projects/rollspace/index.js b/projects/rollspace/index.js new file mode 100644 index 000000000000..b6e50ba27a0b --- /dev/null +++ b/projects/rollspace/index.js @@ -0,0 +1,11 @@ +const { nullAddress } = require("../helper/tokenMapping"); +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const BSC_POOL_CONTRACT = '0xB1FcDb8Ed3c2Bc572440b08a5A93984f366BBf3C'; + +module.exports = { + methodology: 'counts the number of BNB tokens in the bsc pool contract.', + bsc: { + tvl: sumTokensExport({ owner: BSC_POOL_CONTRACT, tokens: [nullAddress], }) + } +} \ No newline at end of file From 8aeef9328186d5664ab78c8baa35d08e01b7981b Mon Sep 17 00:00:00 2001 From: Anas Bin Sohail <50760655+anassohail99@users.noreply.github.com> Date: Fri, 24 May 2024 18:07:34 +0500 Subject: [PATCH 067/855] Fixed formatting (#10367) * fix config function * add support for linea, polygon and polygon zkevm * fixed formatting --- projects/a51-finance-v3/index.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/projects/a51-finance-v3/index.js b/projects/a51-finance-v3/index.js index 6d2cfa563375..7d3e171b294d 100644 --- a/projects/a51-finance-v3/index.js +++ b/projects/a51-finance-v3/index.js @@ -12,17 +12,34 @@ const getStrategyReserves = "function getStrategyReserves(address, int24, int24, const DEFAULT_STRATEGY_CREATION_TOPIC = "StrategyCreated(bytes32)" const config = { + // uniswap arbitrum: [{ target: "0x3e0aa2e17fe3e5e319f388c794fdbc3c64ef9da6", helper: "0x9d80597d9403bdb35b3d7d9f400377e790b01053", startBlock: 190945156 },], + // uniswap blast: [{ target: "0x5a8e82c4b3Dbd7579fD198A3276cF75CEA2Df63D", helper: "0xbA13be69628d12963b28de8E7Ba04C3C4c1eaceA", startBlock: 1709947 },], base: [ + // uniswap { target: "0x3e0AA2e17FE3E5e319f388C794FdBC3c64Ef9da6", helper: "0xA1d8180F4482359CEb7Eb7437FCf4a2616830F81", startBlock: 12765695 }, + // BaseSwap { target: "0xDFb179526ae303Eea49AC99DD360159C39105828", helper: "0x6e7e838E20ED6657Aaf1166f9B7a845565956F51", startBlock: 13890566 }, ], + // uniswap optimism: [{ target: "0x525c80e91efe9222de3eae86af69a480fbced416", helper: "0x965356eb2c208ce4130e267342ca720042cce7b2", startBlock: 118360616 },], - polygon: [{ target: "0xD4798F142FDb87738eF4eBE82Bd56Eccde19A88C", helper: "0x9c225a02426e3229C073A6132E083561e95000b5", startBlock: 55506149 },], + polygon: [ + // uniswap + { target: "0xD4798F142FDb87738eF4eBE82Bd56Eccde19A88C", helper: "0x9c225a02426e3229C073A6132E083561e95000b5", startBlock: 55506149 }, + // quickswap + { target: "0xED19D4A923930F6B0348fE06be694FeC56a70b86", helper: "0x6c8b11476475FA487e2bfa6fE00244160F80213e", startBlock: 56237007, }, + ], + // quickswap + polygon_zkevm: [{target: "0xBd7887e11A9356957680A34955a135cf465e7052",helper: "0x965356eb2C208Ce4130E267342cA720042Cce7b2",startBlock: 11928029,},], + // uniswap bsc: [{ target: "0x6F2b186e9392042B1edE2D1D1706a3DC4a4725d8", helper: "0x9c225a02426e3229C073A6132E083561e95000b5", startBlock: 37623104 },], + // uniswap scroll: [{ target: "0xA8Dc31c8C9F93dB2e42A5472F580689794639576", helper: "0x965356eb2C208Ce4130E267342cA720042Cce7b2", startBlock: 4846051 },], + // quickswap manta: [{ target: "0x69317029384c3305fC04670c68a2b434e2D8C44C", helper: "0xa1d8180f4482359ceb7eb7437fcf4a2616830f81", startBlock: 1834975 },], + // lynex + linea: [{target: "0xA8Dc31c8C9F93dB2e42A5472F580689794639576",helper: "0x965356eb2C208Ce4130E267342cA720042Cce7b2",startBlock: 4518443,},], } module.exports = { From 8392b61d1330ab57d6fbe6d12227e310ee38744e Mon Sep 17 00:00:00 2001 From: Eidolon <92181746+imrtlfarm@users.noreply.github.com> Date: Sat, 25 May 2024 01:12:24 -0700 Subject: [PATCH 068/855] add glyph-fi (#10370) --- projects/glyph-fi/index.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 projects/glyph-fi/index.js diff --git a/projects/glyph-fi/index.js b/projects/glyph-fi/index.js new file mode 100644 index 000000000000..8f2617e94ee1 --- /dev/null +++ b/projects/glyph-fi/index.js @@ -0,0 +1,5 @@ +const { aaveExports } = require('../helper/aave') + +module.exports = { + fraxtal: aaveExports("fraxtal", "0xcD0c5BA79018F37898A58eF56d197828d84f36Ad"), +} \ No newline at end of file From fb00fc4ffb2a5d65c235cf07ca445328f0ab033e Mon Sep 17 00:00:00 2001 From: "Kalax.io" <163113001+Kalaxio@users.noreply.github.com> Date: Sat, 25 May 2024 16:13:51 +0800 Subject: [PATCH 069/855] add kalax (#10371) --- projects/kalax/index.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 projects/kalax/index.js diff --git a/projects/kalax/index.js b/projects/kalax/index.js new file mode 100644 index 000000000000..a9a8710ceb7c --- /dev/null +++ b/projects/kalax/index.js @@ -0,0 +1,40 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +const KALAX = "0x2F67F59b3629Bf24962290DB9edE0CD4127e606D"; + +async function tvl(api) { + const FARM = "0xE63153C3360aCa0F4e7Ca7A1FC61c2215FAEF5A1"; + + let pools = await api.call({ abi: abiInfo.poolInfos, target: FARM }); + pools + .filter((i) => i.assets !== KALAX) + .forEach((i) => { + if (i.assets === "0x0000000000000000000000000000000000000001") { + i.assets = "0x0000000000000000000000000000000000000000"; + } + api.add(i.assets, i.tvl); + }); + return await 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(); +} + +module.exports = { + blast: { + tvl, + staking, + }, +}; + +const abiInfo = { + poolInfos: + "function getPoolTotalTvl() view returns (tuple(uint256 pid, address assets, uint256 tvl)[])", +}; From b5ec379b46a03b9256d57ad66a4113cfbe62e6b5 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sun, 26 May 2024 08:43:50 +0100 Subject: [PATCH 070/855] add more comptrollers --- projects/orbitlending-io/index.js | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/projects/orbitlending-io/index.js b/projects/orbitlending-io/index.js index e5c480b9ed44..a4d550c3cc77 100644 --- a/projects/orbitlending-io/index.js +++ b/projects/orbitlending-io/index.js @@ -1,9 +1,22 @@ const { compoundExports2 } = require('../helper/compound'); +const { mergeExports } = require('../helper/utils'); -module.exports = { - blast: compoundExports2({ - comptroller: '0x1E18C3cb491D908241D0db14b081B51be7B6e652', - cether: ['0xf9b3b455f5d900f62bc1792a6ca6e1d47b989389', '0x0872b71efc37cb8dde22b2118de3d800427fdba0'], - blacklistedTokens: ['0xf92996ddc677a8dcb032ac5fe62bbf00f92ae2ec'] - }), -}; +module.exports = mergeExports([ + compoundExports2({ + comptroller: '0x1E18C3cb491D908241D0db14b081B51be7B6e652', + cether: ['0xf9b3b455f5d900f62bc1792a6ca6e1d47b989389', '0x0872b71efc37cb8dde22b2118de3d800427fdba0'], + blacklistedTokens: ['0xf92996ddc677a8dcb032ac5fe62bbf00f92ae2ec'] + }), + compoundExports2({ + comptroller: '0x273683CA19D9CF827628EE216E4a9604EfB077A3', + cether: ['0x795dcd51eac6eb3123b7a4a1f906992eaa54cb0e'] + }), + compoundExports2({ + comptroller: '0xe9266ae95bB637A7Ad598CB0390d44262130F433', + cether: ['0xafabd582e82042f4a8574f75c36409abea916ac5'] + }), + compoundExports2({ + comptroller: '0xfFF8Fc176697D04607cF4e23E91c65aeD1c3d3F5', + cether: ['0x530a8d3fdf61112f8a879d753fe02e9e37ec36aa'] + }), + ].map(t=>({blast:t}))) From 6dcaca7784ed37aac3451dff0d066a42796756e3 Mon Sep 17 00:00:00 2001 From: mattt21 Date: Sun, 26 May 2024 11:48:35 -0500 Subject: [PATCH 071/855] Add Koi Finance v3 pools (#10376) * dep dmute/mute * add koi v3 pools --- projects/mute-cl/index.js | 10 ++++++++++ projects/mute/index.js | 2 ++ 2 files changed, 12 insertions(+) create mode 100644 projects/mute-cl/index.js diff --git a/projects/mute-cl/index.js b/projects/mute-cl/index.js new file mode 100644 index 000000000000..95093aa3e07b --- /dev/null +++ b/projects/mute-cl/index.js @@ -0,0 +1,10 @@ + +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = { + misrepresentedTokens: true, + ...uniV3Export({ + era: { factory: '0x488A92576DA475f7429BC9dec9247045156144D3', fromBlock: 32830523}, + }) +}; + \ No newline at end of file diff --git a/projects/mute/index.js b/projects/mute/index.js index 110a1a2b27d4..831e482adb22 100644 --- a/projects/mute/index.js +++ b/projects/mute/index.js @@ -4,6 +4,7 @@ const { getUniTVL } = require('../helper/unknownTokens'); const KOI = "0xa995ad25ce5eb76972ab356168f5e1d9257e4d05" const veKOI = "0x98dB4e3Df6502369dAD7AC99f3aEE5D064721C4C" + module.exports = { misrepresentedTokens: true, era: { @@ -12,3 +13,4 @@ module.exports = { }, methodology: "Counts liquidity in pools and KOI token in the veKOI contract", }; + \ No newline at end of file From 80b7fd26336920cfac97dbc78e3ddaf80601eeed Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Mon, 27 May 2024 05:25:21 +0100 Subject: [PATCH 072/855] add bsc tokens --- projects/rehold-v2/index.js | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/projects/rehold-v2/index.js b/projects/rehold-v2/index.js index 6554925930a9..48221eac907d 100644 --- a/projects/rehold-v2/index.js +++ b/projects/rehold-v2/index.js @@ -7,7 +7,40 @@ const tvl = sumTokensExport(config) module.exports = { ethereum: { tvl }, - bsc: { tvl }, + bsc: { tvl: sumTokensExport({ + owner: VAULT_V2, fetchCoValentTokens: true, + tokens: [ + "0x55d398326f99059fF775485246999027B3197955", // BSC-USD + "0x2170Ed0880ac9A755fd29B2688956BD959F933F8", //Bpeg ETH + "0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c", // btcb + "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", // usdc + "0x570A5D26f7765Ecb712C0924E4De545B89fD43dF", // sol + "0x1Fa4a73a3F0133f0025378af00236f3aBDEE5D63", // near + "0x1D2F0da169ceB9fC7B3144628dB156f3F6c60dBE", // xrp + "0x1CE0c2827e2eF14D5C4f29a091d735A204794041", // shib + "0x111111111117dC0aa78b770fA6A738034120C302", // 1inch + "0x045c4324039dA91c52C55DF5D785385Aab073DcF", // bCFX + "0xbA2aE424d960c26247Dd6c32edC70B295c744C43", // doge + "0x4B0F1812e5Df2A09796481Ff14017e6005508003", // twt + "0xfb5B838b6cfEEdC2873aB27866079AC55363D37E", // floki + "0x0Eb3a705fc54725037CC9e008bDede697f62F335", // atom + "0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD", // link + "0xCC42724C6683B7E57334c4E856f4c9965ED682bD", // matic + "0x56b6fB708fC5732DEC1Afc8D8556423A2EDcCbD6", // eos + "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", // busd + "0xBf5140A22578168FD562DCcF235E5D43A02ce9B1", // uni + "0xD41FDb03Ba84762dD66a0af1a6C8540FF1ba5dfb", // sfp + "0xAD29AbB318791D579433D831ed122aFeAf29dcfe", // ftm + "0xB0D502E938ed5f4df2E681fE6E419ff29631d62b", // stg + "0x7083609fCE4d1d8Dc0C979AAb8c869Ea2C873402", // dot + "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", // wbnb + "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82", // cake + "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3", // dai + "0x715D400F88C167884bbCc41C5FeA407ed4D2f8A0", // axs + "0x031b41e504677879370e9DBcF937283A8691Fa7f", // fet + "0x3EE2200Efb3400fAbB9AacF31297cBdD1d435D47", // ada + "0x0D8Ce2A99Bb6e3B7Db580eD848240e4a0F9aE153", // fil + ]}) }, polygon: { tvl }, avax: { tvl }, arbitrum: { tvl }, From 21ef6352182e162617e9ef43237d69aa9c811df5 Mon Sep 17 00:00:00 2001 From: alex-unicrypt <94008455+alex-unicrypt@users.noreply.github.com> Date: Mon, 27 May 2024 05:44:11 +0100 Subject: [PATCH 073/855] added base to v2 lp lockers (#10380) --- projects/unicrypt/apiCache.js | 2 +- projects/unicrypt/config.js | 30 ++++++++++++++++++++++++++++++ projects/unicrypt/index.js | 10 +++++++--- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/projects/unicrypt/apiCache.js b/projects/unicrypt/apiCache.js index 9065e8b6dbd2..fd106b1c6b3f 100644 --- a/projects/unicrypt/apiCache.js +++ b/projects/unicrypt/apiCache.js @@ -1,6 +1,6 @@ const sdk = require('@defillama/sdk'); const { config, protocolPairs, tokens, stakingContracts, - ethereumContractData, bscContractData, polygonContractData, + ethereumContractData, baseContractData, bscContractData, polygonContractData, avalancheContractData, gnosisContractData,arbitrumContractData, } = require('./config') const { getCache, setCache, } = require("../helper/cache") const { vestingHelper, } = require("../helper/unknownTokens") diff --git a/projects/unicrypt/config.js b/projects/unicrypt/config.js index 9b0fd29eaef9..fb9ad32d896b 100644 --- a/projects/unicrypt/config.js +++ b/projects/unicrypt/config.js @@ -107,6 +107,18 @@ const config = { locker: '0xe3D32266974f1E8f8549cAf9F54977040e7D1c07', factory: '0xa818b4f111ccac7aa31d0bcc0806d64f2e0737d7', startBlock: 14476818 + }, + uniswapV2_base: { + chain: 'base', + locker: '0xc4E637D37113192F4F1F060DaEbD7758De7F4131', + factory: '0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6', + startBlock: 12110643 + }, + sushiswapV2_base: { + chain: 'base', + locker: '0xBeddF48499788607B4c2e704e9099561ab38Aae8', + factory: '0x71524B4f93c58fcbF659783284E38825f0622859', + startBlock: 10577634 } } @@ -138,6 +150,23 @@ const ethereumContractData = [ } ] +const baseContractData = [ + { // Uniswap v2 + chain: config.uniswapV2_base.chain, + contract: config.uniswapV2_base.locker, + getNumLockedTokensABI: getNumLockedTokens, + getLockedTokenAtIndexABI: getLockedTokenAtIndex, + factory: config.uniswapV2_base.factory + }, + { // Sushiswap + chain: config.sushiswapV2_base.chain, + contract: config.sushiswapV2_base.locker, + getNumLockedTokensABI: getNumLockedTokens, + getLockedTokenAtIndexABI: getLockedTokenAtIndex, + factory: config.sushiswapV2_base.factory + }, +] + const bscContractData = [ { // Pancakeswap v2 chain: config.pancakeswapv2.chain, @@ -236,6 +265,7 @@ const arbitrumContractData = [ module.exports = { + baseContractData, ethereumContractData, bscContractData, polygonContractData, diff --git a/projects/unicrypt/index.js b/projects/unicrypt/index.js index 179fbaf629f0..614ff0b637f3 100644 --- a/projects/unicrypt/index.js +++ b/projects/unicrypt/index.js @@ -1,7 +1,8 @@ const sdk = require('@defillama/sdk'); const { config, protocolPairs, tokens, stakingContracts, ethereumContractData, bscContractData, polygonContractData, - avalancheContractData, gnosisContractData, arbitrumContractData, } = require('./config') + avalancheContractData, gnosisContractData, arbitrumContractData, + baseContractData, } = require('./config') const { stakings } = require("../helper/staking"); const { pool2s } = require("../helper/pool2"); @@ -62,7 +63,7 @@ function tvl(args) { } module.exports = { - methodology: + methodology: `Counts each LP pair's native token and stable balance, adjusted to reflect locked pair's value. Balances and merged across multiple @@ -80,6 +81,9 @@ module.exports = { [protocolPairs.uncx_WETH], config.uniswapv2.chain) }, + base: { + tvl: tvl(baseContractData) + }, bsc: { tvl: tvl(bscContractData), @@ -93,7 +97,7 @@ module.exports = { avax: { tvl: tvl(avalancheContractData) }, - arbitrum: { tvl: tvl(arbitrumContractData) }, + arbitrum: { tvl: tvl(arbitrumContractData) }, xdai: { tvl: tvl(gnosisContractData), pool2: pool2s([config.honeyswap.locker], From 2d4150d82534d7fa010bbaf41d6a878602dc4c47 Mon Sep 17 00:00:00 2001 From: spzmya <127633250+spzmya@users.noreply.github.com> Date: Mon, 27 May 2024 07:10:38 +0200 Subject: [PATCH 074/855] Create dragon.js (#10379) * Create dragon.js * Update dragon.js * Update dragon.js * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/dragon/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/dragon/index.js diff --git a/projects/dragon/index.js b/projects/dragon/index.js new file mode 100644 index 000000000000..366d1e7f19e1 --- /dev/null +++ b/projects/dragon/index.js @@ -0,0 +1,13 @@ +const { staking } = require("../helper/unknownTokens") + +const ETH_DRAGON_UNIV2 = "0xd53881caee96d3a94fd0e2eb027a05fd44d8c470"; +const DRAGON = "0x528757e34a5617aa3aabe0593225fe33669e921c"; + +module.exports = { + misrepresentedTokens: true, + base: { + staking: staking({ owner: '0xbb595F34190c6eA1adD1C78F6d12DF181542763c', tokens: [DRAGON], lps: [ETH_DRAGON_UNIV2], useDefaultCoreAssets: true, chain: 'ethereum' }), + pool2: staking({ owner: '0x5F020174baEe486d88bea279195a0A3bCD40A41E', tokens: [ETH_DRAGON_UNIV2], lps: [ETH_DRAGON_UNIV2], useDefaultCoreAssets: true, chain: 'ethereum' }), + tvl: () => ({}), + }, +} \ No newline at end of file From c1aa5366b1afca5855501205dc5425d869656069 Mon Sep 17 00:00:00 2001 From: Agnes Lin Date: Mon, 27 May 2024 01:11:03 -0400 Subject: [PATCH 075/855] feat: add iswap tvl (#10374) * feat: add iswap tvl config * feat: update pools * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/iswap-tech/index.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 projects/iswap-tech/index.js diff --git a/projects/iswap-tech/index.js b/projects/iswap-tech/index.js new file mode 100644 index 000000000000..bf7ee1822e9e --- /dev/null +++ b/projects/iswap-tech/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + btr: { factory: '0xad2449234455e0992e1423411df0f8b6fed1feae', fromBlock: 1370065, }, +}) \ No newline at end of file From 1b6c464bde2afe222cc75cc1828bdf3442b10234 Mon Sep 17 00:00:00 2001 From: silvercondor <32993765+silvercondor@users.noreply.github.com> Date: Mon, 27 May 2024 16:45:10 +0800 Subject: [PATCH 076/855] chore: update methology info (#10381) --- projects/native/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/native/index.js b/projects/native/index.js index f4a16b19152b..41e45ed54b60 100644 --- a/projects/native/index.js +++ b/projects/native/index.js @@ -3,7 +3,7 @@ const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); module.exports = { methodology: - "includes the liquidity provided to the infrasturcture and ecosystem of Native", + "TVL: Counts the inventory held by Native's Partnered Market Makers used to facilitate slippage free swaps on the protocol", }; const config = { From 701bb53d31576215f72dc29bfb17ee2bc76fba17 Mon Sep 17 00:00:00 2001 From: WindowAzure Date: Mon, 27 May 2024 16:45:19 +0800 Subject: [PATCH 077/855] hibt cex (#10382) Co-authored-by: Azure --- projects/hibt/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 projects/hibt/index.js diff --git a/projects/hibt/index.js b/projects/hibt/index.js new file mode 100644 index 000000000000..f2544d5e6a4d --- /dev/null +++ b/projects/hibt/index.js @@ -0,0 +1,21 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + '0x89a7f48b79516125c5521d5922a6dc0a085b3b95' + ], + }, + bitcoin: { + owners: [ + 'bc1qpxntlx09kqvpwl7vmjw9f28yvytdqkdx8xh63w' + ] + }, + tron: { + owners: [ + 'TWVCro8i15sJjmwRKfV53gPnCsgz2ThQSc' + ] + }, +} + +module.exports = cexExports(config) \ No newline at end of file From 2eeb1b9a8b6ce893cbaa3249c0f4c51f5a736894 Mon Sep 17 00:00:00 2001 From: gaawai-l Date: Mon, 27 May 2024 16:45:44 +0800 Subject: [PATCH 078/855] Jaspervault Add 2 new liquidity pools for selling options (#10383) * add jaspervault tvl * minor fix * Add a new liquidity pool for selling puts. * Add 2 new liquidity pool for selling options --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Co-authored-by: Gary.Leung --- projects/jaspervault/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/jaspervault/index.js b/projects/jaspervault/index.js index ba1ff656c5ca..46f54ba173bb 100644 --- a/projects/jaspervault/index.js +++ b/projects/jaspervault/index.js @@ -5,8 +5,10 @@ module.exports = { arbitrum: { tvl: sumTokensExport({ owners: [ - '0xE980FD1dEA4E93c25B7f5B27351CF069C4f63a41', // sell WBTC & ETH CALL - '0xE26f15B3cc23e8a5adE4c10CCc69e50520eE2a89' // sell WBTC & ETH PUT + '0xE980FD1dEA4E93c25B7f5B27351CF069C4f63a41', // sell ETH CALL + '0xE26f15B3cc23e8a5adE4c10CCc69e50520eE2a89', // sell ETH PUT + '0xaaa5a76b9397eE41309CC15Bd71a5ae99662d6cd', // sell WBTC CALL + '0xd9344b56AE4C3Eb40a248c2548F128cCcd6208A0' // sell WBTC PUT ], tokens: [ADDRESSES.arbitrum.WBTC, ADDRESSES.null, ADDRESSES.arbitrum.USDT] }) From cba8cf367e874419cba226dd91b21d0078d0f0f6 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Mon, 27 May 2024 11:45:44 +0100 Subject: [PATCH 079/855] add new wallet bitget CEX (#10386) --- projects/bitget/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/projects/bitget/index.js b/projects/bitget/index.js index 54b01f512a61..82a4da501b35 100644 --- a/projects/bitget/index.js +++ b/projects/bitget/index.js @@ -31,6 +31,17 @@ const config = { '0x842ea89f73add9e4fe963ae7929fdc1e80acdb52', //add on 12/01/2024 '0x1a96e5da1315efcf9b75100f5757d5e8b76abb0c', //add on 12/01/2024 '0x4dfc15890972ecea7a213bda2b478dabc382e7a1', //add on 12/01/2024 + '0x70213959a644baa94840bbfb4129550bceceb3c2', // add on 27/05/2024 + '0x54a679e853281a440911f72eae0e24107e9413dc', // add on 27/05/2024 + '0x1ab4973a48dc892cd9971ece8e01dcc7688f8f23', // add on 27/05/2024 + '0x0edd5b0de0fe748be331186bf0aa878f47f601db', // add on 27/05/2024 + '0x4121217c238db06e942f3d87371106d30d0f8c84', // add on 27/05/2024 + '0xed470553f61f23cd30ccf51ab066dc1598ed0c4f', // add on 27/05/2024 + '0x59708733fbbf64378d9293ec56b977c011a08fd2', // add on 27/05/2024 + '0xaab0039de2a8dba8696ee4d42c0d1aa30d7e1059', // add on 27/05/2024 + '0xf207b2f9f9417fc73cad069f7aa5ae1c6a5b428d', // add on 27/05/2024 + '0x4d216d2682f3997f6c19420beee4530d08d0ea5f', // add on 27/05/2024 + '0xdbe46a02322e636b92296954637e1d7db9d5ed26', // add on 27/05/2024 ] }, tron: { @@ -46,6 +57,10 @@ const config = { 'TBM2FK4KBEEsMVYjm4WAW2Q8Es2NKdmUB8', //add on 12/01/2024 'TCvfZC9h6fFXnF7KbHPgY4jgfen93VkfVW', //add on 12/01/2024 'TGp7SNzjrctsWNwaFFN2PNTh3b1Kgxdtib', //add on 12/01/2024 + 'TBpo1Sh7vKCLrfxocZHd8CA5wc2R75kSJM', // add on 27/05/2024 + 'TMauqkA78pfysSTn8jD1dvEUkjme2gEEdn', // add on 27/05/2024 + 'TKPqvBMU2v23RyjjViKvp16kiHPx7FnrHQ', // add on 27/05/2024 + 'TVSdtELybCCa9DPDH15CMAPjeRcENAmDJZ', // add on 27/05/2024 ] }, bitcoin: { @@ -56,6 +71,12 @@ const config = { '3HcSp9sR23w6MxeRrLqqyDzLqThtSMaypQ', '3MdofQ2ouxom9MzC9kKazGUShoL5R3cVLG', '3Jxc4zsvEruEVAFpvwj818TfZXq5y2DLyF', //add on 12/01/2024 + '3KUwtHc5UhWQ76z6WrZRQHHVTZMuUWiZcU', // add on 27/05/2024 + '3H6JnFoz5jcoATKQ83BuQ3cUUCHswqfgtG', // add on 27/05/2024 + '3AZHcgLnJL5C5xKo33mspyHpQX7x4H5bBw', // add on 27/05/2024 + '3DSST4myyyRbiGzgCBE1RVHY7GRjDCh4n9', // add on 27/05/2024 + '3Nu84pbqfcfaFztQ74qc9ni2PH5HGM1bzS', // add on 27/05/2024 + '34hatYbZ27CLLoZWhuJHzBgoTCwXEv8GwT', // add on 27/05/2024 ] }, arbitrum: { From ac69482d232a15b72db89997a79519078d7ed5af Mon Sep 17 00:00:00 2001 From: Patrick Roy <126775449+patrickroyme@users.noreply.github.com> Date: Mon, 27 May 2024 14:19:08 +0300 Subject: [PATCH 080/855] Add Base network to Kinetix V2 and V3 (#10384) --- projects/kinetix-v2/index.js | 7 +++++++ projects/kinetix-v3/index.js | 20 ++++++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/projects/kinetix-v2/index.js b/projects/kinetix-v2/index.js index db85f569e49b..b8c1fa524f37 100644 --- a/projects/kinetix-v2/index.js +++ b/projects/kinetix-v2/index.js @@ -9,4 +9,11 @@ module.exports = { fetchBalances: true, }), }, + base: { + tvl: getUniTVL({ + factory: "0x8aD3d3e6B1b7B65138bD508E48330B544539b2C3", + useDefaultCoreAssets: true, + fetchBalances: true, + }), + }, }; diff --git a/projects/kinetix-v3/index.js b/projects/kinetix-v3/index.js index 48e18f9b3dd0..4f26b6b52c7c 100644 --- a/projects/kinetix-v3/index.js +++ b/projects/kinetix-v3/index.js @@ -1,12 +1,12 @@ -const { uniV3GraphExport } = require('../helper/uniswapV3') +const { uniV3Export } = require("../helper/uniswapV3"); -module.exports = { +module.exports = uniV3Export({ kava: { - tvl: uniV3GraphExport({ - // // factory: '0x2dBB6254231C5569B6A4313c6C1F5Fe1340b35C2', - // // fromBlock: 6069472 - graphURL: 'https://kava-graph-node.metavault.trade/subgraphs/name/kinetixfi/v3-subgraph', - name: 'kinetixfi/kava-v3', - }) - } -} + factory: "0x2dBB6254231C5569B6A4313c6C1F5Fe1340b35C2", + fromBlock: 6069472, + }, + base: { + factory: "0xdDF5a3259a88Ab79D5530eB3eB14c1C92CD97FCf", + fromBlock: 14195510, + }, +}); From c01942906a36298a820231b1a2dbe1467b6d6435 Mon Sep 17 00:00:00 2001 From: LidoKing <55234791+LidoKing@users.noreply.github.com> Date: Mon, 27 May 2024 19:39:24 +0800 Subject: [PATCH 081/855] add nx finance (#10385) * add nx finance * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/nxfinance/index.js | 20 +++++++++ projects/nxfinance/nx-idl.json | 75 ++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 projects/nxfinance/index.js create mode 100644 projects/nxfinance/nx-idl.json diff --git a/projects/nxfinance/index.js b/projects/nxfinance/index.js new file mode 100644 index 000000000000..77ae92d158b0 --- /dev/null +++ b/projects/nxfinance/index.js @@ -0,0 +1,20 @@ +const { Program } = require("@project-serum/anchor"); +const { getProvider, } = require("../helper/solana"); +const nxIdl = require("./nx-idl.json"); + +const NX_PROGRAM_ADDR = "JMpxnop5u1HJAqjzpZHo7MmvfBQf5YkFw4nGK9F83x3"; + +async function tvl(api) { + const provider = getProvider(); + const nx_program = new Program(nxIdl, NX_PROGRAM_ADDR, provider); + const accounts = await nx_program.account.marginPool.all() + + for (let { account: pool } of accounts) + api.add(pool.tokenMint.toBase58(), pool.depositTokens.toString()) +} + +module.exports = { + methodology: "Sum of assets deposited for lending and assets deposited as collateral for leveraging", + timetravel: false, + solana: { tvl, }, +}; diff --git a/projects/nxfinance/nx-idl.json b/projects/nxfinance/nx-idl.json new file mode 100644 index 000000000000..44917c201aa6 --- /dev/null +++ b/projects/nxfinance/nx-idl.json @@ -0,0 +1,75 @@ +{ + "version": "0.1.0", + "name": "leverage_finance", + "instructions": [], + "accounts": [ + { + "name": "MarginPool", + "type": { + "kind": "struct", + "fields": [ + { + "name": "leveragefi", + "type": "publicKey" + }, + { + "name": "vault", + "type": "publicKey" + }, + { + "name": "feeDestination", + "type": "publicKey" + }, + { + "name": "poolAuthority", + "type": "publicKey" + }, + { + "name": "tokenMint", + "type": "publicKey" + }, + { + "name": "tokenPriceOracle", + "type": "publicKey" + }, + { + "name": "borrowedTokens", + "type": "u64" + }, + { + "name": "depositTokens", + "type": "u64" + }, + { + "name": "depositNotes", + "type": "u64" + }, + { + "name": "loanNotes", + "type": "u64" + }, + { + "name": "depositInterest", + "type": "u64" + }, + { + "name": "loanInterest", + "type": "u64" + }, + { + "name": "protocolFee", + "type": "u64" + }, + { + "name": "accruedUntil", + "type": "i64" + }, + { + "name": "utilizationFlag", + "type": "u16" + } + ] + } + } + ] +} From 61eb60ca6ec123acc242925e3c0509602977cf22 Mon Sep 17 00:00:00 2001 From: suNrisEinMyeYes <40171291+suNrisEinMyeYes@users.noreply.github.com> Date: Mon, 27 May 2024 14:39:50 +0300 Subject: [PATCH 082/855] locus update (#10388) * xUsdVaultRedeployed * code fix * update locus * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/locus/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/locus/index.js b/projects/locus/index.js index 990bc10cb5ad..64c94ee9306b 100644 --- a/projects/locus/index.js +++ b/projects/locus/index.js @@ -8,7 +8,7 @@ const stLocus = "0xEcc5e0c19806Cf47531F307140e8b042D5Afb952" module.exports = { doublecounted: true, hallmarks: [ - [Math.floor(new Date('2023-12-30')/1e3), 'Was hacked for 321k'], // https://twitter.com/Locus_finance/status/1744374506267767267 + [Math.floor(new Date('2023-12-30') / 1e3), 'Was hacked for 321k'], // https://twitter.com/Locus_finance/status/1744374506267767267 ], } @@ -22,6 +22,7 @@ const config = { arbitrum: { lvTokens: { xARB: "0xF8F045583580C4Ba954CD911a8b161FafD89A9EF", + pendleETH: "0x515f3533a17E2EEFB13313D9248f328C94dBe641" }, lvTokens2: { xUSD: "0x6318938F825F57d439B3a9E25C38F04EF97987D8", @@ -32,7 +33,7 @@ const config = { Object.keys(config).forEach(chain => { const { lvTokens, lvTokens2 } = config[chain] let tvl = sumERC4626VaultsExport({ vaults: Object.values(lvTokens), tokenAbi: 'token', balanceAbi: 'totalAssets' }) - if (lvTokens2) + if (lvTokens2) tvl = sdk.util.sumChainTvls([tvl, sumERC4626VaultsExport({ vaults: Object.values(lvTokens2), tokenAbi: 'wantToken', balanceAbi: 'totalAssets' })]) module.exports[chain] = { tvl From 3127012c99fcef202dd5be3450a396127f4cbe5b Mon Sep 17 00:00:00 2001 From: Winson Cheng <83229800+0xKMG@users.noreply.github.com> Date: Mon, 27 May 2024 21:11:36 +0800 Subject: [PATCH 083/855] add karak lending vaults into TVL (#10389) --- projects/airpuff/index.js | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/projects/airpuff/index.js b/projects/airpuff/index.js index ab58f104ba58..a8b3f14deabd 100644 --- a/projects/airpuff/index.js +++ b/projects/airpuff/index.js @@ -1,6 +1,7 @@ const { staking } = require("../helper/staking"); const ADDRESSES = require("../helper/coreAssets.json"); const contractAbis = { + getDeposits: "function getDeposits(address) view returns (address[], address[], uint256[], uint256[])", readOraclePrice: "function read() view returns (int224 value, uint32 timestamp)", balanceOf: "function balanceOf(address) external view returns (uint256)", getPrice: "function answer() external view returns (uint256)", @@ -17,6 +18,45 @@ const contractAbis = { module.exports = { misrepresentedTokens: true, + karak: { + tvl: async (api) => { + // const KUSDC = { + // vault: "0x4c18E80b801AA24066D8B1C6E65ee245497Cb741", + // token: "0x7AFAa2428c379862984A3fdF517BbeaA1487A32c", + // }; + // + // const KWETH = { + // vault: "0x5c7a8e3d4c0e382f8c3b6f6a3b7c9d3d1f9e6b9c", + // token: "0x9a9631F7BEcE5C6E0aBA1f73f0e5796c534dc4db", + // }; + + const wethLending = { + vault: "0xd6034F9147CF7528e857403Dea93bc45743295eb", + token: "0x4200000000000000000000000000000000000006", + }; + + const usdcLending = { + vault: "0x475820E4bCE0E3d233Ad7f6A8c9DD1f66974c5d6", + token: "0xa415021bC5c4C3b5B989116DC35Ae95D9C962c8D", + }; + + // const bal1 = await api.call({ target: KUSDC.token, abi: contractAbis.getDeposits, params: [KUSDC.vault] }); + // + // console.log(bal1); + // + // const bal2 = await api.call({ target: KWETH.token, abi: contractAbis.getDeposits, params: [KWETH.vault] }); + // console.log(bal2); + + const strategies = [wethLending, usdcLending]; + + const tokensAndOwners = []; + + strategies.forEach(({ vault, token }) => tokensAndOwners.push([token, vault])); + + await api.sumTokens({ tokensAndOwners }); + }, + }, + zklink: { tvl: async (api) => { const pufEth1x = { From 72de93048f732b8d2b8add091499b62b86ba58c0 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 27 May 2024 15:44:52 +0200 Subject: [PATCH 084/855] track https://daikodex.io/swap --- package-lock.json | 6 +++--- projects/daiko-dex/index.js | 3 +++ projects/helper/chains.json | 1 + projects/helper/env.js | 3 ++- projects/helper/tokenMapping.js | 5 ++++- 5 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 projects/daiko-dex/index.js diff --git a/package-lock.json b/package-lock.json index 4f1deb45ac38..e5913d908526 100644 --- a/package-lock.json +++ b/package-lock.json @@ -886,9 +886,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "5.0.56", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.56.tgz", - "integrity": "sha512-91dDh9+EbZ8ABDz4SYhPj/eV8vjobh0uQ7+OkgfHH9V1zH/ajJ2DbN40NJqRL+rMzZqu0CX062wNaxPYmcwASw==", + "version": "5.0.57", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.57.tgz", + "integrity": "sha512-a4xLOQp7Y5vD+6HVuNPmWxOmsg9MDJliTPen8nzjXoxDG/WWHKFwARa035l60zeoq/TWY6JbTFOBoruCBVYN2g==", "dependencies": { "@aws-sdk/client-s3": "^3.400.0", "@supercharge/promise-pool": "^2.1.0", diff --git a/projects/daiko-dex/index.js b/projects/daiko-dex/index.js new file mode 100644 index 000000000000..3b94051348e4 --- /dev/null +++ b/projects/daiko-dex/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('taiko', '0x2cFAe8F731D6a04f3E868deB03ad73576695271A') \ No newline at end of file diff --git a/projects/helper/chains.json b/projects/helper/chains.json index dcd914774206..8339a572a4df 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -277,6 +277,7 @@ "svm", "sx", "syscoin", + "taiko", "telos", "tenet", "terra", diff --git a/projects/helper/env.js b/projects/helper/env.js index 80961520a73b..8e00c39e43f3 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -17,7 +17,8 @@ const DEFAULTS = { DEFICHAIN_EVM_RPC_MULTICALL: '0x7fEf77CDe3B41221Cff54B84Ea89D2EBc6b53352', BOUNCEBIT_RPC_MULTICALL: '0x493d616f5F9a64e5B3D527120E406439bdF29272', ZKLINK_RPC_MULTICALL: '0xa8738F57538E3Bb73872d1133F2358c7Fe56FD35', - REAL_RPC: 'https://real.drpc.org', + REAL_RPC: 'https://real.drpc.org', // added manually short name is re-al + TAIKO_RPC: 'https://rpc.taiko.xyz', // added manually short name is tko-mainnet REAL_RPC_MULTICALL: '0xcA11bde05977b3631167028862bE2a173976CA11', } diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 9066558f75a8..726dfff8b376 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -116,7 +116,10 @@ const fixBalancesTokens = { '0x90c6e93849e06ec7478ba24522329d14a5954df4': { coingeckoId: 'ethereum', decimals: 18 }, '0x75d0cbf342060b14c2fc756fd6e717dfeb5b1b70': { coingeckoId: 'dai', decimals: 18 }, '0x83fedbc0b85c6e29b589aa6bdefb1cc581935ecd': { coingeckoId: 'mountain-protocol-usdm', decimals: 18 }, - } + }, + taiko: { + '0xA51894664A773981C6C112C43ce576f315d5b1B6': { coingeckoId: 'ethereum', decimals: 18 } + }, } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) From cbe94197d0a2f05476b4b2fb9c3de5974e0c15b4 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 27 May 2024 16:11:29 +0200 Subject: [PATCH 085/855] taikoswap --- projects/taikoswap/index.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 projects/taikoswap/index.js diff --git a/projects/taikoswap/index.js b/projects/taikoswap/index.js new file mode 100644 index 000000000000..3810f942623b --- /dev/null +++ b/projects/taikoswap/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('taiko', '0x7c43adafc2337baa16aa2876f9de8da5b3720fdb') \ No newline at end of file From 7d0cfb27a8c4ee5c4f26a13e13855640a8d79ed0 Mon Sep 17 00:00:00 2001 From: bitpartylabs003 Date: Mon, 27 May 2024 23:19:59 +0800 Subject: [PATCH 086/855] Create index.js (#10372) --- projects/bitparty/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/bitparty/index.js diff --git a/projects/bitparty/index.js b/projects/bitparty/index.js new file mode 100644 index 000000000000..e7d2ae6e842c --- /dev/null +++ b/projects/bitparty/index.js @@ -0,0 +1,11 @@ +const { sumTokens2, } = require('../helper/unwrapLPs') + +async function tvl(api) { + + return sumTokens2({ owners: [ + '0xb002b938d63fe8762f2a0eff9e49a8e20a0078e8', + ], tokens: ['0xef63d4e178b3180beec9b0e143e0f37f4c93f4c2', '0xfe9f969faf8ad72a83b761138bf25de87eff9dd2', '0x9827431e8b77e87c9894bd50b055d6be56be0030', '0xfF204e2681A6fA0e2C3FaDe68a1B28fb90E4Fc5F', '0x07373d112edc4570b46996ad1187bc4ac9fb5ed0'], api, }) //wbtc and usdt +} +module.exports = { + btr: { tvl, } +} From 526eed54cd3855173262ac95e32f376cd4791f23 Mon Sep 17 00:00:00 2001 From: JohnnyWyles <97029546+JohnnyWyles@users.noreply.github.com> Date: Mon, 27 May 2024 18:58:53 +0100 Subject: [PATCH 087/855] Add Astroport Osmosis Deployment (#10392) https://celatone.osmosis.zone/osmosis-1/contracts/osmo1246fnsutktuqqzrru673pqwtt64n288004j5fauyuezwr54llw5sl6drp6 --- projects/astroport/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/astroport/index.js b/projects/astroport/index.js index 02573dbacc77..ed71d81eda1d 100644 --- a/projects/astroport/index.js +++ b/projects/astroport/index.js @@ -16,4 +16,7 @@ module.exports = { sei: { tvl: getFactoryTvl("sei1xr3rq8yvd7qplsw5yx90ftsr2zdhg4e9z60h5duusgxpv72hud3shh3qfl") }, -} // node test.js projects/astroport/index.js \ No newline at end of file + osmosis: { + tvl: getFactoryTvl("osmo1246fnsutktuqqzrru673pqwtt64n288004j5fauyuezwr54llw5sl6drp6") + }, +} // node test.js projects/astroport/index.js From c2ae17460d38ce5948f1d6363d32722fab26c478 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nekojita=20=28=E7=8C=AB=E8=88=8C=29?= <154665857+nekojitaxyz@users.noreply.github.com> Date: Tue, 28 May 2024 04:05:58 +0700 Subject: [PATCH 088/855] Add Henjindex adapter on Taiko (#10391) * Add Henjindex adapter on Taiko * minor fix * add taiko multicall --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/env.js | 1 + projects/helper/tokenMapping.js | 3 ++- projects/henjin/index.js | 9 +++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 projects/henjin/index.js diff --git a/projects/helper/env.js b/projects/helper/env.js index 8e00c39e43f3..d9af5a50f571 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -20,6 +20,7 @@ const DEFAULTS = { REAL_RPC: 'https://real.drpc.org', // added manually short name is re-al TAIKO_RPC: 'https://rpc.taiko.xyz', // added manually short name is tko-mainnet REAL_RPC_MULTICALL: '0xcA11bde05977b3631167028862bE2a173976CA11', + TAIKO_RPC_MULTICALL: '0xcb2436774C3e191c85056d248EF4260ce5f27A9D', } const ENV_KEYS = [ diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 726dfff8b376..d6b63304d35c 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -118,7 +118,8 @@ const fixBalancesTokens = { '0x83fedbc0b85c6e29b589aa6bdefb1cc581935ecd': { coingeckoId: 'mountain-protocol-usdm', decimals: 18 }, }, taiko: { - '0xA51894664A773981C6C112C43ce576f315d5b1B6': { coingeckoId: 'ethereum', decimals: 18 } + '0xA51894664A773981C6C112C43ce576f315d5b1B6': { coingeckoId: 'ethereum', decimals: 18 }, + '0x07d83526730c7438048d55a4fc0b850e2aab6f0b': { coingeckoId: 'usd-coin', decimals: 6 }, }, } diff --git a/projects/henjin/index.js b/projects/henjin/index.js new file mode 100644 index 000000000000..d0542c8ac280 --- /dev/null +++ b/projects/henjin/index.js @@ -0,0 +1,9 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + taiko: { + factory: "0x42B08e7a9211482d3643a126a7dF1895448d3509", + fromBlock: 400, + isAlgebra: true, + }, +}); From 9da2ebf2dd632727890c2d5906fc1024c57afb0b Mon Sep 17 00:00:00 2001 From: Strategic Reserve Date: Mon, 27 May 2024 23:17:45 -0700 Subject: [PATCH 089/855] Add Manta uni and linea linehub (#10394) --- projects/visor/config.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/visor/config.js b/projects/visor/config.js index 0ccba906f308..03b526422404 100644 --- a/projects/visor/config.js +++ b/projects/visor/config.js @@ -75,6 +75,7 @@ const HYPE_REGISTRY = { ["0xA8E2fD481342976a3259591FBc08999369a43C5A", 3554431], // Uniswap ["0xc27ddd78fc49875fe6f844b72bbf31dfbb099881", 163300], // Lynex ["0x9C3E0445559E6de1fe6391E8e018DcA02B480836", 3952143], // Nile + ["0xFf0D3aBfd3003D4D5Ad7d57C912cca02ebA6036B", 4775887], // Linehub ], base: [ ["0x829432679F69DBd8b2575f006EC0129894a39D86", 12465470], // Uniswap @@ -94,8 +95,9 @@ const HYPE_REGISTRY = { ["0xf14Fb95d6E7E1ab5fCdFfF7Ab203a84b9361E6FC", 10038113], // Thena ], manta: [ - ["0x683292172E2175bd08e3927a5e72FC301b161300", 394949], // Apertureswap + ["0x670003267DDFF9C2c740EC9A1645569cCCDC6Bf7", 2261164], // Uniswap ["0x8a9570ec97534277Ade6e46d100939FbCE4968f0", 689622], // Quickswap + ["0x683292172E2175bd08e3927a5e72FC301b161300", 394949], // Apertureswap ], metis: [ ["0xFc13Ebe7FEB9595D70195E9168aA7F3acE153621", 9080358], // Hercules From 3f896021876a9f3829e891275a6f491400489571 Mon Sep 17 00:00:00 2001 From: Victory <103103236+eric0x01@users.noreply.github.com> Date: Tue, 28 May 2024 14:42:11 +0800 Subject: [PATCH 090/855] Add Core-Earn protocol (#10398) * add core-earn protocol * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/core-earn/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/core-earn/index.js diff --git a/projects/core-earn/index.js b/projects/core-earn/index.js new file mode 100644 index 000000000000..ef1dfdc74fc9 --- /dev/null +++ b/projects/core-earn/index.js @@ -0,0 +1,11 @@ +const Earn = "0xf5fA1728bABc3f8D2a617397faC2696c958C3409"; + +async function tvl(api) { + let amount = await api.call({ abi: "uint256:getTotalDelegateAmount", target: Earn }) + api.addGasToken(amount) +} + +module.exports = { + methodology: "Total Core staking Value.", + core: { tvl, }, +} \ No newline at end of file From 44145de1efcc7355d128c38985c7b335cdc2bff9 Mon Sep 17 00:00:00 2001 From: kkexdev Date: Tue, 28 May 2024 14:43:04 +0800 Subject: [PATCH 091/855] add kkex (#10396) --- projects/kkex/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 projects/kkex/index.js diff --git a/projects/kkex/index.js b/projects/kkex/index.js new file mode 100644 index 000000000000..1944a944b1de --- /dev/null +++ b/projects/kkex/index.js @@ -0,0 +1,9 @@ +const { gmxExports } = require("../helper/gmx"); + +module.exports = { + zklink: { + tvl: gmxExports({ + vault: "0xC8F6494bD11A12Dd6B676EC87C8b878a1D90e641", + }), + }, +}; From 22d0e198561ea4e63ec95e20b32d51291ed13a53 Mon Sep 17 00:00:00 2001 From: amedrontadora <134207821+amedrontadora@users.noreply.github.com> Date: Tue, 28 May 2024 14:51:14 +0800 Subject: [PATCH 092/855] add Ritsu Protocol (#10393) * add ritsu * code refactor --------- Co-authored-by: amedrontadora Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/ritsu/index.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 projects/ritsu/index.js diff --git a/projects/ritsu/index.js b/projects/ritsu/index.js new file mode 100644 index 000000000000..572b0614deed --- /dev/null +++ b/projects/ritsu/index.js @@ -0,0 +1,32 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getLogs2 } = require('../helper/cache/getLogs') + +async function tvl(api) { + const { fromBlock, basicFactorys, stableFactorys, rhythmFactorys = [] } = config[api.chain] + + let logs = await Promise.all([basicFactorys, stableFactorys, rhythmFactorys].flat().map(getFactoryLogs)) + logs = logs.flat() + + const ownerTokens = logs.map(({ token0, token1, pool }) => [[token0, token1], pool]) + return sumTokens2({ api, ownerTokens}) + + async function getFactoryLogs(target) { + return getLogs2({ + api, + target, + fromBlock, + eventAbi: 'event PoolCreated(address indexed token0, address indexed token1, address pool)', + }) + } +} + +const config = { + taiko: { + fromBlock: 787, + stableFactorys: ['0x3e846B1520E74728EFf445F1f86D348755F738d9'], + basicFactorys: ['0xDFFee0ad5C833f2A5E610dfe9FD1aD82743eA74e'], + rhythmFactorys: ['0x0A78CAB89a069555a18B78537f09fab24c03dECd'] + } +} + +Object.keys(config).forEach(chain => { module.exports[chain] = { tvl } }) \ No newline at end of file From 9d3de963fead29d3537e24118476a7a11b638e00 Mon Sep 17 00:00:00 2001 From: JoscelynFarr <130961775+JoscelynFarr@users.noreply.github.com> Date: Tue, 28 May 2024 15:32:25 +0800 Subject: [PATCH 093/855] update tvl of jojo (#10399) * remove other chains * update tvl * add fundingRateArbitrage * add fundingRate --------- Co-authored-by: JoscelynFarr --- projects/jojo/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/jojo/index.js b/projects/jojo/index.js index c05697c1ed71..761261f6883b 100644 --- a/projects/jojo/index.js +++ b/projects/jojo/index.js @@ -20,7 +20,7 @@ module.exports = { tvl: sumTokensExport( { tokens: [ADDRESSES.base.USDC, ADDRESSES.base.WETH, cbethBase, degenBase, mUsdcBase, ], - owners: ['0x2f7c3cf9d9280b165981311b822becc4e05fe635', '0xf8192489A8015cA1690a556D42F7328Ea1Bb53D0'] + owners: ['0x2f7c3cf9d9280b165981311b822becc4e05fe635', '0xf8192489A8015cA1690a556D42F7328Ea1Bb53D0', '0x8B7e1924fF57EEc8EbD87254E4de6Ff397f039D3'] } ) }, From 1296df7b675f057528915bbb79481b3f0080ed66 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 28 May 2024 11:03:58 +0200 Subject: [PATCH 094/855] Add support for Lorenzo in DefiLlama (#10401) * add support lorenzo in DefiLlama * minor fix --------- Co-authored-by: Leven --- projects/lorenzo/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/lorenzo/index.js diff --git a/projects/lorenzo/index.js b/projects/lorenzo/index.js new file mode 100644 index 000000000000..c0ee691cba96 --- /dev/null +++ b/projects/lorenzo/index.js @@ -0,0 +1,23 @@ +const { sumTokensExport } = require("../helper/sumTokens"); + +const LorenzoOwners = [ + "bc1pzd6luyardlle9f7lul2y8fl72c22p6vxspc4k4g4gzgjf8975s0sr042yt", + "bc1p7agkadaau66jtva9n8k5pg3lsctuyqur8a2l5y9hzwqkh5nlmd0skuhws3", + "bc1qaf6laj9m7jteztyz4lulrtcjtpusfcfnd7r7xn", + "bc1qf6cj2z2e2mzuvfrl80vgt53k7jc2vf36ckahgy", + "bc1q5hc68n6krnzgzswf7rknha2aqxzrzup4vlhce8", + "bc1qpxpmr3zdjulqnwa3jdvm83tpaek6dv3kc75ms7", + "bc1qaml9d9mqgfhsfuaa2ymutdl4psj8c2undx9n72", + "bc1qutgngqyrflxrfmk9k28ucvq0s2v8a43nwfwv02", + "bc1qrx3fpr5j6sprxett45c2kl9p4pajyxep0mapfd", + "bc1q00t2ntm46c2nfvcer6ukj6npaxjurujthse4qq", + "bc1q3pzhncle68gct6me08kn5kf9awkevt6ettwrmg", + "bc1qw6cvwx8ajprmp2lzkhrsps2qx4k9r2pj4xj98x" +]; + +module.exports = { + methodology: "Lorenzo, As the Bitcoin Liquidity Finance Layer", + bitcoin: { + tvl: sumTokensExport({ owners : LorenzoOwners }), + } +}; \ No newline at end of file From f5a87159ab87c79ebebb8860690440015a5d5f2f Mon Sep 17 00:00:00 2001 From: Winson Cheng <83229800+0xKMG@users.noreply.github.com> Date: Tue, 28 May 2024 17:05:50 +0800 Subject: [PATCH 095/855] add new pools on karak to tvl calculation (#10400) --- projects/airpuff/index.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/projects/airpuff/index.js b/projects/airpuff/index.js index a8b3f14deabd..d5313c3863bf 100644 --- a/projects/airpuff/index.js +++ b/projects/airpuff/index.js @@ -20,15 +20,15 @@ module.exports = { karak: { tvl: async (api) => { - // const KUSDC = { - // vault: "0x4c18E80b801AA24066D8B1C6E65ee245497Cb741", - // token: "0x7AFAa2428c379862984A3fdF517BbeaA1487A32c", - // }; - // - // const KWETH = { - // vault: "0x5c7a8e3d4c0e382f8c3b6f6a3b7c9d3d1f9e6b9c", - // token: "0x9a9631F7BEcE5C6E0aBA1f73f0e5796c534dc4db", - // }; + const KUSDC = { + vault: "0x4c18E80b801AA24066D8B1C6E65ee245497Cb741", + token: "0xa415021bC5c4C3b5B989116DC35Ae95D9C962c8D", + }; + + const KWETH = { + vault: "0x9a9631F7BEcE5C6E0aBA1f73f0e5796c534dc4db", + token: "0x4200000000000000000000000000000000000006", + }; const wethLending = { vault: "0xd6034F9147CF7528e857403Dea93bc45743295eb", @@ -40,12 +40,9 @@ module.exports = { token: "0xa415021bC5c4C3b5B989116DC35Ae95D9C962c8D", }; - // const bal1 = await api.call({ target: KUSDC.token, abi: contractAbis.getDeposits, params: [KUSDC.vault] }); - // - // console.log(bal1); - // - // const bal2 = await api.call({ target: KWETH.token, abi: contractAbis.getDeposits, params: [KWETH.vault] }); - // console.log(bal2); + const KarakUSDCBal = await api.call({ target: KUSDC.vault, abi: contractAbis.getTotalSupply }); + + const KarakWETHbal = await api.call({ target: KWETH.vault, abi: contractAbis.getTotalSupply }); const strategies = [wethLending, usdcLending]; @@ -54,6 +51,9 @@ module.exports = { strategies.forEach(({ vault, token }) => tokensAndOwners.push([token, vault])); await api.sumTokens({ tokensAndOwners }); + + api.add(KUSDC.token, KarakUSDCBal); + api.add(KWETH.token, KarakWETHbal); }, }, From 76f5cedc4702d1eaf5559e4d393ba7d155c15399 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 28 May 2024 11:43:58 +0200 Subject: [PATCH 096/855] fix broken adapters --- projects/dinopool/index.js | 2 ++ projects/dogsofelon/index.js | 3 +++ projects/liquix/index.js | 12 ++++----- projects/metavault-v3/index.js | 2 +- projects/steadefi/index.js | 45 ++++------------------------------ 5 files changed, 17 insertions(+), 47 deletions(-) diff --git a/projects/dinopool/index.js b/projects/dinopool/index.js index 86bf08fec4d8..0a3d344a3435 100644 --- a/projects/dinopool/index.js +++ b/projects/dinopool/index.js @@ -15,3 +15,5 @@ const lps = [ module.exports = { ...tombTvl(bond, share, rewardPool, boardroom, lps, "cronos", undefined, false, lps[1]) }; + +module.exports.deadFrom = "2023-05-30" \ No newline at end of file diff --git a/projects/dogsofelon/index.js b/projects/dogsofelon/index.js index 31db5325c5e9..310e4245d431 100644 --- a/projects/dogsofelon/index.js +++ b/projects/dogsofelon/index.js @@ -21,3 +21,6 @@ module.exports = { }, methodology: "Counts liquidty on the staking and pool2 only", }; + + +module.exports.deadFrom = "2023-01-19" \ No newline at end of file diff --git a/projects/liquix/index.js b/projects/liquix/index.js index 63eb576fa96c..9df6fa82d202 100644 --- a/projects/liquix/index.js +++ b/projects/liquix/index.js @@ -46,12 +46,12 @@ Object.keys(config).forEach((chain) => { fromBlock, }); const vaults = logs.map(i => i.proxyAddress) - for (let i = 0; i < vaults.length; i++) { - const balances = await api.call({ abi: 'function totalUnderlying(address vault_) external view returns ((address,uint256)[] memory)', target: helper, params: vaults[i] }); - for (let j = 0; j < balances.length; j++) { - const token0 = balances[j][0]; - const balance = balances[j][1]; - api.add(token0, balance) + console.log(vaults.length) + const _balances = await api.multiCall({ abi: 'function totalUnderlying(address vault_) external view returns ((address,uint256)[] memory)', target: helper, calls: vaults, permitFailure: true, }) + for (const balances of _balances) { + if (!balances) continue; + for (const balance of balances) { + api.add(balance[0], balance[1]) } } } diff --git a/projects/metavault-v3/index.js b/projects/metavault-v3/index.js index c78ab36597b1..fa4ae6eac261 100644 --- a/projects/metavault-v3/index.js +++ b/projects/metavault-v3/index.js @@ -4,5 +4,5 @@ const factory = "0x9367c561915f9D062aFE3b57B18e30dEC62b8488" // same on all chai module.exports = uniV3Export({ linea: { factory, fromBlock: 652486, }, - scroll: { factory, fromBlock: 77008, }, + scroll: { factory, fromBlock: 77008, blacklistedTokens: ['0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f'] }, }) \ No newline at end of file diff --git a/projects/steadefi/index.js b/projects/steadefi/index.js index 2b4523c0b651..b7cdbff274d5 100644 --- a/projects/steadefi/index.js +++ b/projects/steadefi/index.js @@ -16,47 +16,10 @@ const config = { } module.exports = { - hallmarks : [ + hallmarks: [ [1691373600, "Steadefi exploited"], ], }; -/* -Object.keys(config).forEach(chain => { - const { fsglp } = config[chain] - module.exports[chain] = { - tvl: async (api) => { - const chainId = api.getChainId() - let [lendingPools, vaults] = await getProjectInfo() - lendingPools = lendingPools.filter(i => i.chainId === chainId).map(i => i.address) - const grailVaults = vaults.filter(i => i.chainId === chainId && i.protocol === 'Camelot').map(i => i.address) - vaults = vaults.filter(i => i.chainId === chainId && i.protocol !== 'Camelot').map(i => i.address) - const lpAssets = await api.multiCall({ abi: 'address:asset', calls: lendingPools }) - const managers = await api.multiCall({ abi: 'address:manager', calls: vaults }) - let lpTokens = await api.multiCall({ abi: 'address:lpToken', calls: managers, permitFailure: true, }) - const glpPoolManagers = managers.filter((_, i) => !lpTokens[i]) - glpPoolManagers.forEach(v => { - lpAssets.push(fsglp) - lendingPools.push(v) - }) - const lpPoolManagers = managers.filter((_, i) => lpTokens[i]) - lpTokens = lpTokens.filter(i => i) - const bals = await api.multiCall({ abi: 'uint256:lpTokenAmt', calls: lpPoolManagers }) - api.addTokens(lpTokens, bals) - // api.add('tether', tokenValue.reduce((a, v) => a + v/1e13, 0), { skipChain: true}) - if (grailVaults.length) { - const grailManagers = await api.multiCall({ abi: 'address:manager', calls: grailVaults }) - const spNfts = await api.multiCall({ abi: 'address:spNft', calls: grailManagers }) - const positionIds = await api.multiCall({ abi: 'uint256:positionId', calls: grailManagers }) - const poolInfos = await api.multiCall({ abi: camelotNFTPoolAbi.getPoolInfo, calls: spNfts }) - const stakedPositionInfo = await api.multiCall({ abi: camelotNFTPoolAbi.getStakingPosition, calls: spNfts.map((v, i) => ({ target: v, params: positionIds[i] })) }) - const lpTokens = poolInfos.map(v => v.lpToken) - const lpBalances = stakedPositionInfo.map(v => v.amount) - api.addTokens(lpTokens, lpBalances) - } - return sumTokens2({ api, tokensAndOwners2: [lpAssets, lendingPools] }) - } - } -}) */ Object.keys(config).forEach(chain => { module.exports[chain] = { @@ -67,8 +30,10 @@ Object.keys(config).forEach(chain => { vaults = vaults.filter(i => i.chainId === chainId) const vaultAddresses = vaults.map(i => i.address) const lpAssets = await api.multiCall({ abi: 'address:asset', calls: lendingPools }) - const bals = await api.multiCall({ abi: 'function assetAmt() view returns (uint256,uint256)', calls: vaultAddresses }) - bals.forEach(([bal0, bal1], i) => { + const bals = await api.multiCall({ abi: 'function assetAmt() view returns (uint256,uint256)', calls: vaultAddresses, permitFailure: true }) + bals.forEach((res, i) => { + if (!res) return; + const [bal0, bal1] = res api.addToken(vaults[i].tokens[0].address, bal0) api.addToken(vaults[i].tokens[1].address, bal1) }) From b56fd38b5c565484d946eaa5681da056fb07b865 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Tue, 28 May 2024 11:37:29 +0100 Subject: [PATCH 097/855] add xlayer curve --- projects/curve/contracts.json | 5 +++++ projects/curve/index.js | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/curve/contracts.json b/projects/curve/contracts.json index 66c36b1cfc91..8045849a705b 100644 --- a/projects/curve/contracts.json +++ b/projects/curve/contracts.json @@ -164,5 +164,10 @@ "wrapped": "0xc86c7c0efbd6a49b35e8714c5f59d99de09a225b", "metapoolBases": {}, "CurveStableswapFactoryNG": "0x1764ee18e8B3ccA4787249Ceb249356192594585" + }, + "xlayer": { + "gasTokenDummy": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + "metapoolBases": {}, + "CurveStableswapFactoryNG": "0x5eee3091f747e60a045a2e715a4c71e600e31f6e" } } \ No newline at end of file diff --git a/projects/curve/index.js b/projects/curve/index.js index 4844798d5e5e..fccd53fa7cf1 100644 --- a/projects/curve/index.js +++ b/projects/curve/index.js @@ -23,7 +23,8 @@ const chains = [ "celo", "kava", "base", - "fraxtal" + "fraxtal", + "xlayer" ]; // Object.keys(contracts); const registryIds = { stableswap: 0, From 28fd9020b75310bc8537a8787e1fcbee791ebdb5 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Tue, 28 May 2024 11:57:50 +0100 Subject: [PATCH 098/855] remove crvusd blacklist --- projects/curve/contracts.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/projects/curve/contracts.json b/projects/curve/contracts.json index 8045849a705b..6f0c4a5c7e2d 100644 --- a/projects/curve/contracts.json +++ b/projects/curve/contracts.json @@ -124,9 +124,6 @@ "stableFactory": "0x3093f9B57A428F3EB6285a589cb35bEA6e78c336", "cryptoFactory": "0x5EF72230578b3e399E6C6F4F6360edF95e83BBfd" }, - "blacklist": [ - "0x417Ac0e078398C154EdFadD9Ef675d30Be60Af93" - ], "CurveStableswapFactoryNG": "0xd2002373543Ce3527023C75e7518C274A51ce712" }, "optimism": { From f451df6d30413e89fc04a566e5b1b5bcefc0f9b5 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Tue, 28 May 2024 12:02:57 +0100 Subject: [PATCH 099/855] readd more crvusd --- projects/curve/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/curve/index.js b/projects/curve/index.js index fccd53fa7cf1..0d39815a9aaa 100644 --- a/projects/curve/index.js +++ b/projects/curve/index.js @@ -182,7 +182,7 @@ async function unwrapPools({ poolList, registry, chain, block }) { } const blacklists = { - ethereum: ['0x6b8734ad31d42f5c05a86594314837c416ada984', '0x95ECDC6caAf7E4805FCeF2679A92338351D24297', '0x5aa00dce91409b58b6a1338639b9daa63eb22be7', '0xEf1385D2b5dc6D14d5fecB86D53CdBefeCA20fcC', ADDRESSES.ethereum.CRVUSD, '0x29b41fe7d754b8b43d4060bb43734e436b0b9a33'], + ethereum: ['0x6b8734ad31d42f5c05a86594314837c416ada984', '0x29b41fe7d754b8b43d4060bb43734e436b0b9a33'], arbitrum: ['0x3aef260cb6a5b469f970fae7a1e233dbd5939378'], } From fb9a94f80c751a8054d87207f738ebd45f1ae052 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Tue, 28 May 2024 13:17:51 +0100 Subject: [PATCH 100/855] missing wallets safe (#10406) --- projects/treasury/safe.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/projects/treasury/safe.js b/projects/treasury/safe.js index f86dddf3eb6d..4bede95630f5 100644 --- a/projects/treasury/safe.js +++ b/projects/treasury/safe.js @@ -2,6 +2,10 @@ const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress,treasuryExports } = require("../helper/treasury"); const treasury = "0x3EDf6868d7c42863E44072DaEcC16eCA2804Dea1" // +const SAFE = "0x5afe3855358e112b5647b952709e6165e1c1eeee" +const safe_foundation_treasury = "0x1d4f25bc16b68c50b78e1040bc430a8097fd6f45" +const safe_dao_2 = "0x0b00b3227a5f3df3484f03990a87e02ebad2f888" + module.exports = treasuryExports({ optimism: { @@ -11,5 +15,12 @@ module.exports = treasuryExports({ ], owners: [treasury], }, + ethereum: { + tokens: [ + nullAddress, + ], + owners: [safe_foundation_treasury, safe_dao_2], + ownTokens: [SAFE], + }, }) \ No newline at end of file From 26ad1978ad0e2bb2666024079407a074b05708af Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Tue, 28 May 2024 13:27:53 +0100 Subject: [PATCH 101/855] add manta to uni v3 (#10407) --- projects/uniswap/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index 6e381b717b54..0f16a9b5c9b4 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -82,6 +82,7 @@ module.exports = { scroll: { factory: "0x70C62C8b8e801124A4Aa81ce07b637A3e83cb919", fromBlock: 1367, }, blast: { factory: "0x792edade80af5fc680d96a2ed80a44247d2cf6fd", fromBlock: 400903, }, linea: { factory: "0x31FAfd4889FA1269F7a13A66eE0fB458f27D72A9", fromBlock: 25247, }, + manta: {factory: "0x06D830e15081f65923674268121FF57Cc54e4e23", fromBlock: 1191705} }), filecoin: { tvl: filecoinTvl }, } From 6b995eb375cee98e17a48028bacc50f5c15177ff Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Tue, 28 May 2024 15:45:29 +0100 Subject: [PATCH 102/855] taiko --- projects/taiko-bridge/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 projects/taiko-bridge/index.js diff --git a/projects/taiko-bridge/index.js b/projects/taiko-bridge/index.js new file mode 100644 index 000000000000..34c4bc6c92f0 --- /dev/null +++ b/projects/taiko-bridge/index.js @@ -0,0 +1,15 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +module.exports = { + ethereum: { + tvl: async ({ api }) => + sumTokens2({ + api, + owners: [ + "0xd60247c6848B7Ca29eDdF63AA924E53dB6Ddd8EC", + "0x996282cA11E5DEb6B5D122CC3B9A1FcAAD4415Ab", + ], + fetchCoValentTokens: true, + }), + }, +}; From 042769a86d9fd3c1875ac6d3f09016c221fbaf49 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Tue, 28 May 2024 16:39:22 +0100 Subject: [PATCH 103/855] add bsc --- projects/curve/contracts.json | 5 +++++ projects/curve/index.js | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/curve/contracts.json b/projects/curve/contracts.json index 6f0c4a5c7e2d..212669dc4bd6 100644 --- a/projects/curve/contracts.json +++ b/projects/curve/contracts.json @@ -166,5 +166,10 @@ "gasTokenDummy": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", "metapoolBases": {}, "CurveStableswapFactoryNG": "0x5eee3091f747e60a045a2e715a4c71e600e31f6e" + }, + "bsc": { + "gasTokenDummy": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + "metapoolBases": {}, + "CurveStableswapFactoryNG": "0xd7e72f3615aa65b92a4dbdc211e296a35512988b" } } \ No newline at end of file diff --git a/projects/curve/index.js b/projects/curve/index.js index 0d39815a9aaa..a1ca3c7a6efa 100644 --- a/projects/curve/index.js +++ b/projects/curve/index.js @@ -24,7 +24,8 @@ const chains = [ "kava", "base", "fraxtal", - "xlayer" + "xlayer", + "bsc" ]; // Object.keys(contracts); const registryIds = { stableswap: 0, From 32efa9a920958a64a8be0f9f01c44207c8c30706 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Tue, 28 May 2024 18:41:00 +0100 Subject: [PATCH 104/855] new puff contracts --- projects/puff-penthouse/index.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/projects/puff-penthouse/index.js b/projects/puff-penthouse/index.js index ceae2c0c6d75..fae3fa70783d 100644 --- a/projects/puff-penthouse/index.js +++ b/projects/puff-penthouse/index.js @@ -1,13 +1,14 @@ const { sumTokensExport } = require('../helper/unwrapLPs') -const { staking } = require('../helper/staking') +const { stakings } = require('../helper/staking') module.exports = { mantle: { - staking: staking("0xBeCd6b3D8B06479c83533f0d7E6DF1b0e413AeEa", "0x26a6b0dcdCfb981362aFA56D581e4A7dBA3Be140"), + staking: stakings( + ["0xBeCd6b3D8B06479c83533f0d7E6DF1b0e413AeEa", "0x1260140fEa31cf920D7D890aD1de85cbAC1Fea12", "0x35Ee9e36804d358A2892FA0De336426cC3Cb18e4"], + "0x26a6b0dcdCfb981362aFA56D581e4A7dBA3Be140"), tvl: sumTokensExport({ - tokensAndOwners: [ - ["0xcDA86A272531e8640cD7F1a92c01839911B90bb0", "0x0CC41C11878254aF8E65ca61C03DD03735F2DC6d"] - ] + tokens: ["0xcDA86A272531e8640cD7F1a92c01839911B90bb0"], + owners: ["0x0CC41C11878254aF8E65ca61C03DD03735F2DC6d", "0x1260140fEa31cf920D7D890aD1de85cbAC1Fea12", "0x35Ee9e36804d358A2892FA0De336426cC3Cb18e4"] }), }, }; From 5e0f3745787c7e5cc2bcff5a91cec237b1f15e68 Mon Sep 17 00:00:00 2001 From: 0xbitu Date: Wed, 29 May 2024 16:12:02 +0800 Subject: [PATCH 105/855] add BITU --- projects/bitu-protocol/index.js | 11 +++++++++++ projects/helper/coreAssets.json | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 projects/bitu-protocol/index.js diff --git a/projects/bitu-protocol/index.js b/projects/bitu-protocol/index.js new file mode 100644 index 000000000000..d3d29d110a7b --- /dev/null +++ b/projects/bitu-protocol/index.js @@ -0,0 +1,11 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const BITU = ADDRESSES.bsc.BITU; + +module.exports = { + bsc: { + tvl: async (api) => { + const supply = await api.call({ abi: "erc20:totalSupply", target: BITU }); + api.add(BITU, supply); + }, + }, +}; diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index eee6a5af45c6..31a8dd620d8b 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -125,7 +125,8 @@ "IVN": "0x6a46d878401f46b4c7f665f065e0667580e031ec", "ankrBNB": "0xe85afccdafbe7f2b096f268e31cce3da8da2990a", "aBNBb": "0xbb1aa6e59e5163d8722a122cd66eba614b59df0d", - "TUSD": "0x40af3827f39d0eacbf4a168f8d4ee67c121d11c9" + "TUSD": "0x40af3827f39d0eacbf4a168f8d4ee67c121d11c9", + "BITU": "0x654A32542A84bEA7D2c2C1A1Ed1AAAf26888E6bD" }, "polygon": { "WMATIC": "0xfd28c7cea3c50a060cb4c0059e453c6d4dd9829d", From eed8e411a5f5b050e44598be915b510600ff3fd0 Mon Sep 17 00:00:00 2001 From: George Date: Wed, 29 May 2024 18:26:31 +0400 Subject: [PATCH 106/855] feat: lynx adapter --- projects/lynx/index.js | 125 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 projects/lynx/index.js diff --git a/projects/lynx/index.js b/projects/lynx/index.js new file mode 100644 index 000000000000..1920f7a7d222 --- /dev/null +++ b/projects/lynx/index.js @@ -0,0 +1,125 @@ +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const config = { + linea: { + tokenAndOwnerPair: [ + [ + // veLVC Token + "0xcc22F6AA610D1b2a0e89EF228079cB3e1831b1D1", + // OFTChipAdapter (owner) + "0xc5e782e2a4e2cfcb7ed454cf5a7b6aa2bb424b90", + ], + ], + }, + fuse: { + tokenAndOwnerPair: [ + [ + // WFUSE Token + "0x0BE9e53fd7EDaC9F859882AfdDa116645287C629", + // OFTChipAdapter (owner) + "0x962FD1B229c8c775bC2E37A8a90dac4f3C0105B7", + ], + [ + // MST Token + "0x2363Df84fDb7D4ee9d4E1A15c763BB6b7177eAEe", + // OFTChipAdapter (owner) + "0x028815b56433a4AAe10087290d1Ed9Ef7437068F", + ], + [ + // sFUSE Token + "0xb1DD0B683d9A56525cC096fbF5eec6E60FE79871", + // OFTChipAdapter (owner) + "0x707f3d554B47E17F1FDfb408FE091B39D51929CF", + ], + [ + // VOLT Token + "0xC5E782E2A4E2cFCb7eD454CF5a7b6aa2bB424B90", + // OFTChipAdapter (owner) + "0x094DE4d315198Df981D3a20ceFc3381B2182a572", + ], + ], + }, + arbitrum: { + tokenAndOwnerPair: [ + [ + // stEUR Token + "0x004626a008b1acdc4c74ab51644093b155e59a23", + // OFTChipAdapter (owner) + "0xc5e782e2a4e2cfcb7ed454cf5a7b6aa2bb424b90", + ], + [ + // TST Token + "0xf5a27e55c748bcddbfea5477cb9ae924f0f7fd2e", + // OFTChipAdapter (owner) + "0xd22c72ab0f4967edb876d84773bff0b60a92e51a", + ], + [ + // EUROs Token + "0x643b34980e635719c15a2d4ce69571a258f940e9", + // OFTChipAdapter (owner) + "0x3552fe61af3f6d3235dd1cb75402d4281d1fbac6", + ], + [ + // GRAI Token + "0x894134a25a5faC1c2C26F1d8fBf05111a3CB9487", + // OFTChipAdapter (owner) + "0xBe1fa4177fBf43683434CecD5563DA6Ea00FD474", + ], + ], + }, + optimism: { + tokenAndOwnerPair: [ + [ + // SONNE Token + "0x1db2466d9f5e10d7090e7152b68d62703a2245f0", + // OFTChipAdapter (owner) + "0xc5e782e2a4e2cfcb7ed454cf5a7b6aa2bb424b90", + ], + ], + }, + polygon: { + tokenAndOwnerPair: [ + [ + // MAI Token + "0xa3fa99a148fa48d14ed51d610c367c61876997f1", + // OFTChipAdapter (owner) + "0x7279d1cff1510e503b6be64fbbad64088034504c", + ], + [ + // WMATIC Token + "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", + // OFTChipAdapter (owner) + "0x028815b56433a4aae10087290d1ed9ef7437068f", + ], + ], + }, + mantle: { + tokenAndOwnerPair: [ + [ + // aUSD Token + "0xD2B4C9B0d70e3Da1fBDD98f469bD02E77E12FC79", + // OFTChipAdapter (owner) + "0xC5E782E2A4E2cFCb7eD454CF5a7b6aa2bB424B90", + ], + ], + }, + bsc: { + tokenAndOwnerPair: [ + [ + // lisUSD Token + "0x0782b6d8c4551B9760e74c0545a9bCD90bdc41E5", + // OFTChipAdapter (owner) + "0x3b7ed1cdf0fc64d95c0d0428b9cc99b6a9a5cb94", + ], + ], + }, +}; + +Object.keys(config).forEach((chain) => { + const { tokenAndOwnerPair } = config[chain]; + module.exports[chain] = { + tvl: sumTokensExport({ + tokensAndOwners: tokenAndOwnerPair, + }), + }; +}); From a2fbed8012cb577cc82b7b581b6507978c16b056 Mon Sep 17 00:00:00 2001 From: particle-deployer <130306380+particle-deployer@users.noreply.github.com> Date: Wed, 29 May 2024 08:34:03 -0700 Subject: [PATCH 107/855] Adding a new vault for Ethena (USDe) integration on Blast (#10424) * ethena connection * minor fix --------- Co-authored-by: Wukong Particle Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/astaria-v2/index.js | 6 ++---- projects/helper/tokenMapping.js | 1 + projects/particle-trade-duo/index.js | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/projects/astaria-v2/index.js b/projects/astaria-v2/index.js index 1e83bbd68756..6af422d549fe 100644 --- a/projects/astaria-v2/index.js +++ b/projects/astaria-v2/index.js @@ -1,8 +1,6 @@ const { treasuryExports } = require("../helper/treasury"); -const ADDRESSES = require('../helper/coreAssets.json') module.exports = treasuryExports({ - base: { - owners: ["0x0000000000A6F0986c92cf1EC4d2e77aFBE1466D"], - }, + base: { owners: ["0x0000000000A6F0986c92cf1EC4d2e77aFBE1466D"], }, + ethereum: { owners: ['0x0000000000A6F0986c92cf1EC4d2e77aFBE1466D'], }, }) \ No newline at end of file diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index d6b63304d35c..1b8c6abacebe 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -78,6 +78,7 @@ const fixBalancesTokens = { '0xf7bc58b8d8f97adc129cfc4c9f45ce3c0e1d2692': { coingeckoId: "wrapped-bitcoin", decimals: 8 }, '0x9e0d7d79735e1c63333128149c7b616a0dc0bbdb': { coingeckoId: "weth", decimals: 18 }, //pirex eth '0xde55b113a27cc0c5893caa6ee1c020b6b46650c0': { coingeckoId: "deus-finance-2", decimals: 18 }, // deus + '0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34': { coingeckoId: "ethena-usde", decimals: 18 }, }, solana: { 'AZsHEMXd36Bj1EMNXhowJajpUXzrKcK57wW4ZGXVa7yR': { coingeckoId: "guacamole", decimals: 5 }, diff --git a/projects/particle-trade-duo/index.js b/projects/particle-trade-duo/index.js index e8087e409c71..819a47b4d14b 100644 --- a/projects/particle-trade-duo/index.js +++ b/projects/particle-trade-duo/index.js @@ -1,4 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') const config = { blast: { weth90d: '0xc932317385fDc794633f612874BD687eA987B151', @@ -24,6 +25,13 @@ const wrappedNativeTokenMap = { } } +const usdeVaults = { + blast: { + vault: '0xeEa70D690C6c9c5534FcB90b6b0aE71199C7d4d3', + fwUSDe: '0x04efc000dC9c27445b092622f42e09E173beE61f', + } +} + Object.keys(config).forEach(chain => { module.exports[chain] = { tvl: async (api) => { @@ -41,6 +49,15 @@ Object.keys(config).forEach(chain => { const wrappedBalances = await api.multiCall({ abi: 'uint256:totalSupply', calls: wrappedTokens}) const nativeTokens = wrappedTokens.map(wrappedToken => wrappedNativeTokenMap[chain][wrappedToken]) api.add(nativeTokens, wrappedBalances); + + let usdeVault = usdeVaults[chain] + const wrappedUSDeBalance = await api.call({ + abi: 'erc20:balanceOf', + target: usdeVault.fwUSDe, + params: usdeVault.vault + }); + api.add('0x5d3a1ff2b6bab83b63cd9ad0787074081a52ef34', wrappedUSDeBalance) + return sumTokens2({ api }) } } }) \ No newline at end of file From 823d48526a8a2797197b0fd6cd05451382dfeb6c Mon Sep 17 00:00:00 2001 From: bitpartylabs003 Date: Wed, 29 May 2024 23:41:38 +0800 Subject: [PATCH 108/855] update bitpary token (#10420) * Create index.js * Update index.js supplement token * Update bitparyt index.js supplement token --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/bitparty/index.js | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/projects/bitparty/index.js b/projects/bitparty/index.js index e7d2ae6e842c..e6927521d13c 100644 --- a/projects/bitparty/index.js +++ b/projects/bitparty/index.js @@ -1,11 +1,24 @@ -const { sumTokens2, } = require('../helper/unwrapLPs') +const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs') -async function tvl(api) { - - return sumTokens2({ owners: [ - '0xb002b938d63fe8762f2a0eff9e49a8e20a0078e8', - ], tokens: ['0xef63d4e178b3180beec9b0e143e0f37f4c93f4c2', '0xfe9f969faf8ad72a83b761138bf25de87eff9dd2', '0x9827431e8b77e87c9894bd50b055d6be56be0030', '0xfF204e2681A6fA0e2C3FaDe68a1B28fb90E4Fc5F', '0x07373d112edc4570b46996ad1187bc4ac9fb5ed0'], api, }) //wbtc and usdt -} module.exports = { - btr: { tvl, } + btr: { + tvl: sumTokensExport({ + owners: ['0xb002b938d63fe8762f2a0eff9e49a8e20a0078e8',], + tokens: [ + nullAddress, + '0xef63d4e178b3180beec9b0e143e0f37f4c93f4c2', + '0xfe9f969faf8ad72a83b761138bf25de87eff9dd2', + '0x9827431e8b77e87c9894bd50b055d6be56be0030', + '0xfF204e2681A6fA0e2C3FaDe68a1B28fb90E4Fc5F', + '0x07373d112edc4570b46996ad1187bc4ac9fb5ed0', + '0x2729868df87d062020e4a4867ff507fb52ee697c', + '0x68879ca2af24941fc3b6eb89fdb26a98aa001fc1', + '0xf6718b2701d4a6498ef77d7c152b2137ab28b8a3', + '0xe277aed3ff3eb9824edc52fe7703df0c5ed8b313', + '0xf6fa83e30c7d3978f86141016ee9471d77f48ae0', + '0xbb0cb5c5e49d5c3903932d07831fb8c1bb1651d2', + '0xab7f136bbb18808f0c981d0307d3360ca92ad171' + ], + }), + } } From 40aa7d6d57d72c9c89c0091689afb6bd96b0fb82 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 29 May 2024 17:52:34 +0200 Subject: [PATCH 109/855] update dtx --- projects/dtx/index.js | 57 +++++++++++++++++++++++--------------- projects/helper/erc4626.js | 6 ++-- 2 files changed, 38 insertions(+), 25 deletions(-) diff --git a/projects/dtx/index.js b/projects/dtx/index.js index c2fcfa9561e6..46c6a71b9e85 100644 --- a/projects/dtx/index.js +++ b/projects/dtx/index.js @@ -3,29 +3,40 @@ const sdk = require("@defillama/sdk") const { sumTokensExport } = require("../helper/unwrapLPs") const ADDRESSES = require("../helper/coreAssets.json") -const vaultTvl = sumERC4626VaultsExport({ - vaults: [ - "0x56e0f6DF03883611C9762e78d4091E39aD9c420E", - "0x3D4621fa5ff784dfB2fcDFd5B293224167F239db", - "0xe97D34E531E1b299047A94Fc6854289830362d8f", - "0xBa95FCe6c2683C29bD963dd201CA8ee8f3605801", - "0x037A168876d3027b1384FD1752fEAa52407726dB", - "0x3031F6c8958Cf093377c11b3871BD23AEA5e5865", - "0x802B1f8e092AC4469B30C7560266F9a6f8CA450F", - ], - isOG4626: true, -}) - -const otherTvl = sumTokensExport({ - tokens: [ADDRESSES.blast.USDB, ADDRESSES.blast.WETH, ADDRESSES.blast.ezETH], - owners: [ - "0x9AdF2b330697C6816176491E1fd5503BB746d1d8", - "0x0E5b7DDbF37d92B21512Ae5A6CE66aEfA7A7828F", - ], -}) - -module.exports = { +const config = { blast: { - tvl: sdk.util.sumChainTvls([vaultTvl, otherTvl]), + vaults: [ + "0x56e0f6DF03883611C9762e78d4091E39aD9c420E", + "0x3D4621fa5ff784dfB2fcDFd5B293224167F239db", + "0xe97D34E531E1b299047A94Fc6854289830362d8f", + "0xBa95FCe6c2683C29bD963dd201CA8ee8f3605801", + "0x037A168876d3027b1384FD1752fEAa52407726dB", + "0x3031F6c8958Cf093377c11b3871BD23AEA5e5865", + "0x802B1f8e092AC4469B30C7560266F9a6f8CA450F", + ], + tokenConfig: { + tokens: [ADDRESSES.blast.USDB, ADDRESSES.blast.WETH, ADDRESSES.blast.ezETH], + owners: [ + "0x9AdF2b330697C6816176491E1fd5503BB746d1d8", + "0x0E5b7DDbF37d92B21512Ae5A6CE66aEfA7A7828F", + ], + }, }, + taiko: { + vaults: ['0xdA6a745740Bbdbe5F588b79FEe57f2e10ad4Da11'], + tokenConfig: { + tokens: ['0xa51894664a773981c6c112c43ce576f315d5b1b6'], + owners: [ + "0xc0ab776604059D10880dbD219758FF7B82997cc0", + "0xB00231B308B01Dbb90f16F966F62d86fBc78c450", + ], + }, + } } + +Object.keys(config).forEach(chain => { + const { vaults, tokenConfig, } = config[chain] + const vaultTvl = sumERC4626VaultsExport({ vaults, isOG4626: true }) + const otherTvl = sumTokensExport(tokenConfig) + module.exports[chain] = { tvl: sdk.util.sumChainTvls([vaultTvl, otherTvl]), } +}) \ No newline at end of file diff --git a/projects/helper/erc4626.js b/projects/helper/erc4626.js index 0ea9385689d0..6813fcc3bba2 100644 --- a/projects/helper/erc4626.js +++ b/projects/helper/erc4626.js @@ -1,12 +1,14 @@ +const { sumTokens2 } = require("./unwrapLPs") async function sumERC4626Vaults({ api, ...options }) { await api.erc4626Sum({ ...options }) return api.getBalances() } -function sumERC4626VaultsExport({ vaults, ...options}) { +function sumERC4626VaultsExport({ vaults, ...options }) { return async (api) => { - return sumERC4626Vaults({ ...options, api, calls: vaults }) + await sumERC4626Vaults({ ...options, api, calls: vaults }) + return sumTokens2({ api }) // hack to transform tokens } } From 823c0ff8c076661cf3e54af14d72188d6d158aa5 Mon Sep 17 00:00:00 2001 From: Greg Date: Wed, 29 May 2024 12:56:22 -0300 Subject: [PATCH 110/855] Add blast and base support for metastreet-v2 (#10417) --- projects/metastreet-v2/index.js | 54 +++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/projects/metastreet-v2/index.js b/projects/metastreet-v2/index.js index c957e9f7bc69..d8c8c0c05d70 100644 --- a/projects/metastreet-v2/index.js +++ b/projects/metastreet-v2/index.js @@ -1,20 +1,38 @@ const abi = require("./abi.json"); -const { sumTokens2 } = require("../helper/unwrapLPs") +const { sumTokens2 } = require("../helper/unwrapLPs"); -const METASTREET_POOL_FACTORY = "0x1c91c822F6C5e117A2abe2B33B0E64b850e67095"; +const METASTREET_POOL_FACTORY = { + ethereum: "0x1c91c822F6C5e117A2abe2B33B0E64b850e67095", + base: "0x41cF7ea4Ba650191e829A6bD31B9e2049C78D858", + blast: "0x5F42c24Af1227c3c669035a6cB549579ed0F99dF", +}; const MAX_UINT_128 = "0xffffffffffffffffffffffffffffffff"; async function tvl(api) { - const pools = await api.call({ target: METASTREET_POOL_FACTORY, abi: abi.getPools, }) - const tokens = await api.multiCall({ abi: abi.currencyToken, calls: pools, }) - const ct = await api.multiCall({ abi: abi.collateralToken, calls: pools, }) + const pools = await api.call({ + target: METASTREET_POOL_FACTORY[api.chain], + abi: abi.getPools, + }); + const tokens = await api.multiCall({ abi: abi.currencyToken, calls: pools }); + const ct = await api.multiCall({ abi: abi.collateralToken, calls: pools }); const ownerTokens = pools.map((pool, i) => [[tokens[i], ct[i]], pool]); return sumTokens2({ api, ownerTokens, permitFailure: true }); } async function borrowed(api) { - const pools = await api.call({ target: METASTREET_POOL_FACTORY, abi: abi.getPools, }) - const tokens = await api.multiCall({ abi: abi.currencyToken, calls: pools, }) + const pools = await api.call({ + target: METASTREET_POOL_FACTORY[api.chain], + abi: abi.getPools, + }); + const tokens = await api.multiCall({ abi: abi.currencyToken, calls: pools }); + const tokenDecimals = await api.multiCall({ + abi: "erc20:decimals", + calls: tokens.map((token) => ({ target: token })), + }); + const decimalsMap = {}; + tokens.forEach((token, index) => { + decimalsMap[token] = tokenDecimals[index]; + }); const poolsBorrowedValue = ( await api.multiCall({ abi: abi.liquidityNodes, @@ -23,14 +41,32 @@ async function borrowed(api) { params: [0, MAX_UINT_128], })), }) - ).map((i) => i.reduce((partialSum, node) => partialSum + +node.value - +node.available, 0)); + ).map((liquidityNodes, poolIndex) => { + const token = tokens[poolIndex]; + const decimals = decimalsMap[token]; + const scalingFactor = 10 ** (18 - decimals); + + return liquidityNodes.reduce((partialSum, node) => { + const scaledValue = (+node.value - +node.available) / scalingFactor; + return partialSum + scaledValue; + }, 0); + }); api.addTokens(tokens, poolsBorrowedValue); return api.getBalances(); } module.exports = { ethereum: { - tvl, borrowed, + tvl, + borrowed, + }, + base: { + tvl, + borrowed, + }, + blast: { + tvl, + borrowed, }, methodology: "TVL is calculated by summing the value of token balances and NFTs across all MetaStreet pools. Total borrowed is calculated by subtracting the tokens available from the total value of all liquidity nodes across all pools.", From 54168664aac10116dacd6a7772603f8b4f8da9b1 Mon Sep 17 00:00:00 2001 From: chirag-phoenix <168807722+chirag-phoenix@users.noreply.github.com> Date: Wed, 29 May 2024 21:32:45 +0530 Subject: [PATCH 111/855] feat: Add bluelotusdao project (#10416) * feat: Add bluelotusdao project * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/bluelotusdao/index.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 projects/bluelotusdao/index.js diff --git a/projects/bluelotusdao/index.js b/projects/bluelotusdao/index.js new file mode 100644 index 000000000000..fb24fa08ec5f --- /dev/null +++ b/projects/bluelotusdao/index.js @@ -0,0 +1,3 @@ + +const { uniTvlExport } = require('../helper/unknownTokens') +module.exports = uniTvlExport('genesys', '0x5c4619104985163b3839dA465232B6D2a9588E7B') \ No newline at end of file From 88711c92e853f042280a982e690a9376bdb10cd3 Mon Sep 17 00:00:00 2001 From: Strategic Reserve Date: Wed, 29 May 2024 09:07:01 -0700 Subject: [PATCH 112/855] add kinetix base (#10414) --- projects/visor/config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/visor/config.js b/projects/visor/config.js index 03b526422404..b2832d59d82f 100644 --- a/projects/visor/config.js +++ b/projects/visor/config.js @@ -86,6 +86,7 @@ const HYPE_REGISTRY = { ["0x39ce2eB762e7bFe19b6AD4D5bA384c67CE4051f0", 7310157], // Swapbased ["0x8118C33513feC13f8cf488CCb4509190650F0e92", 7310111], // Baseswap ["0xf1DF4F17e34Ba710DfFC487F73f1e19476E815a6", 8743213], // Thick + ["0xe1cd1c2d2e4B44dE211D554649BC7dc49eF07784", 15063294], // Kinetix ], kava: [ ["0x683292172E2175bd08e3927a5e72FC301b161300", 6384272], // Kinetix From 6f04de262bd804545d6c1bdb8d9d4aba782c5d06 Mon Sep 17 00:00:00 2001 From: Brandon Date: Wed, 29 May 2024 09:07:44 -0700 Subject: [PATCH 113/855] Update/add staking pool (#10413) * Staking pool and TT subgraph url update * Add ztx staking pool * update subgraph endpoint * update avax endpoint * Add stake pool --- projects/steer/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/steer/index.js b/projects/steer/index.js index 24e7646c7c6b..c2d3262336e3 100644 --- a/projects/steer/index.js +++ b/projects/steer/index.js @@ -167,7 +167,8 @@ module.exports.arbitrum.staking = stakings( "0x25Ef108B328Cf752F0E0b0169D499Db164173763", "0x0b619438d1E8b8c205656502de59Af2Af71C43e0", "0xaCdC6fC8F84fbA26f065489a7bf5837D7CDf546F", - "0xff46e1B60dD9De89Aa04902D5c3c5ca01f8576A4" + "0xff46e1B60dD9De89Aa04902D5c3c5ca01f8576A4", + "0x1E6a358a1721e0D2B84f39FD328FC03A1b6e863B" ], "0x1C43D05be7E5b54D506e3DdB6f0305e8A66CD04e", "arbitrum" From 7b2ba0b28712cb8a0ca35d7254cc00aa52409887 Mon Sep 17 00:00:00 2001 From: m66260 <117136064+m66260@users.noreply.github.com> Date: Wed, 29 May 2024 12:08:35 -0400 Subject: [PATCH 114/855] Update D8X TVL with Arbitrum funds (#10412) * add arbitrum * remove log --- projects/d8x/index.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/projects/d8x/index.js b/projects/d8x/index.js index 0c891e749783..474940d7094d 100644 --- a/projects/d8x/index.js +++ b/projects/d8x/index.js @@ -1,9 +1,10 @@ const abi = require("./abi-poolInfo.json"); -const { sumTokens2 } = require('../helper/unwrapLPs') +const { sumTokens2 } = require("../helper/unwrapLPs"); const config = { - polygon_zkevm: { factory: "0xaB7794EcD2c8e9Decc6B577864b40eBf9204720f", }, - xlayer: { factory: "0xb24dB543749277E8625a59C061aE7574C8235475", }, + polygon_zkevm: { factory: "0xaB7794EcD2c8e9Decc6B577864b40eBf9204720f" }, + xlayer: { factory: "0xb24dB543749277E8625a59C061aE7574C8235475" }, + arbitrum: { factory: "0x8f8BccE4c180B699F81499005281fA89440D1e95" }, }; async function tvl(api) { @@ -15,13 +16,14 @@ async function tvl(api) { }); const marginTokens = exchangeInfo[2]; - return sumTokens2({ api, owner: factory, tokens: marginTokens, }); + return sumTokens2({ api, owner: factory, tokens: marginTokens }); } module.exports = { - methodology: "adds up the balances of all liquidity pools in the D8X exchange", + methodology: + "adds up the balances of all liquidity pools in the D8X exchange", }; -Object.keys(config).forEach(chain => { +Object.keys(config).forEach((chain) => { module.exports[chain] = { tvl }; -}); \ No newline at end of file +}); From 2896598e21e86d169a56daaf5a62e87884c488a1 Mon Sep 17 00:00:00 2001 From: Luren L Date: Wed, 29 May 2024 12:15:38 -0400 Subject: [PATCH 115/855] update NAVI tvl (#10410) * update NAVI tvl Add NAVX and VSUI token address to the core token address * revert change --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/coreAssets.json | 2 +- projects/navi/index.js | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index eee6a5af45c6..65840e33f1a7 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1775,4 +1775,4 @@ "btr": { "ETH": "0xef63d4e178b3180beec9b0e143e0f37f4c93f4c2" } -} +} \ No newline at end of file diff --git a/projects/navi/index.js b/projects/navi/index.js index 4c35743ae7de..24a12baa10c0 100644 --- a/projects/navi/index.js +++ b/projects/navi/index.js @@ -13,10 +13,10 @@ async function borrow(api) { const storageObject = await sui.getObject(storageId); const reservesId = storageObject.fields.reserves.fields.id.id - const dynamicFields = await sui.getDynamicFieldObjects({parent: reservesId}) + const dynamicFields = await sui.getDynamicFieldObjects({ parent: reservesId }) dynamicFields.forEach((data) => { const coin = '0x' + data.fields.value.fields.coin_type - const borrowed = data.fields.value.fields.borrow_balance.fields.total_supply + const borrowed = data.fields.value.fields.borrow_balance.fields.total_supply * data.fields.value.fields.current_borrow_index / 1e27 const amount = borrowed * (10 ** (decimalShift[coin] ?? 0)) api.add(coin, amount) }) @@ -27,16 +27,18 @@ async function tvl(api) { const storageObject = await sui.getObject(storageId); const reservesId = storageObject.fields.reserves.fields.id.id - const dynamicFields = await sui.getDynamicFieldObjects({parent: reservesId}) + const dynamicFields = await sui.getDynamicFieldObjects({ parent: reservesId }) + dynamicFields.forEach(object => { const coin = '0x' + object.fields.value.fields.coin_type - const total_supply = object.fields.value.fields.supply_balance.fields.total_supply - const borrowed = object.fields.value.fields.borrow_balance.fields.total_supply + const total_supply = object.fields.value.fields.supply_balance.fields.total_supply * object.fields.value.fields.current_supply_index / 1e27 + const borrowed = object.fields.value.fields.borrow_balance.fields.total_supply * object.fields.value.fields.current_borrow_index / 1e27 const amount = (total_supply - borrowed) * (10 ** (decimalShift[coin] ?? 0)) api.add(coin, amount) }) } + module.exports = { timetravel: false, sui: { From 82f65910fb86fc7e328dd871980a4eb53020ae90 Mon Sep 17 00:00:00 2001 From: Aleksei Lushnikov Date: Wed, 29 May 2024 17:16:44 +0100 Subject: [PATCH 116/855] Symbiosis adds Taiko chain (#10408) * symbiosis adds Core chain support and some new tokens on portals * symbiosis adds Taiko chain --- projects/helper/coreAssets.json | 3 +++ projects/symbiosis-finance/config.js | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 65840e33f1a7..a333a8226f2e 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1774,5 +1774,8 @@ }, "btr": { "ETH": "0xef63d4e178b3180beec9b0e143e0f37f4c93f4c2" + }, + "taiko": { + "WETH": "0xA51894664A773981C6C112C43ce576f315d5b1B6" } } \ No newline at end of file diff --git a/projects/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js index fb87780cda42..db5d5e84c146 100644 --- a/projects/symbiosis-finance/config.js +++ b/projects/symbiosis-finance/config.js @@ -319,5 +319,14 @@ module.exports = { '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 ] }, + { + name: 'taiko', + tokens: [ + ADDRESSES.taiko.WETH, + ], + holders: [ + '0x5Aa5f7f84eD0E5db0a4a85C3947eA16B53352FD4', // portal v2 + ] + }, ] } \ No newline at end of file From ef2c2a4efb5f5e28db91dc60f54dd15369ef0b20 Mon Sep 17 00:00:00 2001 From: leeamijo <154820412+leeamijo@users.noreply.github.com> Date: Thu, 30 May 2024 02:20:38 +0800 Subject: [PATCH 117/855] add Pell Network (#10405) * add Pell Network * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/tokenMapping.js | 24 +++++++++++++++--------- projects/pell/index.js | 15 +++++++++++++++ 2 files changed, 30 insertions(+), 9 deletions(-) create mode 100644 projects/pell/index.js diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 1b8c6abacebe..2e201dc4e929 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -59,7 +59,7 @@ const fixBalancesTokens = { "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-17": { coingeckoId: "usd-coin", decimals: 6 }, "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-18": { coingeckoId: "tether", decimals: 6 }, }, - + acala: { ACA: { coingeckoId: "acala", decimals: 12 }, LDOT: { coingeckoId: "liquid-staking-dot", decimals: 10 }, @@ -75,7 +75,7 @@ const fixBalancesTokens = { KBTC: { coingeckoId: "kintsugi-btc", decimals: 8 }, }, blast: { - '0xf7bc58b8d8f97adc129cfc4c9f45ce3c0e1d2692': { coingeckoId: "wrapped-bitcoin", decimals: 8 }, + '0xf7bc58b8d8f97adc129cfc4c9f45ce3c0e1d2692': { coingeckoId: "wrapped-bitcoin", decimals: 8 }, '0x9e0d7d79735e1c63333128149c7b616a0dc0bbdb': { coingeckoId: "weth", decimals: 18 }, //pirex eth '0xde55b113a27cc0c5893caa6ee1c020b6b46650c0': { coingeckoId: "deus-finance-2", decimals: 18 }, // deus '0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34': { coingeckoId: "ethena-usde", decimals: 18 }, @@ -91,12 +91,18 @@ const fixBalancesTokens = { '0xFb8dBdc644eb54dAe0D7A9757f1e6444a07F8067': { coingeckoId: "bitcoin-trc20", decimals: 18 }, '0x85D431A3a56FDf2d2970635fF627f386b4ae49CC': { coingeckoId: "merlin-s-seal-btc", decimals: 18 }, }, - btr: { - '0x0000000000000000000000000000000000000000': { coingeckoId: 'bitcoin', decimals: 18 }, - '0xff204e2681a6fa0e2c3fade68a1b28fb90e4fc5f': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, - '0xfe9f969faf8ad72a83b761138bf25de87eff9dd2': { coingeckoId: 'tether', decimals: 6 }, - '0x9827431e8b77e87c9894bd50b055d6be56be0030': { coingeckoId: 'usd-coin', decimals: 6 }, - }, + btr: { + '0x0000000000000000000000000000000000000000': { coingeckoId: 'bitcoin', decimals: 18 }, + '0xff204e2681a6fa0e2c3fade68a1b28fb90e4fc5f': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, + '0xfe9f969faf8ad72a83b761138bf25de87eff9dd2': { coingeckoId: 'tether', decimals: 6 }, + '0x9827431e8b77e87c9894bd50b055d6be56be0030': { coingeckoId: 'usd-coin', decimals: 6 }, + + // fix these by pricing the tokens in coins repo + '0xd53E6f1d37f430d84eFad8060F9Fec558B36F6fa': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, + '0xf6718b2701d4a6498ef77d7c152b2137ab28b8a3': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, + '0x9a6ae5622990ba5ec1691648c3a2872469d161f9': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, + '0xA984b70f7B41EE736B487D5F3D9C1e1026476Ea3': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, + }, cyeth: { '0x4200000000000000000000000000000000000006': { coingeckoId: 'ethereum', decimals: 18 }, }, @@ -113,7 +119,7 @@ const fixBalancesTokens = { '0x2967e7bb9daa5711ac332caf874bd47ef99b3820': { coingeckoId: 'wrapped-stbtc', decimals: 18 }, }, real: { - '0x0000000000000000000000000000000000000000': { coingeckoId: 'bitcoin', decimals: 18 }, + '0x0000000000000000000000000000000000000000': { coingeckoId: 'bitcoin', decimals: 18 }, '0x90c6e93849e06ec7478ba24522329d14a5954df4': { coingeckoId: 'ethereum', decimals: 18 }, '0x75d0cbf342060b14c2fc756fd6e717dfeb5b1b70': { coingeckoId: 'dai', decimals: 18 }, '0x83fedbc0b85c6e29b589aa6bdefb1cc581935ecd': { coingeckoId: 'mountain-protocol-usdm', decimals: 18 }, diff --git a/projects/pell/index.js b/projects/pell/index.js new file mode 100644 index 000000000000..5a8ae0be27e4 --- /dev/null +++ b/projects/pell/index.js @@ -0,0 +1,15 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getConfig } = require('../helper/cache') + +const chains = ['merlin', 'bouncebit', 'btr', 'bsc',] + +chains.forEach(chain => { + module.exports[chain] = { + tvl: async function (api) { + const { result } = await getConfig(`pell/${api.chain}`, `https://api.pell.network/v1/stakeList?chainId=${api.chainId}`) + const vaults = result.map(f => f.strategyAddress) + const tokens = await api.multiCall({ abi: 'address:underlyingToken', calls: vaults }) + return sumTokens2({ api, tokensAndOwners2: [tokens, vaults], }) + } + } +}) From 8bfbced3ce93e3f658b503e610edf2b0c61b4053 Mon Sep 17 00:00:00 2001 From: TsimakuridzeNikolozi Date: Wed, 29 May 2024 22:29:15 +0400 Subject: [PATCH 118/855] Implemented hinkal Tvl calculation --- projects/hinkal/beefyTokens.js | 231 ++++++++++++++++ projects/hinkal/gaugeTokens.js | 250 +++++++++++++++++ projects/hinkal/hinkalUtils.js | 96 +++++++ projects/hinkal/index.js | 82 ++++-- projects/hinkal/owners.js | 19 ++ projects/hinkal/pendleTokens.js | 108 ++++++++ projects/hinkal/registryTokens.js | 443 ++++++++++++++++++++++++++++++ projects/hinkal/relayerUrls.js | 11 + 8 files changed, 1223 insertions(+), 17 deletions(-) create mode 100644 projects/hinkal/beefyTokens.js create mode 100644 projects/hinkal/gaugeTokens.js create mode 100644 projects/hinkal/hinkalUtils.js create mode 100644 projects/hinkal/owners.js create mode 100644 projects/hinkal/pendleTokens.js create mode 100644 projects/hinkal/registryTokens.js create mode 100644 projects/hinkal/relayerUrls.js diff --git a/projects/hinkal/beefyTokens.js b/projects/hinkal/beefyTokens.js new file mode 100644 index 000000000000..5ebae68f131f --- /dev/null +++ b/projects/hinkal/beefyTokens.js @@ -0,0 +1,231 @@ +const ETHEREUM_BEEFY_TOKENS = [ + "0xd4D620B23E91031fa08045b6083878f42558d6b9", + "0xe17D6212eAa54D98187026A770dee96f7C264feC", + "0xD1BeaD7CadcCC6b6a715A6272c39F1EC54F6EC99", + "0x047c41817954b51309a2bd6f60e47bC115C23f1F", + "0x6853691Ca8Da03Da16194E468068bE5A80F103b0", + "0xCc19786F91BB1F3F3Fd9A2eA9fD9a54F7743039E", + "0x4dE81AD42E9651755716177fAe9911c54F5b055B", + "0x06c1e90eeb34e7Fa6d78B8E58348Ae15C1a615E4", + "0xe50e2fe90745A8510491F89113959a1EF01AD400", + "0x8cB4f56e9bAa398b6F6a6Fb1B2C4E8ca8cda6ae5", + "0xd5bAd7c89028B3F7094e40DcCe83D4e6b3Fd9AA4", + "0x7f3F33B42b9734e61cb44424D130B5f6e09C9Db3", + "0x15780E0e9618c26dA679740C43bEc76830Ff187b", + "0xFc6a9D39b44a174B5Ba708dBaa437632d78B8585", + "0x83BE6565c0758f746c09f95559B45Cfb9a0FFFc4", + "0xfE5716D0C141F3d800995420e1d3fB0D0CFFCC31", + "0x4115150523599D1F6C6Fa27F5A4C27D578Fd8ce5", + "0x49b562bDcd28dB124f6bA51DEB8Ca483563c067a", + "0xBE2bD093B8F342e060E79Fad6059B1057F016Ba4", + "0x3fe43D4ba0a5BAcC800c7E7E782466a27ab108bf", + "0x4dd0cF20237deb5F2bE76340838B9e2D7c70E852", + "0xE0d5f9DA3613C047003b77cAa31270aBE3EdA6b0", + "0xB9911AB699FD781efDA446e7FD995d375B437c8B", + "0x37925b6319cD41014583A6476a7a1d52Ea404b2f", + "0xAE0bFfc3110e69DA8993F11C1CBd9a6eA3d16daF", +]; + +const ARBITRUM_BEEFY_TOKENS = [ + "0xB27c433C1cdb1B42E2601Af2d40dD442fbf1cdc3", + "0x30dF229cefa463e991e29D42DB0bae2e122B2AC7", + "0x9dbbBaecACEDf53d5Caa295b8293c1def2055Adc", + "0x8e0B8c8BB9db49a46697F3a5Bb8A308e744821D2", + "0x755D6688AD74661Add2FB29212ef9153D40fcA46", + "0x07Db98358D58Ba9bE90cd0A18cd86AF807ac3B4E", + "0x71c15610F11D669d4A9e02a64e43c6D1E27c6Cad", + "0xBDF4e730ED5152a7AC646BB7b514Ed624E1147C4", + "0xf6a1284Dc2ce247Bca885ac4F36b37E91d3bD032", + "0x994Ff2ab544D00aD4EC0380a1Be8F75f4EC47Cf9", + "0x46034C63ad03254D6E96c655e82393E6C31E07C3", + "0xD496eA90a454eA49e30A8fD9E053C186D4FC897D", + "0xd37025aC6227334C7762AeD5929Ce3272fbb6fdC", + "0xFCb0101503f399B4752E5160ccd5EcE3a71719bd", + "0xa7fC98760331409c1FC0177dECF083cE9d5aed87", + "0x5A8beF2fEb83057bBCcC81cea985a94a62A86208", + "0x5B904f19fb9ccf493b623e5c8cE91603665788b0", + "0xA98070C4a600678a93cEaF4bF629eE255F46f64F", + "0x0594Ec32240C78e056304b4A60f48a67c69179b4", + "0xB2DefC5c3A69abe2B681C714b080A892825B2073", + "0x4D323f77c32EDdC62BF8eAbA11E5C573FD0a2ccd", + "0xeD29730F9FF29ea50D63462D8EC84307d36b8954", + "0x12c997FAdca32dB01E3145DE7Bf9cdB06455391D", + "0x85B10228cd93A6e5E354Ff0f2c60875E8E62F65A", + "0xCF297A94d527A34081Db2A20Eb1c87248cD1ea81", + "0xa0d758b81f8ed6635CDE1DA91C8fe1bD48C28A09", + "0x5892bA611fdC1598b72a30D087d28c989d429eF7", +]; + +const OPTIMISM_BEEFY_TOKENS = [ + "0x107Dbf9c9C0EF2Df114159e5C7DC2baf7C444cFF", + "0x54214d0C7772eb6f71ED4De294b3f809691005C9", + "0xF731390c889d9a2089C5bC1d4640F3BA0708D82B", + "0xbe7dC3d2457BBff03943d962F7E4cEE34DFBA69d", + "0x25DE69dA4469A96974FaE79d0C41366A63317FDC", + "0x06E0A84c71dBD037c618CCf90798474E0e6f9C91", + "0x88F72d1f49Ea88f86fc52bebB0c1d0Ef232AE483", + "0x35775aA87b4CA1c04a6c579c90cE9add09247958", + "0xE2f035f59De6a952FF699b4EDD0f99c466f25fEc", + "0xef8D6dDE0a0f0CCdaDB678366a94D93f1C449689", + "0x2232455bf4622002c1416153EE59fd32B239863B", + "0xdCC5DC90A803928Dc21556590D4620030966270F", + "0x3b4DdC7888F752a96290344a1A926E73b80423c0", + "0xcAa74e50428bDC4Af6A7Ead65fFFf77F0D231E80", + "0x062F29e2b5bD99523DD3508207eb2C2CbAf98D50", + "0x7c2967C20B03a8004ea81e86Ac1847D00e7B4CD1", + "0x52cC5B5CB98C9a7fb8cCe7d4b4e8F41E26ce04a8", + "0x6B47afc8bf3b2e013b5e9178e8015Cc620983b51", + "0x011028aB93B355308E4350D109F42aeCfA075604", + "0x8a21Ea69300Fe56ee19fE974e9791a212114573F", + "0xa85F2DeBc911c54414f99103123965c94e351873", + "0x746c19A336A3131fD85D3AB5F16576b1b047F512", + "0x1973ef31F2A82B3f73b8C9Ee1c440615084d5242", + "0x6Fb45a8183660F30EA1c6cDFDDBFdC7ef7925801", + "0xfE1C64D42B7d6554Cc2ACD0D74e2983a2dE4A62f", + "0x8aD01c3a425987c508A69149185383BAf6F47534", + "0x453f61390ce6DfB668bbF4D93E58c94BB0ae81f3", + "0x1A1F0Db1050D1cAD52eEB72371EbFD7716b53a2f", + "0x718A66F21415a5f75F5e8652e8Be55FCF1D1df05", + "0x1910CCeCC57869F1Ff2337dda001246B92E8418A", + "0xB8Ce10759feb3B63B75557f5f9933bD22127f0eC", + "0x100Cd460D7f549B4cc2Ed35d4ff20ac71B377C96", + "0x2bC96f9e07Edc7F1aA9Aa26E85dc7dd30ACe59a6", + "0x2793AF2c7db9f0A06d2727Dd392Ab4Bb1b82a98D", + "0x00557e194B717dCfEbaE6222091C5F806DF99698", + "0x182fe51442C7D65360eD1511f30be6261c2C20C1", + "0xD019FD6267F93ebE5A92DEBB760135a4F02a75F7", + "0xf92129fE0923d766C2540796d4eA31Ff9FF65522", + "0x642F04eCAa00D443fBf2de2AaC9A9e0ACfA4FCE7", + "0xdD84190aF336Ee2831eea88B6783958e8F269de9", + "0xB708038C1b4cF9f91CcB918DAD1B9fD757ADa5C1", + "0x81F2F132465Ffb4B3C5d11f3d94582cC5c281c04", + "0x613f54c8836FD2C09B910869AC9d4de5e49Db1d8", + "0x79149B500f0d796aA7f85e0170d16C7e79BAd3C5", + "0x92651E1bBfE0f8423119AfC4B0610C747Fa125a1", +]; + +const POLYGON_BEEFY_TOKENS = [ + "0x97B2632DB51967b2AedF4c50FfC3a9D965940bEd", + "0x5A0801BAd20B6c62d86C566ca90688A6b9ea1d3f", + "0x1C480521100c962F7da106839a5A504B5A7457a1", + "0x108c7a293162Adff86DA216AB5F91e56723125dc", + "0x4C98CB046c3eb7e3ae7Eb49a33D6f3386Ec2b9D9", + "0x2520D50bfD793D3C757900D81229422F70171969", + "0x2F4BBA9fC4F77F16829F84181eB7C8b50F639F95", + "0x06b73b12421C667A07877B0740bA299e1de73B15", + "0xa0FdCDDA62C4C6a0109A702a7Efe59B4E8807e3f", + "0x108a7474461dC3059E4a6f9F8c7C8612056195A7", + "0xc65E5b6084FAd2F20e289b0d4e64F450cf386E6c", + "0xf0695B22d8F416FEC35E02668aE01B9EEAF96a0D", + "0xAA7C2879DaF8034722A0977f13c343aF0883E92e", + "0x01a8F2E5BfB8679C82442F90e1166469a2E530c8", + "0xB476B7A027da3D9fB5A5c9CB6078A34f7289B476", + "0x67Ecbe3a67624c80356386413E068bfFc03ad228", + "0xeD2905F595B6Ba103d8dF047Aa6dA3708FE6548b", + "0x1A723371f9dc30653dafd826B60d9335bf867E35", + "0x23c65213458A2dcc1321f84Ab42dCaECD79C2215", + "0x4BDA6C4d2f53B2Cd7F7FAc9287902a9928002e7B", + "0x944A5C12cD4399ABC6883fF1ba40A14c23B2Fd37", + "0xb87e2D83DB70599B14818C931DE0A656bf620e77", + "0x449533BcF3Fc5963515f87c17CDfE762b7Ab89fb", + "0x6F79CA179FE1cD131574a08B96e92744B6649128", + "0x99AB491471FBcB7D9d2b69729462fe223a4cCdab", + "0x2eac840950F1FF53d03A55A0255ea787fE84a4b5", + "0xe7B6CB2BfaB7C886CAA97fd3f181bBDad664A19B", + "0x3eEcd5FeD0900451A95537De7F3543cA4Ed926a7", + "0x2FbE43adaf91EE9A6B8252A017297007Acf696a3", + "0x346c16e7a76D224b9955c0F67e93b413Fc63ba3E", + "0x81cec323bf8c4164c66ec066f53cc053a535f03d", + "0x1d34Db65C4fe0f6A73194DBDC4a44ae05B46e6c5", + "0x8AAc0f2a6cAE626b656Ca16c58A50C87CBBC7ff5", + "0x964eA598DF006F692105A951a774ff9825a454Fe", + "0x4ec61a96738564CaD591841df0c8B5b6eA785E4C", + "0x4252Da0559960a50FDd50D5bDDe1B78659B7Ea2A", + "0x3325a25A2608EA723cB5D72E27af65AACFfb810e", + "0xb759b56d82C88806bbcBcD60767E39Af5cc51F32", + "0x2C6d11e756986f1537a2c71c851e9a1F7A0008b2", + "0xD74B5df80347cE9c81b91864DF6a50FfAfE44aa5", + "0x5268F5F2a9799f747A55f193d2E266c77653E518", + "0x67FEe70c32097c53B5aeAaCdbee7544eaE2194f8", + "0x0fC4f2DB534Bf7525710DBf64B7081e1a3A6428f", + "0x40c03Cd0B5D1571608D09e6279B4C63660e431F1", + "0xD97FA4474084350D2c96285E1Fca07A9D515c800", + "0xAb4E02911A7d09BC8300F39332F087d51c183038", + "0x8D0663d2d738e6078Bb77589dE4231eD9fcFd014", + "0xec74671f95F0942358016da627b912143100DAF2", + "0xFe2f5e215C0Fe9b5D4fF99cA7cBB5F5a77f5C515", +]; + +const AVALANCHE_BEEFY_TOKENS = [ + "0x79F26046D122d2F26B1D37237D5C056fB580447A", + "0x7E5bC7088aB3Da3e7fa1Aa7ceF1dC73F5B00681c", + "0xe1a8EeA58D63Ea64d00365531D266C2AD1f62FC4", + "0x22EafB9C7E2858cfDA712940896464DdAA83d053", + "0x68866acc5C940938B373F55F7009f824c7662F5B", + "0xf3340EdF16563D52C7E7C576F2fCC8f3D52464aB", + "0x595786A3848B1de66C6056C87BA91977935fBC46", + "0xA27BF4d56870A37e37a687B8ab3740d8487Ee2C6", + "0xFeA7976733f47557860f4483f2147a3e99C76b58", + "0x3D81A269E05e6057e4dF9E2D76E254E65a65Eb66", + "0x282B11E65f0B49363D4505F91c7A44fBEe6bCc0b", + "0x3C2131A02659343d68c211aAa686750bE37d88c4", + "0x813aB5B3FDc59B143C42284665864b24B794C324", +]; + +const BNB_BEEFY_TOKENS = [ + "0x31e77776b924Cd5f0E624771C9B3d2bD6B9c919E", + "0x4a9945B75E5c860f511CD223E838b213828a0583", + "0x684d86518e6E7d622d24854cBb1C179d6C0E3f75", + "0x62ef49280c0f155afd374fC5Efd1F06318648700", + "0x1542885D6EeD4EE3AC1a110d3f159003a0774101", + "0x6eb020663898c72F8E25958F5f7bcDC732279201", + "0xe47E724c0b4EE9fbC16097AC103b97dc6642fd18", + "0x9A10Cc2024744681fBce1F93Aeee3fd7863B1A12", + "0xD411121C948Cff739857513E1ADF25ED448623f8", + "0x56ec6031dC969CfA035F6D65e65D8595d5660fB4", + "0xC34Ae91312A3c3F9420691922040a5DEe1698E52", + "0xc1fcf50ccaCd1583BD9d3b41657056878C94e592", + "0xb26642B6690E4c4c9A6dAd6115ac149c700C7dfE", + "0x33D0F945F77660F4A9e56949500265313f6D08fb", + "0x86b481fCe116DCd01fBeBb963f1358bcc466668C", + "0x164fb78cAf2730eFD63380c2a645c32eBa1C52bc", + "0x0383E88A19E5c387FeBafbF51E5bA642d2ad8bE0", + "0xf2064C230b285AA6Cf45c6267DA86a8E3505D0AA", + "0x960eE6caC56912D94cE5c83D7Fb0CD873b5c5099", + "0x72fC82b9955f04b20166b0Da7e1af4f893F6316a", + "0xe0Af98A11DB57c7282c1f6066d116E13F02BF0E9", + "0x836C6BffB0B08aCa20b9380330D2532A51aA0eAD", + "0x93DB73f79D4fdc5be42C0bd2812e94A271aDC7e2", + "0x5D83D13Fa899451b75f7c465C0A2590Bb3f9067f", + "0x3b3bc8AE6dcAcCeaaC3C19E196ebD3341Cfe9c4e", +]; + +const BASE_BEEFY_TOKENS = [ + "0xbE3F14312B08E9c6AEe6AeB27B37c08B661A7F83", + "0x5A47993216fa6ACaf93418f9830cee485e82d0ba", + "0xd0c3E7f86338403Df99DEa1996f6C9Ed8f9D3d07", + "0xB614A6E6c21202De79DceB95AE2dd4817DD7e14b", + "0xB62F13126fCD0dD49dE8fF811406554197Bd0E11", + "0x507094549509Efdf63ecA34B795094065cB04008", + "0x8bd6dF821513aECDbbaa29C1d5212b43fdCe7819", + "0x98bEAa72230788572e3e3Be58D91C232dda315d4", + "0x74251C0d0B74Fba6e3B3EDe8533D9Da82B4EC4a4", + "0xc005B9833deBcF5fe6cc5bC9ba4fD74Bb382ae55", + "0xC3a5b142a144135D900FC5Ef2Bb7E92a3bcB46F1", + "0x09139A80454609B69700836a9eE12Db4b5DBB15f", + "0x4Fc0E7cDfe0CF92762eaf3CEE9133239A2197391", + "0x06a613d3a056d4b04D7523C11d82c67Bebf9d850", + "0xFB6864F1c14A90E85398B853701B01ef6a0CA3E5", +]; + +const beefyTokensByChain = { + ethereum: ETHEREUM_BEEFY_TOKENS, + arbitrum: ARBITRUM_BEEFY_TOKENS, + optimism: OPTIMISM_BEEFY_TOKENS, + polygon: POLYGON_BEEFY_TOKENS, + avax: AVALANCHE_BEEFY_TOKENS, + bsc: BNB_BEEFY_TOKENS, + base: BASE_BEEFY_TOKENS, +}; + +module.exports = beefyTokensByChain; diff --git a/projects/hinkal/gaugeTokens.js b/projects/hinkal/gaugeTokens.js new file mode 100644 index 000000000000..000ae01d80d0 --- /dev/null +++ b/projects/hinkal/gaugeTokens.js @@ -0,0 +1,250 @@ +const ETHEREUM_GAUGE_TOKENS = [ + { + erc20TokenAddress: "0x93ce650b8d3a7a7e44121db82a0429a3884db599", + underlyingErc20TokenAddress: "0xbFcF63294aD7105dEa65aA58F8AE5BE2D9d0952A", + }, + { + erc20TokenAddress: "0xE49127B7AEfc043847caDd85B8a41973854D30f5", + underlyingErc20TokenAddress: "0x8dff75976f22db58d7c3fd7b68d782238b0dbe30", + }, + { + erc20TokenAddress: "0x8A31A94bF0926B82083C80E18B331085B84E92D7", + underlyingErc20TokenAddress: "0x689440f2Ff927E1f24c72F1087E1FAF471eCe1c8", + }, + { + erc20TokenAddress: "0xcc26a5246c6a04a85e997d6581c1b4f14363841a", + underlyingErc20TokenAddress: "0xcfc25170633581bf896cb6cdee170e3e3aa59503", + }, + { + erc20TokenAddress: "0x9a7Ce41c96Db8d792497D7BEe70fAfb7F8393D71", + underlyingErc20TokenAddress: "0x7e880867363A7e321f5d260Cade2B0Bb2F717B02", + }, + { + erc20TokenAddress: "0xd4EC67cF6C0Aa65F74eb7F03216Ea23151af21b8", + underlyingErc20TokenAddress: "0x2932a86df44fe8d2a706d8e9c5d51c24883423f5", + }, + { + erc20TokenAddress: "0x4F1546Ce825dB85310aC2c2cfb369543d73FD0a2", + underlyingErc20TokenAddress: "0xbD5445402B0a287cbC77cb67B2a52e2FC635dce4", + }, + { + erc20TokenAddress: "0x394Aa83d0E5D348c7FA39325d2A25993704Faf8f", + underlyingErc20TokenAddress: "0xfb860600f1be1f1c72a89b2ef5caf345aff7d39d", + }, + { + erc20TokenAddress: "0xD1105d6502d3c562B447A75149B00aD366b3212d", + underlyingErc20TokenAddress: "0x6991C1CD588c4e6f6f1de3A0bac5B8BbAb7aAF6d", + }, + { + erc20TokenAddress: "0xE08FF1427b199241506FcdCC23fcc24Dd98a4FA9", + underlyingErc20TokenAddress: "0xDeFd8FdD20e0f34115C7018CCfb655796F6B2168", + }, + { + erc20TokenAddress: "0xC21545c26661ae74b3259B55aE007ACC4Bf5d4e3", + underlyingErc20TokenAddress: "0x9D5C5E364D81DaB193b72db9E9BE9D8ee669B652", + }, + { + erc20TokenAddress: "0xa0Cd8B83B63381895C1854A605315fa7eF50e026", + underlyingErc20TokenAddress: "0x512a68dd5433563bad526c8c2838c39debc9a756", + }, + { + erc20TokenAddress: "0x25aE9BE521898d33c7DF6Ae8c6669Fe038Bb3550", + underlyingErc20TokenAddress: "0xecad6745058377744c09747b2715c0170b5699e5", + }, + { + erc20TokenAddress: "0x9434722bf29750B44649eb1b1A10a335d40edFc1", + underlyingErc20TokenAddress: "0x27cace18f661161661683bba43933b2e6eb1741e", + }, + { + erc20TokenAddress: "0xF2280cBa8e0B9bc9b87b5aFbBeF8C41C20a5ddBe", + underlyingErc20TokenAddress: "0xbe266d68ce3ddfab366bb866f4353b6fc42ba43c", + }, + { + erc20TokenAddress: "0x5F1894e4b409D7199Ea209b9e43C996640BCB691", + underlyingErc20TokenAddress: "0x8605dc0c339a2e7e85eea043bd29d42da2c6d784", + }, + { + erc20TokenAddress: "0xa653510227752632ebf692a77e5032d4afFaB3a2", + underlyingErc20TokenAddress: "0xC94208D230EEdC4cDC4F80141E21aA485A515660", + }, + { + erc20TokenAddress: "0xA1998B87C2935BDbd7fE6ee48542a59a0435a3Ee", + underlyingErc20TokenAddress: "0x245Ec0d447e7f206B43120Ac292dED5E8bB9fe61", + }, + { + erc20TokenAddress: "0xC8c3031fB628Bdf4eA0F7cA5F96E369Dea07624e", + underlyingErc20TokenAddress: "0x0404d05F3992347d2f0dC3a97bdd147D77C85c1c", + }, + { + erc20TokenAddress: "0xDc118133332f703e22C0b0FA7E0DD7d1299A7247", + underlyingErc20TokenAddress: "0xB468dB2E478885B87D7ce0C8DA1D4373A756C138", + }, + { + erc20TokenAddress: "0xC6fDF0921c480Bd7Af89Ab4461D4aCDA24058a65", + underlyingErc20TokenAddress: "0xAE0bFfc3110e69DA8993F11C1CBd9a6eA3d16daF", + }, + { + erc20TokenAddress: "0x6410ee1f8417a7cE1c3E68E3434c1d6beef6944E", + underlyingErc20TokenAddress: "0x277d1424a84b35ec0a8108482551b00b4fc1539b", + }, + { + erc20TokenAddress: "0x9456cB3ae9fA8788ac1af4a7A18b339D4028061D", + underlyingErc20TokenAddress: "0xc2fe9d3c761994897594df63b33b6d843ab7b1cf", + }, + { + erc20TokenAddress: "0x26dA2546602f63b84B3C4dF36476364f6350706E", + underlyingErc20TokenAddress: "0x0e83df148f69965bfe752250835854b0dbeeaf01", + }, + { + erc20TokenAddress: "0x0a3fE1d39E5c60CfdB48Ba2Dc6B7c855289Dec7C", + underlyingErc20TokenAddress: "0x35ad1acf0c4be5d4ba11342128d440fdb9e189eb", + }, + { + erc20TokenAddress: "0xA27fa5E11B121277423aC0b8b372596f2805e36a", + underlyingErc20TokenAddress: "0xe2c422d954db416a69fb29137fe552cce0e160e9", + }, + { + erc20TokenAddress: "0x41e5c3aD70DA89dd7b6AF9Af3cd6861FbC31eA16", + underlyingErc20TokenAddress: "0x621ef98282ac42d2bf4c20fc73912a16599e12fb", + }, +]; + +const ARBITRUM_GAUGE_TOKENS = [ + { + erc20TokenAddress: "0xC3691c157D1B3A431B841230a7B11d5a373097e1", + underlyingErc20TokenAddress: "0xce5f24b7a95e9cba7df4b54e911b4a3dc8cdaf6f", + }, + { + erc20TokenAddress: "0x7Bdc233E5369Ac023b9894645902C9032A72D9Ee", + underlyingErc20TokenAddress: "0x971E732B5c91A59AEa8aa5B0c763E6d648362CF8", + }, + { + erc20TokenAddress: "0xCC26A5246C6A04a85E997d6581C1b4f14363841a", + underlyingErc20TokenAddress: "0xf2ddf89c04d702369ab9ef8399edb99a76e951ce", + }, + { + erc20TokenAddress: "0xeEeeb52E36c78b153caaB2761c369a50b066cDD5", + underlyingErc20TokenAddress: "0x098ef55011b6b8c99845128114a9d9159777d697", + }, + { + erc20TokenAddress: "0x59eC3043D7314B9650294Fd800149b53007f804E", + underlyingErc20TokenAddress: "0x95285ea6ff14f80a2fd3989a6bab993bd6b5fa13", + }, + { + erc20TokenAddress: "0x972c6F2b29638b9AD6955c4F0b0c1239b034f053", + underlyingErc20TokenAddress: "0x93729702Bf9E1687Ae2124e191B8fFbcC0C8A0B0", + }, + { + erc20TokenAddress: "0xbA65D50Cf4e6E739B2735338a964C3354fAF9B19", + underlyingErc20TokenAddress: "0xd6dacdcb438f048cf90e53415872cdb3fcc95421", + }, + { + erc20TokenAddress: "0x886867993080DC3bBFC39CDfc343A0e083bB34E0", + underlyingErc20TokenAddress: "0x6B7B84F6EC1c019aF08C7A2F34D3C10cCB8A8eA6", + }, + { + erc20TokenAddress: "0xB72ea6F99EfA5BD6Fb400BaA4eFddC3cfB075215", + underlyingErc20TokenAddress: "0xc2b1df84112619d190193e48148000e3990bf627", + }, + { + erc20TokenAddress: "0x660108601EED17aF2832A1c0F1D7dE74F560C5ed", + underlyingErc20TokenAddress: "0x7c0ac20c3ca8c6257ea099131081d8199bf6b8f6", + }, +]; + +const OPTIMISM_GAUGE_TOKENS = [ + { + erc20TokenAddress: "0x29c431806E536Fb22ce2Edc8dd6e3C3A0d5689a8", + underlyingErc20TokenAddress: "0xc5ae4b5f86332e70f3205a8151ee9ed9f71e0797", + }, + { + erc20TokenAddress: "0xDaA24E888432b5aa607105e256919Ddfc8b327E9", + underlyingErc20TokenAddress: "0xd53ccbfed6577d8dc82987e766e75e3cb73a8563", + }, + { + erc20TokenAddress: "0xC3691c157D1B3A431B841230a7B11d5a373097e1", + underlyingErc20TokenAddress: "0x15f52286c0ff1d7a7ddbc9e300dd66628d46d4e6", + }, + { + erc20TokenAddress: "0xCC26A5246C6A04a85E997d6581C1b4f14363841a", + underlyingErc20TokenAddress: "0x172a5af37f69c69cc59e748d090a70615830a5dd", + }, + { + erc20TokenAddress: "0xeEeeb52E36c78b153caaB2761c369a50b066cDD5", + underlyingErc20TokenAddress: "0xcb8883d1d8c560003489df43b30612aabb8013bb", + }, + { + erc20TokenAddress: "0x59eC3043D7314B9650294Fd800149b53007f804E", + underlyingErc20TokenAddress: "0x2eb49a3eff789d7b2286bf17667acbf12d882c17", + }, + { + erc20TokenAddress: "0xbA65D50Cf4e6E739B2735338a964C3354fAF9B19", + underlyingErc20TokenAddress: "0xcea806562b757aeffa9fe9d0a03c909b4a204254", + }, +]; + +const POLYGON_GAUGE_TOKENS = [ + { + erc20TokenAddress: "0x9dc8Ee4264923D44F2a33Ea139FC4143C288b172", + underlyingErc20TokenAddress: "0x0e2f214b8f5d0cca011a8298bb907fb62f535160", + }, + { + erc20TokenAddress: "0x1057a796C66ca87EC1e6494f5486006396756083", + underlyingErc20TokenAddress: "0x835cA119fA28515B1F184A5Ce5Ccda2B5b0d9F6D", + }, + { + erc20TokenAddress: "0x350c331F4e5fD9d5D703424F3F14CcC0280B6629", + underlyingErc20TokenAddress: "0x40371aad2a24ed841316ef30938881440fd4426c", + }, + { + erc20TokenAddress: "0xf742B69Bd460F14EB5d8335e06954eba694B552E", + underlyingErc20TokenAddress: "0xA9249f8667cb120F065D9dA1dCb37AD28E1E8FF0", + }, + { + erc20TokenAddress: "0xc44F1103A271BEFF26bB245D760bFbe182CCf121", + underlyingErc20TokenAddress: "0x8b397084699cc64e429f610f81fac13bf061ef55", + }, + { + erc20TokenAddress: "0x195888B86db69C52b54362DB2D71c2d3e411A0bA", + underlyingErc20TokenAddress: "0xc501491b0e4A73B2eFBaC564a412a927D2fc83dD", + }, + { + erc20TokenAddress: "0x22301937028310Cef6530eF3C3Bfe14581eb679F", + underlyingErc20TokenAddress: "0xfc052e70eb6d94afe464a8ce8f43d203109494f2", + }, + { + erc20TokenAddress: "0x90F06727Ba5016eDcf9D8B5def63a5849EcD132f", + underlyingErc20TokenAddress: "0x9633e0749faa6ec6d992265368b88698d6a93ac0", + }, +]; + +const AVALANCHE_GAUGE_TOKENS = []; + +const BNB_GAUGE_TOKENS = []; + +const BASE_GAUGE_TOKENS = [ + { + erc20TokenAddress: "0x3b9860321f03AFe02D3FF9e4Fdd4017DC6F4d7Ca", + underlyingErc20TokenAddress: "0x79edc58C471Acf2244B8f93d6f425fD06A439407", + }, + { + erc20TokenAddress: "0x1f0dbEcDA414F401dB46464864273CaD19368706", + underlyingErc20TokenAddress: "0x93933FA992927284e9d508339153B31eb871e1f4", + }, + { + erc20TokenAddress: "0x3E07F263C1Ce5EC2a3f1cA87af56B80B27674D96", + underlyingErc20TokenAddress: "0x89289DC2192914a9F0674f1E9A17C56456549b8A", + }, +]; + +const gaugeTokensByChain = { + ethereum: ETHEREUM_GAUGE_TOKENS, + arbitrum: ARBITRUM_GAUGE_TOKENS, + optimism: OPTIMISM_GAUGE_TOKENS, + polygon: POLYGON_GAUGE_TOKENS, + avax: AVALANCHE_GAUGE_TOKENS, + bsc: BNB_GAUGE_TOKENS, + base: BASE_GAUGE_TOKENS, +}; + +module.exports = gaugeTokensByChain; diff --git a/projects/hinkal/hinkalUtils.js b/projects/hinkal/hinkalUtils.js new file mode 100644 index 000000000000..72c46e51e3d0 --- /dev/null +++ b/projects/hinkal/hinkalUtils.js @@ -0,0 +1,96 @@ +const utils = require("../helper/utils"); +const sdk = require("@defillama/sdk"); +const RELAYER_URLS = require("./relayerUrls.js"); +const { ethers } = require("ethers"); +const ownerByChain = require("./owners.js"); + +const nullAddress = "0x0000000000000000000000000000000000000000"; + +const getAllTokenBalances = async (tokenList, chain) => { + const balanceCalls = tokenList.map((token) => ({ + target: token, + params: ownerByChain[chain], + })); + const balances = ( + await sdk.api.abi.multiCall({ + calls: balanceCalls, + abi: "erc20:balanceOf", + chain, + }) + ).output; + + const decimalCalls = tokenList.map((token) => ({ + target: token, + })); + + const decimals = ( + await sdk.api.abi.multiCall({ + calls: decimalCalls, + abi: "erc20:decimals", + chain, + }) + ).output; + + const tokenBalances = balances.map((bal) => { + const token = bal.input.target; + + const tokenBalance = bal.output; + + const tokenDecimal = decimals?.find( + (decimalOutput) => decimalOutput.input.target === token + ).output; + + return { + balance: ethers.formatUnits(tokenBalance, Number(tokenDecimal ?? 18)), + address: token, + }; + }); + + //Add Native token balance. + + const nativeTokenBalance = ( + await sdk.api.eth.getBalance({ + target: ownerByChain[chain], + chain, + }) + ).output; + + tokenBalances.push({ + address: nullAddress, + balance: ethers.formatUnits(nativeTokenBalance, 18), + }); + + return tokenBalances.filter((tokenBal) => Number(tokenBal.balance) > 0); +}; +const fetchTotalValue = async (tokenBalances, chainName) => { + const tokenAddresses = tokenBalances.map((token) => token.address); + const prices = ( + await utils.postURL(`${RELAYER_URLS[chainName]}/get-token-prices`, { + erc20Addresses: tokenAddresses, + }) + ).data.prices; + + const total = tokenBalances.map((token, index) => { + const price = prices[index]; + const tokenBalance = Number(token.balance); + if (!price || !tokenBalance || isNaN(price) || isNaN(tokenBalance)) { + console.log("Some error occured for token", { + token: token.address, + bakance: tokenBalance, + price, + chainName, + }); + return { + tokenAddress: token.address, + tokenBalance: 0, + }; + } + return { + tokenAddress: token.address, + tokenBalance: tokenBalance * price, + }; + }); + return total.filter((token) => token && token.tokenBalance > 0); +}; + +module.exports = { getAllTokenBalances, fetchTotalValue }; diff --git a/projects/hinkal/index.js b/projects/hinkal/index.js index 423a7ddd25f1..13e68f8741b3 100644 --- a/projects/hinkal/index.js +++ b/projects/hinkal/index.js @@ -1,17 +1,65 @@ -const { sumTokensExport } = require('../helper/unwrapLPs') - -const config = { - ethereum: "0x2ea81946fF675d5Eb88192144ffc1418fA442E28", - arbitrum: "0x41658B0DaF59Bb2FbB2D9A5249207011d2B364De", - optimism: "0x41658B0DaF59Bb2FbB2D9A5249207011d2B364De", - polygon: "0xeEeeb52E36c78b153caaB2761c369a50b066cDD5", - avax: "0x41658B0DaF59Bb2FbB2D9A5249207011d2B364De", - bsc: "0x0036E884Cab4F427193839788EDEBB4B92B9a069", - base: "0x41658B0DaF59Bb2FbB2D9A5249207011d2B364De", -} - -Object.keys(config).forEach(chain => { - module.exports[chain] = { - tvl: sumTokensExport({ owner: config[chain], fetchCoValentTokens: true, tokenConfig: { onlyWhitelisted: false, } }) - } -}) \ No newline at end of file +const registryTokensByChain = require("./registryTokens.js"); +const gaugeTokensByChain = require("./gaugeTokens.js"); +const beefyTokensByChain = require("./beefyTokens.js"); +const pendleTokensByChain = require("./pendleTokens.js"); +const { getAllTokenBalances, fetchTotalValue } = require("./hinkalUtils.js"); +const { toUSDTBalances } = require("../helper/balances.js"); + +const getRegularTokens = (chain) => { + return [ + registryTokensByChain[chain], + pendleTokensByChain[chain]?.pt, + pendleTokensByChain[chain]?.sy, + beefyTokensByChain[chain], + ].flat(); +}; + +const getTokensWithUnderlyingAddresses = (chain) => { + return [gaugeTokensByChain[chain], pendleTokensByChain[chain]?.yt].flat(); +}; + +const tvl = async (_, _1, _2, { chain }) => { + const regularTokens = getRegularTokens(chain); + const tokensWithUnderlyingAddresses = getTokensWithUnderlyingAddresses(chain); + + const regularTokenBalances = await getAllTokenBalances(regularTokens, chain); + + const tokensWithUnderlyingAddressesBalances = await getAllTokenBalances( + tokensWithUnderlyingAddresses.map((token) => token.erc20TokenAddress), + chain + ); + + const allTokenBalances = [ + ...regularTokenBalances, + ...tokensWithUnderlyingAddressesBalances, + ]; + const totalValue = await fetchTotalValue(allTokenBalances, chain); + + return toUSDTBalances( + totalValue.reduce((acc, token) => acc + token.tokenBalance, 0) + ); +}; + +module.exports = { + ethereum: { + tvl, + }, + base: { + tvl, + }, + arbitrum: { + tvl, + }, + optimism: { + tvl, + }, + polygon: { + tvl, + }, + avax: { + tvl, + }, + bsc: { + tvl, + }, +}; diff --git a/projects/hinkal/owners.js b/projects/hinkal/owners.js new file mode 100644 index 000000000000..cfe9d74c9e83 --- /dev/null +++ b/projects/hinkal/owners.js @@ -0,0 +1,19 @@ +const ETHEREUM_OWNER = "0x2ea81946fF675d5Eb88192144ffc1418fA442E28"; +const ARBITRUM_OWNER = "0x41658B0DaF59Bb2FbB2D9A5249207011d2B364De"; +const OPTIMISM_OWNER = "0x41658B0DaF59Bb2FbB2D9A5249207011d2B364De"; +const POLYGON_OWNER = "0xeEeeb52E36c78b153caaB2761c369a50b066cDD5"; +const AVALANCHE_OWNER = "0x41658B0DaF59Bb2FbB2D9A5249207011d2B364De"; +const BNB_OWNER = "0x0036E884Cab4F427193839788EDEBB4B92B9a069"; +const BASE_OWNER = "0x41658B0DaF59Bb2FbB2D9A5249207011d2B364De"; + +const ownerByChain = { + ethereum: ETHEREUM_OWNER, + arbitrum: ARBITRUM_OWNER, + optimism: OPTIMISM_OWNER, + polygon: POLYGON_OWNER, + avax: AVALANCHE_OWNER, + bsc: BNB_OWNER, + base: BASE_OWNER, +}; + +module.exports = ownerByChain; diff --git a/projects/hinkal/pendleTokens.js b/projects/hinkal/pendleTokens.js new file mode 100644 index 000000000000..b3287bb2846e --- /dev/null +++ b/projects/hinkal/pendleTokens.js @@ -0,0 +1,108 @@ +const ETHEREUM_YT_TOKENS = [ + { + erc20TokenAddress: "0x019e773bE2D65D5fE30bE17547b89500C7C4CD5E", + underlyingErc20TokenAddress: "0xfb35Fd0095dD1096b1Ca49AD44d8C5812A201677", + }, + { + erc20TokenAddress: "0x1346da36093Fdb8013E1125046f0dCBbBF645b3F", + underlyingErc20TokenAddress: "0x0ED3A1D45DfdCf85BCc6C7BAFDC0170A357B974C", + }, + { + erc20TokenAddress: "0x4E0854085bC5a2fa8031ea5819863BD280e610F3", + underlyingErc20TokenAddress: "0x391B570e81e354a85a496952b66ADc831715f54f", + }, + { + erc20TokenAddress: "0x9Ab43f73054C07b02e02c5468b3eB058ccdAA019", + underlyingErc20TokenAddress: "0x98601E27d41ccff643da9d981dc708cf9eF1F150", + }, + { + erc20TokenAddress: "0x223026549740E2672b3f05c867Fd2B31207338A2", + underlyingErc20TokenAddress: "0x7C2D26182adeEf96976035986cF56474feC03bDa", + }, + { + erc20TokenAddress: "0x3e0A917d4d914e432B82825e6FBEe039b89f4477", + underlyingErc20TokenAddress: "0x029aad400f6092dc735a65be95102efcc2fe64bf", + }, +]; + +const ETHEREUM_PT_TOKENS = [ + "0xc69Ad9baB1dEE23F4605a82b3354F8E40d1E5966", + "0x094be6bd31d7b860f7d2c1f280fd09f0463d7e67", + "0x4AE5411F3863CdB640309e84CEDf4B08B8b33FfF", + "0xDDFD5e912C1949B4bDb12579002c44B7A83F9E88", + "0xC58aa33Ce619c7f7Ac4929DF357D0Ef762edbD23", + "0xB05cABCd99cf9a73b19805edefC5f67CA5d1895E", +]; + +const ETHEREUM_SY_TOKENS = [ + "0xAC0047886a985071476a1186bE89222659970d65", + "0x730A5E2AcEbccAA5e9095723B3CB862739DA793c", + "0x253008ba4aE2f3E6488DC998a5321D4EB1a0c905", + "0x7a493be5c2ce014cd049bf178a1ac0db1b434744", + "0xD7DF7E085214743530afF339aFC420c7c720BFa7", + "0x34349c5569e7b846c3558961552d2202760a9789", +]; + +const ARBITRUM_YT_TOKENS = []; +const ARBITRUM_PT_TOKENS = []; +const ARBITRUM_SY_TOKENS = []; + +const OPTIMISM_YT_TOKENS = []; +const OPTIMISM_PT_TOKENS = []; +const OPTIMISM_SY_TOKENS = []; + +const POLYGON_YT_TOKENS = []; +const POLYGON_PT_TOKENS = []; +const POLYGON_SY_TOKENS = []; + +const AVALANCE_YT_TOKENS = []; +const AVALANCE_PT_TOKENS = []; +const AVALANCE_SY_TOKENS = []; + +const BNB_YT_TOKENS = []; +const BNB_PT_TOKENS = []; +const BNB_SY_TOKENS = []; + +const BASE_YT_TOKENS = []; +const BASE_PT_TOKENS = []; +const BASE_SY_TOKENS = []; + +const pendleTokensByChain = { + ethereum: { + yt: ETHEREUM_YT_TOKENS, + pt: ETHEREUM_PT_TOKENS, + sy: ETHEREUM_SY_TOKENS, + }, + arbitrum: { + yt: ARBITRUM_YT_TOKENS, + pt: ARBITRUM_PT_TOKENS, + sy: ARBITRUM_SY_TOKENS, + }, + optimism: { + yt: OPTIMISM_YT_TOKENS, + pt: OPTIMISM_PT_TOKENS, + sy: OPTIMISM_SY_TOKENS, + }, + polygon: { + yt: POLYGON_YT_TOKENS, + pt: POLYGON_PT_TOKENS, + sy: POLYGON_SY_TOKENS, + }, + avax: { + yt: AVALANCE_YT_TOKENS, + pt: AVALANCE_PT_TOKENS, + sy: AVALANCE_SY_TOKENS, + }, + bsc: { + yt: BNB_YT_TOKENS, + pt: BNB_PT_TOKENS, + sy: BNB_SY_TOKENS, + }, + base: { + yt: BASE_YT_TOKENS, + pt: BASE_PT_TOKENS, + sy: BASE_SY_TOKENS, + }, +}; + +module.exports = pendleTokensByChain; diff --git a/projects/hinkal/registryTokens.js b/projects/hinkal/registryTokens.js new file mode 100644 index 000000000000..50535f196db5 --- /dev/null +++ b/projects/hinkal/registryTokens.js @@ -0,0 +1,443 @@ +const ETHEREUM_REGISTRY_TOKENS = [ + "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + "0xdAC17F958D2ee523a2206206994597C13D831ec7", + "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "0x6B175474E89094C44Da98b954EedeAC495271d0F", + "0x8E870D67F660D95d5be530380D0eC0bd388289E1", + "0x83F20F44975D03b1b09e64809B757c47f942BEeA", + "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490", + "0xc4AD29ba4B3c580e6D59105FFf484999997675Ff", + "0x853d955aCEf822Db058eb8505911ED77F175b99e", + "0xFC2838a17D8e8B1D5456E0a351B0708a09211147", + "0x3175Df0976dFA876431C2E9eE6Bc45b65d3473CC", + "0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd", + "0xf43211935C781D5ca1a41d2041F397B8A7366C7A", + "0xD533a949740bb3306d119CC777fa900bA034cd52", + "0x99D8a9C45b2ecA8864373A26D1459e3Dff1e17F3", + "0x5a6A4D54456819380173272A5E8E9B9904BdF41B", + "0x57Ab1ec28D129707052df4dF418D58a2D46d5f51", + "0xC25a3A3b969415c80451098fa907EC722572917F", + "0xb2C35aC676F4A002669e195CF4dc50DDeDF6F0fA", + "0x5e74C9036fb86BD7eCdcb084a0673EFc32eA31cb", + "0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B", + "0x971add32Ea87f10bD192671630be3BE8A11b8623", + "0xEcd5e75AFb02eFa118AF914515D6521aaBd189F1", + "0x0000000000085d4780B73119b644AE5ecd22b376", + "0x68934F60758243eafAf4D2cFeD27BF8010bede3a", + "0xAf5191B0De278C7286d6C7CC6ab6BB8A73bA2Cd6", + "0xdf55670e27bE5cDE7228dD0A6849181891c9ebA1", + "0x9D0464996170c6B9e75eED71c68B99dDEDf279e8", + "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0", + "0xFEEf77d3f69374f66429C91d732A244f074bdf74", + "0xBC6DA0FE9aD5f3b0d58160288917AA56653660E9", + "0xB30dA2376F63De30b42dC055C93fa474F31330A5", + "0x828b154032950C8ff7CF8085D841723Db2696056", + "0x2A8e1E676Ec238d8A992307B495b45B3fEAa5e86", + "0x87650D7bbfC3A9F10587d7778206671719d9910D", + "0x1cEB5cB57C4D4E2b2433641b95Dd330A33185A44", + "0x4647B6D835f3B393C7A955df51EEfcf0db961606", + "0x0100546F2cD4C9D97f798fFC9755E47865FF7Ee6", + "0x5A98FcBEA516Cf06857215779Fd812CA3beF1B32", + "0xb79565c01b7Ae53618d9B847b9443aAf4f9011e7", + "0x856c4Efb76C1D1AE02e20CEB03A2A6a08b0b8dC3", + "0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643", + "0x39AA39c021dfbaE8faC545936693aC917d5E7563", + "0x845838DF265Dcd2c412A1Dc9e959c7d08537f8a2", + "0x0316EB71485b0Ab14103307bf65a021042c6d380", + "0xBEA0000029AD1c77D3d5D23Ba2D8893dB9d1Efab", + "0x8e595470Ed749b85C6F7669de83EAe304C2ec68F", + "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", + "0x6B175474E89094C44Da98b954EedeAC495271d0F", + "0x514910771AF9Ca656af840dff83E8264EcF986CA", + "0x88dF592F8eb5D7Bd38bFeF7dEb0fBc02cf3778a0", + "0x2ba592F78dB6436527729929AAf6c908497cB200", + "0xE41d2489571d322189246DaFA5ebDe1F4699F498", + "0x04Fa0d235C4abf4BcF4787aF4CF447DE572eF828", + "0x8E870D67F660D95d5be530380D0eC0bd388289E1", + "0x5BC25f649fc4e26069dDF4cF4010F9f706c23831", + "0x075b1bb99792c9E1041bA13afEf80C91a1e70fB3", + "0x49849C98ae39Fff122806C06791Fa73784FB3675", + "0xA0d69E286B938e21CBf7E51D71F6A4c8918f482F", + "0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E", + "0x3835a58CA93Cdb5f912519ad366826aC9a752510", + "0x892D701d94a43bDBCB5eA28891DaCA2Fa22A690b", + "0x5Ca135cB8527d76e932f34B5145575F9d8cbE08E", + "0x4704aB1fb693ce163F7c9D3A31b3FF4eaF797714", + "0xD2967f45c4f384DEEa880F807Be904762a3DeA07", + "0xEd279fDD11cA84bEef15AF5D39BB4d4bEE23F0cA", + "0xF3A43307DcAFa93275993862Aae628fCB50dC768", + "0xE57180685E3348589E9521aa53Af0BCD497E884d", + "0x1539c2461d7432cc114b0903f1824079BfCA2C92", + "0xd4D620B23E91031fa08045b6083878f42558d6b9", + "0xe17D6212eAa54D98187026A770dee96f7C264feC", + "0xD1BeaD7CadcCC6b6a715A6272c39F1EC54F6EC99", + "0x047c41817954b51309a2bd6f60e47bC115C23f1F", + "0x6853691Ca8Da03Da16194E468068bE5A80F103b0", + "0xCc19786F91BB1F3F3Fd9A2eA9fD9a54F7743039E", + "0x4dE81AD42E9651755716177fAe9911c54F5b055B", + "0x06c1e90eeb34e7Fa6d78B8E58348Ae15C1a615E4", + "0xe50e2fe90745A8510491F89113959a1EF01AD400", + "0x8cB4f56e9bAa398b6F6a6Fb1B2C4E8ca8cda6ae5", + "0xd5bAd7c89028B3F7094e40DcCe83D4e6b3Fd9AA4", + "0x7f3F33B42b9734e61cb44424D130B5f6e09C9Db3", + "0x15780E0e9618c26dA679740C43bEc76830Ff187b", + "0xFc6a9D39b44a174B5Ba708dBaa437632d78B8585", + "0x83BE6565c0758f746c09f95559B45Cfb9a0FFFc4", + "0xfE5716D0C141F3d800995420e1d3fB0D0CFFCC31", + "0x4115150523599D1F6C6Fa27F5A4C27D578Fd8ce5", + "0x49b562bDcd28dB124f6bA51DEB8Ca483563c067a", + "0xBE2bD093B8F342e060E79Fad6059B1057F016Ba4", + "0x3fe43D4ba0a5BAcC800c7E7E782466a27ab108bf", + "0xAE0bFfc3110e69DA8993F11C1CBd9a6eA3d16daF", + "0x42ED016F826165C2e5976fe5bC3df540C5aD0Af7", + "0x1E19CF2D73a72Ef1332C882F20534B6519Be0276", + "0x3FA8C89704e5d07565444009e5d9e624B40Be813", + "0x32296969Ef14EB0c6d29669C550D4a0449130230", + "0x7F86Bf177Dd4F3494b841a37e810A34dD56c829B", + "0xe6b5CC1B4b47305c58392CE3D359B10282FC36Ea", + "0x2863a328A0B7fC6040f11614FA0728587DB8e353", + "0x642431623AE5d73C19fC931aAeA0d4677303880c", + "0xa2847348b58CEd0cA58d23c7e9106A49f1427Df6", + "0xeaCADc656c9394fb09af25AeBc0897fDfFe484A1", + "0x380aAbE019ed2a9C2d632b51eDDD30fd804d0fAD", + "0x94cc50e4521bd271c1a997a3a4dc815c2f920b41", + "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0", + "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0", + "0xc794c6a95f30d0ebf7b3bbe85e8a0a95c9e411c1", + "0x8272e1a3dbef607c04aa6e5bd3a1a134c8ac063b", + "0xc794c6a95f30d0ebf7b3bbe85e8a0a95c9e411c1", + "0x04c154b66cb340f3ae24111cc767e0184ed00cc6", + "0xf8fde8a259a3698902c88bdb1e13ff28cd7f6f09", + "0x76237BCfDbe8e06FB774663add96216961df4ff3", + "0x0dE54CFdfeD8005176f8b7A9D5438B45c4F1df1e", + "0xb27D1729489d04473631f0AFAca3c3A7389ac9F8", + "0x38D64ce1Bdf1A9f24E0Ec469C9cAde61236fB4a0", + "0x9961BdBE8B7091E584c2bF9D0a160C583f564A8c", + "0xe035e27a8ed6842b478933820f90093d205f7098", + "0x4253ac4046fbfdafcfe125d067b6d89f6923843e", + "0x67701d67b60a96473bfc4873e7a484035c8609b0", + "0x6685fcfce05e7502bf9f0aa03b36025b09374726", + "0xe3e637f8acc097244a065791142c29fbf5877d18", + "0x1BB9b64927e0C5e207C9DB4093b3738Eef5D8447", + "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee", + "0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7", + "0xbf5495efe5db9ce00f80364c8b423567e58d2110", + "0xD9A442856C234a39a81a089C06451EBAa4306a72", +]; + +const ARBITRUM_REGISTRY_TOKENS = [ + "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", + "0xaf88d065e77c8cc2239327c5edb3a432268e5831", + "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9", + "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", + "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f", + "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", + "0xFEa7a6a0B346362BF88A9e4A88416B77a57D6c2A", + "0x7f90122BF0700F9E7e1F688fe926940E8839F353", + "0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F", + "0x11cDb42B0EB46D95f990BeDD4695A6e3fA034978", + "0x64343594Ab9b56e99087BfA6F2335Db24c2d1F17", + "0x641441c631e2F909700d2f41FD87F0aA6A6b4EDb", + "0xEB466342C4d449BC9f53A865D5Cb90586f405215", + "0xC9B8a3FDECB9D5b218d02555a8Baf332E5B740d5", + "0x5979D7b546E38E414F7E9822514be443A4800529", + "0x8616E8EA83f048ab9A5eC513c9412Dd2993bcE3F", + "0xDBf31dF14B66535aF65AaC99C32e9eA844e14501", + "0x93FC1235119c554576D8AB23583371fc25B803ee", + "0x755D6688AD74661Add2FB29212ef9153D40fcA46", + "0x9E75f8298e458B76382870982788988A0799195b", + "0xDa2307A45D298e855415675bF388e2bd64351D5b", + "0xEc7c0205a6f426c2Cb1667d783B5B4fD2f875434", + "0x8cbaAC87FDD9Bb6C3FdB5b3C870b2443D0284fa6", + "0xfd421d60905d2f7cabd49e6a5703a3499367b8f4", + "0xe20F93279fF3538b1ad70D11bA160755625e3400", + "0x4a2f6ae7f3e5d715689530873ec35593dc28951b", + "0xb67c014fa700e69681a673876eb8bafaa36bff71", + "0xfc5a1a6eb076a2c7ad06ed22c90d7e710e35ad0a", + "0x3c6ef5ed8ad5df0d5e3d05c6e607c60f987fb735", + "0x9cb911cbb270cae0d132689ce11c2c52ab2dedbc", + "0x9791d590788598535278552eecd4b211bfc790cb", + "0xade4a71bb62bec25154cfc7e6ff49a513b491e81", + "0x423a1323c871abc9d89eb06855bf5347048fc4a5", + "0xbf6cbb1f40a542af50839cad01b0dc1747f11e18", + "0x3fd4954a851ead144c2ff72b1f5a38ea5976bd54", + "0x8bc65eed474d1a00555825c91feab6a8255c2107", + "0x892785f33cdee22a30aef750f285e18c18040c3e", + "0x36bf227d6bac96e2ab1ebb5492ecec69c691943f", + "0x5402b5f40310bded796c7d0f3ff6683f5c0cffdf", + "0x905dfcd5649217c42684f23958568e533c711aa3", + "0xB7E50106A5bd3Cf21AF210A755F9C8740890A8c9", + "0xc9f52540976385a84bf416903e1ca3983c539e34", + "0x542f16da0efb162d20bf4358efa095b70a100f9e", + "0x59745774ed5eff903e615f5a2282cae03484985a", + "0xce3b19d820cb8b9ae370e423b0a329c4314335fe", + "0x539bdE0d7Dbd336b79148AA742883198BBF60342", + "0x99c409e5f62e4bd2ac142f17cafb6810b8f0baae", + "0x912CE59144191C1204E64559FE8253a0e49E6548", +]; + +const OPTIMISM_REGISTRY_TOKENS = [ + "0x4200000000000000000000000000000000000006", + "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85", + "0x7F5c764cBc14f9669B88837ca1490cCa17c31607", + "0x94b008aa00579c1307b0ef2c499ad98a8ce58e58", + "0x4200000000000000000000000000000000000006", + "0x68f180fcce6836688e9084f035309e29bf0a2095", + "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1", + "0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9", + "0x061b87122Ed14b9526A813209C8a59a633257bAb", + "0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb", + "0xEfDE221f306152971D8e9f181bFe998447975810", + "0x298B9B95708152ff6968aafd889c6586e9169f1D", + "0x9F2fE3500B1a7E285FDc337acacE94c480e00130", + "0x1337BedC9D22ecbe766dF105c9623922A27963EC", + "0x0994206dfe8de6ec6920ff4d779b0d950605fb53", + "0xE405de8F52ba7559f9df3C368500B6E6ae6Cee49", + "0x7Bc5728BC2b59B45a58d9A576E2Ffc5f0505B35E", + "0xB153FB3d196A8eB25522705560ac152eeEc57901", + "0x810D1AaA4Cd8F21c23bB648F2dfb9DC232A01F09", + "0x6c84a8f1c29108F47a79964b5Fe888D4f4D0dE40", + "0x1Dc5c0f8668a9F54ED922171d578011850ca0341", + "0x0892a178c363b4739e5Ac89E9155B9c30214C0c0", + "0xD09B5a0650d68Aae6B1666eE5E770a383d29A97C", + "0x56770b94279539416855fe29Ef14b26438B5e421", + "0x95a05D06Decf8e1Eb93aE09B612FbD342F2F9E2E", + "0x7Ca75bdEa9dEde97F8B13C6641B768650CB83782", + "0x4Fd63966879300caFafBB35D157dC5229278Ed23", + "0xd16232ad60188B68076a235c65d692090caba155", + "0xE54e4020d1C3afDB312095D90054103E68fe34B0", + "0x6dA98Bde0068d10DDD11b468b197eA97D96F96Bc", + "0xbcFa4cfA97f74a6AbF80b9901569BBc8654F4315", + "0x0b28C2e41058EDc7D66c516c617b664Ea86eeC5d", + "0x3f42Dc59DC4dF5cD607163bC620168f7FF7aB970", + "0xFF5318f81Dd791e92d51b8A54fA3538832D2890D", + "0xBE418771bC91F75C4d2BcE1d5E2b7286F50992da", + "0x2e17b8193566345a2Dd467183526dEdc42d2d5A8", + "0x5C2048094bAaDe483D0b1DA85c3Da6200A88a849", + "0xBD08972Cef7C9a5A046C9Ef13C9c3CE13739B8d6", + "0xa1055762336F92b4B8d2eDC032A0Ce45ead6280a", + "0xB720FBC32d60BB6dcc955Be86b98D8fD3c4bA645", + "0x2B47C794c3789f499D8A54Ec12f949EeCCE8bA16", + "0x6e57B9E54ea043a829584B22182ad22bF446926C", + "0xe8B8bfF1E415258eb3d5FA8DeeE9C38406e609cd", + "0x1f8b46abe1EAbF5A60CbBB5Fb2e4a6A46fA0b6e6", + "0x8134A2fDC127549480865fB8E5A9E8A8a95a54c5", + "0xE5F28Fc43Bb40CDF7202ebe406793815b6f07FbD", + "0x4d7959d17B9710BE87e3657e69d946914221BB88", + "0xB280D03909Cc18640621955Cb3bC30948DF2Fa9a", + "0x22D63A26c730d49e5Eab461E4f5De1D8BdF89C92", + "0x0df083de449F75691fc5A36477a6f3284C269108", + "0x3DD9556a521d6e57bE480c94da102fedf0429aba", + "0x4E60495550071693bc8bDfFC40033d278157EAC7", + "0x6387765fFA609aB9A1dA1B16C455548Bfed7CbEA", + "0xfA09479d72E2b3f8B6dF63399772237Ad6658D76", + "0xc37a0a37664aeB3848f98C5dD5d7AE286A1E9Ebd", + "0x47029bc8f5CBe3b464004E87eF9c9419a48018cd", + "0xe8537b6FF1039CB9eD0B71713f697DDbaDBb717d", + "0x79c912FEF520be002c2B6e57EC4324e260f38E50", + "0xf3C45b45223Df6071a478851B9C17e0630fDf535", + "0xC5c247580A4A6E4d3811c0DA6215057aaC480bAc", + "0xf04458f7B21265b80FC340dE7Ee598e24485c5bB", + "0x8F47041aDbeF5BF321c9F63A0660326614ab6B60", + "0x77b6d0279c9cEF559Ef7c32c31d9a5d8Acb664FE", + "0x8542DD4744edEa38b8a9306268b08F4D26d38581", + "0xDB61f9B480f0a8B817811cFAA89A1c219c355224", + "0x4BE2CBE40521279b8fc561e65Bb842bf73ec3a80", + "0xd22363e3762cA7339569F3d33EADe20127D5F98C", + "0xFd7FddFc0A729eCF45fB6B12fA3B71A575E1966F", + "0x667002F9DC61ebcBA8Ee1Cbeb2ad04060388f223", + "0xe63337211DdE2569C348D9B3A0acb5637CFa8aB3", + "0xF753A50fc755c6622BBCAa0f59F0522f264F006e", + "0x6d5BA400640226e24b50214d2bBb3D4Db8e6e15a", + "0xd25711EdfBf747efCE181442Cc1D8F5F8fc8a0D3", + "0x7B50775383d3D6f0215A8F290f2C9e2eEBBEceb2", + "0xd95E98fc33670dC033424E7Aa0578D742D00f9C7", + "0x1AD06Ca54de04DBe9e2817F4C13eCB406DCbeAf0", + "0x296f55f8fb28e498b858d0bcda06d955b2cb3f97", + "0x73cb180bf0521828d8849bc8CF2B920918e23032", + "0x970D50d09F3a656b43E11B0D45241a84e3a6e011", + "0x1DB2466d9F5e10D7090E7152B68d62703a2245F0", + "0x3c8B650257cFb5f272f799F5e2b4e65093a11a05", + "0x6806411765Af15Bddd26f8f544A34cC40cb9838B", + "0x484c2D6e3cDd945a8B2DF735e079178C1036578c", + "0x9485aca5bbBE1667AD97c7fE7C4531a624C8b1ED", + "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb", + "0x217D47011b23BB961eB6D93cA9945B7501a5BB11", + "0x79af5dd14e855823fa3e9ecacdf001d99647d043", + "0x9560e827aF36c94D2Ac33a39bCE1Fe78631088Db", + "0x4e720dd3ac5cfe1e1fbde4935f386bb1c66f4642", +]; + +const POLYGON_REGISTRY_TOKENS = [ + "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", + "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359", + "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", + "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619", + "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6", + "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", + "0xE7a24EF0C5e95Ffb0f6684b813A78F2a3AD7D171", + "0x87ff96aba480f1813aF5c780387d8De7cf7D8261", + "0x2088C47Fc0c78356c622F79dBa4CbE1cCfA84A91", + "0xdAb529f40E671A1D4bF91361c21bf9f0C9712ab7", + "0x4e3Decbb3645551B8A19f0eA1678079FCB33fB4c", + "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + "0x28424507fefb6f7f8E9D3860F56504E4e5f5f390", + "0x20D3922b4a1A8560E1aC99FBA4faDe0c849e2142", + "0x1d2a0E5EC8E5bBDCA5CB219e649B565d8e5c3360", + "0x7D645CBbCAdE2A130bF1bf0528b8541d32D3f8Cf", + "0x2e1AD108fF1D8C782fcBbB89AAd783aC49586756", + "0x45c32fA6DF82ead1e2EF74d17b76547EDdFaFF89", + "0xA691D34Abf93C0A77998e53B564bEcfaf46Dae27", + "0xaA91CDD7abb47F821Cf07a2d38Cc8668DEAf1bdc", + "0x8343091F2499FD4b6174A46D067A920a3b851FF9", + "0x431D5dfF03120AFA4bDf332c61A6e1766eF37BDB", + "0xAd326c253A84e9805559b73A08724e11E49ca651", + "0xE2Aa7db6dA1dAE97C5f5C6914d285fBfCC32A128", + "0x7BDF330f423Ea880FF95fC41A280fD5eCFD3D09f", + "0xE111178A87A3BFf0c8d18DECBa5798827539Ae99", + "0xa3Fa99A148fA48D14Ed51d610c367C61876997F1", + "0x750e4C4984a9e0f12978eA6742Bc1c5D248f40ed", + "0x60D55F02A771d515e077c9C2403a1ef324885CeC", + "0xb5DFABd7fF7F83BAB83995E72A52B97ABb7bcf63", + "0x361a5a4993493ce00f61c32d4ecca5512b82ce90", + "0x2C2D8a078B33bf7782a16AcCE2C5BA6653a90D5f", + "0x172370d5Cd63279eFa6d502DAB29171933a610AF", + "0xdAD97F7713Ae9437fa9249920eC8507e5FbB23d3", + "0x8096ac61db23291252574D49f036f0f9ed8ab390", + "0x447646e84498552e62eCF097Cc305eaBFFF09308", + "0xA73EdCf18421B56D9AF1cE08A34E102E23b2C4B6", + "0x3A58a54C066FdC0f2D55FC9C89F0415C92eBf3C4", + "0x600743B1d8A96438bD46836fD34977a00293f6Aa", + "0xa138341185a9D0429B0021A11FB717B225e13e1F", + "0xb0658482b405496C4EE9453cD0a463b134aEf9d0", + "0xb61Ecec987a9529dbA13a8Dd10ea24446ccBB6ae", + "0xe7CEA2F6d7b120174BF3A9Bc98efaF1fF72C997d", + "0xBed1d474DdA97edcEB7b9af13be4cbf1Bb98A2D3", + "0xfBA3b7Bb043415035220b1c44FB4756434639392", + "0x7BD9757FbAc089d60DaFF1Fa6bfE3BC99b0F5735", + "0xAdf577B69eEaC9Df325536cf1aF106372f2Da263", + "0x81c86081d533f280A8DAaE17F672Fb84B6ed65e3", + "0xbb1b19495b8fe7c402427479b9ac14886cbbaaee", + "0x20759F567BB3EcDB55c817c9a1d13076aB215EdC", + "0x8D9649e50A0d1da8E939f800fB926cdE8f18B47D", + "0xa7de0D88D02B9589d3b02cE52174431275169b77", + "0x40379a439D4F6795B6fc9aa5687dB461677A2dBa", + "0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265", + "0x04d521e2c414e6d898c6f2599fdd863edf49e247", + "0xcdedc76bcc6351275acdef823190453ec43b4edf", + "0x184a51465925ab8a0025e47a00cab6d3769b5487", + "0x3f35705479d9d77c619b2aac9dd7a64e57151506", + "0x98b6a5eedc9382e2c4f8a38f985f2e9ac0b0e84c", + "0xb4d852b92148eaa16467295975167e640e1fe57a", + "0x02203f2351E7aC6aB5051205172D3f772db7D814", + "0xBD02973b441Aa83c8EecEA158b98B5984bb1036E", + "0xd17cb0f162f133e339c0bbfc18c36c357e681d6b", + "0xe058e1ffff9b13d3fcd4803fdb55d1cc2fe07ddc", + "0x8711a1a52c34EDe8E61eF40496ab2618a8F6EA4B", + "0xbe4e30b74b558e41f5837dc86562df44af57a013", + "0xfa68fb4628dff1028cfec22b4162fccd0d45efb6", + "0x2ee50c34392e7e7a1d17b0a42328a8d1ad6894e3", + "0x1205f31718499dbf1fca446663b532ef87481fe1", + "0xb95E1C22dd965FafE926b2A793e9D6757b6613F4", + "0x29e38769f23701a2e4a8ef0492e19da4604be62c", + "0x3f69055f203861abfd5d986dc81a2efa7c915b0c", + "0x74c64d1976157e7aaeeed46ef04705f4424b27ec", + "0x3cc20a6795c4b57d9817399f68e83e71c8626580", + "0xe7806b5ba13d4b2ab3eab3061cb31d4a4f3390aa", + "0x513cdee00251f39de280d9e5f771a6eafebcc88e", + "0xa7565dfeb16010153d3368e002ec53cbfaf96e05", + "0x2589469b7a72802ce02484f053cb6df869eb2689", + "0xE193C653B6030a9BB443AE7c6Ef6e35d93348f98", + "0xFbdd194376de19a88118e84E279b977f165d01b8", +]; + +const AVALANCHE_REGISTRY_TOKENS = [ + "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", + "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", + "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664", + "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7", + "0xc7198437980c041c805A1EDcbA50c1Ce5db95118", + "0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB", + "0x152b9d0FdC40C096757F570A51E494bd4b943E50", + "0x111111111111ed1D73f860F57b2798b683f2d325", + "0x130966628846BFd36ff31a822705796e8cb8C18D", + "0x40b393cecf8F7D7Fc79b83e8fA40e850511817f6", + "0x28690ec942671aC8d9Bc442B667EC338eDE6dFd3", + "0x5c49b268c9841AFF1Cc3B0a418ff5c3442eE3F3b", + "0xb599c3590F42f8F995ECfa0f85D2980B76862fc1", + "0xF14f4CE569cB3679E99d5059909E23B07bd2F387", + "0xAEA2E71b631fA93683BCF256A8689dFa0e094fcD", + "0x6a4aC4DE3bF6bCD2975E2cb15A46954D9bA43fDb", + "0x943F3B750447AbDd61cdF68AE6c3912cd3bedA04", + "0xd39016475200ab8957e9C772C949Ef54bDA69111", + "0x1205f31718499dBf1fCa446663B532Ef87481fe1", + "0xf4003F4efBE8691B60249E6afbD307aBE7758adb", + "0x1dab6560494b04473a0be3e7d83cf3fdf3a51828", + "0xae64d55a6f09e4263421737397d1fdfa71896a69", + "0xFE15c2695F1F920da45C30AAE47d11dE51007AF9", + "0x0e0100ab771e9288e0aa97e11557e6654c3a9665", + "0x32833a12ed3fd5120429fb01564c98ce3c60fc1d", + "0x29e38769f23701A2e4A8Ef0492e19dA4604Be62c", + "0x454E67025631C065d3cFAD6d71E6892f74487a15", + "0x6e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd", + "0xd6070ae98b8069de6b494332d1a1a81b6179d960", + "0x47536f17f4ff30e64a96a7555826b8f9e66ec468", +]; + +const BNB_REGISTRY_TOKENS = [ + "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", + "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", + "0x55d398326f99059fF775485246999027B3197955", + "0x2170Ed0880ac9A755fd29B2688956BD959F933F8", + "0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c", + "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", + "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3", + "0x0827841963Cc8a0515b5baa59782b0a0870b5f88", + "0x483653bcF3a10d9a1c334CE16a19471a614F4385", +]; + +const BASE_REGISTRY_TOKENS = [ + "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", + "0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA", + "0x4621b7A9c75199271F773Ebd9A499dbd165c3191", + "0x8Ee73c484A26e0A5df2Ee2a4960B789967dd0415", + "0x417Ac0e078398C154EdFadD9Ef675d30Be60Af93", + "0xEB466342C4d449BC9f53A865D5Cb90586f405215", + "0x4200000000000000000000000000000000000006", + "0x236aa50979D5f3De3Bd1Eeb40E81137F22ab794b", + "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb", + "0xd07379a755A8f11B57610154861D694b2A0f615a", + "0xB6fe221Fe9EeF5aBa221c348bA20A1Bf5e73624c", + "0x9EaF8C1E34F05a589EDa6BAfdF391Cf6Ad3CB239", + "0xf6C5F01C7F3148891ad0e19DF78743D31E390D1f", + "0x6e53131F68a034873b6bFA15502aF094Ef0c5854", + "0x6DfE79cecE4f64c1a34F48cF5802492aB595257E", + "0xf213F2D02837012dC0236cC105061e121bB03e37", + "0x0B25c51637c43decd6CC1C1e3da4518D54ddb528", + "0x44Ecc644449fC3a9858d2007CaA8CFAa4C561f91", + "0x6B87B8663eE63191887F18225F79D9eEb2DE0d34", + "0xb5E331615FdbA7DF49e05CdEACEb14Acdd5091c3", + "0xA6385c73961dd9C58db2EF0c4EB98cE4B60651e8", + "0x7A034374C89C463DD65D8C9BCfe63BcBCED41f4F", + "0x61366A4e6b1DB1b85DD701f2f4BFa275EF271197", + "0xA6F8A6bc3deA678d5bA786f2Ad2f5F93d1c87c18", + "0x6cDcb1C4A4D1C3C6d054b27AC5B77e89eAFb971d", + "0x323121CD6F6274c9aeB9f87e0664C8FDa5d343A5", + "0xcDAC0d6c6C59727a65F871236188350531885C43", + "0x27a8Afa3Bd49406e48a074350fB7b2020c43B2bD", + "0x82a0c1a0d4EF0c0cA3cFDA3AD1AA78309Cc6139b", + "0x5BfB340FA9305abB164Fb0248D0D82FC3D82C3bb", +]; + +const registryTokensByChain = { + ethereum: ETHEREUM_REGISTRY_TOKENS, + arbitrum: ARBITRUM_REGISTRY_TOKENS, + optimism: OPTIMISM_REGISTRY_TOKENS, + polygon: POLYGON_REGISTRY_TOKENS, + avax: AVALANCHE_REGISTRY_TOKENS, + bsc: BNB_REGISTRY_TOKENS, + base: BASE_REGISTRY_TOKENS, +}; + +module.exports = registryTokensByChain; diff --git a/projects/hinkal/relayerUrls.js b/projects/hinkal/relayerUrls.js new file mode 100644 index 000000000000..5dd2bddf5aac --- /dev/null +++ b/projects/hinkal/relayerUrls.js @@ -0,0 +1,11 @@ +const RELAYER_URLS = { + ethereum: "https://ethMainnet.relayer.hinkal.pro", + arbitrum: "https://arbMainnet.relayer.hinkal.pro", + optimism: "https://optimism.relayer.hinkal.pro", + polygon: "https://polygon.relayer.hinkal.pro", + avax: "https://avalanche.relayer.hinkal.pro", + bsc: "https://bnbMainnet.relayer.hinkal.pro", + base: "https://base.relayer.hinkal.pro", +}; + +module.exports = RELAYER_URLS; From a5b1b84a3b34e6dcc379a54f8793648f5cc46458 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 30 May 2024 10:08:55 +0200 Subject: [PATCH 119/855] fix unicrypt --- projects/unicrypt/apiCache.js | 110 +--------------------------------- 1 file changed, 1 insertion(+), 109 deletions(-) diff --git a/projects/unicrypt/apiCache.js b/projects/unicrypt/apiCache.js index fd106b1c6b3f..dee682a1f296 100644 --- a/projects/unicrypt/apiCache.js +++ b/projects/unicrypt/apiCache.js @@ -1,109 +1 @@ -const sdk = require('@defillama/sdk'); -const { config, protocolPairs, tokens, stakingContracts, - ethereumContractData, baseContractData, bscContractData, polygonContractData, - avalancheContractData, gnosisContractData,arbitrumContractData, } = require('./config') - const { getCache, setCache, } = require("../helper/cache") - const { vestingHelper, } = require("../helper/unknownTokens") -const project = 'bulky/unicrypt' - -const { stakings } = require("../helper/staking"); -const { pool2s } = require("../helper/pool2"); - -function tvl(args) { - return async (timestamp, ethBlock, chainBlocks) => { - let totalBalances = {} - for (let i = 0; i < args.length; i++) { - const chain = args[i].chain - const contract = args[i].contract.toLowerCase() - const cache = await getCache(project, chain) - if (!cache.vaults) cache.vaults = {} - if (!cache.vaults[contract]) cache.vaults[contract] = { tokens: [] } - const cCache = cache.vaults[contract] - let block = chainBlocks[chain] - const { output: totalDepositId } = await sdk.api.abi.call({ - target: contract, - abi: args[i].getNumLockedTokensABI, - chain, block, - }) - - let tokens = cCache.tokens; - let j = cCache.lastTotalDepositId || 0 - cCache.lastTotalDepositId = +totalDepositId - let calls = [] - for (; j < totalDepositId; j++) - calls.push({ target: contract, params: j }) - - const lpAllTokens = ( - await sdk.api.abi.multiCall({ - abi: args[i].getLockedTokenAtIndexABI, - calls, chain, block, - }) - ).output - - lpAllTokens.forEach(lp => { - if (!lp.success) return; - const lpToken = lp.output - tokens.push(lpToken) - }) - - const blacklist = [...(args[i].pool2 || [])] - - if (chain === 'ethereum') - blacklist.push('0x72E5390EDb7727E3d4e3436451DADafF675dBCC0') // HANU - - let balances = await vestingHelper({ - chain, block, - owner: contract, - useDefaultCoreAssets: true, - blacklist, - tokens, - cache, - }) - - for (const [token, balance] of Object.entries(balances)) - sdk.util.sumSingleBalance(totalBalances, token, balance) - await setCache(project, chain, cache) - } - return totalBalances - } -} - -module.exports = { - methodology: - `Counts each LP pair's native token and - stable balance, adjusted to reflect locked pair's value. - Balances and merged across multiple - locker and staking contracts to return sum TVL per chain`, - - ethereum: { - staking: stakings( - stakingContracts, - tokens.uncx_eth, - config.uniswapv2.chain - ), - tvl: tvl(ethereumContractData), - - pool2: pool2s([config.uniswapv2.locker, config.pol.locker], - [protocolPairs.uncx_WETH], - config.uniswapv2.chain) - }, - bsc: { - tvl: tvl(bscContractData), - - pool2: pool2s([config.pancakeswapv2.locker, config.pancakeswapv1.locker, config.safeswap.locker, - config.julswap.locker, config.biswap.locker], - [protocolPairs.uncx_BNB], config.pancakeswapv2.chain) - }, - polygon: { - tvl: tvl(polygonContractData) - }, - avax: { tvl: tvl(avalancheContractData) }, - arbitrum: { tvl: tvl(arbitrumContractData) }, - xdai: { - tvl: tvl(gnosisContractData), - pool2: pool2s([config.honeyswap.locker], - [protocolPairs.uncx_XDAI], - config.honeyswap.chain) - }, -} - +module.exports = require('./index.js') \ No newline at end of file From ba5ef6a3b01f05ba7cdf0afc08a865eca893be61 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 30 May 2024 10:14:17 +0200 Subject: [PATCH 120/855] fix unicrypt - add cache --- projects/unicrypt/apiCache.js | 113 +++++++++++++++++++++++++++++++++- projects/unicrypt/index.js | 109 +------------------------------- 2 files changed, 113 insertions(+), 109 deletions(-) diff --git a/projects/unicrypt/apiCache.js b/projects/unicrypt/apiCache.js index dee682a1f296..a593eb093012 100644 --- a/projects/unicrypt/apiCache.js +++ b/projects/unicrypt/apiCache.js @@ -1 +1,112 @@ -module.exports = require('./index.js') \ No newline at end of file +const sdk = require('@defillama/sdk'); +const { config, protocolPairs, tokens, stakingContracts, + ethereumContractData, baseContractData, bscContractData, polygonContractData, + avalancheContractData, gnosisContractData, arbitrumContractData, } = require('./config') +const { getCache, setCache, } = require("../helper/cache") +const { vestingHelper, } = require("../helper/unknownTokens") +const project = 'bulky/unicrypt' + +const { stakings } = require("../helper/staking"); +const { pool2s } = require("../helper/pool2"); + +function tvl(args) { + return async (timestamp, ethBlock, chainBlocks) => { + let totalBalances = {} + for (let i = 0; i < args.length; i++) { + const chain = args[i].chain + const contract = args[i].contract.toLowerCase() + const cache = await getCache(project, chain) + if (!cache.vaults) cache.vaults = {} + if (!cache.vaults[contract]) cache.vaults[contract] = { tokens: [] } + const cCache = cache.vaults[contract] + let block = chainBlocks[chain] + const { output: totalDepositId } = await sdk.api.abi.call({ + target: contract, + abi: args[i].getNumLockedTokensABI, + chain, block, + }) + + let tokens = cCache.tokens; + let j = cCache.lastTotalDepositId || 0 + cCache.lastTotalDepositId = +totalDepositId + let calls = [] + for (; j < totalDepositId; j++) + calls.push({ target: contract, params: j }) + + const lpAllTokens = ( + await sdk.api.abi.multiCall({ + abi: args[i].getLockedTokenAtIndexABI, + calls, chain, block, + }) + ).output + + lpAllTokens.forEach(lp => { + if (!lp.success) return; + const lpToken = lp.output + tokens.push(lpToken) + }) + + const blacklist = [...(args[i].pool2 || [])] + + if (chain === 'ethereum') + blacklist.push('0x72E5390EDb7727E3d4e3436451DADafF675dBCC0') // HANU + + let balances = await vestingHelper({ + chain, block, + owner: contract, + useDefaultCoreAssets: true, + blacklist, + tokens, + cache, + }) + + for (const [token, balance] of Object.entries(balances)) + sdk.util.sumSingleBalance(totalBalances, token, balance) + await setCache(project, chain, cache) + } + return totalBalances + } +} + +module.exports = { + methodology: + `Counts each LP pair's native token and + stable balance, adjusted to reflect locked pair's value. + Balances and merged across multiple + locker and staking contracts to return sum TVL per chain`, + + ethereum: { + staking: stakings( + stakingContracts, + tokens.uncx_eth, + config.uniswapv2.chain + ), + tvl: tvl(ethereumContractData), + + pool2: pool2s([config.uniswapv2.locker, config.pol.locker], + [protocolPairs.uncx_WETH], + config.uniswapv2.chain) + }, + base: { + tvl: tvl(baseContractData) + }, + bsc: { + tvl: tvl(bscContractData), + + pool2: pool2s([config.pancakeswapv2.locker, config.pancakeswapv1.locker, config.safeswap.locker, + config.julswap.locker, config.biswap.locker], + [protocolPairs.uncx_BNB], config.pancakeswapv2.chain) + }, + polygon: { + tvl: tvl(polygonContractData) + }, + avax: { tvl: tvl(avalancheContractData) }, + arbitrum: { tvl: tvl(arbitrumContractData) }, + xdai: { + tvl: tvl(gnosisContractData), + pool2: pool2s([config.honeyswap.locker], + [protocolPairs.uncx_XDAI], + config.honeyswap.chain) + }, +} + diff --git a/projects/unicrypt/index.js b/projects/unicrypt/index.js index 614ff0b637f3..3bce8bb712a2 100644 --- a/projects/unicrypt/index.js +++ b/projects/unicrypt/index.js @@ -1,108 +1 @@ -const sdk = require('@defillama/sdk'); -const { config, protocolPairs, tokens, stakingContracts, - ethereumContractData, bscContractData, polygonContractData, - avalancheContractData, gnosisContractData, arbitrumContractData, - baseContractData, } = require('./config') - -const { stakings } = require("../helper/staking"); -const { pool2s } = require("../helper/pool2"); - -const { vestingHelper } = require("../helper/unknownTokens") - -function tvl(args) { - return async (timestamp, ethBlock, chainBlocks) => { - let totalBalances = {} - for (let i = 0; i < args.length; i++) { - const chain = args[i].chain - const contract = args[i].contract - let block = chainBlocks[chain] - const { output: totalDepositId } = await sdk.api.abi.call({ - target: contract, - abi: args[i].getNumLockedTokensABI, - chain, block, - }) - - let tokens = []; - const allDepositId = Array.from(Array(+totalDepositId).keys()); - const lpAllTokens = ( - await sdk.api.abi.multiCall({ - abi: args[i].getLockedTokenAtIndexABI, - calls: allDepositId.map((num) => ({ - target: contract, - params: num, - })), - chain: chain, - block: block - }) - ).output - - lpAllTokens.forEach(lp => { - if (!lp.success) return; - const lpToken = lp.output - tokens.push(lpToken) - }) - - const blacklist = [...(args[i].pool2 || [])] - - if (chain === 'ethereum') - blacklist.push('0x72E5390EDb7727E3d4e3436451DADafF675dBCC0') // HANU - - let balances = await vestingHelper({ - chain, block, - owner: contract, - useDefaultCoreAssets: true, - blacklist, - tokens, - }) - - for (const [token, balance] of Object.entries(balances)) - sdk.util.sumSingleBalance(totalBalances, token, balance) - } - return totalBalances - } -} - -module.exports = { - methodology: - `Counts each LP pair's native token and - stable balance, adjusted to reflect locked pair's value. - Balances and merged across multiple - locker and staking contracts to return sum TVL per chain`, - - ethereum: { - staking: stakings( - stakingContracts, - tokens.uncx_eth, - config.uniswapv2.chain - ), - tvl: tvl(ethereumContractData), - - pool2: pool2s([config.uniswapv2.locker, config.pol.locker], - [protocolPairs.uncx_WETH], - config.uniswapv2.chain) - }, - base: { - tvl: tvl(baseContractData) - }, - bsc: { - tvl: tvl(bscContractData), - - pool2: pool2s([config.pancakeswapv2.locker, config.pancakeswapv1.locker, config.safeswap.locker, - config.julswap.locker, config.biswap.locker], - [protocolPairs.uncx_BNB], config.pancakeswapv2.chain) - }, - polygon: { - tvl: tvl(polygonContractData) - }, - avax: { - tvl: tvl(avalancheContractData) - }, - arbitrum: { tvl: tvl(arbitrumContractData) }, - xdai: { - tvl: tvl(gnosisContractData), - pool2: pool2s([config.honeyswap.locker], - [protocolPairs.uncx_XDAI], - config.honeyswap.chain) - }, -} - +module.exports = require('./apiCache') \ No newline at end of file From d8d9775dfaaf3dc46138a9ddee90d18f129e3b0c Mon Sep 17 00:00:00 2001 From: Jean Chambras Date: Thu, 30 May 2024 12:53:35 +0200 Subject: [PATCH 121/855] Add spectra TVL adapter --- projects/spectra/index.js | 164 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 projects/spectra/index.js diff --git a/projects/spectra/index.js b/projects/spectra/index.js new file mode 100644 index 000000000000..ccbacd8dfd79 --- /dev/null +++ b/projects/spectra/index.js @@ -0,0 +1,164 @@ +const { getLogs } = require("../helper/cache/getLogs"); +const sdk = require("@defillama/sdk"); + +const abi = { + markets: { + balances: + "function balances(uint256 index) external view returns (uint256)", + }, + pt: { + getIBT: "function getIBT() external view override returns (address)", + balanceOf: + "function balanceOf(address account) external view returns (uint256)", + }, + vault: { + convertToAsset: + "function convertToAssets(uint256 shares) external view returns (uint256 assets)", + asset: "function asset() external view returns (address assetTokenAddress)", + }, +}; + +const config = { + ethereum: { + factory: "0xae4d5d5199265512B2a77Ad675107735B891aBc8", + fromBlock: 19727256, + }, + arbitrum: { + factory: "0x51100574E1CF11ee9fcC96D70ED146250b0Fdb60", + fromBlock: 204418891, + }, +}; + +module.exports = { + methodology: `All deposited underlying in Spectra Principal Tokens and all underlying supplied as liquidity in Spectra Markets`, +}; + +Object.keys(config).forEach((chain) => { + const { factory, fromBlock } = config[chain]; + module.exports[chain] = { + tvl: async (api) => { + const marketData = await getMarkets(api); + const ibtsInMarket = await api.batchCall( + marketData.map((market) => { + return { + target: market[0], + params: 0, + abi: abi.markets.balances, + }; + }) + ); + const marketsIbtsWithBalance = marketData.map((market, i) => [ + market[1], + ibtsInMarket[i], + ]); + + const poolIBTBalances = marketsIbtsWithBalance.reduce( + (acc, [ibt, balance]) => { + if (acc[ibt] === undefined) { + acc[ibt] = BigInt(0); + } + acc[ibt] += sdk.util.convertToBigInt(balance); + return acc; + }, + {} + ); + + const pts = await getPTs(api); + const ptIbts = await api.batchCall( + pts.map((pt) => { + return { + target: pt, + abi: abi.pt.getIBT, + }; + }) + ); + const ibtBalances = await api.batchCall( + pts.map((pt, i) => { + return { + target: ptIbts[i], + params: pt, + abi: abi.pt.balanceOf, + }; + }) + ); + const ptsIbtsWithBalances = ibtBalances.map((balance, i) => [ + ptIbts[i], + balance, + ]); + const ptIBTBalances = ptsIbtsWithBalances.reduce( + (acc, [ibt, balance]) => { + if (acc[ibt] === undefined) { + acc[ibt] = BigInt(0); + } + acc[ibt] += sdk.util.convertToBigInt(balance); + return acc; + }, + {} + ); + + const allIBTBalances = Object.entries({ + ...poolIBTBalances, + ...ptIBTBalances, + }).reduce( + (acc, [key, value]) => ({ + ...acc, + [key]: (poolIBTBalances[key] || 0n) + (ptIBTBalances[key] || 0n), + }), + {} + ); + + const Assets = await api.batchCall( + Object.entries(allIBTBalances).map(([ibt, balance]) => { + return { + target: ibt, + abi: abi.vault.asset, + }; + }) + ); + const AssetsBalances = await api.batchCall( + Object.entries(allIBTBalances).map(([ibt, balance], i) => { + return { + target: ibt, + params: balance, + abi: abi.vault.convertToAsset, + }; + }) + ); + const assetsWithBalances = Assets.map((asset, i) => [ + asset, + sdk.util.convertToBigInt(AssetsBalances[i]), + ]); + assetsWithBalances.forEach(([asset, balance]) => { + api.add(asset, balance); + }); + let balances = api.getBalances(); + return balances; + }, + }; + + async function getMarkets(api) { + const logs = await getLogs({ + api, + target: factory, + eventAbi: + "event CurvePoolDeployed(address indexed poolAddress, address indexed ibt, address indexed pt)", + onlyArgs: true, + fromBlock: fromBlock, + skipCache: true, + }); + return logs.map((i) => [i.poolAddress, i.ibt]); + } + + async function getPTs(api) { + const logs = await getLogs({ + api, + target: factory, + eventAbi: + "event PTDeployed(address indexed pt, address indexed poolCreator)", + onlyArgs: true, + fromBlock: fromBlock, + skipCache: true, + }); + return logs.map((i) => i.pt); + } +}); From 3846afbb70346322fe5b31071fa17ac021688f67 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 30 May 2024 15:27:13 +0200 Subject: [PATCH 122/855] update sdk version --- package-lock.json | 73 +++++++++++++++++++++++++++++++++-- projects/helper/env.js | 1 - projects/helper/heroku-api.js | 50 +++++++++++++----------- 3 files changed, 97 insertions(+), 27 deletions(-) diff --git a/package-lock.json b/package-lock.json index e5913d908526..dab982ba3670 100644 --- a/package-lock.json +++ b/package-lock.json @@ -886,11 +886,12 @@ } }, "node_modules/@defillama/sdk": { - "version": "5.0.57", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.57.tgz", - "integrity": "sha512-a4xLOQp7Y5vD+6HVuNPmWxOmsg9MDJliTPen8nzjXoxDG/WWHKFwARa035l60zeoq/TWY6JbTFOBoruCBVYN2g==", + "version": "5.0.59", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.59.tgz", + "integrity": "sha512-9Gxs1OkyPrqfvf9nuvlvwWUCxoJO4uHLOfJaT9p6LwC9xl2+iFY0Yb/+kCt0TgRYRooEP88Z4Rf3PmnmhTsw+g==", "dependencies": { "@aws-sdk/client-s3": "^3.400.0", + "@elastic/elasticsearch": "^8.13.1", "@supercharge/promise-pool": "^2.1.0", "axios": "^1.6.5", "ethers": "^6.0.0", @@ -898,6 +899,39 @@ "tron-format-address": "^0.1.11" } }, + "node_modules/@elastic/elasticsearch": { + "version": "8.13.1", + "resolved": "https://registry.npmjs.org/@elastic/elasticsearch/-/elasticsearch-8.13.1.tgz", + "integrity": "sha512-2G4Vu6OHw4+XTrp7AGIcOEezpPEoVrWg2JTK1v/exEKSLYquZkUdd+m4yOL3/UZ6bTj7hmXwrmYzW76BnLCkJQ==", + "dependencies": { + "@elastic/transport": "~8.4.1", + "tslib": "^2.4.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@elastic/transport": { + "version": "8.4.1", + "resolved": "https://registry.npmjs.org/@elastic/transport/-/transport-8.4.1.tgz", + "integrity": "sha512-/SXVuVnuU5b4dq8OFY4izG+dmGla185PcoqgK6+AJMpmOeY1QYVNbWtCwvSvoAANN5D/wV+EBU8+x7Vf9EphbA==", + "dependencies": { + "debug": "^4.3.4", + "hpagent": "^1.0.0", + "ms": "^2.1.3", + "secure-json-parse": "^2.4.0", + "tslib": "^2.4.0", + "undici": "^5.22.1" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@elastic/transport/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", @@ -954,6 +988,14 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, + "node_modules/@fastify/busboy": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", + "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", + "engines": { + "node": ">=14" + } + }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.13", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", @@ -2363,7 +2405,6 @@ "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, "dependencies": { "ms": "2.1.2" }, @@ -2934,6 +2975,14 @@ "resolved": "https://registry.npmjs.org/hi-base32/-/hi-base32-0.5.1.tgz", "integrity": "sha512-EmBBpvdYh/4XxsnUybsPag6VikPYnN30td+vQk+GI3qpahVEG9+gTkG0aXVxTjBqQ5T6ijbWIu77O+C5WFWsnA==" }, + "node_modules/hpagent": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/hpagent/-/hpagent-1.2.0.tgz", + "integrity": "sha512-A91dYTeIB6NoXG+PxTQpCCDDnfHsW9kc06Lvpu1TEe9gnd6ZFeiBoRO9JvzEv6xK7EX97/dUE8g/vBMTqTS3CA==", + "engines": { + "node": ">=14" + } + }, "node_modules/humanize-ms": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", @@ -3584,6 +3633,11 @@ } ] }, + "node_modules/secure-json-parse": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-2.7.0.tgz", + "integrity": "sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw==" + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -3811,6 +3865,17 @@ "node": ">=14.17" } }, + "node_modules/undici": { + "version": "5.28.4", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", + "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", + "dependencies": { + "@fastify/busboy": "^2.0.0" + }, + "engines": { + "node": ">=14.0" + } + }, "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", diff --git a/projects/helper/env.js b/projects/helper/env.js index d9af5a50f571..8e00c39e43f3 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -20,7 +20,6 @@ const DEFAULTS = { REAL_RPC: 'https://real.drpc.org', // added manually short name is re-al TAIKO_RPC: 'https://rpc.taiko.xyz', // added manually short name is tko-mainnet REAL_RPC_MULTICALL: '0xcA11bde05977b3631167028862bE2a173976CA11', - TAIKO_RPC_MULTICALL: '0xcb2436774C3e191c85056d248EF4260ce5f27A9D', } const ENV_KEYS = [ diff --git a/projects/helper/heroku-api.js b/projects/helper/heroku-api.js index aecb1ec9a416..1cbe02f416ca 100644 --- a/projects/helper/heroku-api.js +++ b/projects/helper/heroku-api.js @@ -1,35 +1,41 @@ const { get } = require('./http') const endpoint = "https://sushi-analytics.llama.fi" +let data +async function getData() { + if (!data) data = get(endpoint) + return data +} + function getTvl(protocol, chain) { - return async (timestamp) => { - if (typeof timestamp === "object" && timestamp.timestamp) timestamp = timestamp.timestamp - if(Math.abs(Date.now()/1000-timestamp) > 3600){ - throw new Error("Can't refill adapters moved to heroku") - } - const data = await get(`${endpoint}?project=${protocol}&chain=${chain}`) - if(data[protocol]?.[chain] === undefined){ - throw new Error(`Data for protocol ${protocol} on chain ${chain} is undefined on heroku`) - } - return data[protocol][chain] + return async (timestamp) => { + if (typeof timestamp === "object" && timestamp.timestamp) timestamp = timestamp.timestamp + if (Math.abs(Date.now() / 1000 - timestamp) > 3600) { + throw new Error("Can't refill adapters moved to heroku") } + const data = await getData() + if (data[protocol]?.[chain] === undefined) { + throw new Error(`Data for protocol ${protocol} on chain ${chain} is undefined on heroku`) + } + return data[protocol][chain] + } } function getExports(protocol, chains, exportKeys = []) { - const chainTvls = chains.reduce((obj, chain) => { - obj[chain] = { - tvl: getTvl(protocol, chain) - } - exportKeys.forEach(key => { - obj[chain][key] = getTvl(`${protocol}-${key}`, chain) - }) - return obj - }, {}) + const chainTvls = chains.reduce((obj, chain) => { + obj[chain] = { + tvl: getTvl(protocol, chain) + } + exportKeys.forEach(key => { + obj[chain][key] = getTvl(`${protocol}-${key}`, chain) + }) + return obj + }, {}) - return chainTvls + return chainTvls } -module.exports={ - getExports +module.exports = { + getExports } From 54b413d418c0a58c87fb9763b49d04d2e53dd1d4 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 30 May 2024 15:30:12 +0200 Subject: [PATCH 123/855] code refactor --- projects/cketh/index.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/projects/cketh/index.js b/projects/cketh/index.js index c524a6a1afee..0a12acb97319 100644 --- a/projects/cketh/index.js +++ b/projects/cketh/index.js @@ -1,16 +1,16 @@ const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); -const { get } = require('../helper/http') +// const { get } = require('../helper/http') const ADDRESSES = require('../helper/coreAssets.json') const contract = "0xb25eA1D493B49a1DeD42aC5B1208cC618f9A9B80"; async function tvl(api) { - var end = api.timestamp - let start = end - 24 * 60 * 60; - const { data } = await get(`https://icrc-api.internetcomputer.org/api/v1/ledgers/xevnm-gaaaa-aaaar-qafnq-cai/total-supply?start=${start}&end=${end}&step=1`); - let [_, bal] = data.pop() - api.add(ADDRESSES.ethereum.USDC, bal/1e2) - return sumTokens2({ tokens: [nullAddress], owner: contract, api }); + // var end = api.timestamp + // let start = end - 24 * 60 * 60; + // const { data } = await get(`https://icrc-api.internetcomputer.org/api/v1/ledgers/xevnm-gaaaa-aaaar-qafnq-cai/total-supply?start=${start}&end=${end}&step=1`); + // let [_, bal] = data.pop() + // api.add(ADDRESSES.ethereum.USDC, bal/1e2) + return sumTokens2({ tokens: [nullAddress, ADDRESSES.ethereum.USDC], owner: contract, api }); } module.exports = { From 2a13caa47fa313dd12c4c9dfa8ca4c355e3391ec Mon Sep 17 00:00:00 2001 From: Jean Chambras Date: Thu, 30 May 2024 15:52:14 +0200 Subject: [PATCH 124/855] Refactor adapter code and split in files --- projects/spectra/abi.json | 14 +++ projects/spectra/config.json | 10 ++ projects/spectra/index.js | 171 ++++++++++++----------------------- 3 files changed, 84 insertions(+), 111 deletions(-) create mode 100644 projects/spectra/abi.json create mode 100644 projects/spectra/config.json diff --git a/projects/spectra/abi.json b/projects/spectra/abi.json new file mode 100644 index 000000000000..8a75703679af --- /dev/null +++ b/projects/spectra/abi.json @@ -0,0 +1,14 @@ +{ + "markets": { + "balances": "function balances(uint256 index) external view returns (uint256)" + }, + "pt": { + "getIBT": "function getIBT() external view override returns (address)", + "balanceOf": "function balanceOf(address account) external view returns (uint256)" + }, + "vault": { + "convertToAsset": "function convertToAssets(uint256 shares) external view returns (uint256 assets)", + "asset": "function asset() external view returns (address assetTokenAddress)" + } + } + \ No newline at end of file diff --git a/projects/spectra/config.json b/projects/spectra/config.json new file mode 100644 index 000000000000..1cdebca0c99f --- /dev/null +++ b/projects/spectra/config.json @@ -0,0 +1,10 @@ +{ + "ethereum": { + "factory": "0xae4d5d5199265512B2a77Ad675107735B891aBc8", + "fromBlock": 19727256 + }, + "arbitrum": { + "factory": "0x51100574E1CF11ee9fcC96D70ED146250b0Fdb60", + "fromBlock": 204418891 + } +} diff --git a/projects/spectra/index.js b/projects/spectra/index.js index ccbacd8dfd79..98ab6066db49 100644 --- a/projects/spectra/index.js +++ b/projects/spectra/index.js @@ -1,34 +1,8 @@ const { getLogs } = require("../helper/cache/getLogs"); +const abi = require("./abi.json"); +const config = require("./config.json"); const sdk = require("@defillama/sdk"); -const abi = { - markets: { - balances: - "function balances(uint256 index) external view returns (uint256)", - }, - pt: { - getIBT: "function getIBT() external view override returns (address)", - balanceOf: - "function balanceOf(address account) external view returns (uint256)", - }, - vault: { - convertToAsset: - "function convertToAssets(uint256 shares) external view returns (uint256 assets)", - asset: "function asset() external view returns (address assetTokenAddress)", - }, -}; - -const config = { - ethereum: { - factory: "0xae4d5d5199265512B2a77Ad675107735B891aBc8", - fromBlock: 19727256, - }, - arbitrum: { - factory: "0x51100574E1CF11ee9fcC96D70ED146250b0Fdb60", - fromBlock: 204418891, - }, -}; - module.exports = { methodology: `All deposited underlying in Spectra Principal Tokens and all underlying supplied as liquidity in Spectra Markets`, }; @@ -38,101 +12,76 @@ Object.keys(config).forEach((chain) => { module.exports[chain] = { tvl: async (api) => { const marketData = await getMarkets(api); - const ibtsInMarket = await api.batchCall( - marketData.map((market) => { - return { - target: market[0], - params: 0, - abi: abi.markets.balances, - }; - }) - ); - const marketsIbtsWithBalance = marketData.map((market, i) => [ - market[1], - ibtsInMarket[i], - ]); - - const poolIBTBalances = marketsIbtsWithBalance.reduce( - (acc, [ibt, balance]) => { - if (acc[ibt] === undefined) { - acc[ibt] = BigInt(0); - } - acc[ibt] += sdk.util.convertToBigInt(balance); - return acc; - }, - {} - ); + const marketBatchCalls = marketData.map((market) => ({ + target: market[0], + params: 0, + abi: abi.markets.balances, + })); const pts = await getPTs(api); - const ptIbts = await api.batchCall( - pts.map((pt) => { - return { - target: pt, - abi: abi.pt.getIBT, - }; - }) - ); - const ibtBalances = await api.batchCall( - pts.map((pt, i) => { - return { - target: ptIbts[i], - params: pt, - abi: abi.pt.balanceOf, - }; - }) - ); - const ptsIbtsWithBalances = ibtBalances.map((balance, i) => [ - ptIbts[i], - balance, + const ptIBTCalls = pts.map((pt) => ({ + target: pt, + abi: abi.pt.getIBT, + })); + + const [ibtsInMarket, ptIbts] = await Promise.all([ + api.batchCall(marketBatchCalls), + api.batchCall(ptIBTCalls), ]); - const ptIBTBalances = ptsIbtsWithBalances.reduce( - (acc, [ibt, balance]) => { - if (acc[ibt] === undefined) { - acc[ibt] = BigInt(0); - } - acc[ibt] += sdk.util.convertToBigInt(balance); - return acc; - }, - {} - ); - const allIBTBalances = Object.entries({ - ...poolIBTBalances, - ...ptIBTBalances, - }).reduce( - (acc, [key, value]) => ({ - ...acc, - [key]: (poolIBTBalances[key] || 0n) + (ptIBTBalances[key] || 0n), - }), - {} - ); + const ptIBTBalanceCalls = ptIbts.map((ibt, i) => ({ + target: ibt, + params: pts[i], + abi: abi.pt.balanceOf, + })); + const ibtBalances = await api.batchCall(ptIBTBalanceCalls); - const Assets = await api.batchCall( - Object.entries(allIBTBalances).map(([ibt, balance]) => { - return { - target: ibt, - abi: abi.vault.asset, - }; - }) - ); - const AssetsBalances = await api.batchCall( - Object.entries(allIBTBalances).map(([ibt, balance], i) => { - return { - target: ibt, - params: balance, - abi: abi.vault.convertToAsset, - }; + const poolIBTBalances = marketData.reduce((acc, market, i) => { + const ibt = market[1]; + const balance = sdk.util.convertToBigInt(ibtsInMarket[i]); + acc[ibt] = (acc[ibt] || 0n) + balance; + return acc; + }, {}); + + const ptIBTBalances = ptIbts.reduce((acc, ibt, i) => { + const balance = sdk.util.convertToBigInt(ibtBalances[i]); + acc[ibt] = (acc[ibt] || 0n) + balance; + return acc; + }, {}); + + const allIBTBalances = { ...poolIBTBalances }; + for (const [ibt, balance] of Object.entries(ptIBTBalances)) { + allIBTBalances[ibt] = (allIBTBalances[ibt] || 0n) + balance; + } + + const assetCalls = Object.keys(allIBTBalances).map((ibt) => ({ + target: ibt, + abi: abi.vault.asset, + })); + + const assetBalanceCalls = Object.entries(allIBTBalances).map( + ([ibt, balance]) => ({ + target: ibt, + params: balance, + abi: abi.vault.convertToAsset, }) ); - const assetsWithBalances = Assets.map((asset, i) => [ + + const [assets, assetBalances] = await Promise.all([ + api.batchCall(assetCalls), + api.batchCall(assetBalanceCalls), + ]); + + const assetsWithBalances = assets.map((asset, i) => [ asset, - sdk.util.convertToBigInt(AssetsBalances[i]), + sdk.util.convertToBigInt(assetBalances[i]), ]); + assetsWithBalances.forEach(([asset, balance]) => { api.add(asset, balance); }); - let balances = api.getBalances(); - return balances; + + return api.getBalances(); }, }; From a9337eb3acc2fe7a53f5d9fbf698ad74b876d7e8 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Thu, 30 May 2024 14:54:11 +0100 Subject: [PATCH 125/855] add hallamark stable (#10437) --- projects/platypus-finance/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/platypus-finance/index.js b/projects/platypus-finance/index.js index 8a2c8944406f..3b8368e1bdab 100644 --- a/projects/platypus-finance/index.js +++ b/projects/platypus-finance/index.js @@ -29,5 +29,6 @@ module.exports = { hallmarks: [ [Math.floor(new Date('2023-02-17') / 1e3), 'Protocol was hacked for $8.5m'], [Math.floor(new Date('2023-10-12') / 1e3), 'Protocol was hacked for $2m'], + [1716811215,"Acquired by Stable Jack"] ], }; From ddb8bc3f4a61e52bb325bbbc2df464148935e85e Mon Sep 17 00:00:00 2001 From: Jean Chambras Date: Thu, 30 May 2024 16:39:22 +0200 Subject: [PATCH 126/855] Update abi --- projects/spectra/abi.json | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/projects/spectra/abi.json b/projects/spectra/abi.json index 8a75703679af..4378366d8b49 100644 --- a/projects/spectra/abi.json +++ b/projects/spectra/abi.json @@ -1,14 +1,13 @@ { - "markets": { - "balances": "function balances(uint256 index) external view returns (uint256)" - }, - "pt": { - "getIBT": "function getIBT() external view override returns (address)", - "balanceOf": "function balanceOf(address account) external view returns (uint256)" - }, - "vault": { - "convertToAsset": "function convertToAssets(uint256 shares) external view returns (uint256 assets)", - "asset": "function asset() external view returns (address assetTokenAddress)" - } + "markets": { + "balances": "function balances(uint256 index) view returns (uint256)" + }, + "pt": { + "getIBT": "function getIBT() view override returns (address)", + "balanceOf": "function balanceOf(address account) view returns (uint256)" + }, + "vault": { + "convertToAsset": "function convertToAssets(uint256 shares) view returns (uint256 assets)", + "asset": "function asset() view returns (address assetTokenAddress)" } - \ No newline at end of file +} From 097c2718dbde1d418c6a7d9d0bfe066b8268a946 Mon Sep 17 00:00:00 2001 From: Jean Chambras Date: Thu, 30 May 2024 16:52:38 +0200 Subject: [PATCH 127/855] Remove override from ABI --- projects/spectra/abi.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/spectra/abi.json b/projects/spectra/abi.json index 4378366d8b49..63026fe20409 100644 --- a/projects/spectra/abi.json +++ b/projects/spectra/abi.json @@ -3,7 +3,7 @@ "balances": "function balances(uint256 index) view returns (uint256)" }, "pt": { - "getIBT": "function getIBT() view override returns (address)", + "getIBT": "function getIBT() view returns (address)", "balanceOf": "function balanceOf(address account) view returns (uint256)" }, "vault": { From 294a2f5045b24652b04a57050ce9e681950cdbe3 Mon Sep 17 00:00:00 2001 From: miler012 <124125686+miler012@users.noreply.github.com> Date: Fri, 31 May 2024 02:33:27 +0800 Subject: [PATCH 128/855] satori perp add xlayer (#10439) --- projects/satori/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/projects/satori/index.js b/projects/satori/index.js index d0da28bcc758..84a21cc679c6 100644 --- a/projects/satori/index.js +++ b/projects/satori/index.js @@ -51,4 +51,13 @@ module.exports = { tokens: [ADDRESSES.base.USDC], }), }, + xlayer: { + tvl: sumTokensExport({ + owners: [ + "0x80DD5bC934122e56B9536a9F19F2Ea95a38E98c8", + "0xf915391346Fad5a75F31CD00218BB1EFC13e01f2", + ], + tokens: [ADDRESSES.xlayer.USDC], + }), + }, } \ No newline at end of file From d20f027c8a84c77b25afbbde58fd3010a4254f99 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 30 May 2024 20:52:47 +0200 Subject: [PATCH 129/855] Add SEI EVM chain support (#10440) * symbiosis adds SEI EVM chain support * minor fix --------- Co-authored-by: allush --- projects/helper/chains.json | 1 + projects/helper/coreAssets.json | 3 +++ projects/helper/env.js | 2 ++ projects/helper/tokenMapping.js | 3 +++ projects/symbiosis-finance/config.js | 9 +++++++++ 5 files changed, 18 insertions(+) diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 8339a572a4df..ef75ee76527c 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -255,6 +255,7 @@ "scroll", "secret", "sei", + "sei_evm", "shibarium", "shiden", "shimmer_evm", diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index a333a8226f2e..88be3bab6f7a 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1777,5 +1777,8 @@ }, "taiko": { "WETH": "0xA51894664A773981C6C112C43ce576f315d5b1B6" + }, + "sei_evm": { + "USDC": "0x3894085Ef7Ff0f0aeDf52E2A2704928d1Ec074F1" } } \ No newline at end of file diff --git a/projects/helper/env.js b/projects/helper/env.js index 8e00c39e43f3..a4ae7ad8c3de 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -20,6 +20,8 @@ const DEFAULTS = { REAL_RPC: 'https://real.drpc.org', // added manually short name is re-al TAIKO_RPC: 'https://rpc.taiko.xyz', // added manually short name is tko-mainnet REAL_RPC_MULTICALL: '0xcA11bde05977b3631167028862bE2a173976CA11', + TAIKO_RPC_MULTICALL: '0xcb2436774C3e191c85056d248EF4260ce5f27A9D', + SEI_EVM_RPC: 'https://evm-rpc.sei-apis.com/', } const ENV_KEYS = [ diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 2e201dc4e929..5f65333ba956 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -128,6 +128,9 @@ const fixBalancesTokens = { '0xA51894664A773981C6C112C43ce576f315d5b1B6': { coingeckoId: 'ethereum', decimals: 18 }, '0x07d83526730c7438048d55a4fc0b850e2aab6f0b': { coingeckoId: 'usd-coin', decimals: 6 }, }, + sei_evm: { + '0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1': { coingeckoId: 'usd-coin', decimals: 6 }, + } } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) diff --git a/projects/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js index db5d5e84c146..a094aeae7564 100644 --- a/projects/symbiosis-finance/config.js +++ b/projects/symbiosis-finance/config.js @@ -328,5 +328,14 @@ module.exports = { '0x5Aa5f7f84eD0E5db0a4a85C3947eA16B53352FD4', // portal v2 ] }, + { + name: 'sei_evm', + tokens: [ + ADDRESSES.sei_evm.USDC, + ], + holders: [ + '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 + ] + }, ] } \ No newline at end of file From 470d02245b512a920b67a9cfbfd6880333457677 Mon Sep 17 00:00:00 2001 From: Shoebill Finance <118880028+ShoebillFinance@users.noreply.github.com> Date: Fri, 31 May 2024 03:54:06 +0900 Subject: [PATCH 130/855] add kroma chain eth market (#10434) * add bob-stable market * update kroma chain --- projects/shoebillFinance-v2/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/projects/shoebillFinance-v2/index.js b/projects/shoebillFinance-v2/index.js index 3625ca5c7d25..a411d75fabf8 100644 --- a/projects/shoebillFinance-v2/index.js +++ b/projects/shoebillFinance-v2/index.js @@ -68,6 +68,12 @@ module.exports = mergeExports([ bob: compoundExports2({ comptroller: "0x1e514767F5cFe1ddE599dd39a79666E3BeEAaf7d", }), - }, - + }, + { + kroma: compoundExports2({ + comptroller: "0x9f53Cd350c3aC49cE6CE673abff647E5fe79A3CC", + cether: "0xD13bE8b716b18265e294831FCb1330d170840BB3", + }), + }, + ]); From 18243e388938651c12af5749e1af959a9c370b44 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 30 May 2024 21:23:57 +0200 Subject: [PATCH 131/855] track https://prixmswap.com/home/ --- projects/prixmswap-v3/index.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 projects/prixmswap-v3/index.js diff --git a/projects/prixmswap-v3/index.js b/projects/prixmswap-v3/index.js new file mode 100644 index 000000000000..5150c4e60405 --- /dev/null +++ b/projects/prixmswap-v3/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + kroma: { factory: '0x94527f0fdbb1497C77Bb8d409F0dAEbB323ca229', fromBlock: 10032631 } +}) \ No newline at end of file From 00757067c310a1ec2eabc957cd5077a21d98b2eb Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 30 May 2024 21:36:17 +0200 Subject: [PATCH 132/855] merge sei and sei evm --- projects/helper/coreAssets.json | 6 ++---- projects/helper/env.js | 2 +- projects/helper/tokenMapping.js | 2 +- projects/symbiosis-finance/config.js | 4 ++-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 88be3bab6f7a..cd79f9eb80fa 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1464,7 +1464,8 @@ "USDCar": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/7edDfnf4mku8So3t4Do215GNHwASEwCWrdhM5GqD51xZ", "USDTet": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/HktfLoADCk9mnjv7XJiN4YXK9ayE6xinLzt8wzcsR2rY", "USDTbs": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/871jbn9unTavWsAe83f2Ma9GJWSv6BKsyWYLiQ6z3Pva", - "WBTC": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/7omXa4gryZ5NiBmLep7JsTtTtANCVKXwT9vbN91aS1br" + "WBTC": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/7omXa4gryZ5NiBmLep7JsTtTtANCVKXwT9vbN91aS1br", + "USDC": "0x3894085Ef7Ff0f0aeDf52E2A2704928d1Ec074F1" }, "op_bnb": { "WBNB": "0x4200000000000000000000000000000000000006", @@ -1777,8 +1778,5 @@ }, "taiko": { "WETH": "0xA51894664A773981C6C112C43ce576f315d5b1B6" - }, - "sei_evm": { - "USDC": "0x3894085Ef7Ff0f0aeDf52E2A2704928d1Ec074F1" } } \ No newline at end of file diff --git a/projects/helper/env.js b/projects/helper/env.js index a4ae7ad8c3de..0bb95dda42cb 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -21,7 +21,7 @@ const DEFAULTS = { TAIKO_RPC: 'https://rpc.taiko.xyz', // added manually short name is tko-mainnet REAL_RPC_MULTICALL: '0xcA11bde05977b3631167028862bE2a173976CA11', TAIKO_RPC_MULTICALL: '0xcb2436774C3e191c85056d248EF4260ce5f27A9D', - SEI_EVM_RPC: 'https://evm-rpc.sei-apis.com/', + SEI_RPC: 'https://evm-rpc.sei-apis.com/', } const ENV_KEYS = [ diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 5f65333ba956..db6c3724fc5b 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -128,7 +128,7 @@ const fixBalancesTokens = { '0xA51894664A773981C6C112C43ce576f315d5b1B6': { coingeckoId: 'ethereum', decimals: 18 }, '0x07d83526730c7438048d55a4fc0b850e2aab6f0b': { coingeckoId: 'usd-coin', decimals: 6 }, }, - sei_evm: { + sei: { '0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1': { coingeckoId: 'usd-coin', decimals: 6 }, } } diff --git a/projects/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js index a094aeae7564..d0f1329ed4f4 100644 --- a/projects/symbiosis-finance/config.js +++ b/projects/symbiosis-finance/config.js @@ -329,9 +329,9 @@ module.exports = { ] }, { - name: 'sei_evm', + name: 'sei', tokens: [ - ADDRESSES.sei_evm.USDC, + ADDRESSES.sei.USDC, ], holders: [ '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 From 759a423e778e310fbf58162f10e0a8ac391bce47 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 30 May 2024 21:38:51 +0200 Subject: [PATCH 133/855] merge sei and sei evm --- projects/helper/chains.json | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/helper/chains.json b/projects/helper/chains.json index ef75ee76527c..8339a572a4df 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -255,7 +255,6 @@ "scroll", "secret", "sei", - "sei_evm", "shibarium", "shiden", "shimmer_evm", From e83031d8e0583699666ae9a4586c9367a5b25606 Mon Sep 17 00:00:00 2001 From: Aymen <146243083+aymentrosh@users.noreply.github.com> Date: Thu, 30 May 2024 20:39:29 +0100 Subject: [PATCH 134/855] add mantle to karak (#10441) --- projects/karak/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/karak/index.js b/projects/karak/index.js index 5a163ec01a7c..345fd55a23b7 100644 --- a/projects/karak/index.js +++ b/projects/karak/index.js @@ -4,6 +4,7 @@ const config = { ethereum: { factory: '0x54e44dbb92dba848ace27f44c0cb4268981ef1cc', }, arbitrum: { factory: '0x399f22ae52a18382a67542b3de9bed52b7b9a4ad', }, karak: { factory: '0xB308474350D75447cA8731B7Ce87c9ee9DA03B1C', }, + mantle: { factory: '0x4a2b015CcB8658998692Db9eD4522B8e846962eD' }, } Object.keys(config).forEach(chain => { From eb05259409e74e7433cba2d0e580bbd833564a7e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 30 May 2024 21:42:24 +0200 Subject: [PATCH 135/855] "Add SNSY project and staking functionality" (#10442) * Add SNSY project * snsy --------- Co-authored-by: Panagiotis Apostolidis --- projects/snsy/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/snsy/index.js diff --git a/projects/snsy/index.js b/projects/snsy/index.js new file mode 100644 index 000000000000..c0dac1260e8e --- /dev/null +++ b/projects/snsy/index.js @@ -0,0 +1,11 @@ +const { staking } = require('../helper/staking') +const SNSY_TOKEN_CONTRACT = '0x82a605D6D9114F4Ad6D5Ee461027477EeED31E34'; +const SNSY_CLUB_STAKING_CONTRACT = '0x382c70620e42c2EF2b303b97bad1d9439Bf48ef9'; + +module.exports = { + methodology: 'Counts the number of SNSY tokens in the Staking contract.', + ethereum: { + tvl: () => ({}), + staking: staking(SNSY_CLUB_STAKING_CONTRACT, SNSY_TOKEN_CONTRACT) + } +}; \ No newline at end of file From adaa78f3ced4bf166c0eeb5358039584d2eb04dd Mon Sep 17 00:00:00 2001 From: GausPeerzade <116433573+GausPeerzade@users.noreply.github.com> Date: Fri, 31 May 2024 01:13:15 +0530 Subject: [PATCH 136/855] New chains and vault of Rivera Money (#10431) * Added Arbitrum vaults * Added new chains --- projects/rivera_money/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/projects/rivera_money/index.js b/projects/rivera_money/index.js index 33f1739f2352..d743e285f269 100644 --- a/projects/rivera_money/index.js +++ b/projects/rivera_money/index.js @@ -33,6 +33,19 @@ const config = { arbitrum: [ "0x8E99B66dE170b53b39D9B54f189a12D7c6AC0cd9" ], + + degen: [ + "0xA95417805d18d00844c3C6FB7742577Cd263fE05" + ], + + bsquared: [ + "0xBC91a7a0eE37085af193C61747ecE693979Ec0C1", + "0xD57a87a9101d567C4139247CdF149b1DA4c8604A" + ], + + polygon: [ + "0x67e07BFfce318ADbA7b08618CBf4B8E271499197" + ], } module.exports = { From 44b2cefbcb701cc552e105e713c542eb27fdde94 Mon Sep 17 00:00:00 2001 From: Barak Uri <140400738+dev-uri@users.noreply.github.com> Date: Thu, 30 May 2024 22:44:54 +0300 Subject: [PATCH 137/855] feat: update Rollspace chains list (#10430) --- projects/rollspace/index.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/projects/rollspace/index.js b/projects/rollspace/index.js index b6e50ba27a0b..82f3cb7aa0b0 100644 --- a/projects/rollspace/index.js +++ b/projects/rollspace/index.js @@ -2,10 +2,22 @@ const { nullAddress } = require("../helper/tokenMapping"); const { sumTokensExport } = require("../helper/unwrapLPs"); const BSC_POOL_CONTRACT = '0xB1FcDb8Ed3c2Bc572440b08a5A93984f366BBf3C'; +const BLAST_POOL_CONTRACT = '0x4E927c4bc1432dc7608d2199a77e630cc1676eD7'; +const BASE_POOL_CONTRACT = '0x35a7E7f5A8ECe30585364c28EE5974E3ECe375DC'; +const MODE_POOL_CONTRACT = '0xbADaC8BDFdC6Ef7be408e94AbE3ddC6bec783E59'; module.exports = { - methodology: 'counts the number of BNB tokens in the bsc pool contract.', + methodology: 'counts the number of BNB and ETH tokens in the bsc, blast, base and mode pool contracts.', bsc: { tvl: sumTokensExport({ owner: BSC_POOL_CONTRACT, tokens: [nullAddress], }) - } + }, + blast: { + tvl: sumTokensExport({ owner: BLAST_POOL_CONTRACT, tokens: [nullAddress], }) + }, + base: { + tvl: sumTokensExport({ owner: BASE_POOL_CONTRACT, tokens: [nullAddress], }) + }, + mode: { + tvl: sumTokensExport({ owner: MODE_POOL_CONTRACT, tokens: [nullAddress], }) + }, } \ No newline at end of file From 789267cd9abdfa9b1a9371ac0ee2f7335b25ec6b Mon Sep 17 00:00:00 2001 From: amedrontadora <134207821+amedrontadora@users.noreply.github.com> Date: Fri, 31 May 2024 14:35:38 +0800 Subject: [PATCH 138/855] SyncSwap: Add SyncSwap factory contract address (#10447) * add ritsu * code refactor * SyncSwap: add factories --------- Co-authored-by: amedrontadora Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/syncswap/index.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/projects/syncswap/index.js b/projects/syncswap/index.js index 33d497e213c9..dd75d9ebd2e7 100644 --- a/projects/syncswap/index.js +++ b/projects/syncswap/index.js @@ -43,19 +43,21 @@ async function tvl(api) { const config = { era: { fromBlock: 9775, - stableFactorys: ['0x5b9f21d407F35b10CbfDDca17D5D84b129356ea3'], - classicFactorys: ['0xf2DAd89f2788a8CD54625C60b55cD3d2D0ACa7Cb'], - aquaFactorys: ['0x20b28B1e4665FFf290650586ad76E977EAb90c5D'] + stableFactorys: ['0x5b9f21d407F35b10CbfDDca17D5D84b129356ea3','0x81251524898774F5F2FCaE7E7ae86112Cb5C317f'], + classicFactorys: ['0xf2DAd89f2788a8CD54625C60b55cD3d2D0ACa7Cb','0x0a34FBDf37C246C0B401da5f00ABd6529d906193'], + aquaFactorys: ['0x20b28B1e4665FFf290650586ad76E977EAb90c5D','0xFfa499b019394d9bEB5e21FC54AD572E4942302b'] }, linea: { fromBlock: 716, - stableFactorys: ['0xE4CF807E351b56720B17A59094179e7Ed9dD3727'], - classicFactorys: ['0x37BAc764494c8db4e54BDE72f6965beA9fa0AC2d'], + stableFactorys: ['0xE4CF807E351b56720B17A59094179e7Ed9dD3727','0x61Abf754fc031C544236053495a193f3518e9101','0x024A096bAb43587d24004C95C3e20FcB7518Ad86'], + classicFactorys: ['0x37BAc764494c8db4e54BDE72f6965beA9fa0AC2d','0x9573994Ae6C9b35627976d26FA89e507e71FBaA2','0xb8AbaEa25E42DA5ac6897C9DAb0a8157885fE32b'], + aquaFactorys: ['0x7a31060d8524c21496a352BE65549eEf1e864fb0','0x1080EE857D165186aF7F8d63e8ec510C28A6d1Ea'] }, scroll: { fromBlock: 80875, - stableFactorys: ['0xE4CF807E351b56720B17A59094179e7Ed9dD3727'], - classicFactorys: ['0x37BAc764494c8db4e54BDE72f6965beA9fa0AC2d'], + stableFactorys: ['0xE4CF807E351b56720B17A59094179e7Ed9dD3727','0x5BEBDA7E264b03bB963CB2418f40C5ffcefb7A9e','0xA2acA673C00495A184F88De533BBa8e1b7f38D00'], + classicFactorys: ['0x37BAc764494c8db4e54BDE72f6965beA9fa0AC2d','0xDAEdEcF3F1Caf8d9050A0C973B77E40bA8024F69','0x76f549af692efA64952d02c075226df9878Fb54C'], + aquaFactorys: ['0xa033eAbcCfd9b71543E34dec43935467A230Ce2d','0x87aeb51d606056F48D241C4072f55ACd9D937018'] }, } From be45b84e7cc919ae4af4020b6087105007789cd3 Mon Sep 17 00:00:00 2001 From: kulikov-yldr <161155762+kulikov-yldr@users.noreply.github.com> Date: Fri, 31 May 2024 08:35:59 +0200 Subject: [PATCH 139/855] Update index.js (#10446) --- projects/yldr/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/yldr/index.js b/projects/yldr/index.js index c97f9ee996d4..b601e17d0e2c 100644 --- a/projects/yldr/index.js +++ b/projects/yldr/index.js @@ -10,6 +10,7 @@ const config = { ethereum: { v3Wrapper: '0x13f4dc963ddd2ec0160f6473c69b704b0e8674fc', factory: '0xd7b1C5afc105e0E70F78B66CdFE977aEf80540bA', fromBlock: 18808612, }, arbitrum: { v3Wrapper: '0x07B99965dBEdf38322ADFe48623e042Aa0656283', factory: '0x88959bebbce33d75227633d5114e3c3fd0fb9a6d', fromBlock: 155897900, }, polygon: { v3Wrapper: '0x27b3E5fD3E2C03Ac02Ee2a90E7B0C52Dac179dAe', factory: '0xf336D4687937C109e51e0266663689Da5ad637C3', fromBlock: 54456800 }, + base: { v3Wrapper: '0x4bD51179f30Cd162167D40AF9F6d378FC580C9cd', factory: '0xCE52e9DD55AC9aa98BfEE1bA615FA5a07c8b3eF1', fromBlock: 14253820 }, } const eventAbi = 'event ReserveInitialized (address indexed asset, address indexed yToken, address variableDebtToken, address interestRateStrategyAddress)' From 370092f9a8f28f5cd380210be5161583fbf08e1c Mon Sep 17 00:00:00 2001 From: hxzaifa13 <121883195+hxzaifa13@users.noreply.github.com> Date: Fri, 31 May 2024 02:36:40 -0400 Subject: [PATCH 140/855] Blackwing: Add shib / pepe / egeth / pufeth tokens (#10445) * add blackwing project * add pendle token * nit * add pendle tokens * add shib / pepe / egeth / pufeth --------- Co-authored-by: Huzaifa Nasir Co-authored-by: Huzaifa Nasir --- projects/blackwing/index.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/projects/blackwing/index.js b/projects/blackwing/index.js index a3e6beeefd93..cfe27b8300f1 100644 --- a/projects/blackwing/index.js +++ b/projects/blackwing/index.js @@ -17,7 +17,6 @@ const ETHEREUM_MAINNET_RSETH = "0xa1290d69c65a6fe4df752f95823fae25cb99e5a7"; const ETHEREUM_MAINNET_WEETH = "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee"; const ETHEREUM_MAINNET_EZETH = "0xbf5495Efe5DB9ce00f80364C8B423567e58d2110"; - const ETHEREUM_MAINNET_PENDLE_RSWETH_27JUN2024 = "0x5cb12D56F5346a016DBBA8CA90635d82e6D1bcEa"; const ETHEREUM_MAINNET_PT_EZETH_26DEC2024 = "0xf7906f274c174a52d444175729e3fa98f9bde285"; const ETHEREUM_MAINNET_PT_RSETH_27JUN2024 = "0xb05cabcd99cf9a73b19805edefc5f67ca5d1895e"; @@ -28,6 +27,11 @@ const ETHEREUM_MAINNET_PT_SUSDE_25JUL2024 = "0xd810362556296c834e30c9a61d8e21a5c const ETHEREUM_MAINNET_PT_WEETH_26DEC2024 = "0x6ee2b5e19ecba773a352e5b21415dc419a700d1d"; const ETHEREUM_MAINNET_PT_WEETH_27JUN2024 = "0xc69ad9bab1dee23f4605a82b3354f8e40d1e5966"; +const ETHEREUM_MAINNET_SHIB_ADDRESS = "0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"; +const ETHEREUM_MAINNET_PEPE_ADDRESS = "0x6982508145454Ce325dDbE47a25d4ec3d2311933"; +const ETHEREUM_MAINNET_EGETH_ADDRESS = "0x18f313Fc6Afc9b5FD6f0908c1b3D476E3feA1DD9"; +const ETHEREUM_MAINNET_PUFETH_ADDRESS = "0xD9A442856C234a39a81a089C06451EBAa4306a72"; + module.exports = { arbitrum: { tvl: sumTokensExport({ tokens: [ @@ -63,6 +67,10 @@ module.exports = { ETHEREUM_MAINNET_PT_SUSDE_25JUL2024, ETHEREUM_MAINNET_PT_WEETH_26DEC2024, ETHEREUM_MAINNET_PT_WEETH_27JUN2024, + ETHEREUM_MAINNET_SHIB_ADDRESS, + ETHEREUM_MAINNET_PEPE_ADDRESS, + ETHEREUM_MAINNET_EGETH_ADDRESS, + ETHEREUM_MAINNET_PUFETH_ADDRESS ], owner: BLACKWING_VAULT_ETH, fetchCoValentTokens: true, }) }, @@ -70,7 +78,8 @@ module.exports = { tvl: sumTokensExport({ tokens: [ ADDRESSES.bsc.USDT, - ADDRESSES.bsc.WBNB], + ADDRESSES.bsc.WBNB + ], owner: BLACKWING_VAULT_BSC, fetchCoValentTokens: true, }) } From af93998662b63e4b860f0873eec036ed4045d2c7 Mon Sep 17 00:00:00 2001 From: 0xYFLOW <139814596+0xYFLOW@users.noreply.github.com> Date: Fri, 31 May 2024 10:37:10 +0400 Subject: [PATCH 141/855] Update index.js (#10444) --- projects/yieldflow/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/projects/yieldflow/index.js b/projects/yieldflow/index.js index cccb078f2ed0..1fd1903ae697 100644 --- a/projects/yieldflow/index.js +++ b/projects/yieldflow/index.js @@ -51,9 +51,15 @@ const managers = [ '0x8702800D715461Fb7D9C89C74DDB7bE73F5a37C6', '0xb6F1E82e7AE822DE9eD64967D04359Fe4D58A569', '0xE0213546258ABd7EF0D689D26Cf6d6BCEeE20e8a', - '0xf732Fc726B3a4bE9f6c86a710Fd3367259DB456e' + '0xf732Fc726B3a4bE9f6c86a710Fd3367259DB456e', - + '0x16A3EBd3D55b27FF6e2839DA2078889cA148C040', + '0xf4447cCFeE677A5b0BaD6bcD5f92A1929c171b48', + '0x538A753B616F5aAD60852ca039572e5C4B72cA85', + + '0x780A252d7C797cFB255fe2EAa4E1a257a897B6ed', + '0xffF3c0063f2Fc1Af569C359480b5b62841357169', + '0xEFF4A3260263A927D0707190C931bE13292bD4Ba', ] async function tvl(api) { From a4a49c0ebfb6f06d4a1c129effc34295a0bfbcb9 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 31 May 2024 09:33:56 +0200 Subject: [PATCH 142/855] update astar dapp staking --- projects/astar-dapps-staking/api.js | 16 ++++++++++++ projects/astar-dapps-staking/index.js | 37 +++++---------------------- 2 files changed, 22 insertions(+), 31 deletions(-) create mode 100644 projects/astar-dapps-staking/api.js diff --git a/projects/astar-dapps-staking/api.js b/projects/astar-dapps-staking/api.js new file mode 100644 index 000000000000..1d1d743a21f9 --- /dev/null +++ b/projects/astar-dapps-staking/api.js @@ -0,0 +1,16 @@ +const { ApiPromise, WsProvider } = require("@polkadot/api"); + +async function tvl() { + const polkadotProvider = new WsProvider("wss://rpc.astar.network"); + const polkadotApi = await ApiPromise.create({ provider: polkadotProvider }); + const currentEraInfo = await polkadotApi.query.dappStaking.currentEraInfo(); + const tvl = currentEraInfo.totalLocked.toString() + return { + astar: tvl / 1e18, + }; +} + +module.exports = { + timetravel: false, + astar: { tvl }, +}; \ No newline at end of file diff --git a/projects/astar-dapps-staking/index.js b/projects/astar-dapps-staking/index.js index ba6b5489061c..37b1546c4d05 100644 --- a/projects/astar-dapps-staking/index.js +++ b/projects/astar-dapps-staking/index.js @@ -1,34 +1,9 @@ -// const { ApiPromise, WsProvider } = require("@polkadot/api"); -// const ASTR_DECIMALS = 18; - -// async function tvl() { -// const provider = new WsProvider("wss://astar.api.onfinality.io/public-ws"); -// const api = new ApiPromise({ -// provider, -// }); - -// await api.isReady; -// const era = await api.query.dappsStaking.currentEra(); -// const result = await api.query.dappsStaking.generalEraInfo(era); -// const tvl = result.unwrap().staked.valueOf(); -// const AstrLocked = tvl / 10 ** ASTR_DECIMALS; - -// return { -// astar: AstrLocked, -// }; -// } - -// module.exports = { -// methodology: -// "TVL considers ASTR tokens deposited to the Dapps-Staking program", -// astar: { tvl }, -// }; - -// This has been delisted +const { getExports } = require("../helper/heroku-api"); module.exports = { - astar: { - tvl: () => ({}) - } -} + timetravel: false, + methodology: + "Total value locked is the total amount of ASTR tokens deposited to the dApp Staking program", + ...getExports("astar-dapps-staking", ["astar"]), +}; \ No newline at end of file From 3833754d9f31c50e332b7d008ff9e4239cc31365 Mon Sep 17 00:00:00 2001 From: Jason Mansfield Date: Fri, 31 May 2024 03:36:24 -0400 Subject: [PATCH 143/855] Add Polkadex (#10436) --- projects/helper/chains.json | 1 + projects/polkadex/api.js | 73 +++++++++++++++++++++++++++++++++++++ projects/polkadex/index.js | 6 +++ 3 files changed, 80 insertions(+) create mode 100644 projects/polkadex/api.js create mode 100644 projects/polkadex/index.js diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 8339a572a4df..ad06386d264e 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -227,6 +227,7 @@ "planq", "pokt", "polis", + "polkadex", "polkadot", "polygon", "polygon_zkevm", diff --git a/projects/polkadex/api.js b/projects/polkadex/api.js new file mode 100644 index 000000000000..e8b856d185fd --- /dev/null +++ b/projects/polkadex/api.js @@ -0,0 +1,73 @@ +const { ApiPromise, WsProvider } = require("@polkadot/api"); +const sdk = require('@defillama/sdk') + +const rpcNodes = ["wss://polkadex.api.onfinality.io/public-ws", "wss://polkadex.public.curie.radiumblock.co/ws"]; +const orderbookWallet = "esoEt6uZ3GuFV8EzKB2EAREe3KE9WuRVfmhK1RRtwffY78ArH" + +const assetMapping = { + '193492391581201937291053139015355410612': 'pha', + '182269558229932594457975666948556356791': 'moonbeam', + '313524628741076911470961827389955394913': 'voucher-dot', + '130314105136721928300689838359167097187': 'bifrost-native-coin', + '95930534000017180603917534864279132680': 'polkadot', + '119367686984583275840673742485354142551': 'dot-is-ded', + '32595388462891559990827225517299393930': 'unique-network', + '3496813586714279103986568049643838918': 'tether', + '222121451965151777636299756141619631150': 'astar', + '226557799181424065994173367616174607641': 'interbtc', +} + +function add(_api, token, bal) { + _api.add(token, bal, { skipChain: true }) +} + +async function tvl(_api) { + const provider = new WsProvider(rpcNodes); + const api = await ApiPromise.create({ provider, }); + await api.isReady; + + const pdexBalance = await api.query.system.account(orderbookWallet) + add(_api,'polkadex', pdexBalance.data.free / 1e12) + + let requestedAssets = []; + Object.keys(assetMapping).forEach(function(key) { + requestedAssets.push([key, orderbookWallet]); + }) + + const results = await api.query.assets.account.multi(requestedAssets); + + for(let i = 0; i < results.length; i++) + { + if(results[i].toPrimitive() != null) { + const coingeckoId = assetMapping[requestedAssets[i][0]]; + if(coingeckoId) { + add(_api, coingeckoId, Number(results[i].toPrimitive().balance) / 1e12) + } + } + } + + return _api.getBalances() +} + +async function staking(_api) { + const provider = new WsProvider(rpcNodes); + const api = await ApiPromise.create({ provider, }); + await api.isReady + + const chainActiveEra = await api.query.staking.activeEra(); + + let activeEra = JSON.parse(JSON.stringify(chainActiveEra)).index; + + let results = await api.query.staking.erasTotalStake([activeEra]); + + add(_api,'polkadex', results.toPrimitive() / 1e12) + + return _api.getBalances() +} + +module.exports = { + polkadex: { + tvl: tvl, + staking: staking, + }, +} \ No newline at end of file diff --git a/projects/polkadex/index.js b/projects/polkadex/index.js new file mode 100644 index 000000000000..851d22d04af0 --- /dev/null +++ b/projects/polkadex/index.js @@ -0,0 +1,6 @@ +const { getExports } = require('../helper/heroku-api') + +module.exports = { + timetravel: false, + ...getExports("polkadex", ['polkadex']), +} \ No newline at end of file From 65854d6d61e5f5c4e5ec1ec42657993e2fece559 Mon Sep 17 00:00:00 2001 From: soilking <157099073+soilking@users.noreply.github.com> Date: Fri, 31 May 2024 01:06:58 -0700 Subject: [PATCH 144/855] Beanstalk (#10429) * sums whitelisted tokens in contract * Report staking beans according to the amount in silo deposit * Include tokens underlying deposited lp * remove treasury * overall tvl function * unripe and include 3crv * lowercase + fix and final comments * revert deletion * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/bean/index.js | 292 +++++++++++++++++++++++++++++++++++------ 1 file changed, 250 insertions(+), 42 deletions(-) diff --git a/projects/bean/index.js b/projects/bean/index.js index c7743075b2d9..09207c321992 100644 --- a/projects/bean/index.js +++ b/projects/bean/index.js @@ -1,53 +1,261 @@ -const { sumTokens } = require('../helper/unwrapLPs'); +const BEANSTALK = "0xc1e088fc1323b20bcbee9bd1b9fc9546db5624c5"; -const BEAN_DIA_ADDR = "0xC1E088fC1323b20BCBee9bd1B9fC9546db5624C5"; +const BEAN_ERC20_V1 = "0xdc59ac4fefa32293a95889dc396682858d52e5db"; +const BEANETH_V1 = "0x87898263b6c5babe34b4ec53f22d98430b91e371"; +const BEAN3CRV_V1 = "0x3a70dfa7d2262988064a2d051dd47521e43c9bdd"; +const BEANLUSD_V1 = "0xd652c40fbb3f06d6b58cb9aa9cff063ee63d465d"; -const BEAN_TOKEN_ADDR = "0xdc59ac4fefa32293a95889dc396682858d52e5db"; -const NEW_BEAN_TOKEN_ADDR = "0xBEA0000029AD1c77D3d5D23Ba2D8893dB9d1Efab"; -const BEAN_ETH_ADDR = "0x87898263B6C5BABe34b4ec53F22d98430b91e371"; +const BEAN_ERC20 = "0xbea0000029ad1c77d3d5d23ba2d8893db9d1efab"; +const UNRIPE_BEAN_ERC20 = "0x1bea0050e63e05fbb5d8ba2f10cf5800b6224449"; +const UNRIPE_LP_ERC20 = "0x1bea3ccd22f4ebd3d37d731ba31eeca95713716d"; +const BEAN3CRV_V2 = "0xc9c32cd16bf7efb85ff14e0c8603cc90f6f2ee49"; +const BEANETH_V2 = "0xbea0e11282e2bb5893bece110cf199501e872bad"; -// To add new curve pools to the TVL: -// add their LP token address and the number of tokens in the pool -const BEAN_CRV_POOLS = [ - { addr: "0xD652c40fBb3f06d6B58Cb9aa9CFF063eE63d465D", numToken: 2 }, - { addr: "0x3a70DfA7d2262988064A2D051dd47521E43c9BdD", numToken: 2 }, - { addr: "0xc9C32cd16Bf7eFB85Ff14e0c8603cc90F6F2eE49", numToken: 2 } -]; +// Underlying non-bean tokens +const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; +const CRV3 = "0x6c3f90f043a72fa612cbac8115ee7e52bde6e490"; +const LUSD = "0x5f98805a4e8be255a32880fdec7f6728c6568ba0"; -async function staking(time, block) { - const balances = {}; - // add balance of siloed Beans - await sumTokens(balances, [[NEW_BEAN_TOKEN_ADDR,BEAN_TOKEN_ADDR,],[NEW_BEAN_TOKEN_ADDR, BEAN_DIA_ADDR] ], block) +/// REFERENCE BLOCKS TIMESTAMPS +// Whitelist BEANETH_V1 12974075 1628288832 +// Dewhitelist BEANETH_V1 14602790 165019825s6 +// Whitelist BEAN3CRV_V1 14218934 1645038020 +// dewhitelist BEAN3CRV_V1 14602790 1650198256 +// whitelist BEANLUSD_V1 14547427 1649451979 +// dewhitelist BEANLUSD_V1 14602790 1650198256 +// EXPLOIT_BLOCK 14602790 1650198256 +// REPLANT_BLOCK 15278963 1659657966 +// whitelist BEAN3CRV_V2 15278082 1659645914 +// dewhitelist BEAN3CRV_V2 19927634 1716407627 +// whitelist BEANETH_V2 18028591 1693412759 +// dewhitelist BEANETH_V2 x - return balances; +const EXPLOIT_TIME = 1650198256; +const REPLANT_TIME = 1659657966; +const BIP12_TIME = 1645038020; + +// List of pools and time time periods they were valid within beanstalk +const ALL_POOLS = { + [BEANETH_V1]: { + startTime: 1628288832, + endTime: EXPLOIT_TIME, + underlying: [BEAN_ERC20_V1, WETH] + }, + [BEAN3CRV_V1]: { + startTime: 1645038020, + endTime: EXPLOIT_TIME, + underlying: [BEAN_ERC20_V1, CRV3] + }, + [BEANLUSD_V1]: { + startTime: 1649451979, + endTime: EXPLOIT_TIME, + underlying: [BEAN_ERC20_V1, LUSD] + }, + [BEAN3CRV_V2]: { + startTime: 1659645914, + endTime: 999999999999, + // endTime: 1716407627, // Dewhitelisted upon BIP-45 deployment, but some tokens are still deposited and receive yield + underlying: [BEAN_ERC20, CRV3] + }, + [BEANETH_V2]: { + startTime: 1693412759, + endTime: 999999999999, + underlying: [BEAN_ERC20, WETH] + } +}; + +// Returns the relevant tokens for the given timestamp +function getBean(timestamp) { + if (timestamp <= EXPLOIT_TIME) { + return BEAN_ERC20_V1; + } else if (timestamp >= REPLANT_TIME) { + return BEAN_ERC20; + } + throw new Error("There was no Bean token during the requested timestamp"); +} + +// Returns the relevant pools for the given timestamp +function getPools(timestamp) { + const pools = []; + for (const contract in ALL_POOLS) { + const pool = ALL_POOLS[contract]; + if (timestamp >= pool.startTime && timestamp <= pool.endTime) { + pools.push(contract); + } + } + return pools; +} + +// Gets the total supply of the given erc20 token +async function getTotalSupply(api, token) { + return await api.call({ + abi: 'erc20:totalSupply', + target: token + }); +} + +// Gets the reserves (for simplicity, contract balances) of the requested pool +async function getPoolReserves(api, pool) { + + pool = pool.toLowerCase(); + const poolBalances = await api.multiCall({ + calls: ALL_POOLS[pool].underlying.map(token => ({ + target: token, + params: pool + })), + abi: 'erc20:balanceOf' + }); + + return poolBalances.map((balance, i) => ({ token: ALL_POOLS[pool].underlying[i], balance })); +} + +// Returns the total silo'd amount of the requested token +async function getSiloDeposited(api, token) { + + let result; + if (api.timestamp <= BIP12_TIME) { + // Prior to BIP12, there was no generalized deposit getter + result = await api.call({ + abi: + token === BEAN_ERC20_V1 + ? "function totalDepositedBeans() public view returns (uint256)" + : "function totalDepositedLP() public view returns (uint256)", + target: BEANSTALK + }); + } else { + result = await api.call({ + abi: "function getTotalDeposited(address) external view returns (uint256)", + target: BEANSTALK, + params: token + }); + } + return parseInt(result); +} + +/** + * Returns the balances of the underlying tokens in the given pools of the given ratios + * @param {*} api + * @param {string[]} pools - the pools to calculate the balances for + * @param {number[]} ratios - proportions of the pool underlying to credit towards the resulting balance + */ +async function getPooledBalances(api, pools, ratios) { + + const pooledTokenBalances = {}; + + const poolReserves = await Promise.all(pools.map(pool => getPoolReserves(api, pool))); + + for (let i = 0; i < pools.length; ++i) { + const reserves = poolReserves[i]; + for (const reserve of reserves) { + const ratioAmount = reserve.balance * ratios[i]; + pooledTokenBalances[reserve.token] = (pooledTokenBalances[reserve.token] ?? 0) + ratioAmount; + } + } + return pooledTokenBalances; } -async function pool2(time, block) { - const balances = {}; +// Gets the balances associated with the ripe portion of deposited unripe tokens +async function getRipePooledBalances(api, unripeToken) { - // add balance of siloed BEAN:ETH from uniswap pool - const toa = [[BEAN_ETH_ADDR, BEAN_DIA_ADDR]] + const ripePooledTokenBalances = {}; - // add balances of all siloed curve pools - // this is the block when SiloV2Facet with getTotalDeposited() was introduced - if (block >= 14218934) { - BEAN_CRV_POOLS.forEach(i => toa.push([i.addr, BEAN_DIA_ADDR])) + // Gets unripe's underlying token and amounts + const [underlyingToken, underlyingPerUnripe, depositedUnripe] = await Promise.all([ + api.call({ + abi: "function getUnderlyingToken(address) external view returns (address)", + target: BEANSTALK, + params: unripeToken + }), + api.call({ + abi: "function getUnderlyingPerUnripeToken(address) external view returns (uint256)", + target: BEANSTALK, + params: unripeToken + }), + getSiloDeposited(api, unripeToken), + ]); + + // Add the underlying pooled token balances + const underlyingAmount = underlyingPerUnripe * depositedUnripe / Math.pow(10, 6); + if (underlyingToken.toLowerCase() == BEAN_ERC20) { + ripePooledTokenBalances[BEAN_ERC20] = (ripePooledTokenBalances[BEAN_ERC20] ?? 0) + underlyingAmount; + } else { + const underlyingSupply = await getTotalSupply(api, underlyingToken); + const ratio = underlyingAmount / underlyingSupply; + const balances = await getPooledBalances(api, [underlyingToken], [ratio]); + for (const token in balances) { + ripePooledTokenBalances[token] = (ripePooledTokenBalances[token] ?? 0) + balances[token]; } + } + return ripePooledTokenBalances; +} + +// Beans deposited in the silo +async function staking(api) { + if (api.timestamp >= EXPLOIT_TIME && api.timestamp <= REPLANT_TIME) { + return {}; + } + + // Bean deposits + ripe beans from unripe beans + const bean = getBean(api.timestamp); + const [siloBeans, unripeSiloBeans] = await Promise.all([ + getSiloDeposited(api, bean), + getRipePooledBalances(api, UNRIPE_BEAN_ERC20) + ]); + const totalStaked = siloBeans + unripeSiloBeans[BEAN_ERC20]; + + return { + [`ethereum:${bean.toLowerCase()}`]: totalStaked + } +} + +// Tokens in liquidity pools corresponding to lp tokens that are deposited in the silo +async function pool2(api) { + if (api.timestamp >= EXPLOIT_TIME && api.timestamp <= REPLANT_TIME) { + return {}; + } + + // Get the amount of lp tokens deposited in the silo + const pools = getPools(api.timestamp); + const poolPromises = pools.map(pool => [ + getSiloDeposited(api, pool), + getTotalSupply(api, pool) + ]); + // And determine how much of the pooled tokens correspond to those deposits + const flatResolved = await Promise.all(poolPromises.flat()); + const ratios = []; + for (let i = 0; i < flatResolved.length; i += 2) { + ratios.push(flatResolved[i] / flatResolved[i + 1]); + } + + // Gets the underlying token balances for both regular and unripe deposits + const balancesResults = await Promise.all([ + getPooledBalances(api, pools, ratios), + getRipePooledBalances(api, UNRIPE_LP_ERC20) + ]); + + const pool2Balances = balancesResults[0]; + for (const token in balancesResults[1]) { + pool2Balances[token] = (pool2Balances[token] ?? 0) + balancesResults[1][token]; + } + + // Add chain info + const retval = {}; + for (const token in pool2Balances) { + retval[`ethereum:${token.toLowerCase()}`] = pool2Balances[token]; + } + return retval; +} - return sumTokens(balances, toa, block,) -} - -module.exports={ - doublecounted: true, - methodology: "Counts all beans and current LPs in the silo.", - start: 12974077, - ethereum: { - tvl: async () => ({}), - pool2, - staking, - }, - hallmarks: [ - [1650153600, "Governance proposal hack"], - [1659602715, "Replant"] - ] -}; \ No newline at end of file +module.exports = { + methodology: "Counts the value of deposited Beans and LP tokens in the silo.", + start: 12974077, + ethereum: { + tvl: () => ({}), + pool2, + staking + }, + hallmarks: [ + [1650153600, "Governance Exploit"], + [1659602715, "Replant"] + ] +}; From 6054429b231ce9a5e736f6712334d5275a25cad1 Mon Sep 17 00:00:00 2001 From: harold-awaken <167839386+harold-awaken@users.noreply.github.com> Date: Fri, 31 May 2024 17:37:00 +0800 Subject: [PATCH 145/855] Add Awaken (#10448) * Add Awaken * rename folder --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/awaken/index.js | 45 +++++++++++++++++++++++++++++++++++++ projects/helper/chains.json | 1 + 2 files changed, 46 insertions(+) create mode 100644 projects/awaken/index.js diff --git a/projects/awaken/index.js b/projects/awaken/index.js new file mode 100644 index 000000000000..b40ea52d2cc8 --- /dev/null +++ b/projects/awaken/index.js @@ -0,0 +1,45 @@ +const { request, gql } = require("graphql-request"); +const { toUSDTBalances } = require("../helper/balances"); + +const GRAPH_QUERY = gql` + query get_tvl($dto: GetTotalValueLockedDto) { + totalValueLocked(dto: $dto) { + value + } + } +`; + +function getChainTvl(graphUrls) { + return (chain) => { + return async (api) => { + const result = await request( + graphUrls[chain], + GRAPH_QUERY, + { + dto: { + chainId: "tDVV", + timestamp: api.timestamp * 1000, + }, + }, + { + Accept: "*/*, application/json", + } + ); + + return toUSDTBalances(result.totalValueLocked.value); + }; + }; +} + +const v2graph = getChainTvl({ + aelf: "https://dapp.awaken.finance/AElfIndexer_Swap/SwapIndexerSchema/graphql", +}); + +module.exports = { + misrepresentedTokens: true, + methodology: `Counts the tokens locked on AMM pools, pulling the data from the 'AElfIndexer_Swap' subgraph`, + start: 1706745600, + aelf: { + tvl: v2graph("aelf"), + }, +}; diff --git a/projects/helper/chains.json b/projects/helper/chains.json index ad06386d264e..95829f491727 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -1,6 +1,7 @@ [ "acala", "ace", + "aelf", "airdao", "alephium", "algorand", From 516a78d83cd2887bae73cbbe2fba1d617daeb50c Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Fri, 31 May 2024 11:35:40 +0100 Subject: [PATCH 146/855] hashkey adapter CEX (#10451) --- projects/hashkey/index.js | 56 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 projects/hashkey/index.js diff --git a/projects/hashkey/index.js b/projects/hashkey/index.js new file mode 100644 index 000000000000..290412aafc4f --- /dev/null +++ b/projects/hashkey/index.js @@ -0,0 +1,56 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x5569fd6991d1802dbee9bdd67e763fe7be67c7a9", + "0xcBEA7739929cc6A2B4e46A1F6D26841D8d668b9E" + ], + }, + bitcoin: { + owners: [ + "bc1qyvppkaa74d9jvtz664a6uxmj09hf0eyg3uhx4h", + "1DywJMqHHMWuP7xyfkRqJZCEe7GdEKFRcp" + ], + }, + bsc: { + owners: [ + "0x83455d6c365dcbac10855c623da884b552aaefdd", + ], + }, + tron: { + owners: [ + "TJDENsfBJs4RFETt1X1W8wMDc8M5XnJhCe", + ], + }, + litecoin: { + owners: [ + "ltc1qzjsgswkenmy9v6vm2jvkddeczwfuy9q7rshtxh", + "LXeSRVh6WPan3u5AxEZkvvn1srKnN5BiAm" + ], + }, + optimism: { + owners: [ + "0x5691a157ce38f1b362ab4a686ec7616fb04ba6f1", + "0xC7556Bb9EB188888b1cce25c3587C36Be0809EC4" + ], + }, + arbitrum: { + owners: [ + "0x03248f4759Ef5c4FdDd959aa07a5294e00B03e44", + "0x25a58cee7928b3d6c1d392ebe1a97318aa5ff2f2" + ], + }, + avax: { + owners: [ + "0x9bc72c8bb18d27bad9d0936be5d5e68fe2d37a29", + ], + }, + polygon: { + owners: [ + "0xAa0400E5a90f697230638DbE76D9C49e4aC745B4", + ], + }, +} + +module.exports = cexExports(config) From e35ff17d602cba57d80b8cce5514e8ddf2199986 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Fri, 31 May 2024 11:57:36 +0100 Subject: [PATCH 147/855] git push origin hashkey-final (#10452) --- projects/hashkey/index.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/projects/hashkey/index.js b/projects/hashkey/index.js index 290412aafc4f..5694e7c5e023 100644 --- a/projects/hashkey/index.js +++ b/projects/hashkey/index.js @@ -13,16 +13,6 @@ const config = { "1DywJMqHHMWuP7xyfkRqJZCEe7GdEKFRcp" ], }, - bsc: { - owners: [ - "0x83455d6c365dcbac10855c623da884b552aaefdd", - ], - }, - tron: { - owners: [ - "TJDENsfBJs4RFETt1X1W8wMDc8M5XnJhCe", - ], - }, litecoin: { owners: [ "ltc1qzjsgswkenmy9v6vm2jvkddeczwfuy9q7rshtxh", From 92bc3e5a5a79a5c311e73534be07c0c009f77677 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Fri, 31 May 2024 17:46:46 +0500 Subject: [PATCH 148/855] Upgrade Clip Finance adapter: Add NileCl vaultType (#10453) * Add NileCl vaultType * fix typo --- projects/clip-finance/index.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/projects/clip-finance/index.js b/projects/clip-finance/index.js index 618798dd4843..f52cb9124cc5 100644 --- a/projects/clip-finance/index.js +++ b/projects/clip-finance/index.js @@ -18,15 +18,18 @@ const VaultType = { MendiLending: 3, Aero: 4, LynexAlgebra: 5, + NileCl: 6, }; const typesDataInterfaces = { any: ["uint256"], // has only vaultType + amm: ["uint256", "address"], // vaultType, amm pool address [VaultType.PancakeV3]: ["uint256", "address"], // vaultType, v3 pool address [VaultType.Stargate]: ["uint256"], // vaultType [VaultType.MendiLending]: ["uint256", "address"], //vaultType, mendiLeverage address [VaultType.Aero]: ["uint256"], //vaultType [VaultType.LynexAlgebra]: ["uint256", "address"], // vaultType, algebra pool address + [VaultType.NileCl]: ["uint256", "address", "address"], // vaultType, nileCl pool address, stacking contract address }; const tvl = async (api) => { @@ -38,14 +41,16 @@ const tvl = async (api) => { const vaults = vaultDatas.map((i) => ({ ...i, vaultType: decoder.decode(typesDataInterfaces.any, i.data) })); //ammVaults - const appTypes = [VaultType.PancakeV3, VaultType.LynexAlgebra]; - const ammVaults = vaults.filter((i) => appTypes.includes(Number(i.vaultType.toString()))).map((i) => i.vault); + const ammTypes = [VaultType.PancakeV3, VaultType.LynexAlgebra, VaultType.NileCl]; + const ammVaults = vaults.filter((i) => ammTypes.includes(Number(i.vaultType.toString()))).map((i) => i.vault); const ammPools = vaults - .filter((i) => appTypes.includes(Number(i.vaultType.toString()))) - .map((i) => "0x" + i.data.slice(-40)); + .filter((i) => ammTypes.includes(Number(i.vaultType.toString()))) + .map((i) => decoder.decode(typesDataInterfaces.amm, i.data)[1]); + const ammBalances = await api.multiCall({ abi: abis.getTotalAmounts, calls: ammVaults }); const ammToken0s = await api.multiCall({ abi: "address:token0", calls: ammPools }); const ammToken1s = await api.multiCall({ abi: "address:token1", calls: ammPools }); + ammBalances.forEach((pool, i) => { api.add(ammToken0s[i], pool.total0); api.add(ammToken1s[i], pool.total1); From f13300d190b2b01a5fad773c212d7a37adfa18bc Mon Sep 17 00:00:00 2001 From: TsimakuridzeNikolozi Date: Fri, 31 May 2024 16:50:25 +0400 Subject: [PATCH 149/855] Added blast, removed unnecessary bits, fixed mistakes --- projects/hinkal/beefyTokens.js | 231 ------------ projects/hinkal/gaugeTokens.js | 250 ------------- projects/hinkal/hinkalUtils.js | 32 +- projects/hinkal/index.js | 34 +- projects/hinkal/owners.js | 6 + projects/hinkal/pendleTokens.js | 108 ------ projects/hinkal/registryTokens.js | 590 ++++++++++++++++++++++++++++-- projects/hinkal/relayerUrls.js | 1 + 8 files changed, 604 insertions(+), 648 deletions(-) delete mode 100644 projects/hinkal/beefyTokens.js delete mode 100644 projects/hinkal/gaugeTokens.js delete mode 100644 projects/hinkal/pendleTokens.js diff --git a/projects/hinkal/beefyTokens.js b/projects/hinkal/beefyTokens.js deleted file mode 100644 index 5ebae68f131f..000000000000 --- a/projects/hinkal/beefyTokens.js +++ /dev/null @@ -1,231 +0,0 @@ -const ETHEREUM_BEEFY_TOKENS = [ - "0xd4D620B23E91031fa08045b6083878f42558d6b9", - "0xe17D6212eAa54D98187026A770dee96f7C264feC", - "0xD1BeaD7CadcCC6b6a715A6272c39F1EC54F6EC99", - "0x047c41817954b51309a2bd6f60e47bC115C23f1F", - "0x6853691Ca8Da03Da16194E468068bE5A80F103b0", - "0xCc19786F91BB1F3F3Fd9A2eA9fD9a54F7743039E", - "0x4dE81AD42E9651755716177fAe9911c54F5b055B", - "0x06c1e90eeb34e7Fa6d78B8E58348Ae15C1a615E4", - "0xe50e2fe90745A8510491F89113959a1EF01AD400", - "0x8cB4f56e9bAa398b6F6a6Fb1B2C4E8ca8cda6ae5", - "0xd5bAd7c89028B3F7094e40DcCe83D4e6b3Fd9AA4", - "0x7f3F33B42b9734e61cb44424D130B5f6e09C9Db3", - "0x15780E0e9618c26dA679740C43bEc76830Ff187b", - "0xFc6a9D39b44a174B5Ba708dBaa437632d78B8585", - "0x83BE6565c0758f746c09f95559B45Cfb9a0FFFc4", - "0xfE5716D0C141F3d800995420e1d3fB0D0CFFCC31", - "0x4115150523599D1F6C6Fa27F5A4C27D578Fd8ce5", - "0x49b562bDcd28dB124f6bA51DEB8Ca483563c067a", - "0xBE2bD093B8F342e060E79Fad6059B1057F016Ba4", - "0x3fe43D4ba0a5BAcC800c7E7E782466a27ab108bf", - "0x4dd0cF20237deb5F2bE76340838B9e2D7c70E852", - "0xE0d5f9DA3613C047003b77cAa31270aBE3EdA6b0", - "0xB9911AB699FD781efDA446e7FD995d375B437c8B", - "0x37925b6319cD41014583A6476a7a1d52Ea404b2f", - "0xAE0bFfc3110e69DA8993F11C1CBd9a6eA3d16daF", -]; - -const ARBITRUM_BEEFY_TOKENS = [ - "0xB27c433C1cdb1B42E2601Af2d40dD442fbf1cdc3", - "0x30dF229cefa463e991e29D42DB0bae2e122B2AC7", - "0x9dbbBaecACEDf53d5Caa295b8293c1def2055Adc", - "0x8e0B8c8BB9db49a46697F3a5Bb8A308e744821D2", - "0x755D6688AD74661Add2FB29212ef9153D40fcA46", - "0x07Db98358D58Ba9bE90cd0A18cd86AF807ac3B4E", - "0x71c15610F11D669d4A9e02a64e43c6D1E27c6Cad", - "0xBDF4e730ED5152a7AC646BB7b514Ed624E1147C4", - "0xf6a1284Dc2ce247Bca885ac4F36b37E91d3bD032", - "0x994Ff2ab544D00aD4EC0380a1Be8F75f4EC47Cf9", - "0x46034C63ad03254D6E96c655e82393E6C31E07C3", - "0xD496eA90a454eA49e30A8fD9E053C186D4FC897D", - "0xd37025aC6227334C7762AeD5929Ce3272fbb6fdC", - "0xFCb0101503f399B4752E5160ccd5EcE3a71719bd", - "0xa7fC98760331409c1FC0177dECF083cE9d5aed87", - "0x5A8beF2fEb83057bBCcC81cea985a94a62A86208", - "0x5B904f19fb9ccf493b623e5c8cE91603665788b0", - "0xA98070C4a600678a93cEaF4bF629eE255F46f64F", - "0x0594Ec32240C78e056304b4A60f48a67c69179b4", - "0xB2DefC5c3A69abe2B681C714b080A892825B2073", - "0x4D323f77c32EDdC62BF8eAbA11E5C573FD0a2ccd", - "0xeD29730F9FF29ea50D63462D8EC84307d36b8954", - "0x12c997FAdca32dB01E3145DE7Bf9cdB06455391D", - "0x85B10228cd93A6e5E354Ff0f2c60875E8E62F65A", - "0xCF297A94d527A34081Db2A20Eb1c87248cD1ea81", - "0xa0d758b81f8ed6635CDE1DA91C8fe1bD48C28A09", - "0x5892bA611fdC1598b72a30D087d28c989d429eF7", -]; - -const OPTIMISM_BEEFY_TOKENS = [ - "0x107Dbf9c9C0EF2Df114159e5C7DC2baf7C444cFF", - "0x54214d0C7772eb6f71ED4De294b3f809691005C9", - "0xF731390c889d9a2089C5bC1d4640F3BA0708D82B", - "0xbe7dC3d2457BBff03943d962F7E4cEE34DFBA69d", - "0x25DE69dA4469A96974FaE79d0C41366A63317FDC", - "0x06E0A84c71dBD037c618CCf90798474E0e6f9C91", - "0x88F72d1f49Ea88f86fc52bebB0c1d0Ef232AE483", - "0x35775aA87b4CA1c04a6c579c90cE9add09247958", - "0xE2f035f59De6a952FF699b4EDD0f99c466f25fEc", - "0xef8D6dDE0a0f0CCdaDB678366a94D93f1C449689", - "0x2232455bf4622002c1416153EE59fd32B239863B", - "0xdCC5DC90A803928Dc21556590D4620030966270F", - "0x3b4DdC7888F752a96290344a1A926E73b80423c0", - "0xcAa74e50428bDC4Af6A7Ead65fFFf77F0D231E80", - "0x062F29e2b5bD99523DD3508207eb2C2CbAf98D50", - "0x7c2967C20B03a8004ea81e86Ac1847D00e7B4CD1", - "0x52cC5B5CB98C9a7fb8cCe7d4b4e8F41E26ce04a8", - "0x6B47afc8bf3b2e013b5e9178e8015Cc620983b51", - "0x011028aB93B355308E4350D109F42aeCfA075604", - "0x8a21Ea69300Fe56ee19fE974e9791a212114573F", - "0xa85F2DeBc911c54414f99103123965c94e351873", - "0x746c19A336A3131fD85D3AB5F16576b1b047F512", - "0x1973ef31F2A82B3f73b8C9Ee1c440615084d5242", - "0x6Fb45a8183660F30EA1c6cDFDDBFdC7ef7925801", - "0xfE1C64D42B7d6554Cc2ACD0D74e2983a2dE4A62f", - "0x8aD01c3a425987c508A69149185383BAf6F47534", - "0x453f61390ce6DfB668bbF4D93E58c94BB0ae81f3", - "0x1A1F0Db1050D1cAD52eEB72371EbFD7716b53a2f", - "0x718A66F21415a5f75F5e8652e8Be55FCF1D1df05", - "0x1910CCeCC57869F1Ff2337dda001246B92E8418A", - "0xB8Ce10759feb3B63B75557f5f9933bD22127f0eC", - "0x100Cd460D7f549B4cc2Ed35d4ff20ac71B377C96", - "0x2bC96f9e07Edc7F1aA9Aa26E85dc7dd30ACe59a6", - "0x2793AF2c7db9f0A06d2727Dd392Ab4Bb1b82a98D", - "0x00557e194B717dCfEbaE6222091C5F806DF99698", - "0x182fe51442C7D65360eD1511f30be6261c2C20C1", - "0xD019FD6267F93ebE5A92DEBB760135a4F02a75F7", - "0xf92129fE0923d766C2540796d4eA31Ff9FF65522", - "0x642F04eCAa00D443fBf2de2AaC9A9e0ACfA4FCE7", - "0xdD84190aF336Ee2831eea88B6783958e8F269de9", - "0xB708038C1b4cF9f91CcB918DAD1B9fD757ADa5C1", - "0x81F2F132465Ffb4B3C5d11f3d94582cC5c281c04", - "0x613f54c8836FD2C09B910869AC9d4de5e49Db1d8", - "0x79149B500f0d796aA7f85e0170d16C7e79BAd3C5", - "0x92651E1bBfE0f8423119AfC4B0610C747Fa125a1", -]; - -const POLYGON_BEEFY_TOKENS = [ - "0x97B2632DB51967b2AedF4c50FfC3a9D965940bEd", - "0x5A0801BAd20B6c62d86C566ca90688A6b9ea1d3f", - "0x1C480521100c962F7da106839a5A504B5A7457a1", - "0x108c7a293162Adff86DA216AB5F91e56723125dc", - "0x4C98CB046c3eb7e3ae7Eb49a33D6f3386Ec2b9D9", - "0x2520D50bfD793D3C757900D81229422F70171969", - "0x2F4BBA9fC4F77F16829F84181eB7C8b50F639F95", - "0x06b73b12421C667A07877B0740bA299e1de73B15", - "0xa0FdCDDA62C4C6a0109A702a7Efe59B4E8807e3f", - "0x108a7474461dC3059E4a6f9F8c7C8612056195A7", - "0xc65E5b6084FAd2F20e289b0d4e64F450cf386E6c", - "0xf0695B22d8F416FEC35E02668aE01B9EEAF96a0D", - "0xAA7C2879DaF8034722A0977f13c343aF0883E92e", - "0x01a8F2E5BfB8679C82442F90e1166469a2E530c8", - "0xB476B7A027da3D9fB5A5c9CB6078A34f7289B476", - "0x67Ecbe3a67624c80356386413E068bfFc03ad228", - "0xeD2905F595B6Ba103d8dF047Aa6dA3708FE6548b", - "0x1A723371f9dc30653dafd826B60d9335bf867E35", - "0x23c65213458A2dcc1321f84Ab42dCaECD79C2215", - "0x4BDA6C4d2f53B2Cd7F7FAc9287902a9928002e7B", - "0x944A5C12cD4399ABC6883fF1ba40A14c23B2Fd37", - "0xb87e2D83DB70599B14818C931DE0A656bf620e77", - "0x449533BcF3Fc5963515f87c17CDfE762b7Ab89fb", - "0x6F79CA179FE1cD131574a08B96e92744B6649128", - "0x99AB491471FBcB7D9d2b69729462fe223a4cCdab", - "0x2eac840950F1FF53d03A55A0255ea787fE84a4b5", - "0xe7B6CB2BfaB7C886CAA97fd3f181bBDad664A19B", - "0x3eEcd5FeD0900451A95537De7F3543cA4Ed926a7", - "0x2FbE43adaf91EE9A6B8252A017297007Acf696a3", - "0x346c16e7a76D224b9955c0F67e93b413Fc63ba3E", - "0x81cec323bf8c4164c66ec066f53cc053a535f03d", - "0x1d34Db65C4fe0f6A73194DBDC4a44ae05B46e6c5", - "0x8AAc0f2a6cAE626b656Ca16c58A50C87CBBC7ff5", - "0x964eA598DF006F692105A951a774ff9825a454Fe", - "0x4ec61a96738564CaD591841df0c8B5b6eA785E4C", - "0x4252Da0559960a50FDd50D5bDDe1B78659B7Ea2A", - "0x3325a25A2608EA723cB5D72E27af65AACFfb810e", - "0xb759b56d82C88806bbcBcD60767E39Af5cc51F32", - "0x2C6d11e756986f1537a2c71c851e9a1F7A0008b2", - "0xD74B5df80347cE9c81b91864DF6a50FfAfE44aa5", - "0x5268F5F2a9799f747A55f193d2E266c77653E518", - "0x67FEe70c32097c53B5aeAaCdbee7544eaE2194f8", - "0x0fC4f2DB534Bf7525710DBf64B7081e1a3A6428f", - "0x40c03Cd0B5D1571608D09e6279B4C63660e431F1", - "0xD97FA4474084350D2c96285E1Fca07A9D515c800", - "0xAb4E02911A7d09BC8300F39332F087d51c183038", - "0x8D0663d2d738e6078Bb77589dE4231eD9fcFd014", - "0xec74671f95F0942358016da627b912143100DAF2", - "0xFe2f5e215C0Fe9b5D4fF99cA7cBB5F5a77f5C515", -]; - -const AVALANCHE_BEEFY_TOKENS = [ - "0x79F26046D122d2F26B1D37237D5C056fB580447A", - "0x7E5bC7088aB3Da3e7fa1Aa7ceF1dC73F5B00681c", - "0xe1a8EeA58D63Ea64d00365531D266C2AD1f62FC4", - "0x22EafB9C7E2858cfDA712940896464DdAA83d053", - "0x68866acc5C940938B373F55F7009f824c7662F5B", - "0xf3340EdF16563D52C7E7C576F2fCC8f3D52464aB", - "0x595786A3848B1de66C6056C87BA91977935fBC46", - "0xA27BF4d56870A37e37a687B8ab3740d8487Ee2C6", - "0xFeA7976733f47557860f4483f2147a3e99C76b58", - "0x3D81A269E05e6057e4dF9E2D76E254E65a65Eb66", - "0x282B11E65f0B49363D4505F91c7A44fBEe6bCc0b", - "0x3C2131A02659343d68c211aAa686750bE37d88c4", - "0x813aB5B3FDc59B143C42284665864b24B794C324", -]; - -const BNB_BEEFY_TOKENS = [ - "0x31e77776b924Cd5f0E624771C9B3d2bD6B9c919E", - "0x4a9945B75E5c860f511CD223E838b213828a0583", - "0x684d86518e6E7d622d24854cBb1C179d6C0E3f75", - "0x62ef49280c0f155afd374fC5Efd1F06318648700", - "0x1542885D6EeD4EE3AC1a110d3f159003a0774101", - "0x6eb020663898c72F8E25958F5f7bcDC732279201", - "0xe47E724c0b4EE9fbC16097AC103b97dc6642fd18", - "0x9A10Cc2024744681fBce1F93Aeee3fd7863B1A12", - "0xD411121C948Cff739857513E1ADF25ED448623f8", - "0x56ec6031dC969CfA035F6D65e65D8595d5660fB4", - "0xC34Ae91312A3c3F9420691922040a5DEe1698E52", - "0xc1fcf50ccaCd1583BD9d3b41657056878C94e592", - "0xb26642B6690E4c4c9A6dAd6115ac149c700C7dfE", - "0x33D0F945F77660F4A9e56949500265313f6D08fb", - "0x86b481fCe116DCd01fBeBb963f1358bcc466668C", - "0x164fb78cAf2730eFD63380c2a645c32eBa1C52bc", - "0x0383E88A19E5c387FeBafbF51E5bA642d2ad8bE0", - "0xf2064C230b285AA6Cf45c6267DA86a8E3505D0AA", - "0x960eE6caC56912D94cE5c83D7Fb0CD873b5c5099", - "0x72fC82b9955f04b20166b0Da7e1af4f893F6316a", - "0xe0Af98A11DB57c7282c1f6066d116E13F02BF0E9", - "0x836C6BffB0B08aCa20b9380330D2532A51aA0eAD", - "0x93DB73f79D4fdc5be42C0bd2812e94A271aDC7e2", - "0x5D83D13Fa899451b75f7c465C0A2590Bb3f9067f", - "0x3b3bc8AE6dcAcCeaaC3C19E196ebD3341Cfe9c4e", -]; - -const BASE_BEEFY_TOKENS = [ - "0xbE3F14312B08E9c6AEe6AeB27B37c08B661A7F83", - "0x5A47993216fa6ACaf93418f9830cee485e82d0ba", - "0xd0c3E7f86338403Df99DEa1996f6C9Ed8f9D3d07", - "0xB614A6E6c21202De79DceB95AE2dd4817DD7e14b", - "0xB62F13126fCD0dD49dE8fF811406554197Bd0E11", - "0x507094549509Efdf63ecA34B795094065cB04008", - "0x8bd6dF821513aECDbbaa29C1d5212b43fdCe7819", - "0x98bEAa72230788572e3e3Be58D91C232dda315d4", - "0x74251C0d0B74Fba6e3B3EDe8533D9Da82B4EC4a4", - "0xc005B9833deBcF5fe6cc5bC9ba4fD74Bb382ae55", - "0xC3a5b142a144135D900FC5Ef2Bb7E92a3bcB46F1", - "0x09139A80454609B69700836a9eE12Db4b5DBB15f", - "0x4Fc0E7cDfe0CF92762eaf3CEE9133239A2197391", - "0x06a613d3a056d4b04D7523C11d82c67Bebf9d850", - "0xFB6864F1c14A90E85398B853701B01ef6a0CA3E5", -]; - -const beefyTokensByChain = { - ethereum: ETHEREUM_BEEFY_TOKENS, - arbitrum: ARBITRUM_BEEFY_TOKENS, - optimism: OPTIMISM_BEEFY_TOKENS, - polygon: POLYGON_BEEFY_TOKENS, - avax: AVALANCHE_BEEFY_TOKENS, - bsc: BNB_BEEFY_TOKENS, - base: BASE_BEEFY_TOKENS, -}; - -module.exports = beefyTokensByChain; diff --git a/projects/hinkal/gaugeTokens.js b/projects/hinkal/gaugeTokens.js deleted file mode 100644 index 000ae01d80d0..000000000000 --- a/projects/hinkal/gaugeTokens.js +++ /dev/null @@ -1,250 +0,0 @@ -const ETHEREUM_GAUGE_TOKENS = [ - { - erc20TokenAddress: "0x93ce650b8d3a7a7e44121db82a0429a3884db599", - underlyingErc20TokenAddress: "0xbFcF63294aD7105dEa65aA58F8AE5BE2D9d0952A", - }, - { - erc20TokenAddress: "0xE49127B7AEfc043847caDd85B8a41973854D30f5", - underlyingErc20TokenAddress: "0x8dff75976f22db58d7c3fd7b68d782238b0dbe30", - }, - { - erc20TokenAddress: "0x8A31A94bF0926B82083C80E18B331085B84E92D7", - underlyingErc20TokenAddress: "0x689440f2Ff927E1f24c72F1087E1FAF471eCe1c8", - }, - { - erc20TokenAddress: "0xcc26a5246c6a04a85e997d6581c1b4f14363841a", - underlyingErc20TokenAddress: "0xcfc25170633581bf896cb6cdee170e3e3aa59503", - }, - { - erc20TokenAddress: "0x9a7Ce41c96Db8d792497D7BEe70fAfb7F8393D71", - underlyingErc20TokenAddress: "0x7e880867363A7e321f5d260Cade2B0Bb2F717B02", - }, - { - erc20TokenAddress: "0xd4EC67cF6C0Aa65F74eb7F03216Ea23151af21b8", - underlyingErc20TokenAddress: "0x2932a86df44fe8d2a706d8e9c5d51c24883423f5", - }, - { - erc20TokenAddress: "0x4F1546Ce825dB85310aC2c2cfb369543d73FD0a2", - underlyingErc20TokenAddress: "0xbD5445402B0a287cbC77cb67B2a52e2FC635dce4", - }, - { - erc20TokenAddress: "0x394Aa83d0E5D348c7FA39325d2A25993704Faf8f", - underlyingErc20TokenAddress: "0xfb860600f1be1f1c72a89b2ef5caf345aff7d39d", - }, - { - erc20TokenAddress: "0xD1105d6502d3c562B447A75149B00aD366b3212d", - underlyingErc20TokenAddress: "0x6991C1CD588c4e6f6f1de3A0bac5B8BbAb7aAF6d", - }, - { - erc20TokenAddress: "0xE08FF1427b199241506FcdCC23fcc24Dd98a4FA9", - underlyingErc20TokenAddress: "0xDeFd8FdD20e0f34115C7018CCfb655796F6B2168", - }, - { - erc20TokenAddress: "0xC21545c26661ae74b3259B55aE007ACC4Bf5d4e3", - underlyingErc20TokenAddress: "0x9D5C5E364D81DaB193b72db9E9BE9D8ee669B652", - }, - { - erc20TokenAddress: "0xa0Cd8B83B63381895C1854A605315fa7eF50e026", - underlyingErc20TokenAddress: "0x512a68dd5433563bad526c8c2838c39debc9a756", - }, - { - erc20TokenAddress: "0x25aE9BE521898d33c7DF6Ae8c6669Fe038Bb3550", - underlyingErc20TokenAddress: "0xecad6745058377744c09747b2715c0170b5699e5", - }, - { - erc20TokenAddress: "0x9434722bf29750B44649eb1b1A10a335d40edFc1", - underlyingErc20TokenAddress: "0x27cace18f661161661683bba43933b2e6eb1741e", - }, - { - erc20TokenAddress: "0xF2280cBa8e0B9bc9b87b5aFbBeF8C41C20a5ddBe", - underlyingErc20TokenAddress: "0xbe266d68ce3ddfab366bb866f4353b6fc42ba43c", - }, - { - erc20TokenAddress: "0x5F1894e4b409D7199Ea209b9e43C996640BCB691", - underlyingErc20TokenAddress: "0x8605dc0c339a2e7e85eea043bd29d42da2c6d784", - }, - { - erc20TokenAddress: "0xa653510227752632ebf692a77e5032d4afFaB3a2", - underlyingErc20TokenAddress: "0xC94208D230EEdC4cDC4F80141E21aA485A515660", - }, - { - erc20TokenAddress: "0xA1998B87C2935BDbd7fE6ee48542a59a0435a3Ee", - underlyingErc20TokenAddress: "0x245Ec0d447e7f206B43120Ac292dED5E8bB9fe61", - }, - { - erc20TokenAddress: "0xC8c3031fB628Bdf4eA0F7cA5F96E369Dea07624e", - underlyingErc20TokenAddress: "0x0404d05F3992347d2f0dC3a97bdd147D77C85c1c", - }, - { - erc20TokenAddress: "0xDc118133332f703e22C0b0FA7E0DD7d1299A7247", - underlyingErc20TokenAddress: "0xB468dB2E478885B87D7ce0C8DA1D4373A756C138", - }, - { - erc20TokenAddress: "0xC6fDF0921c480Bd7Af89Ab4461D4aCDA24058a65", - underlyingErc20TokenAddress: "0xAE0bFfc3110e69DA8993F11C1CBd9a6eA3d16daF", - }, - { - erc20TokenAddress: "0x6410ee1f8417a7cE1c3E68E3434c1d6beef6944E", - underlyingErc20TokenAddress: "0x277d1424a84b35ec0a8108482551b00b4fc1539b", - }, - { - erc20TokenAddress: "0x9456cB3ae9fA8788ac1af4a7A18b339D4028061D", - underlyingErc20TokenAddress: "0xc2fe9d3c761994897594df63b33b6d843ab7b1cf", - }, - { - erc20TokenAddress: "0x26dA2546602f63b84B3C4dF36476364f6350706E", - underlyingErc20TokenAddress: "0x0e83df148f69965bfe752250835854b0dbeeaf01", - }, - { - erc20TokenAddress: "0x0a3fE1d39E5c60CfdB48Ba2Dc6B7c855289Dec7C", - underlyingErc20TokenAddress: "0x35ad1acf0c4be5d4ba11342128d440fdb9e189eb", - }, - { - erc20TokenAddress: "0xA27fa5E11B121277423aC0b8b372596f2805e36a", - underlyingErc20TokenAddress: "0xe2c422d954db416a69fb29137fe552cce0e160e9", - }, - { - erc20TokenAddress: "0x41e5c3aD70DA89dd7b6AF9Af3cd6861FbC31eA16", - underlyingErc20TokenAddress: "0x621ef98282ac42d2bf4c20fc73912a16599e12fb", - }, -]; - -const ARBITRUM_GAUGE_TOKENS = [ - { - erc20TokenAddress: "0xC3691c157D1B3A431B841230a7B11d5a373097e1", - underlyingErc20TokenAddress: "0xce5f24b7a95e9cba7df4b54e911b4a3dc8cdaf6f", - }, - { - erc20TokenAddress: "0x7Bdc233E5369Ac023b9894645902C9032A72D9Ee", - underlyingErc20TokenAddress: "0x971E732B5c91A59AEa8aa5B0c763E6d648362CF8", - }, - { - erc20TokenAddress: "0xCC26A5246C6A04a85E997d6581C1b4f14363841a", - underlyingErc20TokenAddress: "0xf2ddf89c04d702369ab9ef8399edb99a76e951ce", - }, - { - erc20TokenAddress: "0xeEeeb52E36c78b153caaB2761c369a50b066cDD5", - underlyingErc20TokenAddress: "0x098ef55011b6b8c99845128114a9d9159777d697", - }, - { - erc20TokenAddress: "0x59eC3043D7314B9650294Fd800149b53007f804E", - underlyingErc20TokenAddress: "0x95285ea6ff14f80a2fd3989a6bab993bd6b5fa13", - }, - { - erc20TokenAddress: "0x972c6F2b29638b9AD6955c4F0b0c1239b034f053", - underlyingErc20TokenAddress: "0x93729702Bf9E1687Ae2124e191B8fFbcC0C8A0B0", - }, - { - erc20TokenAddress: "0xbA65D50Cf4e6E739B2735338a964C3354fAF9B19", - underlyingErc20TokenAddress: "0xd6dacdcb438f048cf90e53415872cdb3fcc95421", - }, - { - erc20TokenAddress: "0x886867993080DC3bBFC39CDfc343A0e083bB34E0", - underlyingErc20TokenAddress: "0x6B7B84F6EC1c019aF08C7A2F34D3C10cCB8A8eA6", - }, - { - erc20TokenAddress: "0xB72ea6F99EfA5BD6Fb400BaA4eFddC3cfB075215", - underlyingErc20TokenAddress: "0xc2b1df84112619d190193e48148000e3990bf627", - }, - { - erc20TokenAddress: "0x660108601EED17aF2832A1c0F1D7dE74F560C5ed", - underlyingErc20TokenAddress: "0x7c0ac20c3ca8c6257ea099131081d8199bf6b8f6", - }, -]; - -const OPTIMISM_GAUGE_TOKENS = [ - { - erc20TokenAddress: "0x29c431806E536Fb22ce2Edc8dd6e3C3A0d5689a8", - underlyingErc20TokenAddress: "0xc5ae4b5f86332e70f3205a8151ee9ed9f71e0797", - }, - { - erc20TokenAddress: "0xDaA24E888432b5aa607105e256919Ddfc8b327E9", - underlyingErc20TokenAddress: "0xd53ccbfed6577d8dc82987e766e75e3cb73a8563", - }, - { - erc20TokenAddress: "0xC3691c157D1B3A431B841230a7B11d5a373097e1", - underlyingErc20TokenAddress: "0x15f52286c0ff1d7a7ddbc9e300dd66628d46d4e6", - }, - { - erc20TokenAddress: "0xCC26A5246C6A04a85E997d6581C1b4f14363841a", - underlyingErc20TokenAddress: "0x172a5af37f69c69cc59e748d090a70615830a5dd", - }, - { - erc20TokenAddress: "0xeEeeb52E36c78b153caaB2761c369a50b066cDD5", - underlyingErc20TokenAddress: "0xcb8883d1d8c560003489df43b30612aabb8013bb", - }, - { - erc20TokenAddress: "0x59eC3043D7314B9650294Fd800149b53007f804E", - underlyingErc20TokenAddress: "0x2eb49a3eff789d7b2286bf17667acbf12d882c17", - }, - { - erc20TokenAddress: "0xbA65D50Cf4e6E739B2735338a964C3354fAF9B19", - underlyingErc20TokenAddress: "0xcea806562b757aeffa9fe9d0a03c909b4a204254", - }, -]; - -const POLYGON_GAUGE_TOKENS = [ - { - erc20TokenAddress: "0x9dc8Ee4264923D44F2a33Ea139FC4143C288b172", - underlyingErc20TokenAddress: "0x0e2f214b8f5d0cca011a8298bb907fb62f535160", - }, - { - erc20TokenAddress: "0x1057a796C66ca87EC1e6494f5486006396756083", - underlyingErc20TokenAddress: "0x835cA119fA28515B1F184A5Ce5Ccda2B5b0d9F6D", - }, - { - erc20TokenAddress: "0x350c331F4e5fD9d5D703424F3F14CcC0280B6629", - underlyingErc20TokenAddress: "0x40371aad2a24ed841316ef30938881440fd4426c", - }, - { - erc20TokenAddress: "0xf742B69Bd460F14EB5d8335e06954eba694B552E", - underlyingErc20TokenAddress: "0xA9249f8667cb120F065D9dA1dCb37AD28E1E8FF0", - }, - { - erc20TokenAddress: "0xc44F1103A271BEFF26bB245D760bFbe182CCf121", - underlyingErc20TokenAddress: "0x8b397084699cc64e429f610f81fac13bf061ef55", - }, - { - erc20TokenAddress: "0x195888B86db69C52b54362DB2D71c2d3e411A0bA", - underlyingErc20TokenAddress: "0xc501491b0e4A73B2eFBaC564a412a927D2fc83dD", - }, - { - erc20TokenAddress: "0x22301937028310Cef6530eF3C3Bfe14581eb679F", - underlyingErc20TokenAddress: "0xfc052e70eb6d94afe464a8ce8f43d203109494f2", - }, - { - erc20TokenAddress: "0x90F06727Ba5016eDcf9D8B5def63a5849EcD132f", - underlyingErc20TokenAddress: "0x9633e0749faa6ec6d992265368b88698d6a93ac0", - }, -]; - -const AVALANCHE_GAUGE_TOKENS = []; - -const BNB_GAUGE_TOKENS = []; - -const BASE_GAUGE_TOKENS = [ - { - erc20TokenAddress: "0x3b9860321f03AFe02D3FF9e4Fdd4017DC6F4d7Ca", - underlyingErc20TokenAddress: "0x79edc58C471Acf2244B8f93d6f425fD06A439407", - }, - { - erc20TokenAddress: "0x1f0dbEcDA414F401dB46464864273CaD19368706", - underlyingErc20TokenAddress: "0x93933FA992927284e9d508339153B31eb871e1f4", - }, - { - erc20TokenAddress: "0x3E07F263C1Ce5EC2a3f1cA87af56B80B27674D96", - underlyingErc20TokenAddress: "0x89289DC2192914a9F0674f1E9A17C56456549b8A", - }, -]; - -const gaugeTokensByChain = { - ethereum: ETHEREUM_GAUGE_TOKENS, - arbitrum: ARBITRUM_GAUGE_TOKENS, - optimism: OPTIMISM_GAUGE_TOKENS, - polygon: POLYGON_GAUGE_TOKENS, - avax: AVALANCHE_GAUGE_TOKENS, - bsc: BNB_GAUGE_TOKENS, - base: BASE_GAUGE_TOKENS, -}; - -module.exports = gaugeTokensByChain; diff --git a/projects/hinkal/hinkalUtils.js b/projects/hinkal/hinkalUtils.js index 72c46e51e3d0..01739c1f6207 100644 --- a/projects/hinkal/hinkalUtils.js +++ b/projects/hinkal/hinkalUtils.js @@ -6,11 +6,25 @@ const ownerByChain = require("./owners.js"); const nullAddress = "0x0000000000000000000000000000000000000000"; +const nativeVolatileChains = ["blast"]; + const getAllTokenBalances = async (tokenList, chain) => { - const balanceCalls = tokenList.map((token) => ({ + let balanceCalls = tokenList.map((token) => ({ target: token, - params: ownerByChain[chain], + params: nativeVolatileChains.includes(chain) + ? ownerByChain[chain].owner ?? "" + : ownerByChain[chain], })); + + if (nativeVolatileChains.includes(chain)) { + const volatileBalanceCalls = tokenList.map((token) => ({ + target: token, + params: ownerByChain[chain].volatileOwner ?? "", + })); + + balanceCalls = [...balanceCalls, ...volatileBalanceCalls]; + } + const balances = ( await sdk.api.abi.multiCall({ calls: balanceCalls, @@ -46,11 +60,11 @@ const getAllTokenBalances = async (tokenList, chain) => { }; }); - //Add Native token balance. - const nativeTokenBalance = ( await sdk.api.eth.getBalance({ - target: ownerByChain[chain], + target: nativeVolatileChains.includes(chain) + ? ownerByChain[chain].volatileOwner ?? "" + : ownerByChain[chain], chain, }) ).output; @@ -62,6 +76,7 @@ const getAllTokenBalances = async (tokenList, chain) => { return tokenBalances.filter((tokenBal) => Number(tokenBal.balance) > 0); }; + const fetchTotalValue = async (tokenBalances, chainName) => { const tokenAddresses = tokenBalances.map((token) => token.address); const prices = ( @@ -76,7 +91,7 @@ const fetchTotalValue = async (tokenBalances, chainName) => { if (!price || !tokenBalance || isNaN(price) || isNaN(tokenBalance)) { console.log("Some error occured for token", { token: token.address, - bakance: tokenBalance, + balance: tokenBalance, price, chainName, }); @@ -93,4 +108,7 @@ const fetchTotalValue = async (tokenBalances, chainName) => { return total.filter((token) => token && token.tokenBalance > 0); }; -module.exports = { getAllTokenBalances, fetchTotalValue }; +module.exports = { + getAllTokenBalances, + fetchTotalValue, +}; diff --git a/projects/hinkal/index.js b/projects/hinkal/index.js index 13e68f8741b3..19bf0c387f74 100644 --- a/projects/hinkal/index.js +++ b/projects/hinkal/index.js @@ -1,39 +1,14 @@ const registryTokensByChain = require("./registryTokens.js"); -const gaugeTokensByChain = require("./gaugeTokens.js"); -const beefyTokensByChain = require("./beefyTokens.js"); -const pendleTokensByChain = require("./pendleTokens.js"); const { getAllTokenBalances, fetchTotalValue } = require("./hinkalUtils.js"); const { toUSDTBalances } = require("../helper/balances.js"); -const getRegularTokens = (chain) => { - return [ - registryTokensByChain[chain], - pendleTokensByChain[chain]?.pt, - pendleTokensByChain[chain]?.sy, - beefyTokensByChain[chain], - ].flat(); -}; - -const getTokensWithUnderlyingAddresses = (chain) => { - return [gaugeTokensByChain[chain], pendleTokensByChain[chain]?.yt].flat(); -}; - const tvl = async (_, _1, _2, { chain }) => { - const regularTokens = getRegularTokens(chain); - const tokensWithUnderlyingAddresses = getTokensWithUnderlyingAddresses(chain); - - const regularTokenBalances = await getAllTokenBalances(regularTokens, chain); - - const tokensWithUnderlyingAddressesBalances = await getAllTokenBalances( - tokensWithUnderlyingAddresses.map((token) => token.erc20TokenAddress), + const tokenBalances = await getAllTokenBalances( + registryTokensByChain[chain], chain ); - const allTokenBalances = [ - ...regularTokenBalances, - ...tokensWithUnderlyingAddressesBalances, - ]; - const totalValue = await fetchTotalValue(allTokenBalances, chain); + const totalValue = await fetchTotalValue(tokenBalances, chain); return toUSDTBalances( totalValue.reduce((acc, token) => acc + token.tokenBalance, 0) @@ -62,4 +37,7 @@ module.exports = { bsc: { tvl, }, + blast: { + tvl, + }, }; diff --git a/projects/hinkal/owners.js b/projects/hinkal/owners.js index cfe9d74c9e83..893c5de86d24 100644 --- a/projects/hinkal/owners.js +++ b/projects/hinkal/owners.js @@ -5,6 +5,8 @@ const POLYGON_OWNER = "0xeEeeb52E36c78b153caaB2761c369a50b066cDD5"; const AVALANCHE_OWNER = "0x41658B0DaF59Bb2FbB2D9A5249207011d2B364De"; const BNB_OWNER = "0x0036E884Cab4F427193839788EDEBB4B92B9a069"; const BASE_OWNER = "0x41658B0DaF59Bb2FbB2D9A5249207011d2B364De"; +const BLAST_OWNER = "0x9606ebb543972fd8aed764341ead8ec94888b7b7"; +const BLAST_VOLATILE_OWNER = "0xba65d50cf4e6e739b2735338a964c3354faf9b19"; const ownerByChain = { ethereum: ETHEREUM_OWNER, @@ -14,6 +16,10 @@ const ownerByChain = { avax: AVALANCHE_OWNER, bsc: BNB_OWNER, base: BASE_OWNER, + blast: { + owner: BLAST_OWNER, + volatileOwner: BLAST_VOLATILE_OWNER, + }, }; module.exports = ownerByChain; diff --git a/projects/hinkal/pendleTokens.js b/projects/hinkal/pendleTokens.js deleted file mode 100644 index b3287bb2846e..000000000000 --- a/projects/hinkal/pendleTokens.js +++ /dev/null @@ -1,108 +0,0 @@ -const ETHEREUM_YT_TOKENS = [ - { - erc20TokenAddress: "0x019e773bE2D65D5fE30bE17547b89500C7C4CD5E", - underlyingErc20TokenAddress: "0xfb35Fd0095dD1096b1Ca49AD44d8C5812A201677", - }, - { - erc20TokenAddress: "0x1346da36093Fdb8013E1125046f0dCBbBF645b3F", - underlyingErc20TokenAddress: "0x0ED3A1D45DfdCf85BCc6C7BAFDC0170A357B974C", - }, - { - erc20TokenAddress: "0x4E0854085bC5a2fa8031ea5819863BD280e610F3", - underlyingErc20TokenAddress: "0x391B570e81e354a85a496952b66ADc831715f54f", - }, - { - erc20TokenAddress: "0x9Ab43f73054C07b02e02c5468b3eB058ccdAA019", - underlyingErc20TokenAddress: "0x98601E27d41ccff643da9d981dc708cf9eF1F150", - }, - { - erc20TokenAddress: "0x223026549740E2672b3f05c867Fd2B31207338A2", - underlyingErc20TokenAddress: "0x7C2D26182adeEf96976035986cF56474feC03bDa", - }, - { - erc20TokenAddress: "0x3e0A917d4d914e432B82825e6FBEe039b89f4477", - underlyingErc20TokenAddress: "0x029aad400f6092dc735a65be95102efcc2fe64bf", - }, -]; - -const ETHEREUM_PT_TOKENS = [ - "0xc69Ad9baB1dEE23F4605a82b3354F8E40d1E5966", - "0x094be6bd31d7b860f7d2c1f280fd09f0463d7e67", - "0x4AE5411F3863CdB640309e84CEDf4B08B8b33FfF", - "0xDDFD5e912C1949B4bDb12579002c44B7A83F9E88", - "0xC58aa33Ce619c7f7Ac4929DF357D0Ef762edbD23", - "0xB05cABCd99cf9a73b19805edefC5f67CA5d1895E", -]; - -const ETHEREUM_SY_TOKENS = [ - "0xAC0047886a985071476a1186bE89222659970d65", - "0x730A5E2AcEbccAA5e9095723B3CB862739DA793c", - "0x253008ba4aE2f3E6488DC998a5321D4EB1a0c905", - "0x7a493be5c2ce014cd049bf178a1ac0db1b434744", - "0xD7DF7E085214743530afF339aFC420c7c720BFa7", - "0x34349c5569e7b846c3558961552d2202760a9789", -]; - -const ARBITRUM_YT_TOKENS = []; -const ARBITRUM_PT_TOKENS = []; -const ARBITRUM_SY_TOKENS = []; - -const OPTIMISM_YT_TOKENS = []; -const OPTIMISM_PT_TOKENS = []; -const OPTIMISM_SY_TOKENS = []; - -const POLYGON_YT_TOKENS = []; -const POLYGON_PT_TOKENS = []; -const POLYGON_SY_TOKENS = []; - -const AVALANCE_YT_TOKENS = []; -const AVALANCE_PT_TOKENS = []; -const AVALANCE_SY_TOKENS = []; - -const BNB_YT_TOKENS = []; -const BNB_PT_TOKENS = []; -const BNB_SY_TOKENS = []; - -const BASE_YT_TOKENS = []; -const BASE_PT_TOKENS = []; -const BASE_SY_TOKENS = []; - -const pendleTokensByChain = { - ethereum: { - yt: ETHEREUM_YT_TOKENS, - pt: ETHEREUM_PT_TOKENS, - sy: ETHEREUM_SY_TOKENS, - }, - arbitrum: { - yt: ARBITRUM_YT_TOKENS, - pt: ARBITRUM_PT_TOKENS, - sy: ARBITRUM_SY_TOKENS, - }, - optimism: { - yt: OPTIMISM_YT_TOKENS, - pt: OPTIMISM_PT_TOKENS, - sy: OPTIMISM_SY_TOKENS, - }, - polygon: { - yt: POLYGON_YT_TOKENS, - pt: POLYGON_PT_TOKENS, - sy: POLYGON_SY_TOKENS, - }, - avax: { - yt: AVALANCE_YT_TOKENS, - pt: AVALANCE_PT_TOKENS, - sy: AVALANCE_SY_TOKENS, - }, - bsc: { - yt: BNB_YT_TOKENS, - pt: BNB_PT_TOKENS, - sy: BNB_SY_TOKENS, - }, - base: { - yt: BASE_YT_TOKENS, - pt: BASE_PT_TOKENS, - sy: BASE_SY_TOKENS, - }, -}; - -module.exports = pendleTokensByChain; diff --git a/projects/hinkal/registryTokens.js b/projects/hinkal/registryTokens.js index 50535f196db5..8ea8f5f02752 100644 --- a/projects/hinkal/registryTokens.js +++ b/projects/hinkal/registryTokens.js @@ -1,7 +1,7 @@ const ETHEREUM_REGISTRY_TOKENS = [ - "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "0xdAC17F958D2ee523a2206206994597C13D831ec7", + "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", "0x6B175474E89094C44Da98b954EedeAC495271d0F", "0x8E870D67F660D95d5be530380D0eC0bd388289E1", @@ -13,6 +13,7 @@ const ETHEREUM_REGISTRY_TOKENS = [ "0x3175Df0976dFA876431C2E9eE6Bc45b65d3473CC", "0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd", "0xf43211935C781D5ca1a41d2041F397B8A7366C7A", + "0xd632f22692FaC7611d2AA1C0D552930D43CAEd3B", "0xD533a949740bb3306d119CC777fa900bA034cd52", "0x99D8a9C45b2ecA8864373A26D1459e3Dff1e17F3", "0x5a6A4D54456819380173272A5E8E9B9904BdF41B", @@ -20,10 +21,25 @@ const ETHEREUM_REGISTRY_TOKENS = [ "0xC25a3A3b969415c80451098fa907EC722572917F", "0xb2C35aC676F4A002669e195CF4dc50DDeDF6F0fA", "0x5e74C9036fb86BD7eCdcb084a0673EFc32eA31cb", + "0xA3D87FffcE63B53E0d54fAa1cc983B7eB0b74A9c", + "0xFCc5c47bE19d06BF83eB04298b026F81069ff65b", + "0x99f5aCc8EC2Da2BC0771c32814EFF52b712de1E5", + "0xfE18be6b3Bd88A2D2A7f928d00292E7a9963CfC6", + "0x051d7e5609917Bd9b73f04BAc0DED8Dd46a74301", + "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0", + "0x5E8422345238F34275888049021821E8E08CAa1f", "0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B", + "0x865377367054516e17014CcdED1e7d814EDC9ce4", + "0x3A283D9c08E8b55966afb64C515f5143cf907611", + "0x06325440D014e39736583c165C2963BA99fAf14E", + "0x4d9f9D15101EEC665F77210cB999639f760F831E", + "0xae78736Cd615f374D3085123A210448E74Fc6393", + "0x6c38cE8984a890F5e46e6dF6117C26b3F1EcfC9C", + "0x62B9c7356A2Dc64a1969e19C23e4f579F9810Aa7", "0x971add32Ea87f10bD192671630be3BE8A11b8623", - "0xEcd5e75AFb02eFa118AF914515D6521aaBd189F1", "0x0000000000085d4780B73119b644AE5ecd22b376", + "0xEcd5e75AFb02eFa118AF914515D6521aaBd189F1", + "0xb40b6608B2743E691C9B54DdBDEe7bf03cd79f1c", "0x68934F60758243eafAf4D2cFeD27BF8010bede3a", "0xAf5191B0De278C7286d6C7CC6ab6BB8A73bA2Cd6", "0xdf55670e27bE5cDE7228dD0A6849181891c9ebA1", @@ -40,23 +56,35 @@ const ETHEREUM_REGISTRY_TOKENS = [ "0x0100546F2cD4C9D97f798fFC9755E47865FF7Ee6", "0x5A98FcBEA516Cf06857215779Fd812CA3beF1B32", "0xb79565c01b7Ae53618d9B847b9443aAf4f9011e7", + "0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e", + "0x29059568bB40344487d62f7450E78b8E6C74e0e5", + "0xBe9895146f7AF43049ca1c1AE358B0541Ea49704", + "0x5b6C539b224014A09B3388e51CaAA8e354c959C8", + "0xd7C9F0e536dC865Ae858b0C0453Fe76D13c3bEAc", + "0x326290A1B0004eeE78fa6ED4F1d8f4b2523ab669", + "0xBEA0000029AD1c77D3d5D23Ba2D8893dB9d1Efab", + "0xc9C32cd16Bf7eFB85Ff14e0c8603cc90F6F2eE49", + "0x836A808d4828586A69364065A1e064609F5078c7", + "0x43b4FdFD4Ff969587185cDB6f0BD875c5Fc83f8c", + "0x21E27a5E5513D6e65C4f830167390997aA84843a", + "0xdB25f211AB05b1c97D595516F45794528a807ad8", + "0x3D229E1B4faab62F621eF2F6A610961f7BD7b23B", "0x856c4Efb76C1D1AE02e20CEB03A2A6a08b0b8dC3", + "0x94B17476A93b3262d87B9a326965D1E91f9c13E7", + "0xF95AAa7EBB1620e46221B73588502960Ef63dBa0", + "0x18084fbA666a33d37592fA2633fD49a74DD93a88", + "0xa2E3356610840701BDf5611a53974510Ae27E2e1", "0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643", "0x39AA39c021dfbaE8faC545936693aC917d5E7563", "0x845838DF265Dcd2c412A1Dc9e959c7d08537f8a2", "0x0316EB71485b0Ab14103307bf65a021042c6d380", - "0xBEA0000029AD1c77D3d5D23Ba2D8893dB9d1Efab", + "0xb19059ebb43466C323583928285a49f558E572Fd", "0x8e595470Ed749b85C6F7669de83EAe304C2ec68F", - "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", - "0x6B175474E89094C44Da98b954EedeAC495271d0F", - "0x514910771AF9Ca656af840dff83E8264EcF986CA", - "0x88dF592F8eb5D7Bd38bFeF7dEb0fBc02cf3778a0", - "0x2ba592F78dB6436527729929AAf6c908497cB200", - "0xE41d2489571d322189246DaFA5ebDe1F4699F498", - "0x04Fa0d235C4abf4BcF4787aF4CF447DE572eF828", - "0x8E870D67F660D95d5be530380D0eC0bd388289E1", - "0x5BC25f649fc4e26069dDF4cF4010F9f706c23831", + "0x76Eb2FE28b36B3ee97F3Adae0C69606eeDB2A37c", + "0x48759F220ED983dB51fA7A8C0D2AAb8f3ce4166a", + "0x5282a4eF67D9C33135340fB3289cc1711c13638C", "0x075b1bb99792c9E1041bA13afEf80C91a1e70fB3", + "0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D", "0x49849C98ae39Fff122806C06791Fa73784FB3675", "0xA0d69E286B938e21CBf7E51D71F6A4c8918f482F", "0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E", @@ -89,6 +117,10 @@ const ETHEREUM_REGISTRY_TOKENS = [ "0x49b562bDcd28dB124f6bA51DEB8Ca483563c067a", "0xBE2bD093B8F342e060E79Fad6059B1057F016Ba4", "0x3fe43D4ba0a5BAcC800c7E7E782466a27ab108bf", + "0x4dd0cF20237deb5F2bE76340838B9e2D7c70E852", + "0xE0d5f9DA3613C047003b77cAa31270aBE3EdA6b0", + "0xB9911AB699FD781efDA446e7FD995d375B437c8B", + "0x37925b6319cD41014583A6476a7a1d52Ea404b2f", "0xAE0bFfc3110e69DA8993F11C1CBd9a6eA3d16daF", "0x42ED016F826165C2e5976fe5bC3df540C5aD0Af7", "0x1E19CF2D73a72Ef1332C882F20534B6519Be0276", @@ -101,12 +133,43 @@ const ETHEREUM_REGISTRY_TOKENS = [ "0xa2847348b58CEd0cA58d23c7e9106A49f1427Df6", "0xeaCADc656c9394fb09af25AeBc0897fDfFe484A1", "0x380aAbE019ed2a9C2d632b51eDDD30fd804d0fAD", - "0x94cc50e4521bd271c1a997a3a4dc815c2f920b41", + "0x101816545F6bd2b1076434B54383a1E633390A2E", + "0x4d224452801ACEd8B2F0aebE155379bb5D594381", + "0x20a61B948E33879ce7F23e535CC7BAA3BC66c5a9", + "0x5870700f1272a1adbb87c3140bd770880a95e55d", + "0x93ce650b8d3a7a7e44121db82a0429a3884db599", + "0xE49127B7AEfc043847caDd85B8a41973854D30f5", + "0x8A31A94bF0926B82083C80E18B331085B84E92D7", + "0xcc26a5246c6a04a85e997d6581c1b4f14363841a", + "0x9a7Ce41c96Db8d792497D7BEe70fAfb7F8393D71", + "0xd4EC67cF6C0Aa65F74eb7F03216Ea23151af21b8", + "0x4F1546Ce825dB85310aC2c2cfb369543d73FD0a2", + "0x394Aa83d0E5D348c7FA39325d2A25993704Faf8f", + "0xD1105d6502d3c562B447A75149B00aD366b3212d", + "0xE08FF1427b199241506FcdCC23fcc24Dd98a4FA9", + "0xC21545c26661ae74b3259B55aE007ACC4Bf5d4e3", + "0x9ee91F9f426fA633d227f7a9b000E28b9dfd8599", "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0", + "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84", + "0x35fA164735182de50811E8e2E824cFb9B6118ac2", "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0", - "0xc794c6a95f30d0ebf7b3bbe85e8a0a95c9e411c1", + "0xa0Cd8B83B63381895C1854A605315fa7eF50e026", + "0x25aE9BE521898d33c7DF6Ae8c6669Fe038Bb3550", + "0x9434722bf29750B44649eb1b1A10a335d40edFc1", + "0xF2280cBa8e0B9bc9b87b5aFbBeF8C41C20a5ddBe", + "0x5F1894e4b409D7199Ea209b9e43C996640BCB691", + "0xa653510227752632ebf692a77e5032d4afFaB3a2", + "0xA1998B87C2935BDbd7fE6ee48542a59a0435a3Ee", + "0xC8c3031fB628Bdf4eA0F7cA5F96E369Dea07624e", + "0xDc118133332f703e22C0b0FA7E0DD7d1299A7247", + "0x94cc50e4521bd271c1a997a3a4dc815c2f920b41", + "0xfef79304c80a694dfd9e603d624567d470e1a0e7", "0x8272e1a3dbef607c04aa6e5bd3a1a134c8ac063b", "0xc794c6a95f30d0ebf7b3bbe85e8a0a95c9e411c1", + "0xaeda92e6a3b1028edc139a4ae56ec881f3064d4f", + "0xacdf0dba4b9839b96221a8487e9ca660a48212be", + "0x514910771af9ca656af840dff83e8264ecf986ca", + "0xa663b02cf0a4b149d2ad41910cb81e23e1c41c32", "0x04c154b66cb340f3ae24111cc767e0184ed00cc6", "0xf8fde8a259a3698902c88bdb1e13ff28cd7f6f09", "0x76237BCfDbe8e06FB774663add96216961df4ff3", @@ -114,16 +177,78 @@ const ETHEREUM_REGISTRY_TOKENS = [ "0xb27D1729489d04473631f0AFAca3c3A7389ac9F8", "0x38D64ce1Bdf1A9f24E0Ec469C9cAde61236fB4a0", "0x9961BdBE8B7091E584c2bF9D0a160C583f564A8c", + "0xe2Ed1dAc3A9547BC6057e32bf8133b5268D7d987", + "0x6307e6688819951cf8d6b6066018243d2496952f", "0xe035e27a8ed6842b478933820f90093d205f7098", + "0x4ef4c7519023f30a78647eeab321d6cfabc2513c", "0x4253ac4046fbfdafcfe125d067b6d89f6923843e", "0x67701d67b60a96473bfc4873e7a484035c8609b0", "0x6685fcfce05e7502bf9f0aa03b36025b09374726", "0xe3e637f8acc097244a065791142c29fbf5877d18", "0x1BB9b64927e0C5e207C9DB4093b3738Eef5D8447", + "0xC6fDF0921c480Bd7Af89Ab4461D4aCDA24058a65", + "0x6410ee1f8417a7cE1c3E68E3434c1d6beef6944E", + "0x9456cB3ae9fA8788ac1af4a7A18b339D4028061D", + "0x26dA2546602f63b84B3C4dF36476364f6350706E", + "0x0a3fE1d39E5c60CfdB48Ba2Dc6B7c855289Dec7C", + "0xA27fa5E11B121277423aC0b8b372596f2805e36a", + "0x41e5c3aD70DA89dd7b6AF9Af3cd6861FbC31eA16", "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee", "0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7", "0xbf5495efe5db9ce00f80364c8b423567e58d2110", "0xD9A442856C234a39a81a089C06451EBAa4306a72", + "0xAC0047886a985071476a1186bE89222659970d65", + "0xfb35Fd0095dD1096b1Ca49AD44d8C5812A201677", + "0xc69Ad9baB1dEE23F4605a82b3354F8E40d1E5966", + "0x730A5E2AcEbccAA5e9095723B3CB862739DA793c", + "0x0ED3A1D45DfdCf85BCc6C7BAFDC0170A357B974C", + "0xB05cABCd99cf9a73b19805edefC5f67CA5d1895E", + "0x253008ba4aE2f3E6488DC998a5321D4EB1a0c905", + "0x391B570e81e354a85a496952b66ADc831715f54f", + "0xC58aa33Ce619c7f7Ac4929DF357D0Ef762edbD23", + "0x7a493be5c2ce014cd049bf178a1ac0db1b434744", + "0x98601E27d41ccff643da9d981dc708cf9eF1F150", + "0xDDFD5e912C1949B4bDb12579002c44B7A83F9E88", + "0xD7DF7E085214743530afF339aFC420c7c720BFa7", + "0x7C2D26182adeEf96976035986cF56474feC03bDa", + "0x4AE5411F3863CdB640309e84CEDf4B08B8b33FfF", + "0x34349c5569e7b846c3558961552d2202760a9789", + "0x029aad400f6092dc735a65be95102efcc2fe64bf", + "0x094be6bd31d7b860f7d2c1f280fd09f0463d7e67", + "0x019e773bE2D65D5fE30bE17547b89500C7C4CD5E", + "0x1346da36093Fdb8013E1125046f0dCBbBF645b3F", + "0x4E0854085bC5a2fa8031ea5819863BD280e610F3", + "0x9Ab43f73054C07b02e02c5468b3eB058ccdAA019", + "0x223026549740E2672b3f05c867Fd2B31207338A2", + "0x3e0A917d4d914e432B82825e6FBEe039b89f4477", + "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8", + "0x0B925eD163218f6662a35e0f0371Ac234f9E9371", + "0x5Ee5bf7ae06D1Be5997A1A72006FE6C607eC6DE8", + "0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c", + "0x23878914EFE38d27C4D67Ab83ed1b93A74D4086a", + "0x018008bfb33d285247A21d44E50697654f754e63", + "0x9ff58f4fFB29fA2266Ab25e75e2A8b3503311656", + "0x030bA81f1c18d280636F32af80b9AAd02Cf0854e", + "0xBcca60bB61934080951369a648Fb03DF4F96263C", + "0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811", + "0x028171bCA77440897B824Ca71D1c56caC55b68A3", + "0x582d872a1b094fc48f5de31d3b73f2d9be47def1", + "0x2af5d2ad76741191d15dfe7bf6ac92d4bd912ca3", + "0x3c3a81e81dc49a522a592e7622a7e711c06bf354", + "0xa0b73e1ff0b80914ab6fe0444e65848c4c34450b", + "0x75231f58b43240c9718dd58b4967c5114342a86c", + "0x6de037ef9ad2725eb40118bb1702ebb27e4aeb24", + "0xf57e7e7c23978c3caec3c3548e3d615c346e79ff", + "0xc944e90c64b2c07662a292be6244bdf05cda44a7", + "0xe28b3b32b6c345a34ff64674606124dd5aceca30", + "0x4c9edd5852cd905f086c759e8383e09bff1e68b3", + "0xaea46a60368a7bd060eec7df8cba43b7ef41ad85", + "0x4a220e6096b25eadb88358cb44068a3248254675", + "0x62d0a8458ed7719fdaf978fe5929c6d342b0bfce", + "0x57e114b691db790c35207b2e685d4a43181e6061", + "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9", + "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", + "0xEEda34A377dD0ca676b9511EE1324974fA8d980D", ]; const ARBITRUM_REGISTRY_TOKENS = [ @@ -145,11 +270,49 @@ const ARBITRUM_REGISTRY_TOKENS = [ "0x8616E8EA83f048ab9A5eC513c9412Dd2993bcE3F", "0xDBf31dF14B66535aF65AaC99C32e9eA844e14501", "0x93FC1235119c554576D8AB23583371fc25B803ee", + "0xaE6aab43C4f3E0cea4Ab83752C278f8dEbabA689", + "0xb1781BF9C582A71269c6098E4155Ea8b15B35305", + "0xf94a05257D3Dd44f30799F03D190988d59aae868", + "0x59bF0545FCa0E5Ad48E13DA269faCD2E8C886Ba4", + "0x8D9bA570D6cb60C7e3e0F31343Efe75AB8E65FB1", + "0x8e0B8c8BB9db49a46697F3a5Bb8A308e744821D2", + "0xDbcD16e622c95AcB2650b38eC799f76BFC557a0b", + "0x30dF229cefa463e991e29D42DB0bae2e122B2AC7", + "0x2ce5Fd6f6F4a159987eac99FF5158B7B62189Acf", + "0x6c84a8f1c29108F47a79964b5Fe888D4f4D0dE40", "0x755D6688AD74661Add2FB29212ef9153D40fcA46", + "0x3E01dD8a5E1fb3481F0F589056b428Fc308AF0Fb", + "0xaB174fFA530C888649C44C4d21C849BBAaBc723F", + "0xae0babD1483ed944BeEd2e112021Ed01301A83aC", + "0xd92Be5A1c565Db5256cDD537B875ED46111Bd8b0", + "0xfC78eAFf2E8290D3d608B689e93ec6954E21B6C2", + "0xB27c433C1cdb1B42E2601Af2d40dD442fbf1cdc3", + "0x9dbbBaecACEDf53d5Caa295b8293c1def2055Adc", "0x9E75f8298e458B76382870982788988A0799195b", "0xDa2307A45D298e855415675bF388e2bd64351D5b", "0xEc7c0205a6f426c2Cb1667d783B5B4fD2f875434", + "0x07Db98358D58Ba9bE90cd0A18cd86AF807ac3B4E", "0x8cbaAC87FDD9Bb6C3FdB5b3C870b2443D0284fa6", + "0x71c15610F11D669d4A9e02a64e43c6D1E27c6Cad", + "0xBDF4e730ED5152a7AC646BB7b514Ed624E1147C4", + "0xf6a1284Dc2ce247Bca885ac4F36b37E91d3bD032", + "0x994Ff2ab544D00aD4EC0380a1Be8F75f4EC47Cf9", + "0x46034C63ad03254D6E96c655e82393E6C31E07C3", + "0xD496eA90a454eA49e30A8fD9E053C186D4FC897D", + "0xd37025aC6227334C7762AeD5929Ce3272fbb6fdC", + "0xFCb0101503f399B4752E5160ccd5EcE3a71719bd", + "0xa7fC98760331409c1FC0177dECF083cE9d5aed87", + "0x5A8beF2fEb83057bBCcC81cea985a94a62A86208", + "0x5B904f19fb9ccf493b623e5c8cE91603665788b0", + "0xA98070C4a600678a93cEaF4bF629eE255F46f64F", + "0x0594Ec32240C78e056304b4A60f48a67c69179b4", + "0xB2DefC5c3A69abe2B681C714b080A892825B2073", + "0x4D323f77c32EDdC62BF8eAbA11E5C573FD0a2ccd", + "0xeD29730F9FF29ea50D63462D8EC84307d36b8954", + "0x12c997FAdca32dB01E3145DE7Bf9cdB06455391D", + "0x85B10228cd93A6e5E354Ff0f2c60875E8E62F65A", + "0xCF297A94d527A34081Db2A20Eb1c87248cD1ea81", + "0xa0d758b81f8ed6635CDE1DA91C8fe1bD48C28A09", "0xfd421d60905d2f7cabd49e6a5703a3499367b8f4", "0xe20F93279fF3538b1ad70D11bA160755625e3400", "0x4a2f6ae7f3e5d715689530873ec35593dc28951b", @@ -159,8 +322,10 @@ const ARBITRUM_REGISTRY_TOKENS = [ "0x9cb911cbb270cae0d132689ce11c2c52ab2dedbc", "0x9791d590788598535278552eecd4b211bfc790cb", "0xade4a71bb62bec25154cfc7e6ff49a513b491e81", + "0xced06c9330b02c378c31c7b12570b1c38abfcea6", "0x423a1323c871abc9d89eb06855bf5347048fc4a5", "0xbf6cbb1f40a542af50839cad01b0dc1747f11e18", + "0x5892bA611fdC1598b72a30D087d28c989d429eF7", "0x3fd4954a851ead144c2ff72b1f5a38ea5976bd54", "0x8bc65eed474d1a00555825c91feab6a8255c2107", "0x892785f33cdee22a30aef750f285e18c18040c3e", @@ -175,10 +340,33 @@ const ARBITRUM_REGISTRY_TOKENS = [ "0x539bdE0d7Dbd336b79148AA742883198BBF60342", "0x99c409e5f62e4bd2ac142f17cafb6810b8f0baae", "0x912CE59144191C1204E64559FE8253a0e49E6548", + "0xC3691c157D1B3A431B841230a7B11d5a373097e1", + "0x7Bdc233E5369Ac023b9894645902C9032A72D9Ee", + "0xCC26A5246C6A04a85E997d6581C1b4f14363841a", + "0xeEeeb52E36c78b153caaB2761c369a50b066cDD5", + "0x59eC3043D7314B9650294Fd800149b53007f804E", + "0x972c6F2b29638b9AD6955c4F0b0c1239b034f053", + "0xbA65D50Cf4e6E739B2735338a964C3354fAF9B19", + "0x886867993080DC3bBFC39CDfc343A0e083bB34E0", + "0xB72ea6F99EfA5BD6Fb400BaA4eFddC3cfB075215", + "0x660108601EED17aF2832A1c0F1D7dE74F560C5ed", + "0xf97f4df75117a78c1a5a0dbb814af92458539fb4", + "0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0", + "0x9623063377ad1b27544c965ccd7342f7ea7e88c7", + "0xb0ffa8000886e57f86dd5264b9582b2ad87b2b91", + "0x13ad51ed4f1b7e9dc168d8a00cb3f4ddd85efa60", + "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8", + "0x513c7E3a9c69cA3e22550eF58AC1C0088e918FFf", + "0x078f358208685046a11C85e8ad32895DED33A249", + "0x724dc807b04555b71ed48a6896b6F41593b8C637", + "0x6ab707Aca953eDAeFBc4fD23bA73294241490620", + "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE", + "0x35751007a407ca6FEFfE80b3cB397736D2cf4dbe", + "0x4186BFC76E2E237523CBC30FD220FE055156b41F", + "0x2416092f143378750bb29b79eD961ab195CcEea5", ]; const OPTIMISM_REGISTRY_TOKENS = [ - "0x4200000000000000000000000000000000000006", "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85", "0x7F5c764cBc14f9669B88837ca1490cCa17c31607", "0x94b008aa00579c1307b0ef2c499ad98a8ce58e58", @@ -227,8 +415,65 @@ const OPTIMISM_REGISTRY_TOKENS = [ "0x4d7959d17B9710BE87e3657e69d946914221BB88", "0xB280D03909Cc18640621955Cb3bC30948DF2Fa9a", "0x22D63A26c730d49e5Eab461E4f5De1D8BdF89C92", + "0x19715771E30c93915A5bbDa134d782b81A820076", "0x0df083de449F75691fc5A36477a6f3284C269108", "0x3DD9556a521d6e57bE480c94da102fedf0429aba", + "0x107Dbf9c9C0EF2Df114159e5C7DC2baf7C444cFF", + "0x54214d0C7772eb6f71ED4De294b3f809691005C9", + "0xF731390c889d9a2089C5bC1d4640F3BA0708D82B", + "0xbe7dC3d2457BBff03943d962F7E4cEE34DFBA69d", + "0x25DE69dA4469A96974FaE79d0C41366A63317FDC", + "0x06E0A84c71dBD037c618CCf90798474E0e6f9C91", + "0x88F72d1f49Ea88f86fc52bebB0c1d0Ef232AE483", + "0x35775aA87b4CA1c04a6c579c90cE9add09247958", + "0xE2f035f59De6a952FF699b4EDD0f99c466f25fEc", + "0xef8D6dDE0a0f0CCdaDB678366a94D93f1C449689", + "0x2232455bf4622002c1416153EE59fd32B239863B", + "0xdCC5DC90A803928Dc21556590D4620030966270F", + "0x3b4DdC7888F752a96290344a1A926E73b80423c0", + "0xcAa74e50428bDC4Af6A7Ead65fFFf77F0D231E80", + "0x062F29e2b5bD99523DD3508207eb2C2CbAf98D50", + "0x7c2967C20B03a8004ea81e86Ac1847D00e7B4CD1", + "0x52cC5B5CB98C9a7fb8cCe7d4b4e8F41E26ce04a8", + "0x6B47afc8bf3b2e013b5e9178e8015Cc620983b51", + "0x011028aB93B355308E4350D109F42aeCfA075604", + "0x8a21Ea69300Fe56ee19fE974e9791a212114573F", + "0xa85F2DeBc911c54414f99103123965c94e351873", + "0x746c19A336A3131fD85D3AB5F16576b1b047F512", + "0x1973ef31F2A82B3f73b8C9Ee1c440615084d5242", + "0x6Fb45a8183660F30EA1c6cDFDDBFdC7ef7925801", + "0xfE1C64D42B7d6554Cc2ACD0D74e2983a2dE4A62f", + "0x8aD01c3a425987c508A69149185383BAf6F47534", + "0x453f61390ce6DfB668bbF4D93E58c94BB0ae81f3", + "0x1A1F0Db1050D1cAD52eEB72371EbFD7716b53a2f", + "0x718A66F21415a5f75F5e8652e8Be55FCF1D1df05", + "0x1910CCeCC57869F1Ff2337dda001246B92E8418A", + "0xB8Ce10759feb3B63B75557f5f9933bD22127f0eC", + "0x100Cd460D7f549B4cc2Ed35d4ff20ac71B377C96", + "0x2bC96f9e07Edc7F1aA9Aa26E85dc7dd30ACe59a6", + "0x2793AF2c7db9f0A06d2727Dd392Ab4Bb1b82a98D", + "0x00557e194B717dCfEbaE6222091C5F806DF99698", + "0x182fe51442C7D65360eD1511f30be6261c2C20C1", + "0xD019FD6267F93ebE5A92DEBB760135a4F02a75F7", + "0xf92129fE0923d766C2540796d4eA31Ff9FF65522", + "0x79149B500f0d796aA7f85e0170d16C7e79BAd3C5", + "0x92651E1bBfE0f8423119AfC4B0610C747Fa125a1", + "0x738CDf563C41aAF8aA350D0a3c24bF614FfD75dC", + "0x669fBdda8553edeAEdd7272391aC966a8AABEC21", + "0x797c35a8032CE0A8dFcA308ac1b2276359cd463b", + "0xD9E277eA320C53dE06C535f0D922A76a68CB9A9C", + "0x9B280aD674d35008482F94a673f8017B961C29F6", + "0x972F747285c2f32699CEFFEbdcF2Ae74F4b58D0c", + "0x935A64d0825D86c1ca57Fe8f270e635AC1a0878A", + "0xdD84190aF336Ee2831eea88B6783958e8F269de9", + "0xB708038C1b4cF9f91CcB918DAD1B9fD757ADa5C1", + "0x81F2F132465Ffb4B3C5d11f3d94582cC5c281c04", + "0x613f54c8836FD2C09B910869AC9d4de5e49Db1d8", + "0x0980C3171E32c4508f614ceC15A3819B6cCf372c", + "0xf659Fe930eEa70Bc49B6DD53d828CBaD12673a2a", + "0x642F04eCAa00D443fBf2de2AaC9A9e0ACfA4FCE7", + "0x0414BA5d3991a7B901d4e3f18b694a62414aC7Db", + "0x28F4cc9552F578B5C6e3a9204D6277cBa49a9416", "0x4E60495550071693bc8bDfFC40033d278157EAC7", "0x6387765fFA609aB9A1dA1B16C455548Bfed7CbEA", "0xfA09479d72E2b3f8B6dF63399772237Ad6658D76", @@ -258,15 +503,47 @@ const OPTIMISM_REGISTRY_TOKENS = [ "0x73cb180bf0521828d8849bc8CF2B920918e23032", "0x970D50d09F3a656b43E11B0D45241a84e3a6e011", "0x1DB2466d9F5e10D7090E7152B68d62703a2245F0", + "0xc40F949F8a4e094D1b49a23ea9241D289B7b2819", + "0xCB8FA9a76b8e203D8C3797bF438d8FB81Ea3326A", + "0xdFA46478F9e5EA86d57387849598dbFB2e964b02", "0x3c8B650257cFb5f272f799F5e2b4e65093a11a05", - "0x6806411765Af15Bddd26f8f544A34cC40cb9838B", + "0x4200000000000000000000000000000000000042", + "0x2e3d870790dc77a83dd1d18184acc7439a53f475", + "0xfdb794692724153d1488ccdbe0c56c252596735f", + "0x1e925De1c68ef83bD98eE3E130eF14a50309C01B", + "0xC03b43d492d904406db2d7D57e67C7e8234bA752", + "0x920cf626a271321c151d027030d5d08af699456b", "0x484c2D6e3cDd945a8B2DF735e079178C1036578c", + "0x6806411765Af15Bddd26f8f544A34cC40cb9838B", + "0x3E29D3A9316dAB217754d13b28646B76607c5f04", + "0x8aE125E8653821E851F12A49F7765db9a9ce7384", + "0x217D47011b23BB961eB6D93cA9945B7501a5BB11", "0x9485aca5bbBE1667AD97c7fE7C4531a624C8b1ED", "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb", - "0x217D47011b23BB961eB6D93cA9945B7501a5BB11", "0x79af5dd14e855823fa3e9ecacdf001d99647d043", "0x9560e827aF36c94D2Ac33a39bCE1Fe78631088Db", "0x4e720dd3ac5cfe1e1fbde4935f386bb1c66f4642", + "0x29c431806E536Fb22ce2Edc8dd6e3C3A0d5689a8", + "0xDaA24E888432b5aa607105e256919Ddfc8b327E9", + "0xC3691c157D1B3A431B841230a7B11d5a373097e1", + "0xCC26A5246C6A04a85E997d6581C1b4f14363841a", + "0xeEeeb52E36c78b153caaB2761c369a50b066cDD5", + "0x59eC3043D7314B9650294Fd800149b53007f804E", + "0xbA65D50Cf4e6E739B2735338a964C3354fAF9B19", + "0x6fd9d7ad17242c41f7131d257212c54a0e816691", + "0x76fb31fb4af56892a25e32cfc43de717950c9278", + "0x8700daec35af8ff88c16bdf0418774cb3d7599b4", + "0x23ee2343b892b1bb63503a4fabc840e0e2c6810f", + "0x350a791bfc2c21f9ed5d10980dad2e2638ffa7f6", + "0xdc6ff44d5d932cbd77b52e5612ba0529dc6226f1", + "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8", + "0xc45A479877e1e9Dfe9FcD4056c699575a1045dAA", + "0x078f358208685046a11C85e8ad32895DED33A249", + "0x38d693cE1dF5AaDF7bC62595A37D667aD57922e5", + "0x6ab707Aca953eDAeFBc4fD23bA73294241490620", + "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE", + "0x4186BFC76E2E237523CBC30FD220FE055156b41F", + "0x346e03F8Cce9fE01dCB3d0Da3e9D00dC2c0E08f0", ]; const POLYGON_REGISTRY_TOKENS = [ @@ -280,13 +557,15 @@ const POLYGON_REGISTRY_TOKENS = [ "0x87ff96aba480f1813aF5c780387d8De7cf7D8261", "0x2088C47Fc0c78356c622F79dBa4CbE1cCfA84A91", "0xdAb529f40E671A1D4bF91361c21bf9f0C9712ab7", - "0x4e3Decbb3645551B8A19f0eA1678079FCB33fB4c", - "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", - "0x28424507fefb6f7f8E9D3860F56504E4e5f5f390", - "0x20D3922b4a1A8560E1aC99FBA4faDe0c849e2142", - "0x1d2a0E5EC8E5bBDCA5CB219e649B565d8e5c3360", + "0xDBf31dF14B66535aF65AaC99C32e9eA844e14501", + "0xD6DF932A45C0f255f85145f286eA0b292B21C90B", + "0xa3FC7E0021970f5AF674aD837a8dc09e2F12F37B", "0x7D645CBbCAdE2A130bF1bf0528b8541d32D3f8Cf", "0x2e1AD108fF1D8C782fcBbB89AAd783aC49586756", + "0x20D3922b4a1A8560E1aC99FBA4faDe0c849e2142", + "0x4e3Decbb3645551B8A19f0eA1678079FCB33fB4c", + "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + "0xf8a57c1d3b9629b77b6726a042ca48990A84Fb49", "0x45c32fA6DF82ead1e2EF74d17b76547EDdFaFF89", "0xA691D34Abf93C0A77998e53B564bEcfaf46Dae27", "0xaA91CDD7abb47F821Cf07a2d38Cc8668DEAf1bdc", @@ -298,17 +577,16 @@ const POLYGON_REGISTRY_TOKENS = [ "0xE111178A87A3BFf0c8d18DECBa5798827539Ae99", "0xa3Fa99A148fA48D14Ed51d610c367C61876997F1", "0x750e4C4984a9e0f12978eA6742Bc1c5D248f40ed", - "0x60D55F02A771d515e077c9C2403a1ef324885CeC", "0xb5DFABd7fF7F83BAB83995E72A52B97ABb7bcf63", "0x361a5a4993493ce00f61c32d4ecca5512b82ce90", "0x2C2D8a078B33bf7782a16AcCE2C5BA6653a90D5f", "0x172370d5Cd63279eFa6d502DAB29171933a610AF", "0xdAD97F7713Ae9437fa9249920eC8507e5FbB23d3", "0x8096ac61db23291252574D49f036f0f9ed8ab390", - "0x447646e84498552e62eCF097Cc305eaBFFF09308", "0xA73EdCf18421B56D9AF1cE08A34E102E23b2C4B6", "0x3A58a54C066FdC0f2D55FC9C89F0415C92eBf3C4", "0x600743B1d8A96438bD46836fD34977a00293f6Aa", + "0x447646e84498552e62eCF097Cc305eaBFFF09308", "0xa138341185a9D0429B0021A11FB717B225e13e1F", "0xb0658482b405496C4EE9453cD0a463b134aEf9d0", "0xb61Ecec987a9529dbA13a8Dd10ea24446ccBB6ae", @@ -324,32 +602,113 @@ const POLYGON_REGISTRY_TOKENS = [ "0xa7de0D88D02B9589d3b02cE52174431275169b77", "0x40379a439D4F6795B6fc9aa5687dB461677A2dBa", "0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265", + "0x97B2632DB51967b2AedF4c50FfC3a9D965940bEd", + "0x5A0801BAd20B6c62d86C566ca90688A6b9ea1d3f", + "0x1C480521100c962F7da106839a5A504B5A7457a1", + "0x108c7a293162Adff86DA216AB5F91e56723125dc", + "0x4C98CB046c3eb7e3ae7Eb49a33D6f3386Ec2b9D9", + "0x2520D50bfD793D3C757900D81229422F70171969", + "0x2F4BBA9fC4F77F16829F84181eB7C8b50F639F95", + "0x06b73b12421C667A07877B0740bA299e1de73B15", + "0xa0FdCDDA62C4C6a0109A702a7Efe59B4E8807e3f", + "0x108a7474461dC3059E4a6f9F8c7C8612056195A7", + "0xc65E5b6084FAd2F20e289b0d4e64F450cf386E6c", + "0xf0695B22d8F416FEC35E02668aE01B9EEAF96a0D", + "0xAA7C2879DaF8034722A0977f13c343aF0883E92e", + "0x01a8F2E5BfB8679C82442F90e1166469a2E530c8", + "0xB476B7A027da3D9fB5A5c9CB6078A34f7289B476", + "0x67Ecbe3a67624c80356386413E068bfFc03ad228", + "0xeD2905F595B6Ba103d8dF047Aa6dA3708FE6548b", + "0x1A723371f9dc30653dafd826B60d9335bf867E35", + "0x23c65213458A2dcc1321f84Ab42dCaECD79C2215", + "0x4BDA6C4d2f53B2Cd7F7FAc9287902a9928002e7B", + "0x944A5C12cD4399ABC6883fF1ba40A14c23B2Fd37", + "0xb87e2D83DB70599B14818C931DE0A656bf620e77", + "0x449533BcF3Fc5963515f87c17CDfE762b7Ab89fb", + "0x6F79CA179FE1cD131574a08B96e92744B6649128", + "0x99AB491471FBcB7D9d2b69729462fe223a4cCdab", + "0x2eac840950F1FF53d03A55A0255ea787fE84a4b5", + "0xe7B6CB2BfaB7C886CAA97fd3f181bBDad664A19B", + "0x3eEcd5FeD0900451A95537De7F3543cA4Ed926a7", + "0x2FbE43adaf91EE9A6B8252A017297007Acf696a3", + "0x346c16e7a76D224b9955c0F67e93b413Fc63ba3E", + "0x81cec323bf8c4164c66ec066f53cc053a535f03d", + "0x1d34Db65C4fe0f6A73194DBDC4a44ae05B46e6c5", "0x04d521e2c414e6d898c6f2599fdd863edf49e247", + "0x8AAc0f2a6cAE626b656Ca16c58A50C87CBBC7ff5", "0xcdedc76bcc6351275acdef823190453ec43b4edf", "0x184a51465925ab8a0025e47a00cab6d3769b5487", + "0x964eA598DF006F692105A951a774ff9825a454Fe", + "0x4ec61a96738564CaD591841df0c8B5b6eA785E4C", "0x3f35705479d9d77c619b2aac9dd7a64e57151506", + "0x4252Da0559960a50FDd50D5bDDe1B78659B7Ea2A", "0x98b6a5eedc9382e2c4f8a38f985f2e9ac0b0e84c", + "0x3325a25A2608EA723cB5D72E27af65AACFfb810e", "0xb4d852b92148eaa16467295975167e640e1fe57a", "0x02203f2351E7aC6aB5051205172D3f772db7D814", + "0xb759b56d82C88806bbcBcD60767E39Af5cc51F32", "0xBD02973b441Aa83c8EecEA158b98B5984bb1036E", + "0x2C6d11e756986f1537a2c71c851e9a1F7A0008b2", + "0xD74B5df80347cE9c81b91864DF6a50FfAfE44aa5", + "0x5268F5F2a9799f747A55f193d2E266c77653E518", "0xd17cb0f162f133e339c0bbfc18c36c357e681d6b", "0xe058e1ffff9b13d3fcd4803fdb55d1cc2fe07ddc", "0x8711a1a52c34EDe8E61eF40496ab2618a8F6EA4B", + "0x67FEe70c32097c53B5aeAaCdbee7544eaE2194f8", "0xbe4e30b74b558e41f5837dc86562df44af57a013", + "0x0fC4f2DB534Bf7525710DBf64B7081e1a3A6428f", "0xfa68fb4628dff1028cfec22b4162fccd0d45efb6", + "0x40c03Cd0B5D1571608D09e6279B4C63660e431F1", "0x2ee50c34392e7e7a1d17b0a42328a8d1ad6894e3", "0x1205f31718499dbf1fca446663b532ef87481fe1", "0xb95E1C22dd965FafE926b2A793e9D6757b6613F4", "0x29e38769f23701a2e4a8ef0492e19da4604be62c", "0x3f69055f203861abfd5d986dc81a2efa7c915b0c", + "0xbfe9584228BBcB21EAA64a878c28c5cBFd0F6304", "0x74c64d1976157e7aaeeed46ef04705f4424b27ec", "0x3cc20a6795c4b57d9817399f68e83e71c8626580", "0xe7806b5ba13d4b2ab3eab3061cb31d4a4f3390aa", + "0xD97FA4474084350D2c96285E1Fca07A9D515c800", "0x513cdee00251f39de280d9e5f771a6eafebcc88e", + "0xAb4E02911A7d09BC8300F39332F087d51c183038", "0xa7565dfeb16010153d3368e002ec53cbfaf96e05", + "0x8D0663d2d738e6078Bb77589dE4231eD9fcFd014", + "0xf0ad209e2e969eaaa8c882aac71f02d8a047d5c2", + "0xec74671f95F0942358016da627b912143100DAF2", "0x2589469b7a72802ce02484f053cb6df869eb2689", + "0xFe2f5e215C0Fe9b5D4fF99cA7cBB5F5a77f5C515", "0xE193C653B6030a9BB443AE7c6Ef6e35d93348f98", "0xFbdd194376de19a88118e84E279b977f165d01b8", + "0x9dc8Ee4264923D44F2a33Ea139FC4143C288b172", + "0x1057a796C66ca87EC1e6494f5486006396756083", + "0x350c331F4e5fD9d5D703424F3F14CcC0280B6629", + "0xf742B69Bd460F14EB5d8335e06954eba694B552E", + "0xc44F1103A271BEFF26bB245D760bFbe182CCf121", + "0x195888B86db69C52b54362DB2D71c2d3e411A0bA", + "0x22301937028310Cef6530eF3C3Bfe14581eb679F", + "0x90F06727Ba5016eDcf9D8B5def63a5849EcD132f", + "0xb33eaad8d922b1083446dc23f610c2567fb5180f", + "0x53e0bca35ec356bd5dddfebbd1fc0fd03fabad39", + "0x61299774020da444af134c82fa83e3810b309991", + "0x5fe2b58c013d7601147dcdd68c143a77499f5531", + "0xbbba073c31bf03b8acf7c28ef0738decf3695683", + "0xc3c7d422809852031b44ab29eec9f1eff2a58756", + "0x50b728d8d964fd00c2d0aad81718b71311fef68a", + "0x6e4e624106cb12e168e6533f8ec7c82263358940", + "0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97", + "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8", + "0xf59036CAEBeA7dC4b86638DFA2E3C97dA9FcCd40", + "0x078f358208685046a11C85e8ad32895DED33A249", + "0xA4D94019934D8333Ef880ABFFbF2FDd611C762BD", + "0x6ab707Aca953eDAeFBc4fD23bA73294241490620", + "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE", + "0x8dF3aad3a84da6b69A4DA8aeC3eA40d9091B2Ac4", + "0x28424507fefb6f7f8E9D3860F56504E4e5f5f390", + "0x5c2ed810328349100A66B82b78a1791B101C9D61", + "0x1a13F4Ca1d028320A707D99520AbFefca3998b7F", + "0x60D55F02A771d515e077c9C2403a1ef324885CeC", + "0x27F8D03b3a2196956ED754baDc28D73be8830A6e", + "0x03b54A6e9a984069379fae1a4fC4dBAE93B3bCCD", ]; const AVALANCHE_REGISTRY_TOKENS = [ @@ -358,7 +717,9 @@ const AVALANCHE_REGISTRY_TOKENS = [ "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664", "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7", "0xc7198437980c041c805A1EDcbA50c1Ce5db95118", + "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70", "0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB", + "0x50b7545627a5162F82A992c33b87aDc75187B218", "0x152b9d0FdC40C096757F570A51E494bd4b943E50", "0x111111111111ed1D73f860F57b2798b683f2d325", "0x130966628846BFd36ff31a822705796e8cb8C18D", @@ -367,22 +728,58 @@ const AVALANCHE_REGISTRY_TOKENS = [ "0x5c49b268c9841AFF1Cc3B0a418ff5c3442eE3F3b", "0xb599c3590F42f8F995ECfa0f85D2980B76862fc1", "0xF14f4CE569cB3679E99d5059909E23B07bd2F387", + "0x1337BedC9D22ecbe766dF105c9623922A27963EC", + "0x0974D9d3bc463Fa17497aAFc3a87535553298FbE", + "0x1da20Ac34187b2d9c74F729B85acB225D3341b25", + "0x6BF6fc7EaF84174bb7e1610Efd865f0eBD2AA96D", + "0xD79138c49c49200a1Afc935171D1bDAd084FDc95", + "0xb0D2EB3C2cA3c6916FAb8DCbf9d9c165649231AE", "0xAEA2E71b631fA93683BCF256A8689dFa0e094fcD", "0x6a4aC4DE3bF6bCD2975E2cb15A46954D9bA43fDb", "0x943F3B750447AbDd61cdF68AE6c3912cd3bedA04", "0xd39016475200ab8957e9C772C949Ef54bDA69111", + "0x79F26046D122d2F26B1D37237D5C056fB580447A", + "0x7E5bC7088aB3Da3e7fa1Aa7ceF1dC73F5B00681c", "0x1205f31718499dBf1fCa446663B532Ef87481fe1", "0xf4003F4efBE8691B60249E6afbD307aBE7758adb", + "0xe1a8EeA58D63Ea64d00365531D266C2AD1f62FC4", "0x1dab6560494b04473a0be3e7d83cf3fdf3a51828", + "0x22EafB9C7E2858cfDA712940896464DdAA83d053", "0xae64d55a6f09e4263421737397d1fdfa71896a69", + "0x68866acc5C940938B373F55F7009f824c7662F5B", "0xFE15c2695F1F920da45C30AAE47d11dE51007AF9", + "0xf3340EdF16563D52C7E7C576F2fCC8f3D52464aB", "0x0e0100ab771e9288e0aa97e11557e6654c3a9665", + "0x595786A3848B1de66C6056C87BA91977935fBC46", "0x32833a12ed3fd5120429fb01564c98ce3c60fc1d", + "0xA27BF4d56870A37e37a687B8ab3740d8487Ee2C6", "0x29e38769f23701A2e4A8Ef0492e19dA4604Be62c", + "0xFeA7976733f47557860f4483f2147a3e99C76b58", + "0x3D81A269E05e6057e4dF9E2D76E254E65a65Eb66", "0x454E67025631C065d3cFAD6d71E6892f74487a15", + "0x282B11E65f0B49363D4505F91c7A44fBEe6bCc0b", "0x6e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd", + "0x3C2131A02659343d68c211aAa686750bE37d88c4", + "0x813aB5B3FDc59B143C42284665864b24B794C324", "0xd6070ae98b8069de6b494332d1a1a81b6179d960", "0x47536f17f4ff30e64a96a7555826b8f9e66ec468", + "0x5947bb275c521040051d82396192181b413227a3", + "0x8ebaf22b6f053dffeaf46f4dd9efa95d89ba8580", + "0x8a0cac13c7da965a312f08ea4229c37869e85cb9", + "0x63a72806098bd3d9520cc43356dd78afe5d386d9", + "0xbec243c995409e6520d7c41e404da5deba4b209b", + "0x44c784266cf024a60e8acf2427b9857ace194c5d", + "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8", + "0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97", + "0x8ffDf2DE812095b1D19CB146E4c004587C0A0692", + "0x625E7708f30cA75bfd92586e17077590C60eb4cD", + "0x6ab707Aca953eDAeFBc4fD23bA73294241490620", + "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE", + "0x53f7c5869a859F0AeC3D334ee8B4Cf01E3492f21", + "0xDFE521292EcE2A4f44242efBcD66Bc594CA9714B", + "0x46A51127C3ce23fb7AB1DE06226147F446e4a857", + "0x532E6537FEA298397212F09A61e03311686f548e", + "0x47AFa96Cdc9fAb46904A55a6ad4bf6660B53c38a", ]; const BNB_REGISTRY_TOKENS = [ @@ -393,8 +790,106 @@ const BNB_REGISTRY_TOKENS = [ "0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c", "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3", + "0x31e77776b924Cd5f0E624771C9B3d2bD6B9c919E", + "0x577d005912C49B1679B4c21E334FdB650E92C077", + "0x4a9945B75E5c860f511CD223E838b213828a0583", "0x0827841963Cc8a0515b5baa59782b0a0870b5f88", + "0x684d86518e6E7d622d24854cBb1C179d6C0E3f75", "0x483653bcF3a10d9a1c334CE16a19471a614F4385", + "0x62ef49280c0f155afd374fC5Efd1F06318648700", + "0x5dc30Bb8D7F02eFEf28f7E637D17Aea13Fa96906", + "0x1542885D6EeD4EE3AC1a110d3f159003a0774101", + "0x804678fa97d91B974ec2af3c843270886528a9E6", + "0x68c39886eA459b4a59758F1e94c3d20C93d47133", + "0x0FB881c078434b1C0E4d0B64d8c64d12078b7Ce2", + "0x2ea77B1d17C9e2a99a2C019abC8eA2f6A59A1044", + "0x63b30de1A998e9E64FD58A21F68D323B9BcD8F85", + "0x6eb020663898c72F8E25958F5f7bcDC732279201", + "0x66FDB2eCCfB58cF098eaa419e5EfDe841368e489", + "0xa4113209bD56f534A24CADc3E3778B5D4B806180", + "0xa987f0b7098585c735cD943ee07544a84e923d1D", + "0xC341DFb9B634a3aD1AEF70B490eA92CACcddf805", + "0x93B32a8dfE10e9196403dd111974E325219aec24", + "0xe47E724c0b4EE9fbC16097AC103b97dc6642fd18", + "0x153dC2eBcB551799b13D4E6Ff84fC34C7AEDf241", + "0x9A10Cc2024744681fBce1F93Aeee3fd7863B1A12", + "0xC7e9d76ba11099AF3F330ff829c5F442d571e057", + "0xD411121C948Cff739857513E1ADF25ED448623f8", + "0x90C97F71E18723b0Cf0dfa30ee176Ab653E89F40", + "0x3F56e0c36d275367b8C502090EDF38289b3dEa0d", + "0x51bd63F240fB13870550423D208452cA87c44444", + "0xbCFcE18C5c33463316f93A067b1f50d75b00dc09", + "0x10bf6e7B28b1cfFb1c047D7F815953931e5Ee947", + "0x56ec6031dC969CfA035F6D65e65D8595d5660fB4", + "0x5c73804FeDd39f3388E03F4aa1fE06a1C0e60c8e", + "0x77c9a64C88Ad5e5467B53E20E66AD2F8800BBf3d", + "0x2ecBD508c00Bbc8aA0cdc9100bf3956fCabE7677", + "0xC34Ae91312A3c3F9420691922040a5DEe1698E52", + "0xa8Bb71facdd46445644C277F9499Dd22f6F0A30C", + "0xeDe45f9dC994a66F1aD1ac68974Abb28086f909d", + "0x6321B57b6fdc14924be480c54e93294617E672aB", + "0xc1fcf50ccaCd1583BD9d3b41657056878C94e592", + "0x9cb73F20164e399958261c289Eb5F9846f4D1404", + "0xb26642B6690E4c4c9A6dAd6115ac149c700C7dfE", + "0x0eD7e52944161450477ee417DE9Cd3a859b14fD0", + "0x33D0F945F77660F4A9e56949500265313f6D08fb", + "0x86b481fCe116DCd01fBeBb963f1358bcc466668C", + "0x164fb78cAf2730eFD63380c2a645c32eBa1C52bc", + "0xDA8ceb724A06819c0A5cDb4304ea0cB27F8304cF", + "0x0383E88A19E5c387FeBafbF51E5bA642d2ad8bE0", + "0x9aA83081AA06AF7208Dcc7A4cB72C94d057D2cda", + "0xf2064C230b285AA6Cf45c6267DA86a8E3505D0AA", + "0xAA20E8Cb61299df2357561C2AC2e1172bC68bc25", + "0x960eE6caC56912D94cE5c83D7Fb0CD873b5c5099", + "0xD3C480EC7a47596fF8D63396227d1F7dC728A7f0", + "0xe0Af98A11DB57c7282c1f6066d116E13F02BF0E9", + "0xF7369B1D005F2cbB1887233B5aa0CB0B39fB9891", + "0x72fC82b9955f04b20166b0Da7e1af4f893F6316a", + "0x5c15842fCC12313C4f94dFB6fad1Af3f989D33e9", + "0xf867cD98F3762D899F5F26FF5Dd62A5C566A3E0C", + "0x1B6E11c5DB9B15DE87714eA9934a6c52371CfEA9", + "0x9B429B6bb5aBfD97869d6D302676a3885e9b0B2b", + "0x8A420aACA0c92e3f97CDcFdd852e01Ac5b609452", + "0x836C6BffB0B08aCa20b9380330D2532A51aA0eAD", + "0x3ec1FFd5dc29190588608Ae9Fd4f93750e84CDA2", + "0xe2AD2c5702f6c9073f85b00E4743066E1D1035f8", + "0x8840C6252e2e86e545deFb6da98B2a0E26d8C1BA", + "0xEeB87e7bAbF17cA97F0Eb897F24Bf475e0A9Aef7", + "0x6216E04cd40DB2c6FBEd64f1B5830A98D3A91740", + "0x220711F15D09bdDFD1f0ba0dfC905074Ea204C4E", + "0x98a5737749490856b401DB5Dc27F522fC314A4e1", + "0x93DB73f79D4fdc5be42C0bd2812e94A271aDC7e2", + "0x854805dc490271B362cc758D94b69eed157070A5", + "0x8860922Eb2795aB0D57363653Dd7EBf18D7c0A42", + "0xB78b6A0137ad8745784D3B23c16abeA8F527ff54", + "0x754Fd74e22255780a58F125300008781D8318e3A", + "0x49ad051F4263517BD7204f75123b7C11aF9Fd31C", + "0x5D83D13Fa899451b75f7c465C0A2590Bb3f9067f", + "0xac109C8025F272414fd9e2faA805a583708A017f", + "0x3b3bc8AE6dcAcCeaaC3C19E196ebD3341Cfe9c4e", + "0xCa3F508B8e4Dd382eE878A314789373D80A5190A", + "0xbf5140a22578168fd562dccf235e5d43a02ce9b1", + "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82", + "0x64048a7eecf3a2f1ba9e144aac3d7db6e58f555e", + "0x90c97f71e18723b0cf0dfa30ee176ab653e89f40", + "0x3EE2200Efb3400fAbB9AacF31297cBdD1d435D47", + "0x1d2f0da169ceb9fc7b3144628db156f3f6c60dbe", + "0x0782b6d8c4551B9760e74c0545a9bCD90bdc41E5", + "0x76a797a59ba2c17726896976b7b3747bfd1d220f", + "0xf8a0bf9cf54bb92f17374d9e9a321e6a111a51bd", + "0x0eb3a705fc54725037cc9e008bdede697f62f335", + "0xa2b726b1145a4773f68593cf171187d8ebe4d495", + "0x031b41e504677879370e9dbcf937283a8691fa7f", + "0x62d0a8458ed7719fdaf978fe5929c6d342b0bfce", + "0xfb5b838b6cfeedc2873ab27866079ac55363d37e", + "0xfb6115445bff7b52feb98650c87f44907e58f802", + "0x715d400f88c167884bbcc41c5fea407ed4d2f8a0", + "0x2E94171493fAbE316b6205f1585779C887771E2F", + "0x56a7ddc4e848EbF43845854205ad71D5D5F72d3D", + "0x9B00a09492a626678E5A3009982191586C444Df9", + "0x00901a076785e0906d1028c7d6372d247bec7d61", + "0xa9251ca9DE909CB71783723713B21E4233fbf1B1", + "0x2416092f143378750bb29b79eD961ab195CcEea5", ]; const BASE_REGISTRY_TOKENS = [ @@ -408,11 +903,27 @@ const BASE_REGISTRY_TOKENS = [ "0x236aa50979D5f3De3Bd1Eeb40E81137F22ab794b", "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb", "0xd07379a755A8f11B57610154861D694b2A0f615a", + "0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22", "0xB6fe221Fe9EeF5aBa221c348bA20A1Bf5e73624c", "0x9EaF8C1E34F05a589EDa6BAfdF391Cf6Ad3CB239", "0xf6C5F01C7F3148891ad0e19DF78743D31E390D1f", "0x6e53131F68a034873b6bFA15502aF094Ef0c5854", "0x6DfE79cecE4f64c1a34F48cF5802492aB595257E", + "0xbE3F14312B08E9c6AEe6AeB27B37c08B661A7F83", + "0x5A47993216fa6ACaf93418f9830cee485e82d0ba", + "0xd0c3E7f86338403Df99DEa1996f6C9Ed8f9D3d07", + "0xB614A6E6c21202De79DceB95AE2dd4817DD7e14b", + "0xB62F13126fCD0dD49dE8fF811406554197Bd0E11", + "0x507094549509Efdf63ecA34B795094065cB04008", + "0x8bd6dF821513aECDbbaa29C1d5212b43fdCe7819", + "0x98bEAa72230788572e3e3Be58D91C232dda315d4", + "0x74251C0d0B74Fba6e3B3EDe8533D9Da82B4EC4a4", + "0xc005B9833deBcF5fe6cc5bC9ba4fD74Bb382ae55", + "0xC3a5b142a144135D900FC5Ef2Bb7E92a3bcB46F1", + "0x09139A80454609B69700836a9eE12Db4b5DBB15f", + "0x4Fc0E7cDfe0CF92762eaf3CEE9133239A2197391", + "0x06a613d3a056d4b04D7523C11d82c67Bebf9d850", + "0xFB6864F1c14A90E85398B853701B01ef6a0CA3E5", "0xf213F2D02837012dC0236cC105061e121bB03e37", "0x0B25c51637c43decd6CC1C1e3da4518D54ddb528", "0x44Ecc644449fC3a9858d2007CaA8CFAa4C561f91", @@ -428,6 +939,36 @@ const BASE_REGISTRY_TOKENS = [ "0x27a8Afa3Bd49406e48a074350fB7b2020c43B2bD", "0x82a0c1a0d4EF0c0cA3cFDA3AD1AA78309Cc6139b", "0x5BfB340FA9305abB164Fb0248D0D82FC3D82C3bb", + "0x3b9860321f03AFe02D3FF9e4Fdd4017DC6F4d7Ca", + "0x1f0dbEcDA414F401dB46464864273CaD19368706", + "0x3E07F263C1Ce5EC2a3f1cA87af56B80B27674D96", + "0xb0ffa8000886e57f86dd5264b9582b2ad87b2b91", + "0x23ee2343b892b1bb63503a4fabc840e0e2c6810f", + "0x940181a94a35a4569e4529a3cdfb74e38fd98631", + "0xD4a0e0b9149BCee3C920d2E00b5dE09138fd8bb7", + "0x99CBC45ea5bb7eF3a5BC08FB1B7E56bB2442Ef0D", + "0x4e65fE4DbA92790696d040ac24Aa414708F5c0AB", + "0x2416092f143378750bb29b79eD961ab195CcEea5", + "0x1Bc71130A0e39942a7658878169764Bbd8A45993", + "0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452", +]; + +const BLAST_REGISTRY_TOKENS = [ + "0x4300000000000000000000000000000000000004", + "0x4300000000000000000000000000000000000003", + "0xF7bc58b8D8f97ADC129cfC4c9f45Ce3C0E1D2692", + "0x9D020B1697035d9d54f115194c9e04a1e4Eb9aF7", + "0x96F6b70f8786646E0FF55813621eF4c03823139C", + "0x5ffd9ebd27f2fcab044c0f0a26a45cb62fa29c06", + "0xa4c7aa67189ec5623121c6c94ec757dfed932d4b", + "0x764933fbAd8f5D04Ccd088602096655c2ED9879F", + "0x9e20461bc2c4c980f62f1B279D71734207a6A356", + "0x837fe561e9c5dfa73f607fda679295dbc2be5e40", + "0xb9dfCd4CF589bB8090569cb52FaC1b88Dbe4981F", + "0x42e12d42b3d6c4a74a88a61063856756ea2db357", + "0x76da31d7c9cbeae102aff34d3398bc450c8374c1", + "0x47c337bd5b9344a6f3d6f58c474d9d8cd419d8ca", + "0x216a5a1135a9dab49fa9ad865e0f22fe22b5630a", ]; const registryTokensByChain = { @@ -438,6 +979,7 @@ const registryTokensByChain = { avax: AVALANCHE_REGISTRY_TOKENS, bsc: BNB_REGISTRY_TOKENS, base: BASE_REGISTRY_TOKENS, + blast: BLAST_REGISTRY_TOKENS, }; module.exports = registryTokensByChain; diff --git a/projects/hinkal/relayerUrls.js b/projects/hinkal/relayerUrls.js index 5dd2bddf5aac..e7ca0abf1ad0 100644 --- a/projects/hinkal/relayerUrls.js +++ b/projects/hinkal/relayerUrls.js @@ -6,6 +6,7 @@ const RELAYER_URLS = { avax: "https://avalanche.relayer.hinkal.pro", bsc: "https://bnbMainnet.relayer.hinkal.pro", base: "https://base.relayer.hinkal.pro", + blast: "https://blast.relayer.hinkal.pro", }; module.exports = RELAYER_URLS; From d52fa77e3ce418e7ae6155e9d3072915d3ac68f8 Mon Sep 17 00:00:00 2001 From: TsimakuridzeNikolozi Date: Fri, 31 May 2024 17:07:03 +0400 Subject: [PATCH 150/855] Commented out blast temporarily --- projects/hinkal/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/hinkal/index.js b/projects/hinkal/index.js index 19bf0c387f74..787c12e4a4b4 100644 --- a/projects/hinkal/index.js +++ b/projects/hinkal/index.js @@ -37,7 +37,7 @@ module.exports = { bsc: { tvl, }, - blast: { - tvl, - }, + // blast: { + // tvl, + // }, }; From 26dc0ecd5d16af9eeb5dfdb92fdda00973cf6e6d Mon Sep 17 00:00:00 2001 From: Tomwhh <30361751+Tomwhh@users.noreply.github.com> Date: Fri, 31 May 2024 14:25:55 +0100 Subject: [PATCH 151/855] Tracking TVL for 21co Tokens on Solana (#10449) * Tracking TVL for 21co Tokens on Solana * track new bitcoin wallet --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/21-co/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/21-co/index.js b/projects/21-co/index.js index 7dcd5740a2b1..1d5299a08af7 100644 --- a/projects/21-co/index.js +++ b/projects/21-co/index.js @@ -3,7 +3,8 @@ const { cexExports } = require('../helper/cex') const config = { bitcoin: { owners: [ - '1HTGi4tfXSEtcXD4pk6S3vBs3s64hWY1pW' + '1HTGi4tfXSEtcXD4pk6S3vBs3s64hWY1pW', + '12WZhMFFLHQ4rCMSkeBfbJXRk7aGWyBh1M', ], }, solana: { From 8ed787b7f171f1b7f26dbca65725b0e9f2632429 Mon Sep 17 00:00:00 2001 From: bleenCN <132842163+bleenCN@users.noreply.github.com> Date: Fri, 31 May 2024 21:26:17 +0800 Subject: [PATCH 152/855] update program address (#10450) nx-finance will be launched on June 3, 2024. Updated the program address of nx-finance for production environment --- projects/nxfinance/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/nxfinance/index.js b/projects/nxfinance/index.js index 77ae92d158b0..98400c018acd 100644 --- a/projects/nxfinance/index.js +++ b/projects/nxfinance/index.js @@ -2,7 +2,7 @@ const { Program } = require("@project-serum/anchor"); const { getProvider, } = require("../helper/solana"); const nxIdl = require("./nx-idl.json"); -const NX_PROGRAM_ADDR = "JMpxnop5u1HJAqjzpZHo7MmvfBQf5YkFw4nGK9F83x3"; +const NX_PROGRAM_ADDR = "EHBN9YKtMmrZhj8JZqyBQRGqyyeHw5xUB1Q5eAHszuMt"; async function tvl(api) { const provider = getProvider(); From 300a5f5ef889f2a6745ad9e33c6ff50f0a5e42ff Mon Sep 17 00:00:00 2001 From: TsimakuridzeNikolozi Date: Fri, 31 May 2024 17:33:54 +0400 Subject: [PATCH 153/855] Added blast back in --- projects/hinkal/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/hinkal/index.js b/projects/hinkal/index.js index 787c12e4a4b4..19bf0c387f74 100644 --- a/projects/hinkal/index.js +++ b/projects/hinkal/index.js @@ -37,7 +37,7 @@ module.exports = { bsc: { tvl, }, - // blast: { - // tvl, - // }, + blast: { + tvl, + }, }; From c1afa23c0432e2761084794064c46db6d46ebef7 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Fri, 31 May 2024 15:09:22 +0100 Subject: [PATCH 154/855] immutablezkevm --- projects/immutable-zkevm/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/immutable-zkevm/index.js diff --git a/projects/immutable-zkevm/index.js b/projects/immutable-zkevm/index.js new file mode 100644 index 000000000000..7ef8cdc2176d --- /dev/null +++ b/projects/immutable-zkevm/index.js @@ -0,0 +1,12 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +module.exports = { + ethereum: { + tvl: async ({ api }) => + sumTokens2({ + api, + owner: "0xBa5E35E26Ae59c7aea6F029B68c6460De2d13eB6", + fetchCoValentTokens: true, + }), + }, +}; From 01c7e2769f66d3959e4bb8d7ca5496828de77dfd Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Fri, 31 May 2024 15:10:09 +0100 Subject: [PATCH 155/855] AEVO treasury (#10457) --- projects/treasury/ribbon.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/treasury/ribbon.js b/projects/treasury/ribbon.js index 899bc9c364f4..752a9b3d0583 100644 --- a/projects/treasury/ribbon.js +++ b/projects/treasury/ribbon.js @@ -6,6 +6,7 @@ const treasury = "0xDAEada3d210D2f45874724BeEa03C7d4BBD41674"; const treasury2 = "0x42c1357aaa3243ea30c713cdfed115d09f10a71d" const treasury3 = "0x6adeb4fddb63f08e03d6f5b9f653be8b65341b35" const RBN = "0x6123B0049F904d730dB3C36a31167D9d4121fA6B"; +const AEVO = "0xb528edbef013aff855ac3c50b381f253af13b997" module.exports = treasuryExports({ ethereum: { @@ -31,6 +32,7 @@ module.exports = treasuryExports({ ownTokens: [ RBN, "0xd590931466cdD6d488A25da1E89dD0539723800c", // 50RBN-50USDC + AEVO ], }, }); From 54765ed2f34ac0dc76c769af41b048eb84512ee7 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 31 May 2024 18:09:46 +0100 Subject: [PATCH 156/855] add new multisig --- projects/treasury/unore.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/treasury/unore.js b/projects/treasury/unore.js index b7cd8bbc6ca8..d12966f9d2c0 100644 --- a/projects/treasury/unore.js +++ b/projects/treasury/unore.js @@ -1,6 +1,7 @@ const ADDRESSES = require("../helper/coreAssets.json"); const { treasuryExports, nullAddress } = require("../helper/treasury"); -const multisig='0x46488d2D36D8983de980Ff3b9f046DCd0a9DC2ae' +const multisig='0x46488d2D36D8983de980Ff3b9f046DCd0a9DC2ae'; +const multisig2='0x4aede441085398BD74FeB9eeFCfe08E709e69ABF' const UNO = "0x474021845c4643113458ea4414bdb7fb74a01a77"; @@ -13,7 +14,7 @@ module.exports = treasuryExports({ ADDRESSES.ethereum.WETH,//WETH ADDRESSES.ethereum.USDT,//USDT ], - owners: [multisig], + owners: [multisig,multisig2], ownTokens: [UNO], }, }); From 626d1eec394404851a40eb7839ab5fd0d09f81dd Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Sat, 1 Jun 2024 02:02:17 +0100 Subject: [PATCH 157/855] add core chain tokens --- projects/helper/tokenMapping.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index db6c3724fc5b..847f6e76b675 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -130,6 +130,10 @@ const fixBalancesTokens = { }, sei: { '0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1': { coingeckoId: 'usd-coin', decimals: 6 }, + }, + core: { + '0x5832f53d147b3d6cd4578b9cbd62425c7ea9d0bd': { coingeckoId: 'wrapped-bitcoin', decimals: 8 }, + '0x5B1Fb849f1F76217246B8AAAC053b5C7b15b7dc3': { coingeckoId: 'solv-btc', decimals: 18 }, } } From 9d944a80ba337958b47c0c0a9afad491e7352c57 Mon Sep 17 00:00:00 2001 From: aster <39130640+aster2709@users.noreply.github.com> Date: Sun, 2 Jun 2024 13:08:35 +0530 Subject: [PATCH 158/855] feat(nftperp): ordinals tvl (#10461) --- projects/nftperp/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/projects/nftperp/index.js b/projects/nftperp/index.js index 78cac076fafb..21642440bd85 100644 --- a/projects/nftperp/index.js +++ b/projects/nftperp/index.js @@ -19,6 +19,16 @@ module.exports = { [ADDRESSES.blast.WETH, "0xFfc0555EC5F5C44A6B529Cef94b9055799696272"], // Insurance fund [ADDRESSES.blast.WETH, "0xe2F4A2845D4183F7913EC66945b20E4c0c15DAFf"], + // DEX Ordinals + [ + "0xF7bc58b8D8f97ADC129cfC4c9f45Ce3C0E1D2692", + "0x0C2309C6554AabBFBcA7d5219545795DcAF6f4A9", + ], + // Insurance fund Ordinals + [ + "0xF7bc58b8D8f97ADC129cfC4c9f45Ce3C0E1D2692", + "0x0b32E91C276377b3b3CdB332e902207Defe542bd", + ], ], }), }, From 55e463d66486bff1da90c25d68ac50221b369045 Mon Sep 17 00:00:00 2001 From: soilking <157099073+soilking@users.noreply.github.com> Date: Sun, 2 Jun 2024 01:38:50 -0700 Subject: [PATCH 159/855] Basin Exchange (#10459) * Identifies deployed wells * Sums all tokens across all wells * skipCache * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/basin/index.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 projects/basin/index.js diff --git a/projects/basin/index.js b/projects/basin/index.js new file mode 100644 index 000000000000..f7b341d6c7b7 --- /dev/null +++ b/projects/basin/index.js @@ -0,0 +1,34 @@ +const { getLogs2 } = require('../helper/cache/getLogs'); + +// Aquifer +const FACTORY = "0xba51aaaa95aeefc1292515b36d86c51dc7877773"; +const BORE_WELL_ABI = "event BoreWell (address well, address implementation, address[] tokens, (address, bytes) wellFunction, (address, bytes)[] pumps, bytes wellData)"; + +const startBlocks = { + ethereum: 17977905 +} + +function chainTvl(chain) { + return async (api) => { + // Find all BoreWell events + const START_BLOCK = startBlocks[chain]; + const logs = await getLogs2({ + api, + target: FACTORY, + fromBlock: START_BLOCK, + eventAbi: BORE_WELL_ABI, + topics: ['0xff64a5823907c85a1e7c0400576024f76bd1640c74350033bd0d689f793202f2'], + }); + + const ownerTokens = logs.map(log => [log.tokens, log.well]) + return api.sumTokens({ ownerTokens }) + } +} + +module.exports = { + methodology: "Counts the value of token reserves inside all deployed Wells.", + start: 17977905, + ethereum: { + tvl: chainTvl('ethereum') + } +}; From 7edd1c421de0ed07405055bbfd27bcd7728bd8a8 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Mon, 3 Jun 2024 09:59:19 +0100 Subject: [PATCH 160/855] add stake blastfutures (#10467) --- projects/blastfutures/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/blastfutures/index.js b/projects/blastfutures/index.js index 291de1720549..d1f051852855 100644 --- a/projects/blastfutures/index.js +++ b/projects/blastfutures/index.js @@ -7,4 +7,7 @@ module.exports = { tvl: sumTokensExport({ owner: '0x3Ba925fdeAe6B46d0BB4d424D829982Cb2F7309e', tokens: [ADDRESSES.blast.USDB, ADDRESSES.blast.WETH]}), staking: staking('0x67dBA61709D78806395acDBa3EF9Df686aF5dc24', '0x236bb48fcF61ce996B2C8C196a9258c176100c7d'), }, + ethereum: { + staking: staking('0x0c378FB17E87B180256a87e3f671cd83Bf3236DB', '0x3Ba925fdeAe6B46d0BB4d424D829982Cb2F7309e'), + }, } From bb1b663ca2ad5581f325a2c89d200ebd225deea9 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Mon, 3 Jun 2024 10:15:42 +0100 Subject: [PATCH 161/855] Revert "add stake blastfutures (#10467)" (#10468) This reverts commit 7edd1c421de0ed07405055bbfd27bcd7728bd8a8. --- projects/blastfutures/index.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/projects/blastfutures/index.js b/projects/blastfutures/index.js index d1f051852855..291de1720549 100644 --- a/projects/blastfutures/index.js +++ b/projects/blastfutures/index.js @@ -7,7 +7,4 @@ module.exports = { tvl: sumTokensExport({ owner: '0x3Ba925fdeAe6B46d0BB4d424D829982Cb2F7309e', tokens: [ADDRESSES.blast.USDB, ADDRESSES.blast.WETH]}), staking: staking('0x67dBA61709D78806395acDBa3EF9Df686aF5dc24', '0x236bb48fcF61ce996B2C8C196a9258c176100c7d'), }, - ethereum: { - staking: staking('0x0c378FB17E87B180256a87e3f671cd83Bf3236DB', '0x3Ba925fdeAe6B46d0BB4d424D829982Cb2F7309e'), - }, } From 53b9566be850c4aaf9cda34b413627cea505dafd Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Mon, 3 Jun 2024 11:48:03 +0100 Subject: [PATCH 162/855] move zun to own tokens (#10470) --- projects/treasury/zunami.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/treasury/zunami.js b/projects/treasury/zunami.js index 04bc565e9081..fe860711528e 100644 --- a/projects/treasury/zunami.js +++ b/projects/treasury/zunami.js @@ -2,6 +2,7 @@ const { nullAddress, treasuryExports } = require("../helper/treasury"); const ADDRESSES = require("../helper/coreAssets.json"); const treasury = "0xb056b9a45f09b006ec7a69770a65339586231a34"; +const ZUN = "0x6b5204b0be36771253cc38e88012e02b752f0f36" module.exports = treasuryExports({ ethereum: { @@ -16,6 +17,7 @@ module.exports = treasuryExports({ "0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F", // SDT "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0" // FXS ], - owners: [treasury] + owners: [treasury], + ownTokens: [ZUN] } }); \ No newline at end of file From 6b061f91d054e7304a5abdbcf8c4ec322362a468 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 3 Jun 2024 17:04:12 +0200 Subject: [PATCH 163/855] Add Dunes.fi and refactor code (#10473) * add Dunes.fi * code refactor --------- Co-authored-by: Sunshine <167001185+0xSunshine@users.noreply.github.com> --- projects/dunes/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/dunes/index.js diff --git a/projects/dunes/index.js b/projects/dunes/index.js new file mode 100644 index 000000000000..628a2e924d1f --- /dev/null +++ b/projects/dunes/index.js @@ -0,0 +1,16 @@ +const DETH_DEPOSIT_POOL = "0x8a1229eDB53f55Bb09D472aFc95D12154590108E"; +const DUSD_DEPOSIT_POOL = "0x634598473B91a6870c1DB151142db0b61C5de8CC"; + +async function tvl(api) { + const res = await api.multiCall({ abi: 'function getTotalDeposits() external view returns (address[], uint256[])', calls: [DETH_DEPOSIT_POOL, DUSD_DEPOSIT_POOL] }) + res.forEach(i => api.add(...i)) +} + +module.exports = { + doublecounted: true, + methodology: + "Deposited assets (LSTs, LRTs, stables, Pendle tokens, Karak tokens, etc.) in deposit pools", + ethereum: { + tvl, + }, +}; \ No newline at end of file From e9d79f1cc98a6ce9d50052e7d853454849db87ea Mon Sep 17 00:00:00 2001 From: kdayski <58617773+kdayski@users.noreply.github.com> Date: Mon, 3 Jun 2024 20:05:12 +0500 Subject: [PATCH 164/855] Add new project tymio.com (#10469) * Obtaining all authorized assets on deployed project contracts * Fix eslint rejection * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/tymio/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/tymio/index.js diff --git a/projects/tymio/index.js b/projects/tymio/index.js new file mode 100644 index 000000000000..9116ba677119 --- /dev/null +++ b/projects/tymio/index.js @@ -0,0 +1,18 @@ +const config = { + ethereum: '0xB67D637B1301EEb56Dba4555bBd15Cd220F1aaD6', + arbitrum: '0xB67D637B1301EEb56Dba4555bBd15Cd220F1aaD6', +}; + +module.exports = { + methodology: 'Obtaining all authorized assets on deployed project contracts', +} + +Object.keys(config).forEach(chain => { + const contract = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const tokens = await api.fetchList({ lengthAbi: 'acceptableTokensArrayLength', itemAbi: 'acceptableTokensArray', target: contract}) + return api.sumTokens({ tokens, owner: contract }) + } + } +}) \ No newline at end of file From b419caad5f9c5da0f19b31e84a5ca4c3982f8560 Mon Sep 17 00:00:00 2001 From: Stone <125890624+Stonepapa@users.noreply.github.com> Date: Tue, 4 Jun 2024 00:01:00 +0800 Subject: [PATCH 165/855] add some assets for BSquared Network. (#10472) --- projects/helper/coreAssets.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index cd79f9eb80fa..0b62a31df9d0 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1755,7 +1755,14 @@ "bsquared": { "WBTC": "0x4200000000000000000000000000000000000006", "USDT": "0x681202351a488040fa4fdcc24188afb582c9dd62", - "USDC": "0xe544e8a38add9b1abf21922090445ba93f74b9e5" + "USDC": "0xe544e8a38add9b1abf21922090445ba93f74b9e5", + "ETH": "0xD48d3A551757ac47655fCe25BDE1B0B6b1Cb2a5A", + "MATIC": "0xc3ee2Df14B1Bc526c24ED802f1873d49664a0d5c", + "FDUSD": "0xC2Fe4f673455Ef92299770a09CDB5E8756A525D5", + "BSTONE": "0x7537C1F80c9E157ED7AFD93a494be3e1f04f1462", + "ORDI": "0xa0f4470B714677AEEcE0d20074c540b3Cf6a477E", + "SATS": "0x7eBFcE05E418C380a2b6EB0F65995cA04ef4bc00", + "UBTC": "0x796e4D53067FF374B89b2Ac101ce0c1f72ccaAc2" }, "planq": { "WPLANQ": "0x5ebcdf1de1781e8b5d41c016b0574ad53e2f6e1a" From 3227adef948ef1820d9cb834125ed49116a24e38 Mon Sep 17 00:00:00 2001 From: Jake Date: Mon, 3 Jun 2024 11:45:44 -0700 Subject: [PATCH 166/855] feat: fix Dinari tvl (#10354) * feat: fix Dinari tvl * feat: remove prices from tvl adapter --- projects/dinari/index.js | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/projects/dinari/index.js b/projects/dinari/index.js index 76fbbd368eee..88adad9c2e5b 100644 --- a/projects/dinari/index.js +++ b/projects/dinari/index.js @@ -1,22 +1,27 @@ const config = { arbitrum: { - "AAPL.d": { oracle: "0x8d0CC5f38f9E802475f2CFf4F9fc7000C2E1557c", token: '0xCe38e140fC3982a6bCEbc37b040913EF2Cd6C5a7' }, - "AMZN.d": { oracle: "0xd6a77691f071E98Df7217BED98f38ae6d2313EBA", token: '0x5a8A18673aDAA0Cd1101Eb4738C05cc6967b860f' }, - "GOOGL.d": { oracle: "0x1D1a83331e9D255EB1Aaf75026B60dFD00A252ba", token: '0x9bd7A08cD17d10E02F596Aa760dfE397C57668b4' }, - "META.d": { oracle: "0xcd1bd86fDc33080DCF1b5715B6FCe04eC6F85845", token: '0xa40c0975607BDbF7B868755E352570454b5B2e48' }, - "MSFT.d": { oracle: "0xDde33fb9F21739602806580bdd73BAd831DcA867", token: '0x20f11c1aBca831E235B15A4714b544Bb968f8CDF' }, - "TSLA.d": { oracle: "0x3609baAa0a9b1f0FE4d6CC01884585d0e191C3E3", token: '0x2888c0aC959484e53bBC6CdaBf2b8b39486225C6' }, - "SPY.d": { oracle: "0x46306F3795342117721D8DEd50fbcF6DF2b3cc10", token: '0xF4BD09B048248876E39Fcf2e0CDF1aee1240a9D2' }, - // "COIN.d": { oracle: "", token: '0x46b979440AC257151EE5a5bC9597B76386907FA1' }, + factory: "0xB4Ca72eA4d072C779254269FD56093D3ADf603b8", + getTokensAbi: "function getDShares() external view returns (address[] memory, address[] memory)", + processor: "0xFA922457873F750244D93679df0d810881E4131D", + latestPriceAbi: "function latestFillPrice(address assetToken, address paymentToken) view returns (tuple(uint256 price, uint64 blocktime))", + usdplus: "0xfc90518D5136585ba45e34ED5E1D108BD3950CFa" } } -Object.keys(config).forEach(chain => { - const tokens = Object.values(config[chain]).map(v => v.token) +async function getTokens(api, chain) { + return (await api.call({ + chain: chain, + target: config[chain].factory, + abi: config[chain].getTokensAbi + }))[0]; +} + +Object.keys(config).forEach( chain => { module.exports[chain] = { tvl: async (api) => { + const tokens = await getTokens(api, chain) const bals = await api.multiCall({ abi: 'erc20:totalSupply', calls: tokens}) api.add(tokens, bals) } } -}) \ No newline at end of file +}) From 64c48c1726b0bd2e63f29e3fbda8289c5555914b Mon Sep 17 00:00:00 2001 From: OxC0 <147254343+OxC0@users.noreply.github.com> Date: Tue, 4 Jun 2024 08:59:55 +0800 Subject: [PATCH 167/855] Dex on ICP, called ICPEx (#10477) * Add files via upload * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js --- projects/icpex/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/icpex/index.js diff --git a/projects/icpex/index.js b/projects/icpex/index.js new file mode 100644 index 000000000000..e0d3deac96a9 --- /dev/null +++ b/projects/icpex/index.js @@ -0,0 +1,18 @@ + +const { get } = require('../helper/http') +const { toUSDTBalances } = require('../helper/balances') + +module.exports = { + misrepresentedTokens: true, + icp: { tvl }, +} + +async function tvl() { + let result = await get('https://metrics.icpex.org/llama/tvl'); + if (result.retCode === 1 && result.retMsg === "success") { + const tvl = result.data; + return toUSDTBalances(tvl); + } else { + throw new Error(`API error! message: ${result.retMsg}`); + } +} From d60b69940310afcc1fc0cd0230736d4b4f05369d Mon Sep 17 00:00:00 2001 From: silvercondor <32993765+silvercondor@users.noreply.github.com> Date: Tue, 4 Jun 2024 09:01:47 +0800 Subject: [PATCH 168/855] chore: remove extra TVL wording on methology (#10478) --- projects/native/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/native/index.js b/projects/native/index.js index 41e45ed54b60..af1278d2f888 100644 --- a/projects/native/index.js +++ b/projects/native/index.js @@ -3,7 +3,7 @@ const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); module.exports = { methodology: - "TVL: Counts the inventory held by Native's Partnered Market Makers used to facilitate slippage free swaps on the protocol", + "Counts the inventory held by Native's Partnered Market Makers used to facilitate slippage free swaps on the protocol", }; const config = { From 81b557b60144b2a38c3606a695ddb39d3e1cb3bc Mon Sep 17 00:00:00 2001 From: Renat Date: Tue, 4 Jun 2024 04:08:33 +0300 Subject: [PATCH 169/855] Add BOB TVL for Sovryn DEX (#10480) --- projects/sovryn-dex/index.js | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/projects/sovryn-dex/index.js b/projects/sovryn-dex/index.js index 55d3973860c9..24c607f73481 100644 --- a/projects/sovryn-dex/index.js +++ b/projects/sovryn-dex/index.js @@ -1,4 +1,6 @@ const { staking } = require('../helper/staking') +const { request, gql } = require("graphql-request"); +const { sumTokens2 } = require('../helper/unwrapLPs'); const { getConfig } = require('../helper/cache') const { getUniqueAddresses } = require('../helper/utils') const { transformDexBalances } = require('../helper/portedTokens') @@ -8,8 +10,10 @@ async function tvl(api) { // const impl = await api.call({ abi: 'address:swapsImpl', target: '0x5a0d867e0d70fcc6ade25c3f1b89d618b5b4eaa7' }) - const protocolContract = '0x5a0d867e0d70fcc6ade25c3f1b89d618b5b4eaa7' + const RSKprotocolContract = '0x5a0d867e0d70fcc6ade25c3f1b89d618b5b4eaa7' + const res = await getConfig('sovryn', 'https://backend.sovryn.app/tvl') + let pools = Object.values(res.tvlAmm).map(i => i?.contract).filter(i => i) pools = getUniqueAddresses(pools) const ownerTokens = [] @@ -31,14 +35,27 @@ async function tvl(api) { }) await Promise.all(promises) - ownerTokens.push([allTokens, protocolContract]) + ownerTokens.push([allTokens, RSKprotocolContract]) await api.sumTokens({ ownerTokens }) return transformDexBalances({ data, api, }) } + module.exports = { misrepresentedTokens: true, + bob: { + tvl: async () => { const query = gql` + { + pools { base quote } + } + ` + pools = await request(`https://bob-ambient-subgraph.sovryn.app/subgraphs/name/DistributedCollective/bob-ambient-subgraph`, query) + const tokens = pools.pools.map(i => [i.base, i.quote]).flat() + return sumTokens2({ chain: "bob", owner: '0xe5bc234A484A912A61Aa74501960cFc202e773dA', tokens, }); + }, + //staking: staking('0xc17C6462cEAFE9A8819258c6bA168BEF5544Fc21') // does not work + }, rsk: { tvl, staking: staking('0x5684a06cab22db16d901fee2a5c081b4c91ea40e', '0xefc78fc7d48b64958315949279ba181c2114abbd') } -} \ No newline at end of file +} From a046ec096e8c2ae1b5482c3bedf0e13d3067d17a Mon Sep 17 00:00:00 2001 From: Viyozc Date: Tue, 4 Jun 2024 11:10:59 +0800 Subject: [PATCH 170/855] update cal --- projects/repl/abi.json | 6 ++++-- projects/repl/index.js | 23 ++++++++++++++++++----- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/projects/repl/abi.json b/projects/repl/abi.json index fb2a47eee728..4cbec3031478 100644 --- a/projects/repl/abi.json +++ b/projects/repl/abi.json @@ -1,7 +1,9 @@ { - "getAllActiveAgents": "function getAllActiveAgents() view returns ((address agent, address owner, uint64 originOwnerID, uint64 curOwnerID, uint64 curBeneficiary, uint64 actorID, uint64 agentID, uint256 targetPledge, uint256 safePledge, uint256 lastSafePledgeUpdateTime, uint256 recoveredPledge, uint256 agentContractBalance, uint256 minerBalance, uint8 status, (bytes val, bool neg) availableBalance, uint256 reservedBalance, uint256 passiveMinting)[])", + "getPagedAgents": "function getPagedAgents(uint offset, uint count) view returns ((address agent, address owner, uint64 originOwnerID, uint64 curOwnerID, uint64 curBeneficiary, uint64 actorID, uint64 agentID, uint256 targetPledge, uint256 safePledge, uint256 lastSafePledgeUpdateTime, uint256 recoveredPledge, uint256 agentContractBalance, uint256 minerBalance, uint8 status, (bytes val, bool neg) availableBalance, uint256 reservedBalance, uint256 passiveMinting)[])", "getTVLComponents": "function getTVLComponents() view returns ((uint256))", + "getUpgradedAgentList": "function getUpgradedAgentList() view returns (address[])", "slot0": "function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)", "totalSupply": "uint256:totalSupply", - "PFILPerToken": "uint256:PFILPerToken" + "PFILPerToken": "uint256:PFILPerToken", + "getAllAgentsCount": "function getAllAgentsCount() view returns ((uint256))" } diff --git a/projects/repl/index.js b/projects/repl/index.js index 5a350506d4ce..e9e0808881e3 100644 --- a/projects/repl/index.js +++ b/projects/repl/index.js @@ -5,12 +5,25 @@ const { json } = require('starknet'); const { ethers } = require('ethers'); const http = require('../helper/http'); -const WFIL_WPFIL_POOL_ADDRESS = '0x443A6243A36Ef0ae1C46523d563c15abD787F4E9'; -const PFIL_CONTRACT = '0xAaa93ac72bECfbBc9149f293466bbdAa4b5Ef68C'; -const WPFIL_CONTRACT = '0x57E3BB9F790185Cfe70Cc2C15Ed5d6B84dCf4aDb'; -const WFIL_CONTRACT = '0x60E1773636CF5E4A227d9AC24F20fEca034ee25A'; const REPL_HELPER_CONTRACT = '0x65846aECBF23385F76B73ef1EDD1ebdFf7Ac258D'; +const getAllValidAgents = async (api) => { + const [total, upgradedList] = await Promise.all([ + api.call({ abi: abi.getAllAgentsCount, target: REPL_HELPER_CONTRACT }), + api.call({ abi: abi.getUpgradedAgentList, target: REPL_HELPER_CONTRACT }), + ]) + const COUNT = 40 + const loop = Math.ceil(total / COUNT) + const query = new Array(loop) + .fill(0) + .map((item, i) => api.call({ abi: abi.getPagedAgents, target: REPL_HELPER_CONTRACT, params: [i * COUNT, COUNT] })) + const lists = (await Promise.all(query)).reduce( + (pre, cur) => [...pre, ...cur], + [] + ) + return lists.filter(agent => Number(agent.curBeneficiary) === Number(agent.agentID) || upgradedList.includes(agent.agent)) +} + // Total Assets of Miners pledged to the protocol const getMinerAssets = (agents) => { return agents.reduce((sum, agent) => sum + +agent.minerBalance, 0); @@ -21,7 +34,7 @@ module.exports = { tvl: async (api) => { const [tvlComponents, activeAgents] = await Promise.all([ api.call({ abi: abi.getTVLComponents, target: REPL_HELPER_CONTRACT }), - api.call({ abi: abi.getAllActiveAgents, target: REPL_HELPER_CONTRACT }), + getAllValidAgents(api), ]); const minerAssets = getMinerAssets(activeAgents); From c48dbfcad65effc2b25cc7f378b48c5fe4abd351 Mon Sep 17 00:00:00 2001 From: Viyozc Date: Tue, 4 Jun 2024 11:44:28 +0800 Subject: [PATCH 171/855] update cal --- projects/repl/abi.json | 3 +-- projects/repl/index.js | 7 ++----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/projects/repl/abi.json b/projects/repl/abi.json index 4cbec3031478..22d7e0cd83a2 100644 --- a/projects/repl/abi.json +++ b/projects/repl/abi.json @@ -1,7 +1,6 @@ { - "getPagedAgents": "function getPagedAgents(uint offset, uint count) view returns ((address agent, address owner, uint64 originOwnerID, uint64 curOwnerID, uint64 curBeneficiary, uint64 actorID, uint64 agentID, uint256 targetPledge, uint256 safePledge, uint256 lastSafePledgeUpdateTime, uint256 recoveredPledge, uint256 agentContractBalance, uint256 minerBalance, uint8 status, (bytes val, bool neg) availableBalance, uint256 reservedBalance, uint256 passiveMinting)[])", + "getPagedAgents": "function getPagedAgents(uint offset, uint count) view returns ((address agent, address owner, uint64 originOwnerID, uint64 curOwnerID, uint64 curBeneficiary, uint64 actorID, uint64 agentID, uint256 targetPledge, uint256 safePledge, uint256 lastSafePledgeUpdateTime, uint256 recoveredPledge, uint256 agentContractBalance, uint256 minerBalance, uint8 status, (bytes val, bool neg) availableBalance, uint256 reservedBalance, uint256 passiveMinting, bool isValid)[])", "getTVLComponents": "function getTVLComponents() view returns ((uint256))", - "getUpgradedAgentList": "function getUpgradedAgentList() view returns (address[])", "slot0": "function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)", "totalSupply": "uint256:totalSupply", "PFILPerToken": "uint256:PFILPerToken", diff --git a/projects/repl/index.js b/projects/repl/index.js index e9e0808881e3..dfe476a329cd 100644 --- a/projects/repl/index.js +++ b/projects/repl/index.js @@ -8,10 +8,7 @@ const http = require('../helper/http'); const REPL_HELPER_CONTRACT = '0x65846aECBF23385F76B73ef1EDD1ebdFf7Ac258D'; const getAllValidAgents = async (api) => { - const [total, upgradedList] = await Promise.all([ - api.call({ abi: abi.getAllAgentsCount, target: REPL_HELPER_CONTRACT }), - api.call({ abi: abi.getUpgradedAgentList, target: REPL_HELPER_CONTRACT }), - ]) + const total = await api.call({ abi: abi.getAllAgentsCount, target: REPL_HELPER_CONTRACT }) const COUNT = 40 const loop = Math.ceil(total / COUNT) const query = new Array(loop) @@ -21,7 +18,7 @@ const getAllValidAgents = async (api) => { (pre, cur) => [...pre, ...cur], [] ) - return lists.filter(agent => Number(agent.curBeneficiary) === Number(agent.agentID) || upgradedList.includes(agent.agent)) + return lists.filter(agent => !!agent.isValid) } // Total Assets of Miners pledged to the protocol From 7576916ea75881541b2b55823c38d7b1bd782a44 Mon Sep 17 00:00:00 2001 From: Viyozc Date: Tue, 4 Jun 2024 11:45:23 +0800 Subject: [PATCH 172/855] fix count --- projects/repl/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/repl/index.js b/projects/repl/index.js index dfe476a329cd..833e739754ad 100644 --- a/projects/repl/index.js +++ b/projects/repl/index.js @@ -9,7 +9,7 @@ const REPL_HELPER_CONTRACT = '0x65846aECBF23385F76B73ef1EDD1ebdFf7Ac258D'; const getAllValidAgents = async (api) => { const total = await api.call({ abi: abi.getAllAgentsCount, target: REPL_HELPER_CONTRACT }) - const COUNT = 40 + const COUNT = 30 const loop = Math.ceil(total / COUNT) const query = new Array(loop) .fill(0) From 1db62527b4732c6557ac181eb8796c33c68a201e Mon Sep 17 00:00:00 2001 From: mortinp Date: Tue, 4 Jun 2024 00:17:56 -0400 Subject: [PATCH 173/855] Added Adapter for Mantra Protocol to compute TVL in 4 chains: shibarium, dogechain, cronos and smartbch --- projects/MantraProtocol/index.js | 65 ++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 projects/MantraProtocol/index.js diff --git a/projects/MantraProtocol/index.js b/projects/MantraProtocol/index.js new file mode 100644 index 000000000000..c7f0190bb7d8 --- /dev/null +++ b/projects/MantraProtocol/index.js @@ -0,0 +1,65 @@ +const sdk = require('@defillama/sdk') + +const NATIVE_TOKEN_INTERNAL_ADDRESS = '0x0000000000000000000000000000000000000000' + +const MANTRA_CONTRACT_PER_CHAIN = { + shibarium: '0xf27B9704a15fFe47818fD48660D952235e9C39aF', + dogechain: '0xf27B9704a15fFe47818fD48660D952235e9C39aF', + cronos: '0xf27B9704a15fFe47818fD48660D952235e9C39aF', + smartbch: '0xA39F586a9F4f68e43F0443A6E966eFe096eb8C88' +} + +async function tvl(api) { + + const MANTRA_CONTRACT = MANTRA_CONTRACT_PER_CHAIN[api.chain] + + // Get all whitelisted tokens (includes native coin as 0x0000000000000000000000000000000000000000) + const whitelistedTokens = await api.call({ + abi: 'function getWhitelistedCurrencies() external view returns (address[] memory currencies)', + target: MANTRA_CONTRACT + }) + + + // -- BALANCE OF NATIVE COIN + const balanceNative = await sdk.api.eth.getBalance({ + target: MANTRA_CONTRACT, + chain: api.chain + }) + + api.add(NATIVE_TOKEN_INTERNAL_ADDRESS, balanceNative.output) + + + // -- BALANCE OF OTHER TOKENS (non native) + + // Filter out native coin from whitelistedTokens + const nonNativeTokens = whitelistedTokens.filter(t => t != NATIVE_TOKEN_INTERNAL_ADDRESS) + + const balanceCalls = [] + for (let i = 0; i < nonNativeTokens.length; i++) { + balanceCalls.push({ + abi: 'erc20:balanceOf', + target: nonNativeTokens[i], + params: [MANTRA_CONTRACT], + }); + } + + balances = await api.batchCall(balanceCalls) + + api.addTokens(nonNativeTokens, balances) +} + +module.exports = { + methodology: 'Counts the balance of each of the whitelisted tokens in the Mantra contract', + shibarium: { + tvl, + }, + dogechain: { + tvl, + }, + cronos: { + tvl, + }, + smartbch: { + tvl, + }, +}; \ No newline at end of file From d7614dea041c5971a702d78371fc1a709dd10872 Mon Sep 17 00:00:00 2001 From: mortinp Date: Tue, 4 Jun 2024 01:02:35 -0400 Subject: [PATCH 174/855] Declared balances as const to please ESLint --- projects/MantraProtocol/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/MantraProtocol/index.js b/projects/MantraProtocol/index.js index c7f0190bb7d8..22ba79f21588 100644 --- a/projects/MantraProtocol/index.js +++ b/projects/MantraProtocol/index.js @@ -43,7 +43,7 @@ async function tvl(api) { }); } - balances = await api.batchCall(balanceCalls) + const balances = await api.batchCall(balanceCalls) api.addTokens(nonNativeTokens, balances) } From 3ab148a0ba087115d8c11c16c58db6541244e33f Mon Sep 17 00:00:00 2001 From: TsimakuridzeNikolozi Date: Tue, 4 Jun 2024 09:48:07 +0400 Subject: [PATCH 175/855] Added Web3 Dollar to registry --- projects/hinkal/registryTokens.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/hinkal/registryTokens.js b/projects/hinkal/registryTokens.js index 8ea8f5f02752..ac1bf27a8188 100644 --- a/projects/hinkal/registryTokens.js +++ b/projects/hinkal/registryTokens.js @@ -249,6 +249,7 @@ const ETHEREUM_REGISTRY_TOKENS = [ "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9", "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", "0xEEda34A377dD0ca676b9511EE1324974fA8d980D", + "0x0d86883faf4ffd7aeb116390af37746f45b6f378", ]; const ARBITRUM_REGISTRY_TOKENS = [ From 67723aca5dc63d4d4aca30f37fb907dd10e5b5a4 Mon Sep 17 00:00:00 2001 From: dtx-devs Date: Tue, 4 Jun 2024 14:59:10 +0800 Subject: [PATCH 176/855] feat: add uniTvl on DTX --- projects/dtx/index.js | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/projects/dtx/index.js b/projects/dtx/index.js index 46c6a71b9e85..e286201253a7 100644 --- a/projects/dtx/index.js +++ b/projects/dtx/index.js @@ -1,6 +1,8 @@ const { sumERC4626VaultsExport } = require("../helper/erc4626") -const sdk = require("@defillama/sdk") const { sumTokensExport } = require("../helper/unwrapLPs") +const { getUniTVL } = require("../helper/unknownTokens") + +const sdk = require("@defillama/sdk") const ADDRESSES = require("../helper/coreAssets.json") const config = { @@ -15,7 +17,11 @@ const config = { "0x802B1f8e092AC4469B30C7560266F9a6f8CA450F", ], tokenConfig: { - tokens: [ADDRESSES.blast.USDB, ADDRESSES.blast.WETH, ADDRESSES.blast.ezETH], + tokens: [ + ADDRESSES.blast.USDB, + ADDRESSES.blast.WETH, + ADDRESSES.blast.ezETH, + ], owners: [ "0x9AdF2b330697C6816176491E1fd5503BB746d1d8", "0x0E5b7DDbF37d92B21512Ae5A6CE66aEfA7A7828F", @@ -23,20 +29,33 @@ const config = { }, }, taiko: { - vaults: ['0xdA6a745740Bbdbe5F588b79FEe57f2e10ad4Da11'], + vaults: ["0xdA6a745740Bbdbe5F588b79FEe57f2e10ad4Da11"], tokenConfig: { - tokens: ['0xa51894664a773981c6c112c43ce576f315d5b1b6'], + tokens: ["0xa51894664a773981c6c112c43ce576f315d5b1b6"], owners: [ "0xc0ab776604059D10880dbD219758FF7B82997cc0", "0xB00231B308B01Dbb90f16F966F62d86fBc78c450", ], }, - } + factory: "0x2EA9051d5a48eA2350b26306f2b959D262cf67e1", + }, } -Object.keys(config).forEach(chain => { - const { vaults, tokenConfig, } = config[chain] +Object.keys(config).forEach((chain) => { + const { vaults, tokenConfig, factory } = config[chain] const vaultTvl = sumERC4626VaultsExport({ vaults, isOG4626: true }) const otherTvl = sumTokensExport(tokenConfig) - module.exports[chain] = { tvl: sdk.util.sumChainTvls([vaultTvl, otherTvl]), } -}) \ No newline at end of file + + let tvlCalculators = [vaultTvl, otherTvl] + + if (factory) { + const uniTvl = getUniTVL({ + chain, + factory, + }) + tvlCalculators.push(uniTvl) + } + module.exports[chain] = { + tvl: sdk.util.sumChainTvls(tvlCalculators), + } +}) From eaec8c778604d400d865d9d067cab12ca59e7b93 Mon Sep 17 00:00:00 2001 From: supermonster Date: Tue, 4 Jun 2024 04:27:28 -0400 Subject: [PATCH 177/855] Add Vesta Equity to DefiLlama (#10390) * Add Vesta Equity to projects * remove outdated libraries --- projects/vestaequity/index.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 projects/vestaequity/index.js diff --git a/projects/vestaequity/index.js b/projects/vestaequity/index.js new file mode 100644 index 000000000000..0d2d5655b7af --- /dev/null +++ b/projects/vestaequity/index.js @@ -0,0 +1,24 @@ +const { toUSDTBalances } = require('../helper/balances'); +const { get } = require('../helper/http'); + +const VestaEquityTVLApi = "https://app.vestaequity.net/api/listings/tvl/"; + +async function vestaequityTVL() { + + const response = ( + await get(VestaEquityTVLApi) + ); + + const total = response.reduce((acc, item) => { + acc = acc + item.tvl; + return acc; + }, 0); + + return toUSDTBalances(total); +} + +module.exports = { + algorand: { + tvl: vestaequityTVL, + } +}; From 393c7468c77c6c267965e4086479f099b1918058 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Tue, 4 Jun 2024 10:03:56 +0100 Subject: [PATCH 178/855] add bob to sovryn dex (#10489) --- projects/sovryn-dex/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/sovryn-dex/index.js b/projects/sovryn-dex/index.js index 24c607f73481..12c6e192801a 100644 --- a/projects/sovryn-dex/index.js +++ b/projects/sovryn-dex/index.js @@ -57,5 +57,8 @@ module.exports = { rsk: { tvl, staking: staking('0x5684a06cab22db16d901fee2a5c081b4c91ea40e', '0xefc78fc7d48b64958315949279ba181c2114abbd') + }, + bob: { + staking: staking('0xc17c6462ceafe9a8819258c6ba168bef5544fc21', '0xba20a5e63eeEFfFA6fD365E7e540628F8fC61474') } } From 58dff77ff99be4b81fa081d675552f20253a1fda Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Tue, 4 Jun 2024 10:45:46 +0100 Subject: [PATCH 179/855] fix sovry problem (#10490) --- projects/sovryn-dex/index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/projects/sovryn-dex/index.js b/projects/sovryn-dex/index.js index 12c6e192801a..96bf85e1be62 100644 --- a/projects/sovryn-dex/index.js +++ b/projects/sovryn-dex/index.js @@ -48,17 +48,16 @@ module.exports = { pools { base quote } } ` + // eslint-disable-next-line no-undef pools = await request(`https://bob-ambient-subgraph.sovryn.app/subgraphs/name/DistributedCollective/bob-ambient-subgraph`, query) + // eslint-disable-next-line no-undef const tokens = pools.pools.map(i => [i.base, i.quote]).flat() return sumTokens2({ chain: "bob", owner: '0xe5bc234A484A912A61Aa74501960cFc202e773dA', tokens, }); }, - //staking: staking('0xc17C6462cEAFE9A8819258c6bA168BEF5544Fc21') // does not work + staking: staking('0xc17c6462ceafe9a8819258c6ba168bef5544fc21', '0xba20a5e63eeEFfFA6fD365E7e540628F8fC61474') }, rsk: { tvl, staking: staking('0x5684a06cab22db16d901fee2a5c081b4c91ea40e', '0xefc78fc7d48b64958315949279ba181c2114abbd') }, - bob: { - staking: staking('0xc17c6462ceafe9a8819258c6ba168bef5544fc21', '0xba20a5e63eeEFfFA6fD365E7e540628F8fC61474') - } } From b91efa646707c6653227a5f5677b456e0447ee2c Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Tue, 4 Jun 2024 12:09:47 +0100 Subject: [PATCH 180/855] Add Lukso Chain (#10492) --- projects/helper/coreAssets.json | 3 +++ projects/helper/env.js | 1 + projects/helper/tokenMapping.js | 7 +++++-- projects/universal-swaps/index.js | 5 +++++ 4 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 projects/universal-swaps/index.js diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 0b62a31df9d0..9e09dd0ed402 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1785,5 +1785,8 @@ }, "taiko": { "WETH": "0xA51894664A773981C6C112C43ce576f315d5b1B6" + }, + "lukso": { + "WLYX": "0x2db41674f2b882889e5e1bd09a3f3613952bc472" } } \ No newline at end of file diff --git a/projects/helper/env.js b/projects/helper/env.js index 0bb95dda42cb..9a25c7e56173 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -22,6 +22,7 @@ const DEFAULTS = { REAL_RPC_MULTICALL: '0xcA11bde05977b3631167028862bE2a173976CA11', TAIKO_RPC_MULTICALL: '0xcb2436774C3e191c85056d248EF4260ce5f27A9D', SEI_RPC: 'https://evm-rpc.sei-apis.com/', + LUKSO_RPC: 'https://rpc.lukso.sigmacore.io', } const ENV_KEYS = [ diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 847f6e76b675..3b38b86fae9b 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -100,8 +100,8 @@ const fixBalancesTokens = { // fix these by pricing the tokens in coins repo '0xd53E6f1d37f430d84eFad8060F9Fec558B36F6fa': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, '0xf6718b2701d4a6498ef77d7c152b2137ab28b8a3': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, - '0x9a6ae5622990ba5ec1691648c3a2872469d161f9': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, - '0xA984b70f7B41EE736B487D5F3D9C1e1026476Ea3': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, + //REMOVE '0x9a6ae5622990ba5ec1691648c3a2872469d161f9': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, + //REMOVE '0xA984b70f7B41EE736B487D5F3D9C1e1026476Ea3': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, }, cyeth: { '0x4200000000000000000000000000000000000006': { coingeckoId: 'ethereum', decimals: 18 }, @@ -134,6 +134,9 @@ const fixBalancesTokens = { core: { '0x5832f53d147b3d6cd4578b9cbd62425c7ea9d0bd': { coingeckoId: 'wrapped-bitcoin', decimals: 8 }, '0x5B1Fb849f1F76217246B8AAAC053b5C7b15b7dc3': { coingeckoId: 'solv-btc', decimals: 18 }, + }, + lukso: { + '0x2db41674f2b882889e5e1bd09a3f3613952bc472': { coingeckoId: 'wrapped-lyx-universalswaps-2', decimals: 18 }, } } diff --git a/projects/universal-swaps/index.js b/projects/universal-swaps/index.js new file mode 100644 index 000000000000..56d0a3aa59cf --- /dev/null +++ b/projects/universal-swaps/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + lukso: { factory: "0x8130c332dddf8964b08eab86aad3999017436a6e", fromBlock: 1939261, }, +}); \ No newline at end of file From 9d3a4cf8e4ab2b2810127b932d711f0801642b8a Mon Sep 17 00:00:00 2001 From: Christopher Mercer <120351727+chris-mercer@users.noreply.github.com> Date: Tue, 4 Jun 2024 07:10:10 -0600 Subject: [PATCH 181/855] Add ETCSwap V3 (#10482) Co-authored-by: leon-do --- projects/etcswap-v3/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/etcswap-v3/index.js diff --git a/projects/etcswap-v3/index.js b/projects/etcswap-v3/index.js new file mode 100644 index 000000000000..a358219cc489 --- /dev/null +++ b/projects/etcswap-v3/index.js @@ -0,0 +1,8 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + ethereumclassic: { + factory: "0x2624E907BcC04f93C8f29d7C7149a8700Ceb8cDC", + fromBlock: 19714286, + }, +}); From 1d1ead21789e4539d1143d88392a2195247f3535 Mon Sep 17 00:00:00 2001 From: yanfu-mercurylabs <155401479+yanfu-mercurylabs@users.noreply.github.com> Date: Tue, 4 Jun 2024 23:17:10 +1000 Subject: [PATCH 182/855] Add Earlyfans adapter (#10486) * add earlyfans adapter * update wording * Update index.js --------- Co-authored-by: Yan Fu Co-authored-by: Yan Fu Co-authored-by: Define101 <93603962+Define101@users.noreply.github.com> --- projects/earlyfans/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/earlyfans/index.js diff --git a/projects/earlyfans/index.js b/projects/earlyfans/index.js new file mode 100644 index 000000000000..e7801fcb37e7 --- /dev/null +++ b/projects/earlyfans/index.js @@ -0,0 +1,18 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); +const ADDRESSES = require('../helper/coreAssets.json') +const { staking } = require('../helper/staking') + +const contract = "0x4b17a9318238403ddac8E3a790C3b06D18132Bf4"; +const early = "0x7135B32e9903BdB4e19a8b1D22fC2038964B8451"; + +async function tvl(api) { + return sumTokens2({ tokens: [ADDRESSES.null], owners: [contract], api }); +} + +module.exports = { + methodology: `TVL counts the EARLY on ${early} and ETH on ${contract}`, + blast: { + tvl, + staking: staking(contract, early) // early token + }, +}; From 0632e537d2d3b4ec3132491cc6910961ec4fe63d Mon Sep 17 00:00:00 2001 From: yb <43601702+yasha-black@users.noreply.github.com> Date: Tue, 4 Jun 2024 16:18:59 +0300 Subject: [PATCH 183/855] fix: split ergodex and splash adapters (#10491) --- projects/ergodex.js | 12 ------------ projects/splash.js | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 12 deletions(-) create mode 100644 projects/splash.js diff --git a/projects/ergodex.js b/projects/ergodex.js index e7caf7509ae5..fb17071d94df 100644 --- a/projects/ergodex.js +++ b/projects/ergodex.js @@ -1,21 +1,9 @@ const { sumTokensExport } = require('./helper/chain/ergo') -const { sumTokensExport: steCardano } = require('./helper/chain/cardano') -const { get } = require('./helper/http'); - -async function cardanoTVL() { - let { tvlAda } = await get('https://api.splash.trade/platform-api/v1/platform/stats') - - return { cardano: tvlAda }; -} module.exports = { timetravel: false, misrepresentedTokens: true, ergo: { tvl: sumTokensExport({ owner: '5vSUZRZbdVbnk4sJWjg2uhL94VZWRg4iatK9VgMChufzUgdihgvhR8yWSUEJKszzV7Vmi6K8hCyKTNhUaiP8p5ko6YEU9yfHpjVuXdQ4i5p4cRCzch6ZiqWrNukYjv7Vs5jvBwqg5hcEJ8u1eerr537YLWUoxxi1M4vQxuaCihzPKMt8NDXP4WcbN6mfNxxLZeGBvsHVvVmina5THaECosCWozKJFBnscjhpr3AJsdaL8evXAvPfEjGhVMoTKXAb2ZGGRmR8g1eZshaHmgTg2imSiaoXU5eiF3HvBnDuawaCtt674ikZ3oZdekqswcVPGMwqqUKVsGY4QuFeQoGwRkMqEYTdV2UDMMsfrjrBYQYKUBFMwsQGMNBL1VoY78aotXzdeqJCBVKbQdD3ZZWvukhSe4xrz8tcF3PoxpysDLt89boMqZJtGEHTV9UBTBEac6sDyQP693qT3nKaErN8TCXrJBUmHPqKozAg9bwxTqMYkpmb9iVKLSoJxG7MjAj72SRbcqQfNCVTztSwN3cRxSrVtz4p87jNFbVtFzhPg7UqDwNFTaasySCqM', }) - }, - cardano: { - tvl: cardanoTVL, - // tvl: steCardano({ owner: 'addr1x94ec3t25egvhqy2n265xfhq882jxhkknurfe9ny4rl9k6dj764lvrxdayh2ux30fl0ktuh27csgmpevdu89jlxppvrst84slu'}) } } diff --git a/projects/splash.js b/projects/splash.js new file mode 100644 index 000000000000..0e4c15d75fa4 --- /dev/null +++ b/projects/splash.js @@ -0,0 +1,15 @@ +const { get } = require('./helper/http'); + +async function cardanoTVL() { + let { tvlAda } = await get('https://api2.splash.trade/platform-api/v1/platform/stats') + + return { cardano: tvlAda }; +} + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + cardano: { + tvl: cardanoTVL, + } +} From f13797a91c22ae8b2cb3e3d8e3074c47941e765e Mon Sep 17 00:00:00 2001 From: MindGamesM <66219051+MindGamesM@users.noreply.github.com> Date: Tue, 4 Jun 2024 15:37:41 +0200 Subject: [PATCH 184/855] Add BlastUp Adapter (#10493) * add blastup project * Update index.js --------- Co-authored-by: MindGames Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/blastup/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 projects/blastup/index.js diff --git a/projects/blastup/index.js b/projects/blastup/index.js new file mode 100644 index 000000000000..a44fce37bd9e --- /dev/null +++ b/projects/blastup/index.js @@ -0,0 +1,10 @@ +const { staking } = require("../helper/staking") +const stakingpool = "0x0E84461a00C661A18e00Cab8888d146FDe10Da8D" + +const ADDRESSES = require("../helper/coreAssets.json") + +module.exports = { + blast: { + tvl: staking(stakingpool, [ADDRESSES.blast.USDB, ADDRESSES.blast.WETH]), + }, +} From 680560cae24e92a3fddcdc067da205125adb8df2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20L=C3=BCcke?= Date: Tue, 4 Jun 2024 15:39:40 +0200 Subject: [PATCH 185/855] Add USK on Telos (#10494) --- projects/kuma/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/kuma/index.js b/projects/kuma/index.js index d29162875c0f..8b5c2a80fcf3 100644 --- a/projects/kuma/index.js +++ b/projects/kuma/index.js @@ -13,6 +13,9 @@ const allAddresses = { }, linea: { USK: "0x7a6AA80B49017f3E091574ab5C6977d863ff3865", + }, + telos: { + USK: "0x09B88f74Fb9E243c4A3F4D2FfE3d1BA4287a476c", } } From e20339e72a9215ad69deb80065beef730e7c0201 Mon Sep 17 00:00:00 2001 From: charq <73696209+buchaoqun@users.noreply.github.com> Date: Tue, 4 Jun 2024 21:41:40 +0800 Subject: [PATCH 186/855] Eliminate SolvBTC (#10487) * Changed to get all vault raise balances * Add judgment * add network * del console log * fix bug * fix bug * Update index.js * update subgraph url * fix bug * revert * Excluding Fof Funds * add other Deposit * add solvbtc Solv Funds del solvbtc * update graphql query * add mirro balance * Eliminate SolvBTC * Remove unusable code * Format --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Co-authored-by: qwen-solv --- projects/solv-protocol-funds/abi.json | 3 +- projects/solv-protocol-funds/index.js | 56 +++++++++++---------------- 2 files changed, 24 insertions(+), 35 deletions(-) diff --git a/projects/solv-protocol-funds/abi.json b/projects/solv-protocol-funds/abi.json index a0495db17d11..1435ab0f58e2 100644 --- a/projects/solv-protocol-funds/abi.json +++ b/projects/solv-protocol-funds/abi.json @@ -11,5 +11,6 @@ "pool": "function pool(address tokenX, address tokenY, uint24 fee) view returns (address)", "state": "function state() view returns (uint160 sqrtPriceX96, int24 currentPoint, uint16 observationCurrentIndex, uint16 observationQueueLen, uint16 observationNextQueueLen, bool locked, uint256 liquidity, uint256 liquidityX)", "stakedAmountsAbi": "function stakedAmounts(address) external view returns (uint256)", - "stakedMlpAmount": "function stakedMlpAmount(address account) view returns (uint256)" + "stakedMlpAmount": "function stakedMlpAmount(address account) view returns (uint256)", + "symbol": "string:symbol" } \ No newline at end of file diff --git a/projects/solv-protocol-funds/index.js b/projects/solv-protocol-funds/index.js index bac24c4908f6..efdf9aec3aea 100644 --- a/projects/solv-protocol-funds/index.js +++ b/projects/solv-protocol-funds/index.js @@ -93,6 +93,13 @@ async function borrowed(api) { } } + const symbols = await api.multiCall({ + abi: abi.symbol, + calls: poolBaseInfos.map((index) => ({ + target: index[1] + })), + }) + const balances = await api.multiCall({ abi: abi.balanceOf, calls: Object.values(vaults).map((index) => ({ @@ -113,7 +120,9 @@ async function borrowed(api) { vaultbalances[`${pools[i]['vault'].toLowerCase()}-${poolBaseInfos[i][1].toLowerCase()}`] = undefined } if (balance > 0) { - api.add(poolBaseInfos[i][1], balance) + if (symbols[i] !== "SolvBTC") { + api.add(poolBaseInfos[i][1], balance) + } } } } @@ -249,8 +258,8 @@ async function liquidity(api, iziswap, owner) { tokenList.forEach((token, index) => { const amounts = getAmounts(state[index], liquidities[index]) - api.add(token[0], amounts.amountX) - api.add(token[1], amounts.amountY) + api.add(token[0], amounts.amountX); + api.add(token[1], amounts.amountY); }) } @@ -320,6 +329,13 @@ async function vaultBalance(api, graphData) { } } + const symbols = await api.multiCall({ + abi: abi.symbol, + calls: Object.values(vaults).map((index) => ({ + target: index[0] + })), + }) + const balances = await api.multiCall({ abi: abi.balanceOf, calls: Object.values(vaults).map((index) => ({ @@ -329,7 +345,9 @@ async function vaultBalance(api, graphData) { }) for (const key in balances) { - api.add(Object.values(vaults)[key][0], balances[key]) + if (symbols[key] !== "SolvBTC") { + api.add(Object.values(vaults)[key][0], balances[key]) + } } } } @@ -432,36 +450,6 @@ async function ceffuBalance(api, address, graphData) { } } - -async function getGraphSoltData(timestamp, chain, api, slot) { - console.log("slot", slot) - const poolSlotDataQuery = `query PoolOrderInfos { - poolOrderInfos(first: 1000 where:{fundraisingEndTime_gt:${timestamp}, openFundShareSlot:"${slot["slot"]}") { - marketContractAddress - contractAddress - navOracle - poolId - vault - openFundShareSlot - } - }`; - - console.log("slotDataQuery", poolSlotDataQuery); - let data; - if (graphUrlList[chain]) { - data = (await cachedGraphQuery(`solv-protocol/funds-graph-data/${chain}`, graphUrlList[chain], poolSlotDataQuery, { api, fetchById: true })); - } - - let poolList = []; - if (data != undefined && data.poolOrderInfos != undefined) { - poolList = data.poolOrderInfos; - } - - return { - pools: poolList - }; -} - async function getGraphData(timestamp, chain, api) { let rwaSlot = (await getConfig('solv-protocol/slots', slotListUrl)); From 192cd8bdd855b6f85d2a72c9c6f172b42b6a9dc1 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 4 Jun 2024 15:54:54 +0200 Subject: [PATCH 187/855] split adapter (#10495) --- projects/dtx-dex/index.js | 4 ++++ projects/dtx/index.js | 11 +---------- projects/helper/unknownTokens.js | 11 +++++++++++ 3 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 projects/dtx-dex/index.js diff --git a/projects/dtx-dex/index.js b/projects/dtx-dex/index.js new file mode 100644 index 000000000000..a9afb34a4b9d --- /dev/null +++ b/projects/dtx-dex/index.js @@ -0,0 +1,4 @@ +const { uniTvlExports } = require('../helper/unknownTokens') +module.exports = uniTvlExports({ + taiko: '0x2EA9051d5a48eA2350b26306f2b959D262cf67e1' +}) diff --git a/projects/dtx/index.js b/projects/dtx/index.js index e286201253a7..db223b152f5e 100644 --- a/projects/dtx/index.js +++ b/projects/dtx/index.js @@ -1,6 +1,5 @@ const { sumERC4626VaultsExport } = require("../helper/erc4626") const { sumTokensExport } = require("../helper/unwrapLPs") -const { getUniTVL } = require("../helper/unknownTokens") const sdk = require("@defillama/sdk") const ADDRESSES = require("../helper/coreAssets.json") @@ -37,7 +36,6 @@ const config = { "0xB00231B308B01Dbb90f16F966F62d86fBc78c450", ], }, - factory: "0x2EA9051d5a48eA2350b26306f2b959D262cf67e1", }, } @@ -47,14 +45,7 @@ Object.keys(config).forEach((chain) => { const otherTvl = sumTokensExport(tokenConfig) let tvlCalculators = [vaultTvl, otherTvl] - - if (factory) { - const uniTvl = getUniTVL({ - chain, - factory, - }) - tvlCalculators.push(uniTvl) - } + module.exports[chain] = { tvl: sdk.util.sumChainTvls(tvlCalculators), } diff --git a/projects/helper/unknownTokens.js b/projects/helper/unknownTokens.js index c722bc96ee43..cf07b1d5f989 100644 --- a/projects/helper/unknownTokens.js +++ b/projects/helper/unknownTokens.js @@ -9,6 +9,16 @@ const { getTokenPrices, sumUnknownTokens, getLPData, } = require('./cache/sumUnk const { getUniTVL } = require('./cache/uniswap') const { getUniqueAddresses, } = require('./utils') +function uniTvlExports(config, commonOptions) { + const exportsObj = { + misrepresentedTokens: true, + } + Object.keys(config).forEach(chain => { + exportsObj[chain] = uniTvlExport(chain, config[chain],commonOptions )[chain] + }) + return exportsObj +} + function unknownTombs({ token = [], shares = [], rewardPool = [], masonry = [], lps, chain = "ethereum", coreAssets = [], useDefaultCoreAssets = false, }) { let getPrices @@ -256,4 +266,5 @@ module.exports = { sumTokensExport, yieldHelper, uniTvlExport, + uniTvlExports, }; \ No newline at end of file From 0cd636266b3aa87da4f82819050c196c5496da5b Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 4 Jun 2024 17:43:16 +0200 Subject: [PATCH 188/855] Add Joltify adapter and move mapping to server (#10498) * add joltify adapter * move mapping to server --------- Co-authored-by: briangarden --- projects/helper/chain/cosmos.js | 4 +++- projects/helper/chains.json | 3 ++- projects/helper/tokenMapping.js | 2 +- projects/joltify-lending/index.js | 24 ++++++++++++++++++++++++ 4 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 projects/joltify-lending/index.js diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index c7b392745cf8..fda290201eb4 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -41,7 +41,8 @@ const endPoints = { sifchain: "https://sifchain-api.polkachu.com", nolus: "https://pirin-cl.nolus.network:1317", nibiru: "https://lcd.nibiru.fi", - bostrom: "https://lcd.bostrom.cybernode.ai" + bostrom: "https://lcd.bostrom.cybernode.ai", + joltify: "https://lcd.joltify.io" }; const chainSubpaths = { @@ -50,6 +51,7 @@ const chainSubpaths = { comdex: "comdex", umee: "umee", kava: "kava", + joltify: "joltify", }; // some contract calls need endpoint with higher gas limit diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 95829f491727..6b6056b39adb 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -319,5 +319,6 @@ "zklink", "zksync", "zora", - "zyx" + "zyx", + "joltify" ] \ No newline at end of file diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 3b38b86fae9b..b3c55dcd0b88 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -17,7 +17,7 @@ coreAssets = JSON.parse(JSON.stringify(coreAssets)) // carbon: https://api-insights.carbon.network/info/denom_gecko_map // orbit brige: https://bridge.orbitchain.io/open/v1/api/monitor/rawTokenList -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'] +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'] const transformTokens = { diff --git a/projects/joltify-lending/index.js b/projects/joltify-lending/index.js new file mode 100644 index 000000000000..931d31b53ce4 --- /dev/null +++ b/projects/joltify-lending/index.js @@ -0,0 +1,24 @@ +const { queryV1Beta1 } = require('../helper/chain/cosmos'); +const chain = 'joltify' + +const tvl = async (api) => { + const [deposited, borrowed] = await Promise.all([ + queryV1Beta1({ chain, url: `third_party/jolt/v1beta1/total-deposited/` }), + queryV1Beta1({ chain, url: `third_party/jolt/v1beta1/total-borrowed/` }) + ]); + deposited.supplied_coins.forEach(({ denom, amount }) => api.add(denom, amount)); + borrowed.borrowed_coins.forEach(({ denom, amount }) => api.add(denom, amount * -1)); +} + +const borrowed = async (api) => { + const borrowed = await queryV1Beta1({ chain, url: 'third_party/jolt/v1beta1/total-borrowed/' }) + borrowed.borrowed_coins.forEach(({ denom, amount }) => api.add(denom, amount)) +} + +module.exports = { + timetravel: false, + joltify: { + tvl, + borrowed + } +} \ No newline at end of file From fc56d8ed199a8950444c5336755b6cd0a2a812c1 Mon Sep 17 00:00:00 2001 From: Brian Bodollo Date: Tue, 4 Jun 2024 23:44:26 +0800 Subject: [PATCH 189/855] Stride Hyperlane Adapter (#10497) * feat: added stride-hyperlane tvl for defillama * chore: added final new line on index file * chore: removed redemption_rate and changed methodology * fix: fixed not showing balances properly * chore: added note for address denom reference * chore: changed methodology --- projects/stride-hyperlane/index.js | 38 ++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 projects/stride-hyperlane/index.js diff --git a/projects/stride-hyperlane/index.js b/projects/stride-hyperlane/index.js new file mode 100644 index 000000000000..71f6a8371c21 --- /dev/null +++ b/projects/stride-hyperlane/index.js @@ -0,0 +1,38 @@ +const sdk = require("@defillama/sdk") +const { get } = require("../helper/http") + +async function tvl() { + // address denom reference: https://www.mintscan.io/stride/address/stride1h4rhlwcmdwnnd99agxm3gp7uqkr4vcjd73m4586hcuklh3vdtldqgqmjxc + const hyperlaneAddressDenom = "ibc/BF3B4F53F3694B66E13C23107C84B6485BD2B96296BB7EC680EA77BBA75B4801" + + const { balances: hyperlaneBalances } = await get( + "https://stride-fleet.main.stridenet.co/api/cosmos/bank/v1beta1/balances/stride1h4rhlwcmdwnnd99agxm3gp7uqkr4vcjd73m4586hcuklh3vdtldqgqmjxc" + ) + + const hyperlaneBalance = hyperlaneBalances.find((balance) => balance.denom === hyperlaneAddressDenom) + + if (hyperlaneBalance == null) throw new Error("Something went wrong with getting the available hyperlane balance") + + // This defaults to 1e6 (for now) since the origin denom of `hyperlaneAddressDenom` is utia + const coinDecimals = 1e6 + + const amount = hyperlaneBalance.amount / coinDecimals + + const balances = {} + + sdk.util.sumSingleBalance( + balances, + "celestia", + amount + ) + + return balances +} + +module.exports = { + timetravel: false, + methodology: "Hyperlane uses a lock-and-mint mechanism. To calculate TVL, we are taking the number of locked TIA on the Stride side of the bridge, and multiplying by TIA price.", + "celestia": { + tvl + } +} // node test.js projects/stride-hyperlane/index.js From 3140371e40008b3a51a6e95d9723f2726e20836d Mon Sep 17 00:00:00 2001 From: ivanshukhov <45999338+ivanshukhov@users.noreply.github.com> Date: Tue, 4 Jun 2024 18:00:32 +0200 Subject: [PATCH 190/855] add physica, usdc tokens to planq (#10499) --- projects/helper/coreAssets.json | 6 ++++-- projects/helper/tokenMapping.js | 4 ++++ projects/physica-finance/index.js | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 projects/physica-finance/index.js diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 9e09dd0ed402..02dbb4df6efd 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1765,7 +1765,9 @@ "UBTC": "0x796e4D53067FF374B89b2Ac101ce0c1f72ccaAc2" }, "planq": { - "WPLANQ": "0x5ebcdf1de1781e8b5d41c016b0574ad53e2f6e1a" + "WPLANQ": "0x5ebcdf1de1781e8b5d41c016b0574ad53e2f6e1a", + "USDC": "0xecEEEfCEE421D8062EF8d6b4D814efe4dc898265", + "USDC_1": "0x75E20C5d4aade76143b8b74d1C5E2865347f9d3B" }, "lac": { "LAC": "0x2911a1ab18546cb501628be8625c7503a2a7db54" @@ -1789,4 +1791,4 @@ "lukso": { "WLYX": "0x2db41674f2b882889e5e1bd09a3f3613952bc472" } -} \ No newline at end of file +} diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index b3c55dcd0b88..4794c30e2272 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -137,6 +137,10 @@ const fixBalancesTokens = { }, lukso: { '0x2db41674f2b882889e5e1bd09a3f3613952bc472': { coingeckoId: 'wrapped-lyx-universalswaps-2', decimals: 18 }, + }, + planq: { + "0xecEEEfCEE421D8062EF8d6b4D814efe4dc898265": { coingeckoId: 'usd-coin', decimals: 6 }, + "0x75E20C5d4aade76143b8b74d1C5E2865347f9d3B": { coingeckoId: 'usd-coin', decimals: 18 }, } } diff --git a/projects/physica-finance/index.js b/projects/physica-finance/index.js new file mode 100644 index 000000000000..99bea7e259b8 --- /dev/null +++ b/projects/physica-finance/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + planq: { factory: "0xFF4F8f857fd60142a135aB139C16370da89c76c2", fromBlock: 9020194, }, +}); From 38f766b6d58d606cf63d754338bc1580661afdb8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 4 Jun 2024 18:01:01 +0200 Subject: [PATCH 191/855] update sdk version --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index dab982ba3670..2143492e47f2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -886,9 +886,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "5.0.59", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.59.tgz", - "integrity": "sha512-9Gxs1OkyPrqfvf9nuvlvwWUCxoJO4uHLOfJaT9p6LwC9xl2+iFY0Yb/+kCt0TgRYRooEP88Z4Rf3PmnmhTsw+g==", + "version": "5.0.61", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.61.tgz", + "integrity": "sha512-t7nOMdpQ29y1eZmQothokRqsrfmGSTcu/ZHauvl/CvDEcUuWK+uNpdSAYG0cf93Z3XUXKH4eyRI7XLZcYR7/6w==", "dependencies": { "@aws-sdk/client-s3": "^3.400.0", "@elastic/elasticsearch": "^8.13.1", From 9c08ea20e5bc9f4afef4457b31cb7ac3d5e89bf8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 4 Jun 2024 18:20:51 +0200 Subject: [PATCH 192/855] Update sei deployment and contract calls (#10500) * Add carbondefi sei evm deployment * Use sei instead of sei_evm * Use contract call to get pairs instead of getLogs * minor fix --------- Co-authored-by: Tiago Silva --- projects/carbondefi/index.js | 42 +++++++++++++++++++-------------- projects/helper/tokenMapping.js | 2 ++ 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/projects/carbondefi/index.js b/projects/carbondefi/index.js index 2d365672677b..beacc231a1e0 100644 --- a/projects/carbondefi/index.js +++ b/projects/carbondefi/index.js @@ -1,21 +1,27 @@ -const { getLogs } = require('../helper/cache/getLogs') -const { sumTokens2 } = require('../helper/unwrapLPs') +const { sumTokens2 } = require("../helper/unwrapLPs"); -const controller = '0xC537e898CD774e2dCBa3B14Ea6f34C93d5eA45e1' +const config = { + ethereum: { + fromBlock: 17087375, + controller: "0xC537e898CD774e2dCBa3B14Ea6f34C93d5eA45e1", + }, + sei: { + fromBlock: 79146720, + controller: "0xe4816658ad10bF215053C533cceAe3f59e1f1087", + }, +}; -async function tvl(api) { - const logs = await getLogs({ - api, - target: controller, - topic: 'PairCreated(uint128,address,address)', - eventAbi: 'event PairCreated(uint128 indexed pairId, address indexed token0, address indexed token1)', - onlyArgs: true, - fromBlock: 17087375, - }) - const tokens = logs.map(i => [i.token0, i.token1]).flat() +Object.keys(config).forEach((chain) => { + const { controller, fromBlock } = config[chain]; + module.exports[chain] = { + tvl: async (api) => { + const pairs = await api.call({ + target:controller, + abi: 'function pairs() view returns (address[2][])', + }) + const tokens = pairs.flat().map(i => i.toLowerCase()) - return sumTokens2({ api, owner: controller, tokens, }) -} - - -module.exports = { ethereum: { tvl } } \ No newline at end of file + return sumTokens2({ api, owner: controller, tokens }); + }, + }; +}); diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 4794c30e2272..193d816cb616 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -130,6 +130,8 @@ const fixBalancesTokens = { }, sei: { '0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1': { coingeckoId: 'usd-coin', decimals: 6 }, + '0x0000000000000000000000000000000000000000': { coingeckoId: 'sei-network', decimals: 18 }, + '0xe30fedd158a2e3b13e9badaeabafc5516e95e8c7': { coingeckoId: 'sei-network', decimals: 18 }, }, core: { '0x5832f53d147b3d6cd4578b9cbd62425c7ea9d0bd': { coingeckoId: 'wrapped-bitcoin', decimals: 8 }, From 45169e95ec4feef73e9b8d4574a55fe75c54b158 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 4 Jun 2024 18:23:59 +0200 Subject: [PATCH 193/855] minor fix --- projects/helper/tokenMapping.js | 2 +- projects/helper/utils.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 193d816cb616..3e85616ff948 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -138,7 +138,7 @@ const fixBalancesTokens = { '0x5B1Fb849f1F76217246B8AAAC053b5C7b15b7dc3': { coingeckoId: 'solv-btc', decimals: 18 }, }, lukso: { - '0x2db41674f2b882889e5e1bd09a3f3613952bc472': { coingeckoId: 'wrapped-lyx-universalswaps-2', decimals: 18 }, + '0x2db41674f2b882889e5e1bd09a3f3613952bc472': { coingeckoId: 'lukso-token-2', decimals: 18 }, }, planq: { "0xecEEEfCEE421D8062EF8d6b4D814efe4dc898265": { coingeckoId: 'usd-coin', decimals: 6 }, diff --git a/projects/helper/utils.js b/projects/helper/utils.js index e4c8cbda8cb7..0e4dccd218e9 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -262,7 +262,7 @@ async function debugBalances({ balances = {}, chain, log = false, tableLabel = ' labelMapping[label] = token }) - if (tokens.length > 100) { + if (tokens.length > 400) { sdk.log('too many unknowns') return; } From fab519dc18808ef2eaa7e7ae6f099f534d20691d Mon Sep 17 00:00:00 2001 From: 0xngmi <80541789+0xngmi@users.noreply.github.com> Date: Tue, 4 Jun 2024 17:33:20 +0100 Subject: [PATCH 194/855] fix errrs --- projects/sovryn-dex/index.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/projects/sovryn-dex/index.js b/projects/sovryn-dex/index.js index 96bf85e1be62..81cd541b03fc 100644 --- a/projects/sovryn-dex/index.js +++ b/projects/sovryn-dex/index.js @@ -47,10 +47,8 @@ module.exports = { { pools { base quote } } - ` - // eslint-disable-next-line no-undef - pools = await request(`https://bob-ambient-subgraph.sovryn.app/subgraphs/name/DistributedCollective/bob-ambient-subgraph`, query) - // eslint-disable-next-line no-undef + `; + const pools = await request(`https://bob-ambient-subgraph.sovryn.app/subgraphs/name/DistributedCollective/bob-ambient-subgraph`, query) const tokens = pools.pools.map(i => [i.base, i.quote]).flat() return sumTokens2({ chain: "bob", owner: '0xe5bc234A484A912A61Aa74501960cFc202e773dA', tokens, }); }, From be4a7c510a21b70bdc843bec67ce5dd1726cab18 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 4 Jun 2024 21:50:50 +0200 Subject: [PATCH 195/855] track yei fi --- projects/bancor/index.js | 98 ++++++-------------------------- projects/bancor/v3.js | 36 ++---------- projects/carbondefi/index.js | 2 +- projects/dragonswap-sei/index.js | 3 + projects/helper/env.js | 1 + projects/helper/tokenMapping.js | 2 + projects/yei-fi/index.js | 5 ++ 7 files changed, 34 insertions(+), 113 deletions(-) create mode 100644 projects/dragonswap-sei/index.js create mode 100644 projects/yei-fi/index.js diff --git a/projects/bancor/index.js b/projects/bancor/index.js index d73bdfdd7e93..835254bea24e 100644 --- a/projects/bancor/index.js +++ b/projects/bancor/index.js @@ -1,51 +1,27 @@ -const ADDRESSES = require('../helper/coreAssets.json') +const ADDRESSES = require('../helper/coreAssets.json'); +const { sumTokens2 } = require('../helper/unwrapLPs'); const abi = require('./abi.json'); -const sdk = require('@defillama/sdk'); -const { sumTokens } = require('../helper/unwrapLPs'); -const ethAddress = ADDRESSES.null; -const ethReserveAddresses = ['0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee']; - -async function generateCallsByBlockchain(block) { +async function generateCallsByBlockchain(api) { + const block = api.block const registryAddress = '0x52Ae12ABe5D8BD778BD5397F99cA900624CfADD4'; const converterRegistryHex = '0x42616e636f72436f6e7665727465725265676973747279000000000000000000'; - let result; let converterRegistryAddress; - if (block < 9195218) { + if (block && block < 9195218) { converterRegistryAddress = '0xf6E2D7F616B67E46D708e4410746E9AAb3a4C518'; } else { // get converter registry address - result = await sdk.api.abi.call({ - target: registryAddress, - abi: abi['abiContractRegistryAddressOf'], - params: [converterRegistryHex], - block - }); - - converterRegistryAddress = result.output; + converterRegistryAddress = await api.call({ abi: abi.abiContractRegistryAddressOf, target: registryAddress, params: [converterRegistryHex] }); } // get pool anchor addresses - result = await sdk.api.abi.call({ - target: converterRegistryAddress, - abi: abi['abiConverterRegistryGetPools'], - block - }); - - // get converter addresses - result = await sdk.api.abi.call({ - target: converterRegistryAddress, - abi: abi['abiRegistryGetConvertersBySmartTokens'], - params: [result.output], - block - }); - - // get reserve token addresses (currently limited to 2) - const converterAddresses = result.output; + const poolAnchorAddresses = await api.call({ abi: abi.abiConverterRegistryGetPools, target: converterRegistryAddress }); + const converterAddresses = await api.call({ abi: abi.abiRegistryGetConvertersBySmartTokens, target: converterRegistryAddress, params: [poolAnchorAddresses] }); const reserveTokenCalls = []; + const owners = []; for (let i = 0; i < converterAddresses.length; i++) { reserveTokenCalls.push({ target: converterAddresses[i], @@ -55,62 +31,22 @@ async function generateCallsByBlockchain(block) { target: converterAddresses[i], params: [1] }); + owners.push(converterAddresses[i]); + owners.push(converterAddresses[i]); } - result = await sdk.api.abi.multiCall({ - calls: reserveTokenCalls, - abi: abi['abiConverterConnectorTokens'], - block - }); - - // create reserve balance calls - const balanceCalls = []; - for (let i = 0; i < result.output.length; i++) { - const item = result.output[i]; - balanceCalls.push({ - target: item.output, - params: [item.input.target] - }); - } - - return balanceCalls; -} - -/*================================================== - TVL - ==================================================*/ - -async function tvl(timestamp, block) { - let balanceCalls = await generateCallsByBlockchain(block); - - // get ETH balances - let balances = {}; - - const ethBalanceCalls = balanceCalls.filter((call) => ethReserveAddresses.includes(call.target.toLowerCase())).map(call => call.params[0]) - ethBalanceCalls.push('0xc0829421C1d260BD3cB3E0F06cfE2D52db2cE315') - - - const { output: ethBalances } = await sdk.api.eth.getBalances({ targets: ethBalanceCalls, block }) - ethBalances.forEach(bal => sdk.util.sumSingleBalance(balances, ethAddress, bal.balance)) - - // get reserve balances - let result = await sdk.api.abi.multiCall({ - calls: balanceCalls.filter(c => c.target.toLowerCase() !== "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE".toLowerCase()), - abi: 'erc20:balanceOf', - block - }); - - sdk.util.sumMultiBalanceOf(balances, result); - - return balances; + const tokens = await api.multiCall({ calls: reserveTokenCalls, abi: abi['abiConverterConnectorTokens'], }); + tokens.push(ADDRESSES.null); + owners.push('0xc0829421C1d260BD3cB3E0F06cfE2D52db2cE315'); + return sumTokens2({ api, tokensAndOwners2: [tokens, owners] }) } module.exports = { start: 1501632000, // 08/02/2017 @ 12:00am (UTC) ethereum: { - tvl, + tvl: generateCallsByBlockchain, }, - hallmarks:[ + hallmarks: [ [1588114800, "V2.0 Launch"], // 29/04/2020 @ 12:00am (UTC) [1602457200, "V2.1 Launch"] // 12/10/2020 @ 12:00am (UTC) ], diff --git a/projects/bancor/v3.js b/projects/bancor/v3.js index 37fbea3109be..266cd459a2ff 100644 --- a/projects/bancor/v3.js +++ b/projects/bancor/v3.js @@ -1,47 +1,21 @@ -const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs'); const abi = require('./abi.json'); -const sdk = require('@defillama/sdk'); -const { sumTokens } = require('../helper/unwrapLPs'); -const ethAddress = ADDRESSES.null; -const ethReserveAddresses = ['0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee']; const bancor = '0x1f573d6fb3f13d689ff844b4ce37794d79a7ff1c' -async function addV3Balance(balances, block) { +async function addV3Balance(api) { const masterVault = '0x649765821D9f64198c905eC0B2B037a4a52Bc373' const networkSettings = '0xeEF417e1D5CC832e619ae18D2F140De2999dD4fB' - const { output: tokens } = await sdk.api.abi.call({ - target: networkSettings, block, abi: abi.liquidityPools - }) - + const tokens = await api.call({ abi: abi.liquidityPools, target: networkSettings}) tokens.push(bancor) - - const toa = tokens - .filter(t => !ethReserveAddresses.includes(t.toLowerCase())) - .map(t => [t, masterVault]) - - const { output: balance } = await sdk.api.eth.getBalance({ target: masterVault, block }) - sdk.util.sumSingleBalance(balances, ethAddress, balance) - return sumTokens(balances, toa, block) -} - -/*================================================== - TVL - ==================================================*/ - -async function tvl(timestamp, block) { - - // get ETH balances - let balances = {}; - - return addV3Balance(balances, block) + return sumTokens2({ api, owner: masterVault, tokens }) } module.exports = { start: 1650283200, // 18/04/2022 @ 1:00pm (UTC) methodology: `Counts the tokens in the Master Vault Contract.`, ethereum: { - tvl, + tvl: addV3Balance, }, hallmarks:[ [1650322800, "V3 Beta"], // 19/04/2022 @ 12:00am (UTC) diff --git a/projects/carbondefi/index.js b/projects/carbondefi/index.js index beacc231a1e0..85a5897ddfd9 100644 --- a/projects/carbondefi/index.js +++ b/projects/carbondefi/index.js @@ -19,7 +19,7 @@ Object.keys(config).forEach((chain) => { target:controller, abi: 'function pairs() view returns (address[2][])', }) - const tokens = pairs.flat().map(i => i.toLowerCase()) + const tokens = pairs.flat() return sumTokens2({ api, owner: controller, tokens }); }, diff --git a/projects/dragonswap-sei/index.js b/projects/dragonswap-sei/index.js new file mode 100644 index 000000000000..a26d9a7cacfb --- /dev/null +++ b/projects/dragonswap-sei/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require("../helper/unknownTokens"); + +module.exports = uniTvlExport('sei', '0x71f6b49ae1558357bbb5a6074f1143c46cbca03d') diff --git a/projects/helper/env.js b/projects/helper/env.js index 9a25c7e56173..d4f517ebf5be 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -20,6 +20,7 @@ const DEFAULTS = { REAL_RPC: 'https://real.drpc.org', // added manually short name is re-al TAIKO_RPC: 'https://rpc.taiko.xyz', // added manually short name is tko-mainnet REAL_RPC_MULTICALL: '0xcA11bde05977b3631167028862bE2a173976CA11', + SEI_RPC_MULTICALL: '0xcA11bde05977b3631167028862bE2a173976CA11', TAIKO_RPC_MULTICALL: '0xcb2436774C3e191c85056d248EF4260ce5f27A9D', SEI_RPC: 'https://evm-rpc.sei-apis.com/', LUKSO_RPC: 'https://rpc.lukso.sigmacore.io', diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 3e85616ff948..35b60d19db6b 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -130,6 +130,7 @@ const fixBalancesTokens = { }, sei: { '0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1': { coingeckoId: 'usd-coin', decimals: 6 }, + '0xb75d0b03c06a926e488e2659df1a861f860bd3d1': { coingeckoId: 'tether', decimals: 6 }, '0x0000000000000000000000000000000000000000': { coingeckoId: 'sei-network', decimals: 18 }, '0xe30fedd158a2e3b13e9badaeabafc5516e95e8c7': { coingeckoId: 'sei-network', decimals: 18 }, }, @@ -185,6 +186,7 @@ function getCoreAssets(chain = 'ethereum') { function normalizeAddress(address, chain, extractChain = false) { if (!chain && extractChain && address.includes(':')) chain = address.split(':')[0] + if (chain === 'sei' && address?.startsWith('0x')) return address.toLowerCase() if (caseSensitiveChains.includes(chain)) return address return address.toLowerCase() } diff --git a/projects/yei-fi/index.js b/projects/yei-fi/index.js new file mode 100644 index 000000000000..c66083025c0e --- /dev/null +++ b/projects/yei-fi/index.js @@ -0,0 +1,5 @@ +const { aaveExports } = require('../helper/aave'); + +module.exports = { + sei: aaveExports(undefined, '', undefined, ['0x60c82a40c57736a9c692c42e87a8849fb407f0d6']), +}; From d8e79588abc6be9da67deb35a6523bf23bdc058e Mon Sep 17 00:00:00 2001 From: Noah Hanover Date: Wed, 5 Jun 2024 02:18:12 -0500 Subject: [PATCH 196/855] Add Season2 of Munchables (#10503) * bringing back s * added season 2 --- projects/munchables-season2/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/munchables-season2/index.js diff --git a/projects/munchables-season2/index.js b/projects/munchables-season2/index.js new file mode 100644 index 000000000000..8c8a101bdbd9 --- /dev/null +++ b/projects/munchables-season2/index.js @@ -0,0 +1,11 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const { sumTokensExport } = require("../helper/unwrapLPs"); + +module.exports = { + blast: { + tvl: sumTokensExport({ + owner: "0xEA091311Fc07139d753A6BBfcA27aB0224854Bae", + tokens: [ADDRESSES.null, ADDRESSES.blast.USDB, ADDRESSES.blast.WETH], + }), + }, +}; \ No newline at end of file From 698e6595b4f9aa93108296fc6fde070b313b028f Mon Sep 17 00:00:00 2001 From: Ncookie Date: Wed, 5 Jun 2024 04:27:01 -0300 Subject: [PATCH 197/855] added base and arbitrum pooltogether vault factories (#10501) --- projects/pooltogether-v5/index.js | 2 +- projects/pooltogether/v5.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/projects/pooltogether-v5/index.js b/projects/pooltogether-v5/index.js index 7c02208969c5..879280fd6d63 100644 --- a/projects/pooltogether-v5/index.js +++ b/projects/pooltogether-v5/index.js @@ -1,6 +1,6 @@ const { tvl } = require('../pooltogether/v5.js') -const chains = ['optimism'] +const chains = ['optimism', 'base', 'arbitrum'] module.exports = { doublecounted: true, diff --git a/projects/pooltogether/v5.js b/projects/pooltogether/v5.js index 888a11c4d5b2..b69a502a81ab 100644 --- a/projects/pooltogether/v5.js +++ b/projects/pooltogether/v5.js @@ -2,7 +2,9 @@ const abi = require('./abi.json') const { sumTokens2 } = require('../helper/unwrapLPs') const V5_VAULT_FACTORIES = { - optimism: ['0xF65FA202907D6046D1eF33C521889B54BdE08081', '0x6B17EE3a95BcCd605340454c5919e693Ef8EfF0E', '0xF0F151494658baE060034c8f4f199F74910ea806', '0x0C379e9b71ba7079084aDa0D1c1Aeb85d24dFD39'] + optimism: ['0xF65FA202907D6046D1eF33C521889B54BdE08081', '0x6B17EE3a95BcCd605340454c5919e693Ef8EfF0E', '0xF0F151494658baE060034c8f4f199F74910ea806', '0x0C379e9b71ba7079084aDa0D1c1Aeb85d24dFD39'], + base: ['0xE32F6344875494ca3643198d87524519Dc396DDf'], + arbitrum: ['0x44Be003E55e7cE8a2e0ECC3266f8a9A9de2c07BC'] } async function tvl(api) { @@ -16,7 +18,7 @@ async function tvl(api) { const tokens = await api.multiCall({ abi: abi.asset, calls: vaults }) const bals = await api.multiCall({ abi: abi.totalAssets, calls: vaults }) api.addTokens(tokens, bals) - return sumTokens2({ api, resolveLP: true, }) + return sumTokens2({ api, resolveLP: true }) } module.exports = { From f84da28a14daea5d89be83639afa936e94313ae2 Mon Sep 17 00:00:00 2001 From: shafu Date: Wed, 5 Jun 2024 09:27:22 +0200 Subject: [PATCH 198/855] DYAD v2 (#10502) * Update index.js * Update coreAssets.json * Update coreAssets.json * refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/dyad/index.js | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/projects/dyad/index.js b/projects/dyad/index.js index d8f921d39d77..c7e27744d3f8 100644 --- a/projects/dyad/index.js +++ b/projects/dyad/index.js @@ -1,19 +1,21 @@ const ADDRESSES = require("../helper/coreAssets.json"); -const { sumTokensExport } = require("../helper/unwrapLPs"); +const vaults = [ + "0xcF97cEc1907CcF9d4A0DC4F492A3448eFc744F6c", + "0x7aE80418051b2897729Cbdf388b07C5158C557A1", + "0x4fde0131694ae08c549118c595923ce0b42f8299", + "0x7e5f2b8f089a4cd27f5b6b846306020800df45bd", + // "0xf3768D6e78E65FC64b8F12ffc824452130BD5394", // Kerosene is own token +] + +async function tvl(api) { + const tokens = await api.multiCall({ abi: 'address:asset', calls: vaults }) + tokens.push(ADDRESSES.null) + vaults.push('0xdc400bbe0b8b79c07a962ea99a642f5819e3b712') + return api.sumTokens({ tokensAndOwners2: [tokens, vaults] }) +} module.exports = { ethereum: { - tvl: sumTokensExport({ - owners: [ - "0xdc400bbe0b8b79c07a962ea99a642f5819e3b712", - "0xcF97cEc1907CcF9d4A0DC4F492A3448eFc744F6c", - "0x7aE80418051b2897729Cbdf388b07C5158C557A1", - ], - tokens: [ - ADDRESSES.null, - ADDRESSES.ethereum.WETH, - ADDRESSES.ethereum.WSTETH, - ], - }), + tvl, }, -}; +} \ No newline at end of file From 1ea73cd98ca8b04bb5c8447937dc477943a16914 Mon Sep 17 00:00:00 2001 From: dojo-trading <153982231+dojo-trading@users.noreply.github.com> Date: Wed, 5 Jun 2024 15:30:23 +0800 Subject: [PATCH 199/855] feat: injera project (#10504) Co-authored-by: dojo --- projects/injera/index.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 projects/injera/index.js diff --git a/projects/injera/index.js b/projects/injera/index.js new file mode 100644 index 000000000000..0b7fd40df0b7 --- /dev/null +++ b/projects/injera/index.js @@ -0,0 +1,29 @@ +const { sumTokens} = require('../helper/chain/cosmos'); + +const addresses = { + injective: { + redBank: 'inj1dffuj4ud2fn7vhhw7dec6arx7tuyxd56srjwk4', + creditManager: 'inj1da4kst7293x7g43sxdx6hnppkqmr5aaf2hanhj', + params: 'inj1xuf0xk9583ry4wczmxulleuhrw6dqtlnvvcx56' + }, +} + +async function injectiveTVL() { + let balances = {}; + await addRedBankTvl(balances, 'injective'); + return balances; +} + + +async function addRedBankTvl(balances, chain) { + let a = await sumTokens({balances, owners: [addresses[chain].redBank], chain}); + return a +} + +module.exports = { + timetravel: false, + methodology: 'For Injective chain, sum token balances in Bank/Credit Manager smart contracts to approximate net deposits, plus vault underlying assets held', + injective: { + tvl: injectiveTVL, + }, +}; From d38c12ddbd27fe0b1962ba3874c51348c32ebca1 Mon Sep 17 00:00:00 2001 From: LeeRyanj <138840879+LeeRyanj@users.noreply.github.com> Date: Wed, 5 Jun 2024 16:39:14 +0800 Subject: [PATCH 200/855] Update index.js add taiko config (#10506) --- projects/kiloex/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/kiloex/index.js b/projects/kiloex/index.js index 0ffd836d483a..47ba4bfea13a 100644 --- a/projects/kiloex/index.js +++ b/projects/kiloex/index.js @@ -5,6 +5,7 @@ const owners = ["0x1c3f35F7883fc4Ea8C4BCA1507144DC6087ad0fb", "0xfE03be1b0504031 const opbnb_owners = ["0xA2E2F3726DF754C1848C8fd1CbeA6aAFF84FC5B2", "0x1EbEd4024308afcb05E6938eF8Ebd1ec5d6E8C46"]; const manta_owners = ["0xA2E2F3726DF754C1848C8fd1CbeA6aAFF84FC5B2", "0x1EbEd4024308afcb05E6938eF8Ebd1ec5d6E8C46", "0x471C5e8Cc0fEC9aeeb7ABA6697105fD6aaaDFf99"]; const manta_stone_token = "0xEc901DA9c68E90798BbBb74c11406A32A70652C3"; +const taiko_owners = ["0x735D00A9368164B9dcB2e008d5Cd15b367649aD5", "0x235C5C450952C12C8b815086943A7bBCF96bc619"]; module.exports = { start: 1690971144, @@ -15,4 +16,7 @@ module.exports = { manta: { tvl: sumTokensExport({ owners: manta_owners, tokens: [ADDRESSES.manta.USDT, manta_stone_token] }) }, + taiko: { + tvl: sumTokensExport({ owners: taiko_owners, tokens: ['0x07d83526730c7438048D55A4fc0b850e2aaB6f0b'] }) + }, }; From 64b5f072155ee0baf4f9a03872f22ffac1238f6b Mon Sep 17 00:00:00 2001 From: BAICE <48044642+libaice@users.noreply.github.com> Date: Wed, 5 Jun 2024 18:55:09 +0800 Subject: [PATCH 201/855] add uBTC lending market on b2 ecosystem (#10509) --- projects/bitlen/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/bitlen/index.js b/projects/bitlen/index.js index 89c4c904d9db..0dc80f0a0546 100644 --- a/projects/bitlen/index.js +++ b/projects/bitlen/index.js @@ -3,6 +3,7 @@ const { sumTokens2 } = require("../helper/unwrapLPs"); const WBTC_POOL = '0x6996c446b1bfb8cc2ef7a4bc32979de613bcefe1'; const USDT_POOL = '0xad9b8b6c60ca112ab10670d87d53e6ff86ec3c2a'; const USDC_POOL = '0x779bddc3cBc62617093CB1E27436C78DA015508E'; +const UBTC_POOL = '0xfAa5376d7A04cb111d5a1601CB083408c167d299' const CORE_POOL = '0xfE345fF60ACB262848FBf3Cb11bf5811c8293Aa9'; @@ -12,7 +13,7 @@ const CORE_USDC_POOL = '0x514C4876e239a248dD6d40F54491Cc1C7b2D044A'; const config = { bsquared: { - pools: [WBTC_POOL, USDT_POOL, USDC_POOL,] + pools: [WBTC_POOL, USDT_POOL, USDC_POOL,UBTC_POOL] }, core: { pools: [CORE_POOL, COREBTC_POOL, CORE_USDT_POOL, CORE_USDC_POOL] From 6f214908849b1b8822670cd539f2d90b9d75f557 Mon Sep 17 00:00:00 2001 From: Harrirbl <131149828+Harrirbl@users.noreply.github.com> Date: Wed, 5 Jun 2024 13:59:58 +0300 Subject: [PATCH 202/855] feat: add adapter for sceptre staked flr (#10510) * feat: add adapter for sceptre staked flr * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/sceptre-staked-flr/index.js | 13 +++++++++++++ projects/sceptre-staked-flr/sflr.json | 4 ++++ 2 files changed, 17 insertions(+) create mode 100644 projects/sceptre-staked-flr/index.js create mode 100644 projects/sceptre-staked-flr/sflr.json diff --git a/projects/sceptre-staked-flr/index.js b/projects/sceptre-staked-flr/index.js new file mode 100644 index 000000000000..c3a6ed5ca93f --- /dev/null +++ b/projects/sceptre-staked-flr/index.js @@ -0,0 +1,13 @@ +const SFLR = "0x12e605bc104e93B45e1aD99F9e555f659051c2BB"; + +async function tvl(api) { + const pooledFlr = await api.call({ abi: "uint256:totalPooledFlr", target: SFLR }) + api.addGasToken(pooledFlr) +} + +module.exports = { + flare: { + tvl, + }, + methodology: "Counts staked FLR tokens.", +} \ No newline at end of file diff --git a/projects/sceptre-staked-flr/sflr.json b/projects/sceptre-staked-flr/sflr.json new file mode 100644 index 000000000000..aba69c17f93a --- /dev/null +++ b/projects/sceptre-staked-flr/sflr.json @@ -0,0 +1,4 @@ +{ + "totalPooledFlr": "uint256:totalPooledFlr", + "getSharesByPooledFlr": "function getSharesByPooledFlr(uint256 flrAmount) view returns (uint256)" +} \ No newline at end of file From fafd7dbb31f0805585975b9e955eb083f26a2820 Mon Sep 17 00:00:00 2001 From: mootz12 <38118608+mootz12@users.noreply.github.com> Date: Wed, 5 Jun 2024 09:52:21 -0400 Subject: [PATCH 203/855] add Blend adapters (#10479) * add Blend adapters * revert change to package-lock.json * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/blend-backstop/api.js | 30 ++++++++++++++++ projects/blend-backstop/index.js | 8 +++++ projects/blend-pools/api.js | 60 ++++++++++++++++++++++++++++++++ projects/blend-pools/index.js | 8 +++++ projects/helper/coreAssets.json | 4 +++ projects/helper/tokenMapping.js | 7 +++- 6 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 projects/blend-backstop/api.js create mode 100644 projects/blend-backstop/index.js create mode 100644 projects/blend-pools/api.js create mode 100644 projects/blend-pools/index.js diff --git a/projects/blend-backstop/api.js b/projects/blend-backstop/api.js new file mode 100644 index 000000000000..7bb971541eca --- /dev/null +++ b/projects/blend-backstop/api.js @@ -0,0 +1,30 @@ +const { BackstopConfig, BackstopToken } = require("@blend-capital/blend-sdk"); + +const BACKSTOP_ID = "CAO3AGAMZVRMHITL36EJ2VZQWKYRPWMQAPDQD5YEOF3GIF7T44U4JAL3"; + +const network = { + rpc: "https://soroban-rpc.creit.tech/", + passphrase: "Public Global Stellar Network ; September 2015", +}; + +async function tvl(api) { + let backstop = await BackstopConfig.load(network, BACKSTOP_ID); + let backstop_token = await BackstopToken.load( + network, + backstop.backstopTkn, + backstop.blndTkn, + backstop.usdcTkn + ); + + // backstop token is a 80% BLND 20% USDC Comet pool (Balancer v1 fork) + // since BLND has no coingecko price, use USDC held in LP shares by the + // backstop to approximate total USDC held + api.addCGToken("usd-coin", (Number(backstop_token.usdc) / 1e7) * 5); + return api.getBalances(); +} + +module.exports = { + stellar: { + tvl, + }, +}; diff --git a/projects/blend-backstop/index.js b/projects/blend-backstop/index.js new file mode 100644 index 000000000000..2d3fc4f32d4c --- /dev/null +++ b/projects/blend-backstop/index.js @@ -0,0 +1,8 @@ +const { getExports } = require("../helper/heroku-api"); + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + methodology: `Counts the total amount of BLND-USDC LP shares held by the Blend backstop contract. The shares are converted to a USDC value based on the liquidity pool weights.`, + ...getExports("blend-backstop", ['stellar']) +}; diff --git a/projects/blend-pools/api.js b/projects/blend-pools/api.js new file mode 100644 index 000000000000..fa85d3cb59fa --- /dev/null +++ b/projects/blend-pools/api.js @@ -0,0 +1,60 @@ +const { + PoolConfig, + ReserveData, + BackstopConfig, +} = require("@blend-capital/blend-sdk"); +const { PromisePool } = require("@supercharge/promise-pool"); +const { sumTokens2 } = require('../helper/unwrapLPs') + +const BACKSTOP_ID = "CAO3AGAMZVRMHITL36EJ2VZQWKYRPWMQAPDQD5YEOF3GIF7T44U4JAL3"; + +const network = { + rpc: "https://soroban-rpc.creit.tech/", + passphrase: "Public Global Stellar Network ; September 2015", +}; + +async function getReserveDeposits(poolId, reserveId, isBorrowed = false) { + const data = await ReserveData.load(network, poolId, reserveId) + const rate = Number(data.bRate) / 1e9 + const supply = Number(data.bSupply) + const borrowed = Number(data.dSupply) + if (isBorrowed) + return borrowed * rate + return (supply - borrowed) * rate +} + + +async function addPoolTVL(poolId, api, isBorrowed = false) { + let pool_config = await PoolConfig.load(network, poolId); + const { errors } = await PromisePool.withConcurrency(4) + .for(pool_config.reserveList) + .process(async (reserveId) => { + // pools have unique reserves + let pool_deposit = await getReserveDeposits(poolId, reserveId, isBorrowed); + api.add(reserveId, pool_deposit) + }); + if (errors.length > 0) + throw new Error(errors) +} + +async function tvl(api) { + let backstop = await BackstopConfig.load(network, BACKSTOP_ID); + for (const pool of backstop.rewardZone) + await addPoolTVL(pool, api); + + return sumTokens2({ api }) +} + +async function borrowed(api) { + let backstop = await BackstopConfig.load(network, BACKSTOP_ID); + for (const pool of backstop.rewardZone) + await addPoolTVL(pool, api, true); + + return sumTokens2({ api }) +} + +module.exports = { + stellar: { + tvl, borrowed, + }, +}; diff --git a/projects/blend-pools/index.js b/projects/blend-pools/index.js new file mode 100644 index 000000000000..a50560012b06 --- /dev/null +++ b/projects/blend-pools/index.js @@ -0,0 +1,8 @@ +const { getExports } = require("../helper/heroku-api"); +const methodologies = require("../helper/methodologies"); + +module.exports = { + timetravel: false, + methodology: `${methodologies.lendingMarket}. TVL is calculated and totaled for all Blend pools in the Blend reward zone.`, + ...getExports("blend-pools", ['stellar'], ['borrowed']) +}; diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 02dbb4df6efd..bf40f4c0eb76 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1788,6 +1788,10 @@ "taiko": { "WETH": "0xA51894664A773981C6C112C43ce576f315d5b1B6" }, + "stellar": { + "XLM": "CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA", + "USDC": "CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75" + }, "lukso": { "WLYX": "0x2db41674f2b882889e5e1bd09a3f3613952bc472" } diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 35b60d19db6b..75315f1bbc1c 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -17,8 +17,9 @@ coreAssets = JSON.parse(JSON.stringify(coreAssets)) // carbon: https://api-insights.carbon.network/info/denom_gecko_map // orbit brige: https://bridge.orbitchain.io/open/v1/api/monitor/rawTokenList + 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'] +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 transformTokens = { // Sample Code @@ -35,6 +36,10 @@ const ibcMappings = { } const fixBalancesTokens = { + stellar: { + "CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA": { coingeckoId: "stellar", decimals: 7}, + "CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75": { coingeckoId: "usd-coin", decimals: 7}, + }, defichain_evm: { '0x49febbf9626b2d39aba11c01d83ef59b3d56d2a4': { coingeckoId: "defichain", decimals: 18 }, '0xff0000000000000000000000000000000000000d': { coingeckoId: "usd-coin", decimals: 18 }, From 9600ad996fe3a1757f0989f1d0a8f262bd90fbf2 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 5 Jun 2024 19:38:37 +0530 Subject: [PATCH 204/855] track iotaevm (#10514) * added new chain polygon_zkevm * added marker for new chain launch on Polygon zkEVM * added new chain arbitrum * fixed type in methodology * added shimmersea adapter * added shimmersea adapter * added shimmer_evm to chainlist * added shimmer_evm as new chain to Swapline DEX * added shimmer_evm as new chain to Swapline DEX * added IOTA EVM as new chain to MagicSea DEX * code refactor --------- Co-authored-by: 0xjosaphat Co-authored-by: 0xjosaphat <120175614+0xjosaphat@users.noreply.github.com> --- projects/helper/chains.json | 1 + projects/helper/tokenMapping.js | 4 +++- projects/shimmersea/index.js | 8 +++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 6b6056b39adb..b294f0282d32 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -143,6 +143,7 @@ "inevm", "injective", "interlay", + "iotaevm", "iotex", "islm", "jbc", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 75315f1bbc1c..24098fff64fa 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -64,7 +64,9 @@ const fixBalancesTokens = { "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-17": { coingeckoId: "usd-coin", decimals: 6 }, "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-18": { coingeckoId: "tether", decimals: 6 }, }, - + iotaevm: { + "0x6e47f8d48a01b44DF3fFF35d258A10A3AEdC114c": { coingeckoId: 'iota', decimals: 18 }, + }, acala: { ACA: { coingeckoId: "acala", decimals: 12 }, LDOT: { coingeckoId: "liquid-staking-dot", decimals: 10 }, diff --git a/projects/shimmersea/index.js b/projects/shimmersea/index.js index 235b4b878eee..a5a63a83adf2 100644 --- a/projects/shimmersea/index.js +++ b/projects/shimmersea/index.js @@ -1,3 +1,5 @@ -const { uniTvlExport } = require('../helper/unknownTokens'); - -module.exports = uniTvlExport('shimmer_evm', '0x4fb5d3a06f5de2e88ce490e2e11d22b840d5ac47') +const { uniTvlExports } = require('../helper/unknownTokens'); +module.exports = uniTvlExports({ + shimmer_evm: '0x4fb5d3a06f5de2e88ce490e2e11d22b840d5ac47', + iotaevm: '0x349aaAc3a500014981CBA11b64C76c66a6c1e8D0' +}) From 81cc25a60f1b2bffb5191d7935919adede72a4b7 Mon Sep 17 00:00:00 2001 From: Jonathan Smirnoff <7558841+jonathansmirnoff@users.noreply.github.com> Date: Wed, 5 Jun 2024 11:12:34 -0300 Subject: [PATCH 205/855] fix: update rif on chain contract address because USDRIF v2 (#10513) --- projects/rif-on-chain/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/rif-on-chain/index.js b/projects/rif-on-chain/index.js index 21c0b004820d..5bca62e43094 100644 --- a/projects/rif-on-chain/index.js +++ b/projects/rif-on-chain/index.js @@ -2,6 +2,6 @@ const { sumTokensExport } = require('../helper/unwrapLPs') module.exports = { rsk: { - tvl: sumTokensExport({ owner: '0xCff3FCaEc2352C672C38d77cB1A064B7d50CE7e1', tokens: ['0x2aCc95758f8b5F583470bA265Eb685a8f45fC9D5']}) + tvl: sumTokensExport({ owner: '0xA27024eD70035E46DBa712609FC2AFA1c97aa36a', tokens: ['0x2aCc95758f8b5F583470bA265Eb685a8f45fC9D5']}) } } \ No newline at end of file From fea9b5629075a1075cf27e389186665e3920a3be Mon Sep 17 00:00:00 2001 From: TsimakuridzeNikolozi Date: Wed, 5 Jun 2024 18:51:16 +0400 Subject: [PATCH 206/855] Refactored to remove in-house API usage --- projects/hinkal/hinkalUtils.js | 56 +--- projects/hinkal/index.js | 19 +- .../registryTokensWithUnderlyingAddresses.js | 267 ++++++++++++++++++ projects/hinkal/relayerUrls.js | 12 - 4 files changed, 283 insertions(+), 71 deletions(-) create mode 100644 projects/hinkal/registryTokensWithUnderlyingAddresses.js delete mode 100644 projects/hinkal/relayerUrls.js diff --git a/projects/hinkal/hinkalUtils.js b/projects/hinkal/hinkalUtils.js index 01739c1f6207..fd8768e9800f 100644 --- a/projects/hinkal/hinkalUtils.js +++ b/projects/hinkal/hinkalUtils.js @@ -1,7 +1,4 @@ -const utils = require("../helper/utils"); const sdk = require("@defillama/sdk"); -const RELAYER_URLS = require("./relayerUrls.js"); -const { ethers } = require("ethers"); const ownerByChain = require("./owners.js"); const nullAddress = "0x0000000000000000000000000000000000000000"; @@ -33,29 +30,12 @@ const getAllTokenBalances = async (tokenList, chain) => { }) ).output; - const decimalCalls = tokenList.map((token) => ({ - target: token, - })); - - const decimals = ( - await sdk.api.abi.multiCall({ - calls: decimalCalls, - abi: "erc20:decimals", - chain, - }) - ).output; - const tokenBalances = balances.map((bal) => { const token = bal.input.target; - const tokenBalance = bal.output; - const tokenDecimal = decimals?.find( - (decimalOutput) => decimalOutput.input.target === token - ).output; - return { - balance: ethers.formatUnits(tokenBalance, Number(tokenDecimal ?? 18)), + balance: tokenBalance, address: token, }; }); @@ -71,44 +51,12 @@ const getAllTokenBalances = async (tokenList, chain) => { tokenBalances.push({ address: nullAddress, - balance: ethers.formatUnits(nativeTokenBalance, 18), + balance: nativeTokenBalance, }); return tokenBalances.filter((tokenBal) => Number(tokenBal.balance) > 0); }; -const fetchTotalValue = async (tokenBalances, chainName) => { - const tokenAddresses = tokenBalances.map((token) => token.address); - const prices = ( - await utils.postURL(`${RELAYER_URLS[chainName]}/get-token-prices`, { - erc20Addresses: tokenAddresses, - }) - ).data.prices; - - const total = tokenBalances.map((token, index) => { - const price = prices[index]; - const tokenBalance = Number(token.balance); - if (!price || !tokenBalance || isNaN(price) || isNaN(tokenBalance)) { - console.log("Some error occured for token", { - token: token.address, - balance: tokenBalance, - price, - chainName, - }); - return { - tokenAddress: token.address, - tokenBalance: 0, - }; - } - return { - tokenAddress: token.address, - tokenBalance: tokenBalance * price, - }; - }); - return total.filter((token) => token && token.tokenBalance > 0); -}; - module.exports = { getAllTokenBalances, - fetchTotalValue, }; diff --git a/projects/hinkal/index.js b/projects/hinkal/index.js index 19bf0c387f74..93bedf76c89a 100644 --- a/projects/hinkal/index.js +++ b/projects/hinkal/index.js @@ -1,17 +1,26 @@ const registryTokensByChain = require("./registryTokens.js"); -const { getAllTokenBalances, fetchTotalValue } = require("./hinkalUtils.js"); +const registryTokensWithUnderlyingAddressesByChain = require("./registryTokensWithUnderlyingAddresses.js"); +const { getAllTokenBalances } = require("./hinkalUtils.js"); const { toUSDTBalances } = require("../helper/balances.js"); -const tvl = async (_, _1, _2, { chain }) => { +const tvl = async (_, _1, _2, { chain, api }) => { const tokenBalances = await getAllTokenBalances( registryTokensByChain[chain], chain ); - const totalValue = await fetchTotalValue(tokenBalances, chain); + const mappedTokens = tokenBalances.map((token) => { + const underlyingAddress = + registryTokensWithUnderlyingAddressesByChain[token.address]; + return { + address: underlyingAddress ? underlyingAddress : token.address, + balance: token.balance, + }; + }); - return toUSDTBalances( - totalValue.reduce((acc, token) => acc + token.tokenBalance, 0) + return api.addTokens( + mappedTokens.map((token) => token.address), + mappedTokens.map((token) => token.balance) ); }; diff --git a/projects/hinkal/registryTokensWithUnderlyingAddresses.js b/projects/hinkal/registryTokensWithUnderlyingAddresses.js new file mode 100644 index 000000000000..40ca2f6e6b12 --- /dev/null +++ b/projects/hinkal/registryTokensWithUnderlyingAddresses.js @@ -0,0 +1,267 @@ +const ETHEREUM_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = { + "0x93ce650b8d3a7a7e44121db82a0429a3884db599": + "0xbFcF63294aD7105dEa65aA58F8AE5BE2D9d0952A", + "0xE49127B7AEfc043847caDd85B8a41973854D30f5": + "0x8dff75976f22db58d7c3fd7b68d782238b0dbe30", + "0x8A31A94bF0926B82083C80E18B331085B84E92D7": + "0x689440f2Ff927E1f24c72F1087E1FAF471eCe1c8", + "0xcc26a5246c6a04a85e997d6581c1b4f14363841a": + "0xcfc25170633581bf896cb6cdee170e3e3aa59503", + "0x9a7Ce41c96Db8d792497D7BEe70fAfb7F8393D71": + "0x7e880867363A7e321f5d260Cade2B0Bb2F717B02", + "0xd4EC67cF6C0Aa65F74eb7F03216Ea23151af21b8": + "0x2932a86df44fe8d2a706d8e9c5d51c24883423f5", + "0x4F1546Ce825dB85310aC2c2cfb369543d73FD0a2": + "0xbD5445402B0a287cbC77cb67B2a52e2FC635dce4", + "0x394Aa83d0E5D348c7FA39325d2A25993704Faf8f": + "0xfb860600f1be1f1c72a89b2ef5caf345aff7d39d", + "0xD1105d6502d3c562B447A75149B00aD366b3212d": + "0x6991C1CD588c4e6f6f1de3A0bac5B8BbAb7aAF6d", + "0xE08FF1427b199241506FcdCC23fcc24Dd98a4FA9": + "0xDeFd8FdD20e0f34115C7018CCfb655796F6B2168", + "0xC21545c26661ae74b3259B55aE007ACC4Bf5d4e3": + "0x9D5C5E364D81DaB193b72db9E9BE9D8ee669B652", + "0xa0Cd8B83B63381895C1854A605315fa7eF50e026": + "0x512a68dd5433563bad526c8c2838c39debc9a756", + "0x25aE9BE521898d33c7DF6Ae8c6669Fe038Bb3550": + "0xecad6745058377744c09747b2715c0170b5699e5", + "0x9434722bf29750B44649eb1b1A10a335d40edFc1": + "0x27cace18f661161661683bba43933b2e6eb1741e", + "0xF2280cBa8e0B9bc9b87b5aFbBeF8C41C20a5ddBe": + "0xbe266d68ce3ddfab366bb866f4353b6fc42ba43c", + "0x5F1894e4b409D7199Ea209b9e43C996640BCB691": + "0x8605dc0c339a2e7e85eea043bd29d42da2c6d784", + "0xa653510227752632ebf692a77e5032d4afFaB3a2": + "0xC94208D230EEdC4cDC4F80141E21aA485A515660", + "0xA1998B87C2935BDbd7fE6ee48542a59a0435a3Ee": + "0x245Ec0d447e7f206B43120Ac292dED5E8bB9fe61", + "0xC8c3031fB628Bdf4eA0F7cA5F96E369Dea07624e": + "0x0404d05F3992347d2f0dC3a97bdd147D77C85c1c", + "0xDc118133332f703e22C0b0FA7E0DD7d1299A7247": + "0xB468dB2E478885B87D7ce0C8DA1D4373A756C138", + "0xC6fDF0921c480Bd7Af89Ab4461D4aCDA24058a65": + "0xAE0bFfc3110e69DA8993F11C1CBd9a6eA3d16daF", + "0x6410ee1f8417a7cE1c3E68E3434c1d6beef6944E": + "0x277d1424a84b35ec0a8108482551b00b4fc1539b", + "0x9456cB3ae9fA8788ac1af4a7A18b339D4028061D": + "0xc2fe9d3c761994897594df63b33b6d843ab7b1cf", + "0x26dA2546602f63b84B3C4dF36476364f6350706E": + "0x0e83df148f69965bfe752250835854b0dbeeaf01", + "0x0a3fE1d39E5c60CfdB48Ba2Dc6B7c855289Dec7C": + "0x35ad1acf0c4be5d4ba11342128d440fdb9e189eb", + "0xA27fa5E11B121277423aC0b8b372596f2805e36a": + "0xe2c422d954db416a69fb29137fe552cce0e160e9", + "0x41e5c3aD70DA89dd7b6AF9Af3cd6861FbC31eA16": + "0x621ef98282ac42d2bf4c20fc73912a16599e12fb", + "0x019e773bE2D65D5fE30bE17547b89500C7C4CD5E": + "0xfb35Fd0095dD1096b1Ca49AD44d8C5812A201677", + "0x1346da36093Fdb8013E1125046f0dCBbBF645b3F": + "0x0ED3A1D45DfdCf85BCc6C7BAFDC0170A357B974C", + "0x4E0854085bC5a2fa8031ea5819863BD280e610F3": + "0x391B570e81e354a85a496952b66ADc831715f54f", + "0x9Ab43f73054C07b02e02c5468b3eB058ccdAA019": + "0x98601E27d41ccff643da9d981dc708cf9eF1F150", + "0x223026549740E2672b3f05c867Fd2B31207338A2": + "0x7C2D26182adeEf96976035986cF56474feC03bDa", + "0x3e0A917d4d914e432B82825e6FBEe039b89f4477": + "0x029aad400f6092dc735a65be95102efcc2fe64bf", + "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8": + "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "0x0B925eD163218f6662a35e0f0371Ac234f9E9371": + "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0", + "0x5Ee5bf7ae06D1Be5997A1A72006FE6C607eC6DE8": + "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c": + "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + "0x23878914EFE38d27C4D67Ab83ed1b93A74D4086a": + "0xdAC17F958D2ee523a2206206994597C13D831ec7", + "0x018008bfb33d285247A21d44E50697654f754e63": + "0x6B175474E89094C44Da98b954EedeAC495271d0F", + "0x9ff58f4fFB29fA2266Ab25e75e2A8b3503311656": + "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "0x030bA81f1c18d280636F32af80b9AAd02Cf0854e": + "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "0xBcca60bB61934080951369a648Fb03DF4F96263C": + "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + "0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811": + "0xdAC17F958D2ee523a2206206994597C13D831ec7", + "0x028171bCA77440897B824Ca71D1c56caC55b68A3": + "0x6B175474E89094C44Da98b954EedeAC495271d0F", +}; + +const ARBITRUM_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = { + "0xC3691c157D1B3A431B841230a7B11d5a373097e1": + "0xce5f24b7a95e9cba7df4b54e911b4a3dc8cdaf6f", + "0x7Bdc233E5369Ac023b9894645902C9032A72D9Ee": + "0x971E732B5c91A59AEa8aa5B0c763E6d648362CF8", + "0xCC26A5246C6A04a85E997d6581C1b4f14363841a": + "0xf2ddf89c04d702369ab9ef8399edb99a76e951ce", + "0xeEeeb52E36c78b153caaB2761c369a50b066cDD5": + "0x098ef55011b6b8c99845128114a9d9159777d697", + "0x59eC3043D7314B9650294Fd800149b53007f804E": + "0x95285ea6ff14f80a2fd3989a6bab993bd6b5fa13", + "0x972c6F2b29638b9AD6955c4F0b0c1239b034f053": + "0x93729702Bf9E1687Ae2124e191B8fFbcC0C8A0B0", + "0xbA65D50Cf4e6E739B2735338a964C3354fAF9B19": + "0xd6dacdcb438f048cf90e53415872cdb3fcc95421", + "0x886867993080DC3bBFC39CDfc343A0e083bB34E0": + "0x6B7B84F6EC1c019aF08C7A2F34D3C10cCB8A8eA6", + "0xB72ea6F99EfA5BD6Fb400BaA4eFddC3cfB075215": + "0xc2b1df84112619d190193e48148000e3990bf627", + "0x660108601EED17aF2832A1c0F1D7dE74F560C5ed": + "0x7c0ac20c3ca8c6257ea099131081d8199bf6b8f6", + "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8": + "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", + "0x513c7E3a9c69cA3e22550eF58AC1C0088e918FFf": + "0x5979D7b546E38E414F7E9822514be443A4800529", + "0x078f358208685046a11C85e8ad32895DED33A249": + "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f", + "0x724dc807b04555b71ed48a6896b6F41593b8C637": + "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", + "0x6ab707Aca953eDAeFBc4fD23bA73294241490620": + "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9", + "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE": + "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", +}; + +const OPTIMISM_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = { + "0x29c431806E536Fb22ce2Edc8dd6e3C3A0d5689a8": + "0xc5ae4b5f86332e70f3205a8151ee9ed9f71e0797", + "0xDaA24E888432b5aa607105e256919Ddfc8b327E9": + "0xd53ccbfed6577d8dc82987e766e75e3cb73a8563", + "0xC3691c157D1B3A431B841230a7B11d5a373097e1": + "0x15f52286c0ff1d7a7ddbc9e300dd66628d46d4e6", + "0xCC26A5246C6A04a85E997d6581C1b4f14363841a": + "0x172a5af37f69c69cc59e748d090a70615830a5dd", + "0xeEeeb52E36c78b153caaB2761c369a50b066cDD5": + "0xcb8883d1d8c560003489df43b30612aabb8013bb", + "0x59eC3043D7314B9650294Fd800149b53007f804E": + "0x2eb49a3eff789d7b2286bf17667acbf12d882c17", + "0xbA65D50Cf4e6E739B2735338a964C3354fAF9B19": + "0xcea806562b757aeffa9fe9d0a03c909b4a204254", + "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8": + "0x4200000000000000000000000000000000000006", + "0xc45A479877e1e9Dfe9FcD4056c699575a1045dAA": + "0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb", + "0x078f358208685046a11C85e8ad32895DED33A249": + "0x68f180fcCe6836688e9084f035309E29Bf0A2095", + "0x38d693cE1dF5AaDF7bC62595A37D667aD57922e5": + "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85", + "0x6ab707Aca953eDAeFBc4fD23bA73294241490620": + "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58", + "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE": + "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", +}; + +const POLYGON_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = { + "0x9dc8Ee4264923D44F2a33Ea139FC4143C288b172": + "0x0e2f214b8f5d0cca011a8298bb907fb62f535160", + "0x1057a796C66ca87EC1e6494f5486006396756083": + "0x835cA119fA28515B1F184A5Ce5Ccda2B5b0d9F6D", + "0x350c331F4e5fD9d5D703424F3F14CcC0280B6629": + "0x40371aad2a24ed841316ef30938881440fd4426c", + "0xf742B69Bd460F14EB5d8335e06954eba694B552E": + "0xA9249f8667cb120F065D9dA1dCb37AD28E1E8FF0", + "0xc44F1103A271BEFF26bB245D760bFbe182CCf121": + "0x8b397084699cc64e429f610f81fac13bf061ef55", + "0x195888B86db69C52b54362DB2D71c2d3e411A0bA": + "0xc501491b0e4A73B2eFBaC564a412a927D2fc83dD", + "0x22301937028310Cef6530eF3C3Bfe14581eb679F": + "0xfc052e70eb6d94afe464a8ce8f43d203109494f2", + "0x90F06727Ba5016eDcf9D8B5def63a5849EcD132f": + "0x9633e0749faa6ec6d992265368b88698d6a93ac0", + "0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97": + "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8": + "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619", + "0xf59036CAEBeA7dC4b86638DFA2E3C97dA9FcCd40": + "0x03b54A6e9a984069379fae1a4fC4dBAE93B3bCCD", + "0x078f358208685046a11C85e8ad32895DED33A249": + "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6", + "0xA4D94019934D8333Ef880ABFFbF2FDd611C762BD": + "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359", + "0x6ab707Aca953eDAeFBc4fD23bA73294241490620": + "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", + "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE": + "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", + "0x8dF3aad3a84da6b69A4DA8aeC3eA40d9091B2Ac4": + "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + "0x28424507fefb6f7f8E9D3860F56504E4e5f5f390": + "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619", + "0x5c2ed810328349100A66B82b78a1791B101C9D61": + "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6", + "0x1a13F4Ca1d028320A707D99520AbFefca3998b7F": + "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", + "0x60D55F02A771d515e077c9C2403a1ef324885CeC": + "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", + "0x27F8D03b3a2196956ED754baDc28D73be8830A6e": + "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", +}; + +const AVALANCHE_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = { + "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8": + "0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB", + "0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97": + "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", + "0x8ffDf2DE812095b1D19CB146E4c004587C0A0692": + "0x152b9d0FdC40C096757F570A51E494bd4b943E50", + "0x625E7708f30cA75bfd92586e17077590C60eb4cD": + "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", + "0x6ab707Aca953eDAeFBc4fD23bA73294241490620": + "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7", + "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE": + "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70", + "0x53f7c5869a859F0AeC3D334ee8B4Cf01E3492f21": + "0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB", + "0xDFE521292EcE2A4f44242efBcD66Bc594CA9714B": + "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", + "0x46A51127C3ce23fb7AB1DE06226147F446e4a857": + "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", + "0x532E6537FEA298397212F09A61e03311686f548e": + "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7", + "0x47AFa96Cdc9fAb46904A55a6ad4bf6660B53c38a": + "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7", +}; + +const BNB_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = { + "0x2E94171493fAbE316b6205f1585779C887771E2F": + "0x2170Ed0880ac9A755fd29B2688956BD959F933F8", + "0x56a7ddc4e848EbF43845854205ad71D5D5F72d3D": + "0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c", + "0x9B00a09492a626678E5A3009982191586C444Df9": + "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", + "0x00901a076785e0906d1028c7d6372d247bec7d61": + "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", + "0xa9251ca9DE909CB71783723713B21E4233fbf1B1": + "0x55d398326f99059fF775485246999027B3197955", +}; + +const BASE_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = { + "0x3b9860321f03AFe02D3FF9e4Fdd4017DC6F4d7Ca": + "0x79edc58C471Acf2244B8f93d6f425fD06A439407", + "0x1f0dbEcDA414F401dB46464864273CaD19368706": + "0x93933FA992927284e9d508339153B31eb871e1f4", + "0x3E07F263C1Ce5EC2a3f1cA87af56B80B27674D96": + "0x89289DC2192914a9F0674f1E9A17C56456549b8A", + "0xD4a0e0b9149BCee3C920d2E00b5dE09138fd8bb7": + "0x4200000000000000000000000000000000000006", + "0x99CBC45ea5bb7eF3a5BC08FB1B7E56bB2442Ef0D": + "0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452", + "0x4e65fE4DbA92790696d040ac24Aa414708F5c0AB": + "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", +}; + +const BLAST_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = {}; + +const registryTokensWithUnderlyingAddressesByChain = { + ethereum: ETHEREUM_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES, + arbitrum: ARBITRUM_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES, + optimism: OPTIMISM_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES, + polygon: POLYGON_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES, + avalanche: AVALANCHE_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES, + bsc: BNB_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES, + base: BASE_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES, + blast: BLAST_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES, +}; + +module.exports = registryTokensWithUnderlyingAddressesByChain; diff --git a/projects/hinkal/relayerUrls.js b/projects/hinkal/relayerUrls.js deleted file mode 100644 index e7ca0abf1ad0..000000000000 --- a/projects/hinkal/relayerUrls.js +++ /dev/null @@ -1,12 +0,0 @@ -const RELAYER_URLS = { - ethereum: "https://ethMainnet.relayer.hinkal.pro", - arbitrum: "https://arbMainnet.relayer.hinkal.pro", - optimism: "https://optimism.relayer.hinkal.pro", - polygon: "https://polygon.relayer.hinkal.pro", - avax: "https://avalanche.relayer.hinkal.pro", - bsc: "https://bnbMainnet.relayer.hinkal.pro", - base: "https://base.relayer.hinkal.pro", - blast: "https://blast.relayer.hinkal.pro", -}; - -module.exports = RELAYER_URLS; From 361e6fc66315bd24e13c04dba76a2f3e027186ee Mon Sep 17 00:00:00 2001 From: TsimakuridzeNikolozi Date: Wed, 5 Jun 2024 19:50:35 +0400 Subject: [PATCH 207/855] Fixed a mistake --- projects/hinkal/index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/projects/hinkal/index.js b/projects/hinkal/index.js index 93bedf76c89a..91a310be2684 100644 --- a/projects/hinkal/index.js +++ b/projects/hinkal/index.js @@ -9,11 +9,16 @@ const tvl = async (_, _1, _2, { chain, api }) => { chain ); + const chainTokensWithUnderlyingAddresses = + registryTokensWithUnderlyingAddressesByChain[chain]; + const mappedTokens = tokenBalances.map((token) => { - const underlyingAddress = - registryTokensWithUnderlyingAddressesByChain[token.address]; + const tokenUnderlyingAddress = chainTokensWithUnderlyingAddresses + ? chainTokensWithUnderlyingAddresses[token.address] + : undefined; + return { - address: underlyingAddress ? underlyingAddress : token.address, + address: tokenUnderlyingAddress ? tokenUnderlyingAddress : token.address, balance: token.balance, }; }); From c6ba7eec92dd5be2e58ba5e73dc183873d2ee363 Mon Sep 17 00:00:00 2001 From: Edd Date: Wed, 5 Jun 2024 17:07:39 +0100 Subject: [PATCH 208/855] update vega protocol tvl calculation (#10515) Vega Protocol now has an Arbitrum asset bridge. This PR adds Arbitrum assets in the new asset pool to the total TVL. Staking calculations are unchanged. - Add arbritrum contract & asset pool addresses --- projects/vega-protocol/index.js | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/projects/vega-protocol/index.js b/projects/vega-protocol/index.js index 57d6692f7b31..1e04155ce6bc 100644 --- a/projects/vega-protocol/index.js +++ b/projects/vega-protocol/index.js @@ -2,16 +2,22 @@ const { getLogs } = require('../helper/cache/getLogs') const { sumTokens2 } = require('../helper/unwrapLPs') const assetListedEvent = "event Asset_Listed(address indexed asset_source, bytes32 indexed vega_asset_id, uint256 nonce)" +const assetListedTopic = "0x4180d77d05ff0d31650c548c23f2de07a3da3ad42e3dd6edd817b438a150452e" const BigNumber = require("bignumber.js"); const config = { ethereum: { - fromBlock: 17343884, + fromBlock: 17343884, vega: '0xcb84d72e61e383767c4dfeb2d8ff7f4fb89abc6e', stakingContract: '0x195064D33f09e0c42cF98E665D9506e0dC17de68', assetPool: '0xA226E2A13e07e750EfBD2E5839C5c3Be80fE7D4d', bridge: '0x23872549cE10B40e31D6577e0A920088B0E0666a', vestingContract: '0x23d1bFE8fA50a167816fBD79D7932577c06011f4' + }, + arbitrum: { + fromBlock: 213213680, + bridge: "0x475B597652bCb2769949FD6787b1DC6916518407", + assetPool: "0xCc006887FE2bfABB535030b3a9877Bb8C1e35201" } } @@ -25,23 +31,24 @@ module.exports = { Object.keys(config).forEach(chain => { const { bridge, fromBlock, vega, stakingContract, assetPool, vestingContract } = config[chain] - module.exports[chain] = { + const sums = { tvl: async (api) => { - const logs = await getLogs({ + const listedAssets = await getLogs({ api, target: bridge, - topics: ['0x4180d77d05ff0d31650c548c23f2de07a3da3ad42e3dd6edd817b438a150452e'], + topics: [assetListedTopic], eventAbi: assetListedEvent, onlyArgs: true, fromBlock, }) const blacklistedTokens = [] if (vega) blacklistedTokens.push(vega) - return sumTokens2({ api, blacklistedTokens, owner: assetPool, tokens: logs.map(i => i.asset_source) }) - }, - //staking: staking(stakingContract, vega) - staking: async (_, _b, cb, { chain, block, api } = {}) => { + return sumTokens2({ api, blacklistedTokens, owner: assetPool, tokens: listedAssets.map(i => i.asset_source) }) + } + } + if (vestingContract && stakingContract) { + sums.staking = async (_, _b, cb, { chain, block, api } = {}) => { const vegaStakedInVesting = await api.call({ abi: contractAbis.totalStaked, target: vestingContract @@ -56,9 +63,8 @@ Object.keys(config).forEach(chain => { return { '0xcb84d72e61e383767c4dfeb2d8ff7f4fb89abc6e': BigNumber(vegaStakedInVesting).plus(BigNumber(vegaStakedInStaking)).toFixed(0) } - } } - + module.exports[chain] = sums }) From 2560b67743551dbe877a55e1c5ff6c64636155f8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 5 Jun 2024 18:11:41 +0200 Subject: [PATCH 209/855] remove unused --- projects/sceptre-staked-flr/sflr.json | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 projects/sceptre-staked-flr/sflr.json diff --git a/projects/sceptre-staked-flr/sflr.json b/projects/sceptre-staked-flr/sflr.json deleted file mode 100644 index aba69c17f93a..000000000000 --- a/projects/sceptre-staked-flr/sflr.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "totalPooledFlr": "uint256:totalPooledFlr", - "getSharesByPooledFlr": "function getSharesByPooledFlr(uint256 flrAmount) view returns (uint256)" -} \ No newline at end of file From 2ace15d7318896a721bec88d2c1c6a8f54246c05 Mon Sep 17 00:00:00 2001 From: PossumLabsCrypto <136654177+PossumLabsCrypto@users.noreply.github.com> Date: Wed, 5 Jun 2024 18:16:12 +0200 Subject: [PATCH 210/855] Update Possum Labs (add V2 contracts) (#10516) * Add HLP Portal and Hallmarks * Adjust timestamp * Fix export and contract address * remove double chain ID from export * try on-chain price for HLP * roll back on-chain price * full overhaul * code refactor * Added Possum-V2 tvl and hallmarks * code refactor --------- Co-authored-by: defichad23 Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Co-authored-by: James Osunkiyesi --- projects/possumLabs/index.js | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/projects/possumLabs/index.js b/projects/possumLabs/index.js index acad6bf323ca..07e33b7b14ac 100644 --- a/projects/possumLabs/index.js +++ b/projects/possumLabs/index.js @@ -1,15 +1,25 @@ const portalsContractAddress = "0x24b7d3034C711497c81ed5f70BEE2280907Ea1Fa"; -const timeRiftContractAddress = "0x6df4EF024089ab148078fdD88f5BF0Ee63248D3E"; -const hlpToken = "0x4307fbDCD9Ec7AEA5a1c2958deCaa6f316952bAb"; -const flashToken = "0xc628534100180582E43271448098cb2c185795BD"; +const portalsV2 = { + USDC: "0x9167CFf02D6f55912011d6f498D98454227F4e16", + USDCE: "0xE8EfFf304D01aC2D9BA256b602D736dB81f20984", + ETH: "0xe771545aaDF6feC3815B982fe2294F7230C9c55b", + WBTC: "0x919B37b5f2f1DEd2a1f6230Bf41790e27b016609", + ARB: "0x523a93037c47Ba173E9080FE8EBAeae834c24082", + LINK: "0x51623b54753E07Ba9B3144Ba8bAB969D427982b6", +}; async function tvl(api) { - const portalsStaked = await api.call({ target: portalsContractAddress, abi: "uint256:totalPrincipalStaked", }); - api.add(hlpToken, portalsStaked) - return api.sumTokens({ owner: timeRiftContractAddress, tokens: [flashToken] }) + const vaults = [portalsContractAddress, ...Object.values(portalsV2)] + const bals = await api.multiCall({ abi: 'uint256:totalPrincipalStaked', calls: vaults}) + const tokens = await api.multiCall({ abi: 'address:PRINCIPAL_TOKEN_ADDRESS', calls: vaults}) + api.add(tokens, bals) } module.exports = { - methodology: "TVL is equal to the amount staked in the Portals and TimeRift contracts", + methodology: + "TVL is equal to the amount staked in the Portals V1 and Portals V2 contracts.", arbitrum: { tvl }, -}; \ No newline at end of file + hallmarks: [ + [1715776637, "Portals V2 Launch"], + ], +}; From 6ada1302decabeacc2fca480387c2a358c597380 Mon Sep 17 00:00:00 2001 From: lsblk07 <154802093+lsblk07@users.noreply.github.com> Date: Thu, 6 Jun 2024 00:19:11 +0800 Subject: [PATCH 211/855] blasterswap-v3 adapter (#10508) Co-authored-by: lsblk07 --- projects/blasterswap-v3/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 projects/blasterswap-v3/index.js diff --git a/projects/blasterswap-v3/index.js b/projects/blasterswap-v3/index.js new file mode 100644 index 000000000000..34138e184222 --- /dev/null +++ b/projects/blasterswap-v3/index.js @@ -0,0 +1,9 @@ +const sdk = require('@defillama/sdk') +const { uniV3Export } = require("../helper/uniswapV3"); +const { mergeExports } = require('../helper/utils') + +module.exports = mergeExports([ + uniV3Export({ blast: { factory: "0xb7a92633Bc7074c8216Dc53566fD58A77b5D32D9", fromBlock: 4308657, }, }), +]) + +module.exports.blast.tvl = sdk.util.sumChainTvls([module.exports.blast.tvl]) From 37f487ceb1dfed3e46fdfd2fcf032052cdb4b50c Mon Sep 17 00:00:00 2001 From: TsimakuridzeNikolozi Date: Wed, 5 Jun 2024 22:39:10 +0400 Subject: [PATCH 212/855] Changed wrong underlying address --- projects/hinkal/registryTokensWithUnderlyingAddresses.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/hinkal/registryTokensWithUnderlyingAddresses.js b/projects/hinkal/registryTokensWithUnderlyingAddresses.js index 40ca2f6e6b12..4185fd3f16ce 100644 --- a/projects/hinkal/registryTokensWithUnderlyingAddresses.js +++ b/projects/hinkal/registryTokensWithUnderlyingAddresses.js @@ -1,6 +1,6 @@ const ETHEREUM_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = { "0x93ce650b8d3a7a7e44121db82a0429a3884db599": - "0xbFcF63294aD7105dEa65aA58F8AE5BE2D9d0952A", + "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490", "0xE49127B7AEfc043847caDd85B8a41973854D30f5": "0x8dff75976f22db58d7c3fd7b68d782238b0dbe30", "0x8A31A94bF0926B82083C80E18B331085B84E92D7": From 0151029c737c5bd108a2144c13a8ed3b27c836bf Mon Sep 17 00:00:00 2001 From: rogi-sh <46889545+rogi-sh@users.noreply.github.com> Date: Thu, 6 Jun 2024 10:30:44 +0200 Subject: [PATCH 213/855] Add Javsphere staker and freezer (#10528) * add staker and freezer * add stakings correct * fix staking * add vesting * fix vesting token --------- Co-authored-by: igorshelkovenkov --- projects/javsphere/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/projects/javsphere/index.js b/projects/javsphere/index.js index 68bd33d975e5..415910ea316c 100644 --- a/projects/javsphere/index.js +++ b/projects/javsphere/index.js @@ -1,4 +1,6 @@ const { get } = require('../helper/http') +const { staking } = require("../helper/staking.js"); +const {stakings} = require("../helper/staking"); const vaultUrl = "https://mainnet.ocean.jellyfishsdk.com/v0/mainnet/address/df1q7zkdpw6hd5wzcxudx28k72vjvpefa4pyqls2grnahhyw4u8kf0zqu2cnz6/vaults"; const ONE_YEAR_LOCKING_MAINNET = '0xD88Bb8359D694c974C9726b6201479a123212333' @@ -18,9 +20,12 @@ async function defichainTvl(api) { module.exports = { methodology: `We count the total value locked in DUSD from all current products (dusd staking is a vault in defichain L1, - 1 year bond and 2 year bond are smart contracts on defimetachain L2). `, + 1 year bond and 2 year bond are smart contracts on defimetachain L2. We also track staking and freezer of javsphers native token JAV). `, defichain_evm: { - tvl + tvl, + staking: stakings( ['0x4e15D4225623D07Adb43e9D546E57E1E6097e869', '0xF923f0828c56b27C8f57bc698c99543f63091E9A'], + '0x66F3Cf265D2D146A0348F6fC67E3Da0835e0968E'), + vesting: staking('0x7246ad1ac72715c5fd6c1FD7460A63afB8289104','0x66F3Cf265D2D146A0348F6fC67E3Da0835e0968E') }, defichain: { tvl: defichainTvl }, From ea4d2be13d44cbc3af4b3b0aecee74f487fbd588 Mon Sep 17 00:00:00 2001 From: zk-linkswap <165469536+zk-linkswap@users.noreply.github.com> Date: Thu, 6 Jun 2024 01:31:10 -0700 Subject: [PATCH 214/855] add linkswap tvl (#10527) Co-authored-by: dev --- projects/linkswap/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 projects/linkswap/index.js diff --git a/projects/linkswap/index.js b/projects/linkswap/index.js new file mode 100644 index 000000000000..4f8dd3961e5c --- /dev/null +++ b/projects/linkswap/index.js @@ -0,0 +1,10 @@ +const { getUniTVL } = require("../helper/unknownTokens"); + +module.exports = { + zklink: { + tvl: getUniTVL({ + factory: "0x87929083ac2215cF3CE4936857D314aF6687C978", + useDefaultCoreAssets: true, + }), + }, +}; From cb7ef93606bd8e462dcafd7605467f34c16de8a6 Mon Sep 17 00:00:00 2001 From: LpcAries <101619245+LpcAries@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:32:07 +0800 Subject: [PATCH 215/855] add taiko config (#10526) --- projects/izumi-iziswap/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/izumi-iziswap/index.js b/projects/izumi-iziswap/index.js index 6970edde8594..63ce4f8601be 100644 --- a/projects/izumi-iziswap/index.js +++ b/projects/izumi-iziswap/index.js @@ -33,6 +33,7 @@ const poolHelpers = { 'mode': ['0x19b683A2F45012318d9B2aE1280d68d3eC54D663'], 'xlayer': ['0xF42C48f971bDaA130573039B6c940212EeAb8496'], 'bob': ['0x19b683A2F45012318d9B2aE1280d68d3eC54D663'], + 'taiko': ['0x33531bDBFE34fa6Fd5963D0423f7699775AacaaF'], } // iziswap liquidityManager contracts const blacklistedTokens = [ From 58d313f182b9f41f7a02e957e7da8c769e11c53d Mon Sep 17 00:00:00 2001 From: Aleksei Lushnikov Date: Thu, 6 Jun 2024 09:32:26 +0100 Subject: [PATCH 216/855] symbiosis adds USDT on Sei EVM chain (#10525) --- projects/helper/coreAssets.json | 3 ++- projects/symbiosis-finance/config.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index bf40f4c0eb76..125a0ed160f9 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1465,7 +1465,8 @@ "USDTet": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/HktfLoADCk9mnjv7XJiN4YXK9ayE6xinLzt8wzcsR2rY", "USDTbs": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/871jbn9unTavWsAe83f2Ma9GJWSv6BKsyWYLiQ6z3Pva", "WBTC": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/7omXa4gryZ5NiBmLep7JsTtTtANCVKXwT9vbN91aS1br", - "USDC": "0x3894085Ef7Ff0f0aeDf52E2A2704928d1Ec074F1" + "USDC": "0x3894085Ef7Ff0f0aeDf52E2A2704928d1Ec074F1", + "USDT": "0xB75D0B03c06A926e488e2659DF1A861F860bD3d1" }, "op_bnb": { "WBNB": "0x4200000000000000000000000000000000000006", diff --git a/projects/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js index d0f1329ed4f4..e06ef05c2539 100644 --- a/projects/symbiosis-finance/config.js +++ b/projects/symbiosis-finance/config.js @@ -332,6 +332,7 @@ module.exports = { name: 'sei', tokens: [ ADDRESSES.sei.USDC, + ADDRESSES.sei.USDT, ], holders: [ '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 From a68867ba965967519ec990a4e2855d3f64fef405 Mon Sep 17 00:00:00 2001 From: Brandon Date: Thu, 6 Jun 2024 01:33:04 -0700 Subject: [PATCH 217/855] Add telos and xlayer (#10524) --- projects/steer/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/projects/steer/index.js b/projects/steer/index.js index c2d3262336e3..39ef515ba7fa 100644 --- a/projects/steer/index.js +++ b/projects/steer/index.js @@ -129,6 +129,18 @@ const supportedChains = [ chainId: 3776, identifier: 'astrzk' }, + { + name: 'Telos', + subgraphEndpoint: 'https://api.goldsky.com/api/public/project_clohj3ta78ok12nzs5m8yag0b/subgraphs/steer-protocol-telos/1.0.1/gn', + chainId: 40, + identifier: 'telos' + }, + { + name: 'X Layer', + subgraphEndpoint: 'https://api.goldsky.com/api/public/project_clohj3ta78ok12nzs5m8yag0b/subgraphs/steer-protocol-x-layer/1.0.1/gn', + chainId: 196, + identifier: 'xlayer' + }, // { // name: 'Celo', // subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/rakeshbhatt10/steer-test-celo', From 819f2f27368696eeb900c11ae47ea43a66880b07 Mon Sep 17 00:00:00 2001 From: dtx-devs <164329664+dtx-devs@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:33:25 +0800 Subject: [PATCH 218/855] chore: add taiko tokenConfig and usdcVault in DTX (#10523) --- projects/dtx/index.js | 9 ++++++--- projects/helper/coreAssets.json | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/projects/dtx/index.js b/projects/dtx/index.js index db223b152f5e..9f72076e0a79 100644 --- a/projects/dtx/index.js +++ b/projects/dtx/index.js @@ -28,9 +28,12 @@ const config = { }, }, taiko: { - vaults: ["0xdA6a745740Bbdbe5F588b79FEe57f2e10ad4Da11"], + vaults: [ + "0xdA6a745740Bbdbe5F588b79FEe57f2e10ad4Da11", + "0xE3e6818bbC193D454f38772D34FA4cf8C19684d5", + ], tokenConfig: { - tokens: ["0xa51894664a773981c6c112c43ce576f315d5b1b6"], + tokens: [ADDRESSES.taiko.USDC, ADDRESSES.taiko.WETH], owners: [ "0xc0ab776604059D10880dbD219758FF7B82997cc0", "0xB00231B308B01Dbb90f16F966F62d86fBc78c450", @@ -45,7 +48,7 @@ Object.keys(config).forEach((chain) => { const otherTvl = sumTokensExport(tokenConfig) let tvlCalculators = [vaultTvl, otherTvl] - + module.exports[chain] = { tvl: sdk.util.sumChainTvls(tvlCalculators), } diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 125a0ed160f9..546ca718290e 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1787,6 +1787,7 @@ "ETH": "0xef63d4e178b3180beec9b0e143e0f37f4c93f4c2" }, "taiko": { + "USDC": "0x07d83526730c7438048D55A4fc0b850e2aaB6f0b", "WETH": "0xA51894664A773981C6C112C43ce576f315d5b1B6" }, "stellar": { From 9baec01b3aa68cb2a75d4690035daf2242adcb67 Mon Sep 17 00:00:00 2001 From: hamur dev <122794657+tpktpj@users.noreply.github.com> Date: Thu, 6 Jun 2024 01:53:30 -0700 Subject: [PATCH 219/855] Add: avalon finance coredao market (#10519) Co-authored-by: jsmjsm --- projects/avalon-finance/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/avalon-finance/index.js b/projects/avalon-finance/index.js index 578bf4a14a58..2c5e1018f133 100644 --- a/projects/avalon-finance/index.js +++ b/projects/avalon-finance/index.js @@ -8,6 +8,7 @@ const mainMarket = { btr: aaveExports('', '0x6aB5d5E96aC59f66baB57450275cc16961219796', undefined, ['0x5F314b36412765f3E1016632fD1Ad528929536CA'], { v3: true }), arbitrum: aaveExports('', '0xa2ddc06baDc817C612111137c0cf6Bd43634EE1a', undefined, ['0xEc579d2cE07401258710199Ff12a5bb56e086a6F'], { v3: true }), bsc: aaveExports('', '0x5395201A4DD625a0d69b99D917282f75928416c1', undefined, ['0x672b19DdA450120C505214D149Ee7F7B6DEd8C39'], { v3: true }), + core: aaveExports('', '0x410d2D3Dc79ec66A2Cfc3A4a0AD4af3a38D38bd0', undefined, ['0x802CB61844325dc9A161bC3A498E3BE1B7b6FE00'], { v3: true }), } const innovativeMarket = { From a60703c3d7d6edabb1cb53df0ed6b09476f190a6 Mon Sep 17 00:00:00 2001 From: Yieldfarming24 <165474414+Yieldfarming24@users.noreply.github.com> Date: Thu, 6 Jun 2024 11:24:28 +0200 Subject: [PATCH 220/855] Add bbqswap (#10517) * Add bbqswap * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/BBQSwap/index.js | 3 +++ projects/helper/chains.json | 1 + projects/helper/env.js | 1 + projects/helper/tokenMapping.js | 3 +++ 4 files changed, 8 insertions(+) create mode 100644 projects/BBQSwap/index.js diff --git a/projects/BBQSwap/index.js b/projects/BBQSwap/index.js new file mode 100644 index 000000000000..7db1599e9a6f --- /dev/null +++ b/projects/BBQSwap/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('ham', '0x7304e5751973113fA7c4FFf677871B926258f27e') diff --git a/projects/helper/chains.json b/projects/helper/chains.json index b294f0282d32..5fe8d95cb351 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -129,6 +129,7 @@ "gravitybridge", "grove", "harmony", + "ham", "heco", "hedera", "heiko", diff --git a/projects/helper/env.js b/projects/helper/env.js index d4f517ebf5be..7fc7c2ebc61b 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -24,6 +24,7 @@ const DEFAULTS = { TAIKO_RPC_MULTICALL: '0xcb2436774C3e191c85056d248EF4260ce5f27A9D', SEI_RPC: 'https://evm-rpc.sei-apis.com/', LUKSO_RPC: 'https://rpc.lukso.sigmacore.io', + HAM_RPC: 'https://rpc.ham.fun', } const ENV_KEYS = [ diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 24098fff64fa..95d8a211dce5 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -81,6 +81,9 @@ const fixBalancesTokens = { KINT: { coingeckoId: "kintsugi", decimals: 12 }, KBTC: { coingeckoId: "kintsugi-btc", decimals: 8 }, }, + ham: { + '0x4200000000000000000000000000000000000006': { coingeckoId: 'ethereum', decimals: 18 }, + }, blast: { '0xf7bc58b8d8f97adc129cfc4c9f45ce3c0e1d2692': { coingeckoId: "wrapped-bitcoin", decimals: 8 }, '0x9e0d7d79735e1c63333128149c7b616a0dc0bbdb': { coingeckoId: "weth", decimals: 18 }, //pirex eth From feea58e21621873ab7c25ec4656bc60288a28bbc Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 6 Jun 2024 11:26:45 +0200 Subject: [PATCH 221/855] add ham multicall --- projects/helper/env.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/helper/env.js b/projects/helper/env.js index 7fc7c2ebc61b..91c86eb67f3f 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -25,6 +25,7 @@ const DEFAULTS = { SEI_RPC: 'https://evm-rpc.sei-apis.com/', LUKSO_RPC: 'https://rpc.lukso.sigmacore.io', HAM_RPC: 'https://rpc.ham.fun', + HAM_RPC_MULTICALL: '0xB7c3Ea932649fBD594C881aDCb3F19415e2EA2d5', } const ENV_KEYS = [ From aa8adb0546f8d78e4a41dd9c1981fb20e105a7c5 Mon Sep 17 00:00:00 2001 From: Mykola Bezruk Date: Thu, 6 Jun 2024 12:34:17 +0300 Subject: [PATCH 222/855] Add sei chain to myso v2 (#10518) * add sei network to myso v2 * Update index.js --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/myso-v2/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/myso-v2/index.js b/projects/myso-v2/index.js index 6b7bd72a44c3..f6957fd3805d 100644 --- a/projects/myso-v2/index.js +++ b/projects/myso-v2/index.js @@ -107,6 +107,9 @@ const config = { linea: { fromBlock: 2118418, }, + sei: { + fromBlock: 79773668, + }, }; Object.keys(config).forEach((chain) => { From dcfb16ff3aa8a369852116fd3506c32742cbd216 Mon Sep 17 00:00:00 2001 From: smithmonnnnnnn <130979786+smithmonnnnnnn@users.noreply.github.com> Date: Thu, 6 Jun 2024 17:59:41 +0800 Subject: [PATCH 223/855] Fix the Nibiru Chain Tvl query error (#10531) * Kryptonite:SEI Liquid Staking Platform TVL * Add STSEI-USEI-LP to the statistics of Pool2 * Add staking tvl on the Nibiru chain * fix nibiru tvl query error --- projects/kryptonite/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/kryptonite/index.js b/projects/kryptonite/index.js index 2ebb4b890354..d2584d3830c4 100644 --- a/projects/kryptonite/index.js +++ b/projects/kryptonite/index.js @@ -58,8 +58,8 @@ Object.keys(config).forEach(chain => { module.exports[chain] = { tvl: async (api) => { // Logic for calculating TVL excluding staked LP tokens - const { total_bond_stsei_amount } = await queryContractWithRetries({ contract: hub, chain, data: { state: {} } }); - api.add(coinGeckoId, total_bond_stsei_amount / 10 ** 6, { skipChain: true }); + const { total_bond_stsei_amount, total_bond_st_amount } = await queryContractWithRetries({ contract: hub, chain, data: { state: {} } }); + api.add(coinGeckoId, (total_bond_stsei_amount ?? total_bond_st_amount) / 10 ** 6, { skipChain: true }); return api.getBalances(); }, pool2: async (api) => { From d417d79577cde6cd07ffee56a4750a19f4a5c69c Mon Sep 17 00:00:00 2001 From: Austin <128147981+austinjfi@users.noreply.github.com> Date: Thu, 6 Jun 2024 15:58:08 +0530 Subject: [PATCH 224/855] feat: new contracts and tokens (#10533) --- projects/brine/index.js | 48 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/projects/brine/index.js b/projects/brine/index.js index de87774c2735..74cb4d2069e5 100644 --- a/projects/brine/index.js +++ b/projects/brine/index.js @@ -3,6 +3,11 @@ const { sumTokensExport } = require("../helper/unwrapLPs"); const ethereumContracts = ["0x1390f521A79BaBE99b69B37154D63D431da27A07", "0xe17F8e501bF5e968e39D8702B30c3A8b955d8f52"]; const polygonContracts = ["0x2714C5958e2b1417B3f2b7609202FFAD359a5965"]; +const optimismContracts = ["0xBdd40916bBC43bE14dd7183C30a64EE4A893D97f"]; +const arbitrumContracts = ["0x149e2C169f10914830EF39B9d184AE62BbCdF526"]; +const lineaContracts = ["0x508f001baa00976fc1d679af880267555900ab09"]; +const modeContracts = ["0xB884389d818046F48Ca63d4cCAF303ba65f6DbC1"]; +const scrollContracts = ["0x1e4a1a0d31cFDDC722965a0c2d3bBecF748252d6"]; const ethereumTokens = [ ADDRESSES.null, @@ -10,17 +15,58 @@ const ethereumTokens = [ ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.WBTC, ADDRESSES.ethereum.MATIC, - '0xB50721BCf8d664c30412Cfbc6cf7a15145234ad1', + '0xB50721BCf8d664c30412Cfbc6cf7a15145234ad1', // arb ADDRESSES.ethereum.LINK, ADDRESSES.ethereum.AAVE, ADDRESSES.ethereum.MKR, + ADDRESSES.ethereum.LIDO, + "0xD33526068D116cE69F19A9ee46F0bd304F21A51f", // rpl + "0xCa14007Eff0dB1f8135f4C25B34De49AB0d42766", // strk + "0xc00e94cb662c3520282e6f5717214004a7f26888" // comp ]; const polygonTokens = [ + ADDRESSES.null, ADDRESSES.polygon.USDC, + ADDRESSES.polygon.USDT, +] + +const optimismTokens = [ + ADDRESSES.null, + ADDRESSES.optimism.USDC, + ADDRESSES.optimism.USDT, +] + +const arbitrumTokens = [ + ADDRESSES.null, + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.USDT, +] + +const lineaTokens = [ + ADDRESSES.null, + ADDRESSES.linea.USDC, + ADDRESSES.linea.USDT, +] + +const modeTokens = [ + ADDRESSES.null, + ADDRESSES.mode.USDC, + ADDRESSES.mode.USDT +] + +const scrollTokens = [ + ADDRESSES.null, + ADDRESSES.scroll.USDC, + ADDRESSES.scroll.USDT ] module.exports = { start: 1685817000, ethereum: { tvl: sumTokensExport({ owners: ethereumContracts, tokens: ethereumTokens, }) }, polygon: { tvl: sumTokensExport({ owners: polygonContracts, tokens: polygonTokens}) }, + optimism: { tvl: sumTokensExport({ owners: optimismContracts, tokens: optimismTokens}) }, + arbitrum: { tvl: sumTokensExport({ owners: arbitrumContracts, tokens: arbitrumTokens}) }, + linea: { tvl: sumTokensExport({ owners: lineaContracts, tokens: lineaTokens}) }, + mode: { tvl: sumTokensExport({ owners: modeContracts, tokens: modeTokens}) }, + scroll: { tvl: sumTokensExport({ owners: scrollContracts, tokens: scrollTokens}) }, }; From 3186d31fc8ea668f5dc18c065ad30ebf8903fcc8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 6 Jun 2024 13:45:01 +0200 Subject: [PATCH 225/855] track rosen bridge --- projects/rosen-bridge/index.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 projects/rosen-bridge/index.js diff --git a/projects/rosen-bridge/index.js b/projects/rosen-bridge/index.js new file mode 100644 index 000000000000..9dcc3196fa2f --- /dev/null +++ b/projects/rosen-bridge/index.js @@ -0,0 +1,30 @@ +const { sumTokensExport } = require("../helper/sumTokens"); +const ADDRESSES = require('../helper/coreAssets.json'); + +module.exports = { + timetravel: false, + ergo: { + tvl: sumTokensExport({ + owners: [ + "nB3L2PD3J4rMmyGk7nnNdESpPXxhPRQ4t1chF8LTXtceMQjKCEgL2pFjPY6cehGjyEFZyHEomBTFXZyqfonvxDozrTtK5JzatD8SdmcPeJNWPvdRb5UxEMXE4WQtpAFzt2veT8Z6bmoWN", + ], + tokens: [ + ADDRESSES.null, + '0cd8c9f416e5b1ca9f986a7f10a84191dfb85941619e49e53c0dc30ebf83324b', + '9a06d9e545a41fd51eeffc5e20d818073bf820c635e2a9d922269913e0de369d', + '03faf2cb329f2e90d6d23b58d91bbb6c046aa143261cc21f52fbe2824bfcbf04', + ] + }), + }, + cardano: { + tvl: sumTokensExport({ + owners: [ + "addr1v8kqhz5lkdxqm8qtkn4lgd9f4890v0j6advjfmk5k9amu4c535lsu", + ], + tokens: [ + ADDRESSES.null, + 'a0028f350aaabe0545fdcb56b039bfb08e4bb4d8c4d7c3c7d481c235484f534b59' + ] + }), + }, +}; From be209010ecfbef3f34f33d17e6aaebdeb3c4498a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 6 Jun 2024 13:47:49 +0200 Subject: [PATCH 226/855] PR #10532: rosen bridge --- projects/rosen-bridge/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/rosen-bridge/index.js b/projects/rosen-bridge/index.js index 9dcc3196fa2f..92b66bfe6219 100644 --- a/projects/rosen-bridge/index.js +++ b/projects/rosen-bridge/index.js @@ -7,6 +7,8 @@ module.exports = { tvl: sumTokensExport({ owners: [ "nB3L2PD3J4rMmyGk7nnNdESpPXxhPRQ4t1chF8LTXtceMQjKCEgL2pFjPY6cehGjyEFZyHEomBTFXZyqfonvxDozrTtK5JzatD8SdmcPeJNWPvdRb5UxEMXE4WQtpAFzt2veT8Z6bmoWN", + "LXwmG9jPiXvYd6Z1DWRazpc2wTdpW2awCB9NV5qjJx4UFoncqYxve6G1gzTVBNCsDwSu5ZPEi6LNLuPdzM1r9DUMgAzEfGghKeoGebPAyLCerZ8Us4ukQSJPj8j3TQY5JLZDqS2BRcPkmovmt7SZCKD95zoNgsitrYdmv2JhoC8Wmq7aM3DpwmhejCZ59n1ZYCAL7LsKw4zX45tH3sGLXxmeBNCCkcT2yxiziEAn2C3ybXqqab7cMhkoNdRMwXpUUpk3489kfyTY7SjbUPqPKhkH9veUS6H4U7a4HaEi7tPyueHTbjjQZjCZd5uGi5tC7jMvrgjYqByUG9PA9oeXHj89RxK5TPbbmkmsZVHVtdBzfHiexJh32LMszDRHuUc6YfisZKx9kNSSzadBdLbJUGHeCd8XaBg6w3e1uUBQDghpx2z44C2GZbAmUQSUQ2jqY8BBwEhtaxzZ69NK3dEjTFgsZ1R3nkbhbAu5Xs5fabBWZo6RvaPf8jTKRwKaNgQZrL93QV2JEZoapbRHCdvzaHHpBLr1p6nkDg2kB3rUTj6kmaabxswG8bSLAA9qYZhDCyh1QdSyUnd9T2o7qHybaoeEuqG1kEWYon4741ut8HCqbwEjKze6rDuEbnPUYzSr7kiwoPeV2GrdsVFRLgxwgHJoENgjUhj1VVKZB2q7n8S6smwf7CJyYZZCZGkg5bLpywJddmegJjk2FuLwA2VEmnrDKRGpFkhxBc2rbj974XgGcBZ66mPTtwrXUwjY9G5hUArtYs8WhsCDAH58yaHFFViaAhBNDQ3HBtFbXwh6b1osdv8zDSvncYXPx2iikhmf6TRC2DE2ENYtzhLHJmgyXmQkm7yXp6nWxJaeLnUuxRaWdxxQSPy1Wnm1GvKJYzRBhv9RdcmDnEgKs21ex5uSSdqJ4H53Qs6StxGyQ4HyjTjEVUxTbUZpnzvECgAufKkuSPyC2mYkKKGrzWmvv5sh6fyo4eAq9QnfXB9YMETMpJbx5dFpc6ZXYimSCfJbJfP1bpCe1hXkhTPWeZJ9aPX6HZEfu89ChZiX32MaSM3QnnUhRbSnzdQ2jVAtqqwjNN5SeNNvXNxS6B1UHj52TGvGrLnNUp4BWgNKAAwpBxAAB7wny9tUSXt6jHVnGHBG1vJWF7S9DeaVjKg3qR8j1bUsGqh9bVkarag4SREopK8cHwFpb2yFcdGERfaKHyekAUjVkhqySH3Vb8GiAdDbRArKV2ip4eveocsFwjoCD5i9rotksNysgi9RDjkApYm7aJegC79omCujHVYFpU6HtV2AhNVFRvVBG2xDW9YEKEm3RxrjoCttM6sFkbNX61CSiQ3LsBPvcd5Aix9NUESjbNxFwARZ75UgquvFddApn13yxSqfzVoE9L3eRnAMxd7KHudBWQsnDK", + "ChTbcUHgBNqNMVjzV1dvCb2UDrX9nh6rGGcURCFEYXuH5ykKh7Ea3FvpFhHb9AnxXJkgAZ6WASN7Rdn7VMgkFaqP5Z5RWp84cDTmsZkhYrgAVGN7mjeLs8UxqUvRi2ArZbm35Xqk8Y88Uq2MJzmDVHLHzCYRGym8XPxFM4YEVxqzHSKYYDvaMLgKvoskFXKrvceAqEiyih26hjpekCmefiF1VmrPwwShrYYxgHLFCZdigw5JWKV4DmewuR1FH3oNtGoFok859SXeuRbpQfrTjHhGVfDsbXEo3GYP2imAh1APKyLEsG9LcE5WZnJV8eseQnYA8sACLDKZ8Tbpp9KUE7QZNFpnwGnkYx7eybbrCeFDFjTGpsBzaS6fRKrWj2J4Wy3TTyTU1F8iMCrHBF8inZPw9Kg9YEZuJMdXDFNtuaK15u86mF2s2Z5B1vdL5MtZfWThFLnixKds8ABEmGbe8n75Dym5Wv3pkEXQ6XPpaMjUxHfRJB3EfcoFM5nsZHWSTfbFBcHxSRnEiiU67cgJsBUpQn7FvEvqNLiKM4fL3yyykMtQ6RjAS8rhycszphvQa5qFrDHie4vPuTq8", ], tokens: [ ADDRESSES.null, From 27e73737959685db96033173fd3b76d71343cdcf Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 6 Jun 2024 15:31:47 +0200 Subject: [PATCH 227/855] track rosen collateral --- projects/rosen-bridge/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/rosen-bridge/index.js b/projects/rosen-bridge/index.js index 92b66bfe6219..0d575bcff0a9 100644 --- a/projects/rosen-bridge/index.js +++ b/projects/rosen-bridge/index.js @@ -17,6 +17,11 @@ module.exports = { '03faf2cb329f2e90d6d23b58d91bbb6c046aa143261cc21f52fbe2824bfcbf04', ] }), + staking: sumTokensExport({ + owners: [ + "LXwmG9jPiXvYd6Z1DWRazpc2wTdpW2awCB9NV5qjJx4UFoncqYxve6G1gzTVBNCsDwSu5ZPEi6LNLuPdzM1r9DUMgAzEfGghKeoGebPAyLCerZ8Us4ukQSJPj8j3TQY5JLZBwceKrx1KHjeRRQBwBgxTkfButyeLtHgMELArAC9DDaZbYg7o2t98LMUZyArDzmK5fmhdKgeo6Dw4oZ1ENbepgqG35kR2pS63heXUeEuhH4nvqfLGHwSTanzhsQeBmYH9iqxSFfCvoRFnasoEPkWAv6PwGURqUk23wS5J9CaSadgPYRNdB915Vjf2kvxxmPFwoW9Uq1ZRo5DDS49goU3YbMgDJPnekbGQ9u9jMcwvo8FGRMiJVyEy2zdncnqPUaipekDaDowgf8EKYxBRYPo93DGga9FCVAoMC2PzRXRN1Q4X2zCx9onwMPoTWu2nFjYdx58bqzqs2ToK4S7UXZw4vpt6oSam7XN2miAfSN8WJmYRJ3FSGNfUz1ryo6N8uoecwEGeFksvbkobAvykuDGzeCNgdeNnRnMFZrco3kPvdzMf75tsRJu5ZTpTMW5mJWm6NbPJwxgV5JdxUvHPd8SCCmFKxhFywqVifp6WRMMqfVKaBdmXWG7zzN6hJZhf9EHupjR4KZExmuShvpx5bA1YyMUz1MpE9VP7vkLJWDYXfpJHJEWFRiADfSHt2RE5LzepxScfoHfpE7C6e4TBQBZd3dndxWDRREZSV45A1iXdq14AYqcsoBJ5Y8JCGHzXaGCLiBHvsXFMfUdTHhbPA8cegddhhZ2tK29UhR3veSGcjVZ1YwzVthQeJZK8RMbbbdf2s3f7dr8a7YGLU31T2jjy4tPR26ZFSadcuuMFR6QQisRP7qBKpgmUJc68fWdwNsLr8FLW8q2yipH1YnsWG389BQ9aXM4Zfb2WmXUT6JCpaeABWUFCLv6w3BkuBHyUFmmfiiHNx1E9u1VEuibAJYEkC6BEuoCKDqxMV62wdjbahsAn4fZdpQyVMK6xADbY2FXrREeaq4KDGzY4XYVZxaEZs3CEeedoZjFLbBe7ysm4MWqCiK7tucARTFF4XaxoH1C5JqqiraqRm4HBGVcjfzcyMwMHUC15m2N4AoQycb97Dn8W4Qp7s7gmchThLotvP2E7t7CXDa21cwKdVx9nh2xTJRPaXzMjt49L4AbXqT9RJ9PeRsYzKcQLcgugdDoB3vDtFBTZeoNNvf43JFpapTozoQtSfj7iNrPYfaEkNvCEzLjqJVyMPZ7gt13aySy5jDPp2vF5hGd5f6yv21PAiwQtfV47hn7y5hZfKv4T3gDE4sD6UQ2HFmhrAXmcuZ4AtfZZXpC3vgw6vhraKUFsHKjLZU3WKKAwnPW1HJC61jiutpnaBK1hDhop6FHkjvNtGrSnti", + ], + }), }, cardano: { tvl: sumTokensExport({ From 718fe2e495c982654e90cd9de2749ddfdd7f4a9e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 6 Jun 2024 15:34:38 +0200 Subject: [PATCH 228/855] track rosen collateral --- projects/rosen-bridge/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/rosen-bridge/index.js b/projects/rosen-bridge/index.js index 0d575bcff0a9..acd2ceb0f632 100644 --- a/projects/rosen-bridge/index.js +++ b/projects/rosen-bridge/index.js @@ -7,7 +7,6 @@ module.exports = { tvl: sumTokensExport({ owners: [ "nB3L2PD3J4rMmyGk7nnNdESpPXxhPRQ4t1chF8LTXtceMQjKCEgL2pFjPY6cehGjyEFZyHEomBTFXZyqfonvxDozrTtK5JzatD8SdmcPeJNWPvdRb5UxEMXE4WQtpAFzt2veT8Z6bmoWN", - "LXwmG9jPiXvYd6Z1DWRazpc2wTdpW2awCB9NV5qjJx4UFoncqYxve6G1gzTVBNCsDwSu5ZPEi6LNLuPdzM1r9DUMgAzEfGghKeoGebPAyLCerZ8Us4ukQSJPj8j3TQY5JLZDqS2BRcPkmovmt7SZCKD95zoNgsitrYdmv2JhoC8Wmq7aM3DpwmhejCZ59n1ZYCAL7LsKw4zX45tH3sGLXxmeBNCCkcT2yxiziEAn2C3ybXqqab7cMhkoNdRMwXpUUpk3489kfyTY7SjbUPqPKhkH9veUS6H4U7a4HaEi7tPyueHTbjjQZjCZd5uGi5tC7jMvrgjYqByUG9PA9oeXHj89RxK5TPbbmkmsZVHVtdBzfHiexJh32LMszDRHuUc6YfisZKx9kNSSzadBdLbJUGHeCd8XaBg6w3e1uUBQDghpx2z44C2GZbAmUQSUQ2jqY8BBwEhtaxzZ69NK3dEjTFgsZ1R3nkbhbAu5Xs5fabBWZo6RvaPf8jTKRwKaNgQZrL93QV2JEZoapbRHCdvzaHHpBLr1p6nkDg2kB3rUTj6kmaabxswG8bSLAA9qYZhDCyh1QdSyUnd9T2o7qHybaoeEuqG1kEWYon4741ut8HCqbwEjKze6rDuEbnPUYzSr7kiwoPeV2GrdsVFRLgxwgHJoENgjUhj1VVKZB2q7n8S6smwf7CJyYZZCZGkg5bLpywJddmegJjk2FuLwA2VEmnrDKRGpFkhxBc2rbj974XgGcBZ66mPTtwrXUwjY9G5hUArtYs8WhsCDAH58yaHFFViaAhBNDQ3HBtFbXwh6b1osdv8zDSvncYXPx2iikhmf6TRC2DE2ENYtzhLHJmgyXmQkm7yXp6nWxJaeLnUuxRaWdxxQSPy1Wnm1GvKJYzRBhv9RdcmDnEgKs21ex5uSSdqJ4H53Qs6StxGyQ4HyjTjEVUxTbUZpnzvECgAufKkuSPyC2mYkKKGrzWmvv5sh6fyo4eAq9QnfXB9YMETMpJbx5dFpc6ZXYimSCfJbJfP1bpCe1hXkhTPWeZJ9aPX6HZEfu89ChZiX32MaSM3QnnUhRbSnzdQ2jVAtqqwjNN5SeNNvXNxS6B1UHj52TGvGrLnNUp4BWgNKAAwpBxAAB7wny9tUSXt6jHVnGHBG1vJWF7S9DeaVjKg3qR8j1bUsGqh9bVkarag4SREopK8cHwFpb2yFcdGERfaKHyekAUjVkhqySH3Vb8GiAdDbRArKV2ip4eveocsFwjoCD5i9rotksNysgi9RDjkApYm7aJegC79omCujHVYFpU6HtV2AhNVFRvVBG2xDW9YEKEm3RxrjoCttM6sFkbNX61CSiQ3LsBPvcd5Aix9NUESjbNxFwARZ75UgquvFddApn13yxSqfzVoE9L3eRnAMxd7KHudBWQsnDK", "ChTbcUHgBNqNMVjzV1dvCb2UDrX9nh6rGGcURCFEYXuH5ykKh7Ea3FvpFhHb9AnxXJkgAZ6WASN7Rdn7VMgkFaqP5Z5RWp84cDTmsZkhYrgAVGN7mjeLs8UxqUvRi2ArZbm35Xqk8Y88Uq2MJzmDVHLHzCYRGym8XPxFM4YEVxqzHSKYYDvaMLgKvoskFXKrvceAqEiyih26hjpekCmefiF1VmrPwwShrYYxgHLFCZdigw5JWKV4DmewuR1FH3oNtGoFok859SXeuRbpQfrTjHhGVfDsbXEo3GYP2imAh1APKyLEsG9LcE5WZnJV8eseQnYA8sACLDKZ8Tbpp9KUE7QZNFpnwGnkYx7eybbrCeFDFjTGpsBzaS6fRKrWj2J4Wy3TTyTU1F8iMCrHBF8inZPw9Kg9YEZuJMdXDFNtuaK15u86mF2s2Z5B1vdL5MtZfWThFLnixKds8ABEmGbe8n75Dym5Wv3pkEXQ6XPpaMjUxHfRJB3EfcoFM5nsZHWSTfbFBcHxSRnEiiU67cgJsBUpQn7FvEvqNLiKM4fL3yyykMtQ6RjAS8rhycszphvQa5qFrDHie4vPuTq8", ], tokens: [ @@ -19,8 +18,13 @@ module.exports = { }), staking: sumTokensExport({ owners: [ + "ChTbcUHgBNqNMVjzV1dvCb2UDrX9nh6rGGcURCFEYXuH5ykKh7Ea3FvpFhHb9AnxXJkgAZ6WASN7Rdn7VMgkFaqP5Z5RWp84cDTmsZkhYrgAVGN7mjeLs8UxqUvRi2ArZbm35Xqk8Y88Uq2MJzmDVHLHzCYRGym8XPxFM4YEVxqzHSKYYDvaMLgKvoskFXKrvceAqEiyih26hjpekCmefiF1VmrPwwShrYYxgHLFCZdigw5JWKV4DmewuR1FH3oNtGoFok859SXeuRbpQfrTjHhGVfDsbXEo3GYP2imAh1APKyLEsG9LcE5WZnJV8eseQnYA8sACLDKZ8Tbpp9KUE7QZNFpnwGnkYx7eybbrCeFDFjTGpsBzaS6fRKrWj2J4Wy3TTyTU1F8iMCrHBF8inZPw9Kg9YEZuJMdXDFNtuaK15u86mF2s2Z5B1vdL5MtZfWThFLnixKds8ABEmGbe8n75Dym5Wv3pkEXQ6XPpaMjUxHfRJB3EfcoFM5nsZHWSTfbFBcHxSRnEiiU67cgJsBUpQn7FvEvqNLiKM4fL3yyykMtQ6RjAS8rhycszphvQa5qFrDHie4vPuTq8", + "LXwmG9jPiXvYd6Z1DWRazpc2wTdpW2awCB9NV5qjJx4UFoncqYxve6G1gzTVBNCsDwSu5ZPEi6LNLuPdzM1r9DUMgAzEfGghKeoGebPAyLCerZ8Us4ukQSJPj8j3TQY5JLZDqS2BRcPkmovmt7SZCKD95zoNgsitrYdmv2JhoC8Wmq7aM3DpwmhejCZ59n1ZYCAL7LsKw4zX45tH3sGLXxmeBNCCkcT2yxiziEAn2C3ybXqqab7cMhkoNdRMwXpUUpk3489kfyTY7SjbUPqPKhkH9veUS6H4U7a4HaEi7tPyueHTbjjQZjCZd5uGi5tC7jMvrgjYqByUG9PA9oeXHj89RxK5TPbbmkmsZVHVtdBzfHiexJh32LMszDRHuUc6YfisZKx9kNSSzadBdLbJUGHeCd8XaBg6w3e1uUBQDghpx2z44C2GZbAmUQSUQ2jqY8BBwEhtaxzZ69NK3dEjTFgsZ1R3nkbhbAu5Xs5fabBWZo6RvaPf8jTKRwKaNgQZrL93QV2JEZoapbRHCdvzaHHpBLr1p6nkDg2kB3rUTj6kmaabxswG8bSLAA9qYZhDCyh1QdSyUnd9T2o7qHybaoeEuqG1kEWYon4741ut8HCqbwEjKze6rDuEbnPUYzSr7kiwoPeV2GrdsVFRLgxwgHJoENgjUhj1VVKZB2q7n8S6smwf7CJyYZZCZGkg5bLpywJddmegJjk2FuLwA2VEmnrDKRGpFkhxBc2rbj974XgGcBZ66mPTtwrXUwjY9G5hUArtYs8WhsCDAH58yaHFFViaAhBNDQ3HBtFbXwh6b1osdv8zDSvncYXPx2iikhmf6TRC2DE2ENYtzhLHJmgyXmQkm7yXp6nWxJaeLnUuxRaWdxxQSPy1Wnm1GvKJYzRBhv9RdcmDnEgKs21ex5uSSdqJ4H53Qs6StxGyQ4HyjTjEVUxTbUZpnzvECgAufKkuSPyC2mYkKKGrzWmvv5sh6fyo4eAq9QnfXB9YMETMpJbx5dFpc6ZXYimSCfJbJfP1bpCe1hXkhTPWeZJ9aPX6HZEfu89ChZiX32MaSM3QnnUhRbSnzdQ2jVAtqqwjNN5SeNNvXNxS6B1UHj52TGvGrLnNUp4BWgNKAAwpBxAAB7wny9tUSXt6jHVnGHBG1vJWF7S9DeaVjKg3qR8j1bUsGqh9bVkarag4SREopK8cHwFpb2yFcdGERfaKHyekAUjVkhqySH3Vb8GiAdDbRArKV2ip4eveocsFwjoCD5i9rotksNysgi9RDjkApYm7aJegC79omCujHVYFpU6HtV2AhNVFRvVBG2xDW9YEKEm3RxrjoCttM6sFkbNX61CSiQ3LsBPvcd5Aix9NUESjbNxFwARZ75UgquvFddApn13yxSqfzVoE9L3eRnAMxd7KHudBWQsnDK", "LXwmG9jPiXvYd6Z1DWRazpc2wTdpW2awCB9NV5qjJx4UFoncqYxve6G1gzTVBNCsDwSu5ZPEi6LNLuPdzM1r9DUMgAzEfGghKeoGebPAyLCerZ8Us4ukQSJPj8j3TQY5JLZBwceKrx1KHjeRRQBwBgxTkfButyeLtHgMELArAC9DDaZbYg7o2t98LMUZyArDzmK5fmhdKgeo6Dw4oZ1ENbepgqG35kR2pS63heXUeEuhH4nvqfLGHwSTanzhsQeBmYH9iqxSFfCvoRFnasoEPkWAv6PwGURqUk23wS5J9CaSadgPYRNdB915Vjf2kvxxmPFwoW9Uq1ZRo5DDS49goU3YbMgDJPnekbGQ9u9jMcwvo8FGRMiJVyEy2zdncnqPUaipekDaDowgf8EKYxBRYPo93DGga9FCVAoMC2PzRXRN1Q4X2zCx9onwMPoTWu2nFjYdx58bqzqs2ToK4S7UXZw4vpt6oSam7XN2miAfSN8WJmYRJ3FSGNfUz1ryo6N8uoecwEGeFksvbkobAvykuDGzeCNgdeNnRnMFZrco3kPvdzMf75tsRJu5ZTpTMW5mJWm6NbPJwxgV5JdxUvHPd8SCCmFKxhFywqVifp6WRMMqfVKaBdmXWG7zzN6hJZhf9EHupjR4KZExmuShvpx5bA1YyMUz1MpE9VP7vkLJWDYXfpJHJEWFRiADfSHt2RE5LzepxScfoHfpE7C6e4TBQBZd3dndxWDRREZSV45A1iXdq14AYqcsoBJ5Y8JCGHzXaGCLiBHvsXFMfUdTHhbPA8cegddhhZ2tK29UhR3veSGcjVZ1YwzVthQeJZK8RMbbbdf2s3f7dr8a7YGLU31T2jjy4tPR26ZFSadcuuMFR6QQisRP7qBKpgmUJc68fWdwNsLr8FLW8q2yipH1YnsWG389BQ9aXM4Zfb2WmXUT6JCpaeABWUFCLv6w3BkuBHyUFmmfiiHNx1E9u1VEuibAJYEkC6BEuoCKDqxMV62wdjbahsAn4fZdpQyVMK6xADbY2FXrREeaq4KDGzY4XYVZxaEZs3CEeedoZjFLbBe7ysm4MWqCiK7tucARTFF4XaxoH1C5JqqiraqRm4HBGVcjfzcyMwMHUC15m2N4AoQycb97Dn8W4Qp7s7gmchThLotvP2E7t7CXDa21cwKdVx9nh2xTJRPaXzMjt49L4AbXqT9RJ9PeRsYzKcQLcgugdDoB3vDtFBTZeoNNvf43JFpapTozoQtSfj7iNrPYfaEkNvCEzLjqJVyMPZ7gt13aySy5jDPp2vF5hGd5f6yv21PAiwQtfV47hn7y5hZfKv4T3gDE4sD6UQ2HFmhrAXmcuZ4AtfZZXpC3vgw6vhraKUFsHKjLZU3WKKAwnPW1HJC61jiutpnaBK1hDhop6FHkjvNtGrSnti", ], + tokens: [ + '8b08cdd5449a9592a9e79711d7d79249d7a03c535d17efaee83e216e80a44c4b', + ] }), }, cardano: { From 4e0321fd79e5262420c1e88d8e3ebabc229b49a1 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 6 Jun 2024 19:35:11 +0530 Subject: [PATCH 229/855] add divvy.bet (#10530) * Add: divvy.bet * refactor code * chore: house authority PDA and whitelisted house keys (#10534) * chore: house authority PDA and whitelisted house keys * chore: add SOL owner * bugfix: Max seed length exceeded * bugfix: Max seed length exceeded * chore: aggregate house accounts more scalable * bugfix: update solOwners mapper * bugfix: missing params in PDA helper * bugfix: PDA helper --------- Co-authored-by: kdevdivvy Co-authored-by: kdevdivvy <119331575+kdevdivvy@users.noreply.github.com> --- projects/clone/index.js | 11 +++++---- projects/divvy-bet/index.js | 47 +++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 projects/divvy-bet/index.js diff --git a/projects/clone/index.js b/projects/clone/index.js index 88136f79d806..13dabc9eaf3d 100644 --- a/projects/clone/index.js +++ b/projects/clone/index.js @@ -1,16 +1,17 @@ -const anchor = require("@coral-xyz/anchor"); +const { Program } = require("@project-serum/anchor"); const { sumTokens2, getProvider, } = require("../helper/solana"); +const { PublicKey } = require("@solana/web3.js") -const programId = new anchor.web3.PublicKey('C1onEW2kPetmHmwe74YC1ESx3LnFEpVau6g2pg4fHycr') +const programId = new PublicKey('C1onEW2kPetmHmwe74YC1ESx3LnFEpVau6g2pg4fHycr') async function tvl() { const provider = getProvider() - const idl = await anchor.Program.fetchIdl(programId, provider) - const program = new anchor.Program(idl, programId, provider) + const idl = await Program.fetchIdl(programId, provider) + const program = new Program(idl, programId, provider) let tokenAccounts = [] - const cloneAccountAddress = anchor.web3.PublicKey.findProgramAddressSync( + const cloneAccountAddress = PublicKey.findProgramAddressSync( [Buffer.from("clone")], programId)[0] const cloneAccount = await program.account.clone.fetch(cloneAccountAddress) diff --git a/projects/divvy-bet/index.js b/projects/divvy-bet/index.js new file mode 100644 index 000000000000..fe8a3d9d62c5 --- /dev/null +++ b/projects/divvy-bet/index.js @@ -0,0 +1,47 @@ +const { Program } = require("@project-serum/anchor"); +const { PublicKey } = require("@solana/web3.js"); +const { getProvider, sumTokens2 } = require("../helper/solana"); + +async function tvl() { + function findHouseAuthorityAddress(houseKey, programId) { + return PublicKey.findProgramAddressSync( + [Buffer.from("House Authority"), houseKey.toBuffer()], + programId + )[0]; + } + + const NATIVE_MINT = "So11111111111111111111111111111111111111112"; + const DIVVY_ADMIN = "AHf1MX99d31ebLfAydVPe2vVdgzZGuUaW972znWPNzZY"; + + const programId = new PublicKey("dvyFwAPniptQNb1ey4eM12L8iLHrzdiDsPPDndd6xAR"); + const provider = getProvider(); + const idl = await Program.fetchIdl(programId, provider); + const program = new Program(idl, programId, provider); + const houses = await program.account.house.all([ + { + memcmp: { + offset: 8, + bytes: DIVVY_ADMIN, // houses governed by Divvy's multisig + }, + }, + ]); + const tokensAndOwners = houses + .filter((house) => house.account.currency.toBase58() !== NATIVE_MINT) + .map((house) => { + const owner = findHouseAuthorityAddress(house.publicKey, programId); + return [house.account.currency, owner]; + }); + const solOwners = houses + .filter((house) => house.account.currency.toBase58() === NATIVE_MINT) + .map((house) => { + return findHouseAuthorityAddress(house.publicKey, programId); + }); + return sumTokens2({ tokensAndOwners, solOwners }); +} + +module.exports = { + timetravel: false, + solana: { + tvl, + }, +}; From b8f92a60a85b01af1c15c301b314b50a75613d0e Mon Sep 17 00:00:00 2001 From: mul53 Date: Thu, 6 Jun 2024 16:07:06 +0200 Subject: [PATCH 230/855] Update voltageswap adapter - add fusdv3 and pegswap (#10535) * add more assets to fuse core assets * add WETH_2 * add fusdv3 and pegswap --- projects/helper/coreAssets.json | 9 ++++++++- projects/voltage-stableswap/index.js | 28 ++++++++++++++++++++++++---- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 546ca718290e..0f548bbf34fa 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -281,7 +281,14 @@ "USDT": "0xfadbbf8ce7d5b7041be672561bba99f79c532e10", "KNC": "0x43b17749b246fd2a96de25d9e4184e27e09765b0", "BUSD": "0x6a5f6a8121592becd6747a38d67451b310f7f156", - "null": "0x0000000000000000000000000000000000000000" + "null": "0x0000000000000000000000000000000000000000", + "USDC_2": "0x28c3d1cd466ba22f6cae51b1a4692a831696391a", + "USDT_2": "0x68c9736781e9316ebf5c3d49fe0c1f45d2d104cd", + "VOLT": "0x34ef2cc892a88415e9f02b91bfa9c91fc0be6bd4", + "FUSD_3": "0xce86a1cf3cff48139598de6bf9b1df2e0f79f86f", + "WETH_2": "0x5622f6dc93e08a8b717b149677930c38d5d50682", + "BNB": "0x6acb34b1df86e254b544189ec32cf737e2482058", + "BNB_2": "0x117c0419352ddb6fe575a67faa70315bdc4a93f3" }, "evmos": { "WEVMOS": "0xd4949664cd82660aae99bedc034a0dea8a0bd517", diff --git a/projects/voltage-stableswap/index.js b/projects/voltage-stableswap/index.js index f6b1af3c59a6..1b44e9007d39 100644 --- a/projects/voltage-stableswap/index.js +++ b/projects/voltage-stableswap/index.js @@ -1,13 +1,33 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs') -const FUSD_ADDRESS = '0xd0ce1b4a349c35e61af02f5971e71ac502441e49'.toLowerCase() +const FUSD_ADDRESS = '0xd0ce1b4a349c35e61af02f5971e71ac502441e49' const STABLESWAP_ADDRESS = '0x2a68D7C6Ea986fA06B2665d08b4D08F5e7aF960c'.toLowerCase() +const FUSD_V3_ADDRESS = '0xce86a1cf3cff48139598de6bf9b1df2e0f79f86f' +const PEGSWAP_ADDRESS = '0x56ee525bb9056bed23a6055e60b2a2c5c225d1db' -const STABLES = [ADDRESSES.fuse.USDC, ADDRESSES.fuse.USDT, ADDRESSES.fuse.BUSD] +const STABLES = [ + ADDRESSES.fuse.USDC, + ADDRESSES.fuse.USDT, + ADDRESSES.fuse.BUSD, + ADDRESSES.fuse.USDC_2, + ADDRESSES.fuse.USDT_2, + ADDRESSES.fuse.BNB, + ADDRESSES.fuse.BNB_2, + ADDRESSES.fuse.WETH, + ADDRESSES.fuse.WETH_2, +] module.exports = { fuse: { - tvl: sumTokensExport({ owners: [STABLESWAP_ADDRESS, FUSD_ADDRESS], tokens: STABLES, }) - } + tvl: sumTokensExport({ + owners: [ + STABLESWAP_ADDRESS, + FUSD_ADDRESS, + FUSD_V3_ADDRESS, + PEGSWAP_ADDRESS, + ], + tokens: STABLES, + }), + }, } From d4fa16bb3e3f7e068d06d3553b2b32491b15d698 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Thu, 6 Jun 2024 15:52:24 +0100 Subject: [PATCH 231/855] add wenmarkets --- projects/wenmarkets/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/wenmarkets/index.js diff --git a/projects/wenmarkets/index.js b/projects/wenmarkets/index.js new file mode 100644 index 000000000000..b1bcd2437c76 --- /dev/null +++ b/projects/wenmarkets/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +const contract = "0x3bB94837A91E22A134053B9F38728E27055ec3d1" + +async function tvl(api) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }) +} + +module.exports = { + methodology: `We count the MATIC on ${contract}`, + polygon: { + tvl + } +} \ No newline at end of file From fc2d0ab9d688b4f7917a73369239367ddec19897 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:26:02 +0100 Subject: [PATCH 232/855] add rsk to sushiswap (#10537) --- projects/sushiswap/api.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/sushiswap/api.js b/projects/sushiswap/api.js index 02737ea89f4e..2c3e0c53af6b 100644 --- a/projects/sushiswap/api.js +++ b/projects/sushiswap/api.js @@ -95,6 +95,7 @@ module.exports = { }, blast: { tvl: getUniTVL({ factory: '0x42Fa929fc636e657AC568C0b5Cf38E203b67aC2b', useDefaultCoreAssets: true, }) }, core: { tvl: tvl2 }, + rsk: { tvl: tvl2 }, } module.exports.polygon.tvl = getChainTVL('polygon') From 4a94a9dc917f78b9be3f32fc510b2230bafa0c11 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Thu, 6 Jun 2024 17:18:24 +0100 Subject: [PATCH 233/855] add taiko to uni v3 (#10538) --- projects/uniswap/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index 0f16a9b5c9b4..96e2f7707097 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -82,7 +82,9 @@ module.exports = { scroll: { factory: "0x70C62C8b8e801124A4Aa81ce07b637A3e83cb919", fromBlock: 1367, }, blast: { factory: "0x792edade80af5fc680d96a2ed80a44247d2cf6fd", fromBlock: 400903, }, linea: { factory: "0x31FAfd4889FA1269F7a13A66eE0fB458f27D72A9", fromBlock: 25247, }, - manta: {factory: "0x06D830e15081f65923674268121FF57Cc54e4e23", fromBlock: 1191705} + manta: {factory: "0x06D830e15081f65923674268121FF57Cc54e4e23", fromBlock: 1191705}, + taiko: {factory: "0x75FC67473A91335B5b8F8821277262a13B38c9b3", fromBlock: 961} + }), filecoin: { tvl: filecoinTvl }, } From 5a2043b100662d1bc8c807845129a879b6fce77b Mon Sep 17 00:00:00 2001 From: stabble-devops <110252704+stabble-devops@users.noreply.github.com> Date: Thu, 6 Jun 2024 23:40:50 +0700 Subject: [PATCH 234/855] Add: stabble (#10522) * stabble adapter * feat: track tokens by pools * bugfix: IDL type * bugfix: IDL type * bugfix: IDL type * bugfix: unique tokens array mapping * bugfix: get tokens --- projects/stabble/index.js | 256 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 256 insertions(+) create mode 100644 projects/stabble/index.js diff --git a/projects/stabble/index.js b/projects/stabble/index.js new file mode 100644 index 000000000000..82b83afeab22 --- /dev/null +++ b/projects/stabble/index.js @@ -0,0 +1,256 @@ +const sdk = require("@defillama/sdk"); +const { Program } = require("@project-serum/anchor"); +const { PublicKey } = require("@solana/web3.js"); +const { getProvider, sumTokens2 } = require("../helper/solana"); + +async function weightedSwapTvl() { + const VAULT_ID = "w8edo9a9TDw52c1rBmVbP6dNakaAuFiPjDd52ZJwwVi"; + + const provider = getProvider(); + const programId = new PublicKey("swapFpHZwjELNnjvThjajtiVmkz3yPQEHjLtka2fwHW"); + const program = new Program(WEIGHTED_SWAP_IDL, programId, provider); + const pools = await program.account.pool.all([ + { + memcmp: { + offset: 40, + bytes: VAULT_ID, + }, + }, + ]); + const tokens = Array.from(new Set(pools.map(({ account }) => account.tokens.map(({ mint }) => mint)).flat())); + const owner = findVaultAuthorityAddress(new PublicKey(VAULT_ID)); + + return sumTokens2({ + tokens, + owner, + }); +} + +async function stableSwapTvl() { + const VAULT_ID = "stab1io8dHvK26KoHmTwwHyYmHRbUWbyEJx6CdrGabC"; + + const provider = getProvider(); + const programId = new PublicKey("swapNyd8XiQwJ6ianp9snpu4brUqFxadzvHebnAXjJZ"); + const program = new Program(STABLE_SWAP_IDL, programId, provider); + const pools = await program.account.pool.all([ + { + memcmp: { + offset: 40, + bytes: VAULT_ID, + }, + }, + ]); + const tokens = Array.from(new Set(pools.map(({ account }) => account.tokens.map(({ mint }) => mint)).flat())); + const owner = findVaultAuthorityAddress(new PublicKey(VAULT_ID)); + + return sumTokens2({ + tokens, + owner, + }); +} + +module.exports = { + timetravel: false, + solana: { tvl: sdk.util.sumChainTvls([weightedSwapTvl, stableSwapTvl]) }, +}; + +function findVaultAuthorityAddress(vaultKey) { + return PublicKey.findProgramAddressSync( + [Buffer.from("vault_authority"), vaultKey.toBuffer()], + new PublicKey("vo1tWgqZMjG61Z2T9qUaMYKqZ75CYzMuaZ2LZP1n7HV") + )[0]; +} + +const WEIGHTED_SWAP_IDL = { + version: "1.0.0", + name: "weighted_swap", + instructions: [], + accounts: [ + { + name: "pool", + type: { + kind: "struct", + fields: [ + { + name: "owner", + type: "publicKey", + }, + { + name: "vault", + type: "publicKey", + }, + { + name: "mint", + type: "publicKey", + }, + { + name: "authorityBump", + type: "u8", + }, + { + name: "isActive", + type: "bool", + }, + { + name: "invariant", + type: "u64", + }, + { + name: "swapFee", + type: "u64", + }, + { + name: "tokens", + type: { + vec: { + defined: "PoolToken", + }, + }, + }, + { + name: "pendingOwner", + type: { + option: "publicKey", + }, + }, + ], + }, + }, + ], + types: [ + { + name: "PoolToken", + type: { + kind: "struct", + fields: [ + { + name: "mint", + type: "publicKey", + }, + { + name: "decimals", + type: "u8", + }, + { + name: "scalingUp", + type: "bool", + }, + { + name: "scalingFactor", + type: "u64", + }, + { + name: "balance", + type: "u64", + }, + { + name: "weight", + type: "u64", + }, + ], + }, + }, + ], + errors: [], +}; + +const STABLE_SWAP_IDL = { + version: "1.0.0", + name: "stable_swap", + instructions: [], + accounts: [ + { + name: "pool", + type: { + kind: "struct", + fields: [ + { + name: "owner", + type: "publicKey", + }, + { + name: "vault", + type: "publicKey", + }, + { + name: "mint", + type: "publicKey", + }, + { + name: "authorityBump", + type: "u8", + }, + { + name: "isActive", + type: "bool", + }, + { + name: "ampInitialFactor", + type: "u16", + }, + { + name: "ampTargetFactor", + type: "u16", + }, + { + name: "rampStartTs", + type: "i64", + }, + { + name: "rampStopTs", + type: "i64", + }, + { + name: "swapFee", + type: "u64", + }, + { + name: "tokens", + type: { + vec: { + defined: "PoolToken", + }, + }, + }, + { + name: "pendingOwner", + type: { + option: "publicKey", + }, + }, + ], + }, + }, + ], + types: [ + { + name: "PoolToken", + type: { + kind: "struct", + fields: [ + { + name: "mint", + type: "publicKey", + }, + { + name: "decimals", + type: "u8", + }, + { + name: "scalingUp", + type: "bool", + }, + { + name: "scalingFactor", + type: "u64", + }, + { + name: "balance", + type: "u64", + }, + ], + }, + }, + ], + errors: [], +}; From 9bd8bfd135307e09d4e240cb7d24937da140d98c Mon Sep 17 00:00:00 2001 From: Jason Mansfield Date: Thu, 6 Jun 2024 13:02:42 -0400 Subject: [PATCH 235/855] Update existing Polkadex adapter - Add staking TVL (#10520) * Add Polkadex * Add Polkadex staking TVL * Change export to include staking --- projects/polkadex/api.js | 33 +++++++++++++++++++-------------- projects/polkadex/index.js | 2 +- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/projects/polkadex/api.js b/projects/polkadex/api.js index e8b856d185fd..2a3caf7d1120 100644 --- a/projects/polkadex/api.js +++ b/projects/polkadex/api.js @@ -1,22 +1,10 @@ const { ApiPromise, WsProvider } = require("@polkadot/api"); const sdk = require('@defillama/sdk') +const {fetchURL} = require("../helper/utils"); const rpcNodes = ["wss://polkadex.api.onfinality.io/public-ws", "wss://polkadex.public.curie.radiumblock.co/ws"]; const orderbookWallet = "esoEt6uZ3GuFV8EzKB2EAREe3KE9WuRVfmhK1RRtwffY78ArH" -const assetMapping = { - '193492391581201937291053139015355410612': 'pha', - '182269558229932594457975666948556356791': 'moonbeam', - '313524628741076911470961827389955394913': 'voucher-dot', - '130314105136721928300689838359167097187': 'bifrost-native-coin', - '95930534000017180603917534864279132680': 'polkadot', - '119367686984583275840673742485354142551': 'dot-is-ded', - '32595388462891559990827225517299393930': 'unique-network', - '3496813586714279103986568049643838918': 'tether', - '222121451965151777636299756141619631150': 'astar', - '226557799181424065994173367616174607641': 'interbtc', -} - function add(_api, token, bal) { _api.add(token, bal, { skipChain: true }) } @@ -26,12 +14,15 @@ async function tvl(_api) { const api = await ApiPromise.create({ provider, }); await api.isReady; + const assetMapping = await getAssetMappings(); + const pdexBalance = await api.query.system.account(orderbookWallet) add(_api,'polkadex', pdexBalance.data.free / 1e12) let requestedAssets = []; Object.keys(assetMapping).forEach(function(key) { - requestedAssets.push([key, orderbookWallet]); + if(key !== "PDEX") + requestedAssets.push([key, orderbookWallet]); }) const results = await api.query.assets.account.multi(requestedAssets); @@ -65,6 +56,20 @@ async function staking(_api) { return _api.getBalances() } +async function getAssetMappings() { + let coingeckoMappings = await fetchURL("https://integration-api.polkadex.trade/v1/assets"); + let assetMapping = {}; + + if(coingeckoMappings.data === null) + return assetMapping; + + Object.keys(coingeckoMappings.data).forEach(function(key) { + assetMapping[coingeckoMappings.data[key].asset_id] = coingeckoMappings.data[key].coingecko_id; + }) + + return assetMapping; +} + module.exports = { polkadex: { tvl: tvl, diff --git a/projects/polkadex/index.js b/projects/polkadex/index.js index 851d22d04af0..542615642dd5 100644 --- a/projects/polkadex/index.js +++ b/projects/polkadex/index.js @@ -2,5 +2,5 @@ const { getExports } = require('../helper/heroku-api') module.exports = { timetravel: false, - ...getExports("polkadex", ['polkadex']), + ...getExports("polkadex", ['polkadex'], ['staking']) } \ No newline at end of file From dde5940d98b68e6ee72d82a3ba07b4b5d5779149 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Thu, 6 Jun 2024 21:43:18 +0100 Subject: [PATCH 236/855] v3 rsk sushi (#10540) --- projects/sushiswap-v3/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/sushiswap-v3/index.js b/projects/sushiswap-v3/index.js index 93f9064367ff..3cbc37b1b412 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, }, + rsk: { factory: '0x46B3fDF7B5cde91Ac049936bF0Bdb12C5D22202E', fromBlock: 6365060, }, //this one }); const config = { From 00ad930a4abf9d84ebabbcea17027635f0944a3e Mon Sep 17 00:00:00 2001 From: MathPoem <79817711+MathPoem@users.noreply.github.com> Date: Thu, 6 Jun 2024 23:43:38 +0300 Subject: [PATCH 237/855] Update fabric (#10541) * blasterswap-v3 adapter * Update index.js * Update index.js --------- Co-authored-by: lsblk07 --- projects/blasterswap-v3/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/blasterswap-v3/index.js b/projects/blasterswap-v3/index.js index 34138e184222..e741dead563f 100644 --- a/projects/blasterswap-v3/index.js +++ b/projects/blasterswap-v3/index.js @@ -3,7 +3,7 @@ const { uniV3Export } = require("../helper/uniswapV3"); const { mergeExports } = require('../helper/utils') module.exports = mergeExports([ - uniV3Export({ blast: { factory: "0xb7a92633Bc7074c8216Dc53566fD58A77b5D32D9", fromBlock: 4308657, }, }), + uniV3Export({ blast: { factory: "0x1A8027625C830aAC43aD82a3f7cD6D5fdCE89d78", fromBlock: 4308657, }, }), ]) module.exports.blast.tvl = sdk.util.sumChainTvls([module.exports.blast.tvl]) From 3c55b52946c50e93bdec88ed2a45eb6c2b85dd3c Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Thu, 6 Jun 2024 23:27:11 +0100 Subject: [PATCH 238/855] maple syrup --- projects/maple-syrup/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/maple-syrup/index.js diff --git a/projects/maple-syrup/index.js b/projects/maple-syrup/index.js new file mode 100644 index 000000000000..bf031ef8e119 --- /dev/null +++ b/projects/maple-syrup/index.js @@ -0,0 +1,14 @@ +const rwaPools = [ + '0x80ac24aA929eaF5013f6436cdA2a7ba190f5Cc0b', +] + +async function tvl(api) { + const tokens = await api.multiCall({ abi: 'address:asset', calls: rwaPools }) + const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: rwaPools }) + api.addTokens(tokens, bals) +} + +module.exports = { + doublecounted: true, + ethereum: { tvl, } +} \ No newline at end of file From 6790196adc4120e2e20fa287541713bd50ce6929 Mon Sep 17 00:00:00 2001 From: Austin <128147981+austinjfi@users.noreply.github.com> Date: Fri, 7 Jun 2024 14:18:12 +0530 Subject: [PATCH 239/855] add usdc circle tokens (#10546) --- projects/brine/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/brine/index.js b/projects/brine/index.js index 74cb4d2069e5..89402f930182 100644 --- a/projects/brine/index.js +++ b/projects/brine/index.js @@ -33,12 +33,14 @@ const polygonTokens = [ const optimismTokens = [ ADDRESSES.null, ADDRESSES.optimism.USDC, + ADDRESSES.optimism.USDC_CIRCLE, ADDRESSES.optimism.USDT, ] const arbitrumTokens = [ ADDRESSES.null, ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.USDC_CIRCLE, ADDRESSES.arbitrum.USDT, ] From 191299d8a9290a0069d10ce947c6fcc07add7dd8 Mon Sep 17 00:00:00 2001 From: amedrontadora <134207821+amedrontadora@users.noreply.github.com> Date: Fri, 7 Jun 2024 16:48:24 +0800 Subject: [PATCH 240/855] SyncSwap: Add SyncSwap Aqua v2 factory (#10545) * add ritsu * code refactor * SyncSwap: add factories * SyncSwap: add aquaV2 factory --------- Co-authored-by: amedrontadora Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/syncswap/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/syncswap/index.js b/projects/syncswap/index.js index dd75d9ebd2e7..b24b4c8d1034 100644 --- a/projects/syncswap/index.js +++ b/projects/syncswap/index.js @@ -45,7 +45,7 @@ const config = { fromBlock: 9775, stableFactorys: ['0x5b9f21d407F35b10CbfDDca17D5D84b129356ea3','0x81251524898774F5F2FCaE7E7ae86112Cb5C317f'], classicFactorys: ['0xf2DAd89f2788a8CD54625C60b55cD3d2D0ACa7Cb','0x0a34FBDf37C246C0B401da5f00ABd6529d906193'], - aquaFactorys: ['0x20b28B1e4665FFf290650586ad76E977EAb90c5D','0xFfa499b019394d9bEB5e21FC54AD572E4942302b'] + aquaFactorys: ['0x20b28B1e4665FFf290650586ad76E977EAb90c5D','0xFfa499b019394d9bEB5e21FC54AD572E4942302b','0x0754870C1aAb00eDCFABDF4e6FEbDD30e90f327d'] }, linea: { fromBlock: 716, From eaea8753c37c5449e280e021a3b76e23c58b367e Mon Sep 17 00:00:00 2001 From: plonkai <167075793+plonkai@users.noreply.github.com> Date: Fri, 7 Jun 2024 16:51:05 +0800 Subject: [PATCH 241/855] add tradoor (#10544) --- projects/tradoor/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/tradoor/index.js diff --git a/projects/tradoor/index.js b/projects/tradoor/index.js new file mode 100644 index 000000000000..8d44d395b7f3 --- /dev/null +++ b/projects/tradoor/index.js @@ -0,0 +1,11 @@ +const { sumTokensExport } = require("../helper/chain/ton"); +const ADDRESSES = require("../helper/coreAssets.json"); + +const evaaScAddr = "EQBPAMNu5Eud9AEvplOjNlRhxI4EkuJEhEMAmxh9erxmImKs" + +module.exports = { + methodology: 'Counts EVAA smartcontract balance as TVL.', + ton: { + tvl: sumTokensExport({ owner: evaaScAddr, tokens: [ADDRESSES.null]}), + } +} From 83dbafa31fb65e86bd5a96eae2f850066de3d816 Mon Sep 17 00:00:00 2001 From: creamD3v <141406164+creamD3v@users.noreply.github.com> Date: Fri, 7 Jun 2024 16:55:32 +0800 Subject: [PATCH 242/855] Update CREAM adapter (#10548) * Update README.md * update cream adapter --------- Co-authored-by: DefiLlama <73503892+DefiLlama@users.noreply.github.com> --- projects/cream/index.js | 182 +++------------------------------------- 1 file changed, 11 insertions(+), 171 deletions(-) diff --git a/projects/cream/index.js b/projects/cream/index.js index 9de10783b742..3f60a31e7bab 100644 --- a/projects/cream/index.js +++ b/projects/cream/index.js @@ -1,178 +1,18 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const utils = require("../helper/utils"); -const { unwrapUniswapLPs, nullAddress } = require("../helper/unwrapLPs"); -const { getCompoundV2Tvl, compoundExports } = require("../helper/compound"); -const { getConfig } = require('../helper/cache') - -const abiCerc20 = require("./cerc20.json"); -const abiCereth2 = require("./creth2.json"); -const BigNumber = require("bignumber.js"); - -// -const wETH = ADDRESSES.ethereum.WETH; -const CRETH2 = "0xcBc1065255cBc3aB41a6868c22d1f1C573AB89fd"; -const crvIB = "0x27b7b1ad7288079A66d12350c828D3C00A6F07d7"; - -const replacements = { - "0xe1237aA7f535b0CC33Fd973D66cBf830354D16c7": wETH, // yWETH -> WETH - //'0x27b7b1ad7288079A66d12350c828D3C00A6F07d7': ADDRESSES.ethereum.DAI, // yearn: yCRV-IB -> DAI - "0x986b4AFF588a109c09B50A03f42E4110E29D353F": wETH, // yearn: yCRV/sETH - "0xdCD90C7f6324cfa40d7169ef80b12031770B4325": wETH, // yearn: yCRV/stETH - "0x9cA85572E6A3EbF24dEDd195623F188735A5179f": - "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490", // yearn: y3Crv -> 3Crv -}; - -async function ethereumTvl(timestamp, block) { - let balances = {}; - - let tokens_ethereum = ( - await getConfig('cream/ethereum', - "https://api.cream.finance/api/v1/crtoken?comptroller=eth" - ) - ); - - // --- Grab all the getCash values of crERC20 (Lending Contract Addresses) --- - let cashValues = ( - await sdk.api.abi.multiCall({ - block, - calls: tokens_ethereum.map((token) => ({ target: token.token_address })), - abi: abiCerc20["getCash"], - }) - ).output; - - let underlyings = ( - await sdk.api.abi.multiCall({ - block, - calls: tokens_ethereum.map((token) => ({ target: token.token_address })), - abi: abiCerc20["underlying"], - permitFailure: true, - }) - ).output; - - const lpPositions = []; - cashValues.map((cashVal, idx) => { - if (underlyings[idx].output === null) { - // It's ETH - sdk.util.sumSingleBalance( - balances, - ADDRESSES.null, - cashVal.output - ); - } else if ( - tokens_ethereum[idx].underlying_symbol === "UNI-V2" || - tokens_ethereum[idx].underlying_symbol === "SLP" - ) { - lpPositions.push({ - token: underlyings[idx].output, - balance: cashVal.output, - }); - } else if (underlyings[idx].output === crvIB || underlyings[idx].output === CRETH2) { - return; // Exclude CRETH2 //https://twitter.com/0xngmi/status/1398565590856515585 - } else { - const token = - replacements[underlyings[idx].output] || underlyings[idx].output; - sdk.util.sumSingleBalance(balances, token, cashVal.output); - } - }); - - await unwrapUniswapLPs(balances, lpPositions, block); - - - return balances; -} - -async function lending(block, chain, borrowed) { - let balances = {}; - - let tokens_bsc = ( - await getConfig('cream/'+chain, - `https://api.cream.finance/api/v1/crtoken?comptroller=${chain}` - ) - ); - - let cashValues = ( - await sdk.api.abi.multiCall({ - block, - calls: tokens_bsc.map((token) => ({ target: token.token_address })), - abi: borrowed ? abiCerc20.totalBorrows : abiCerc20["getCash"], - chain, - }) - ).output; - - let underlyings = ( - await sdk.api.abi.multiCall({ - block, - calls: tokens_bsc.map((token) => ({ target: token.token_address })), - abi: abiCerc20["underlying"], - permitFailure: true, - chain, - }) - ).output; - - const transformAdress = i => `bsc:${i}` - const lpPositions = []; - cashValues.map((cashVal, idx) => { - if (tokens_bsc[idx].underlying_symbol === "Cake-LP") { - lpPositions.push({ - token: underlyings[idx].output, - balance: cashVal.output, - }); - } else if (tokens_bsc[idx].symbol === "crBNB") { - sdk.util.sumSingleBalance( - balances, - "bsc:" + ADDRESSES.bsc.WBNB, - cashVal.output - ); // BNB - } else { - const tokenAddr = underlyings[idx].output; - sdk.util.sumSingleBalance(balances, transformAdress(tokenAddr), cashVal.output); - } - }); - await unwrapUniswapLPs(balances, lpPositions, block, 'bsc', transformAdress); - return balances -} - -const bscTvl = async (timestamp, ethBlock, chainBlocks) => { - const block = chainBlocks["bsc"]; // req for the block type - const balances = await lending(block, "bsc", false) - - // --- Staking bsc service --- - const bsc_staking_service = await utils.fetchURL( - "https://api.binance.org/v1/staking/chains/bsc/validators/bva1asktsxqny35hwxltpzqsvr64s5vr2ph2t2vlnw/" - ); - - sdk.util.sumSingleBalance( - balances, - "bsc:" + ADDRESSES.bsc.WBNB, // -- Apparently it auto-merges balances (check on output) --- - BigNumber(bsc_staking_service.data.votingPower) - .multipliedBy(10 ** 18) - .toFixed(0) - ); - - return balances; -}; - -const bscBorrowed = async (timestamp, ethBlock, chainBlocks) => { - const block = chainBlocks["bsc"]; // req for the block type - return lending(block, "bsc", true) -} +const ADDRESSES = require("../helper/coreAssets.json"); +const { compoundExports } = require("../helper/compound"); module.exports = { - hallmarks: [ - [1635292800, "Flashloan exploit"] - ], + hallmarks: [[1635292800, "Flashloan exploit"]], timetravel: false, // bsc and fantom api's for staked coins can't be queried at historical points start: 1599552000, // 09/08/2020 @ 8:00am (UTC) - ethereum: { - tvl: ethereumTvl, - }, - bsc: { - tvl: bscTvl, - borrowed: bscBorrowed - //getCompoundV2Tvl("0x589de0f0ccf905477646599bb3e5c622c84cc0ba", "bsc", addr=>`bsc:${addr}`, "0x1Ffe17B99b439bE0aFC831239dDECda2A790fF3A", ADDRESSES.bsc.WBNB, true), - }, - // ethereum:compoundExports("0x3d5BC3c8d13dcB8bF317092d84783c2697AE9258", "ethereum", "0xd06527d5e56a3495252a528c4987003b712860ee", nullAddress), + ethereum: compoundExports("0xbdC857eae1D15ad171E11af6FC3e99413Ed57Ec4", "ethereum"), + bsc: compoundExports( + "0x589DE0F0Ccf905477646599bb3E5C622C84cC0BA", + "bsc", + "0x1Ffe17B99b439bE0aFC831239dDECda2A790fF3A", + ADDRESSES.bsc.WBNB + ), polygon: compoundExports("0x20ca53e2395fa571798623f1cfbd11fe2c114c24", "polygon"), arbitrum: compoundExports("0xbadaC56c9aca307079e8B8FC699987AAc89813ee", "arbitrum"), + base: compoundExports("0x94d31f92a7f85b51F0B628467B3E660BA3e8D799", "base"), }; From 80dc38fb8e4495ebc507dac84b59c3c496d6eb17 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Fri, 7 Jun 2024 10:35:02 +0100 Subject: [PATCH 243/855] ADD binance june wallets (#10549) --- projects/binance/config.js | 67 ++++++++++++++------------------------ 1 file changed, 24 insertions(+), 43 deletions(-) diff --git a/projects/binance/config.js b/projects/binance/config.js index abdbd461a895..b9851721ea45 100644 --- a/projects/binance/config.js +++ b/projects/binance/config.js @@ -49,13 +49,13 @@ const assetList = [ ['BNB', 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'], ['BNB', 'BEP20', '0xeb2d2f1b8c558a40207669291fda468e50c8a0bb'], ['BNB', 'BEP20', '0xf977814e90da44bfa03b6295a0616a897441acec'], + ['BNB', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'], ['BNB', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'], + ['BNB', 'ETH', '0xdfd5293d8e347dfe59e90efd55b2956a1343963d'], ['BNB', 'ETH', '0xf977814e90da44bfa03b6295a0616a897441acec'], ['BNB', 'OPBNB', '0x001ceb373c83ae75b9f5cf78fc2aba3e185d09e2'], ['BNB', 'OPBNB', '0xf977814e90da44bfa03b6295a0616a897441acec'], - ['BTC', 'BEP2', 'bnb17jky4rwhu9rzgrx7exrfc3pcd5z290ga8qfm0j'], ['BTC', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'], - ['BTC', 'BEP2', 'bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t'], ['BTC', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'], ['BTC', 'BEP20', '0x0e4158c85ff724526233c1aeb4ff6f0c46827fbe'], ['BTC', 'BEP20', '0x5a52e96bacdabb82fd05763e25335261b270efcb'], @@ -145,8 +145,6 @@ const assetList = [ ['CHZ', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'], ['CHZ', 'BEP2', 'bnb1m5amny2gs3xdyta6pksmr43zu4727w24syyks7'], ['CHZ', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'], - // ['CHZ', 'CHZ2', '0x87917d879ba83ce3ada6e02d49a10c1ec1988062'], - // ['CHZ', 'CHZ2', '0xf977814e90da44bfa03b6295a0616a897441acec'], ['CHZ', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'], ['CHZ', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'], ['CHZ', 'ETH', '0x4a9e49a45a4b2545cb177f79c7381a30e1dc261f'], @@ -159,13 +157,13 @@ const assetList = [ ['CRV', 'ETH', '0xf977814e90da44bfa03b6295a0616a897441acec'], ['CVP', 'BEP20', '0x8894e0a0c962cb723c1976a4421c95949be2d4e3'], ['CVP', 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'], + ['CVP', 'BEP20', '0xf977814e90da44bfa03b6295a0616a897441acec'], ['CVP', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'], ['CVP', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'], ['CVP', 'ETH', '0x5a52e96bacdabb82fd05763e25335261b270efcb'], ['CVP', 'ETH', '0xdfd5293d8e347dfe59e90efd55b2956a1343963d'], ['CVP', 'ETH', '0xf977814e90da44bfa03b6295a0616a897441acec'], ['DOGE', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'], - ['DOGE', 'BEP2', 'bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t'], ['DOGE', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'], ['DOGE', 'BEP20', '0x0e4158c85ff724526233c1aeb4ff6f0c46827fbe'], ['DOGE', 'BEP20', '0x5a52e96bacdabb82fd05763e25335261b270efcb'], @@ -174,6 +172,7 @@ const assetList = [ ['DOGE', 'BEP20', '0xd3a22590f8243f8e83ac230d1842c9af0404c4a1'], ['DOGE', 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'], ['DOGE', 'BEP20', '0xf977814e90da44bfa03b6295a0616a897441acec'], + /* ['DOGE', 'DOGE', 'D73RQLGWW9TBT2AKspEP24wLiXFrXvnTqX'], ['DOGE', 'DOGE', 'D7BrtudMAdwz2U7vSGumVDuxZsZNibJuzw'], ['DOGE', 'DOGE', 'D7D2f2WuEkwhTWqBkisZ5sM3JagaBcNWBs'], @@ -209,10 +208,10 @@ const assetList = [ ['DOGE', 'DOGE', 'DRweGdMgohChLBn2TamjCNicKYEncRgj5a'], ['DOGE', 'DOGE', 'DTGrjpvJXQU2zSpUDsnk9b4PAQW5Pwtg4K'], ['DOGE', 'DOGE', 'DTSop4ycWkpmDqpncVZ3jwKp3z7B4kW4T3'], + ['DOGE', 'DOGE', 'DTbG3RJRejnM99g8MSnhSbJxJVW8X7YXy9'], ['DOGE', 'DOGE', 'DU8gPC5mh4KxWJARQRxoESFark2jAguBr5'], - ['DOT', 'BEP2', 'bnb17jky4rwhu9rzgrx7exrfc3pcd5z290ga8qfm0j'], + */ ['DOT', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'], - ['DOT', 'BEP2', 'bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t'], ['DOT', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'], ['DOT', 'BEP20', '0x0e4158c85ff724526233c1aeb4ff6f0c46827fbe'], ['DOT', 'BEP20', '0x5a52e96bacdabb82fd05763e25335261b270efcb'], @@ -230,7 +229,7 @@ const assetList = [ ['DOT', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'], ['DOT', 'ETH', '0xdfd5293d8e347dfe59e90efd55b2956a1343963d'], ['DOT', 'ETH', '0xf977814e90da44bfa03b6295a0616a897441acec'], - // ['ENJ', 'ENJ', 'enC1zkqfU5X4x84LMKSzcRdsSSiF7M1Nt7ovm62jRXr78uT1h'], + ['ENJ', 'ENJ', 'enC1zkqfU5X4x84LMKSzcRdsSSiF7M1Nt7ovm62jRXr78uT1h'], ['ENJ', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'], ['ENJ', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'], ['ENJ', 'ETH', '0x56eddb7aa87536c09ccc2793473599fd21a8b17f'], @@ -245,7 +244,6 @@ const assetList = [ ['ETH', 'BASE', '0x3304e22ddaa22bcdc5fca2269b418046ae7b566a'], ['ETH', 'BASE', '0xf977814e90da44bfa03b6295a0616a897441acec'], ['ETH', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'], - ['ETH', 'BEP2', 'bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t'], ['ETH', 'BEP2', 'bnb1m5amny2gs3xdyta6pksmr43zu4727w24syyks7'], ['ETH', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'], ['ETH', 'BEP2', 'bnb1xrfwzlu9c5208lhtn7ywt0mjrhjh4nt4fjyqxy'], @@ -255,6 +253,7 @@ const assetList = [ ['ETH', 'BEP20', '0x3c783c21a0383057d128bae431894a5c19f9cf06'], ['ETH', 'BEP20', '0x515b72ed8a97f42c568d6a143232775018f133c8'], ['ETH', 'BEP20', '0x5a52e96bacdabb82fd05763e25335261b270efcb'], + ['ETH', 'BEP20', '0x835678a611b28684005a5e2233695fb6cbbb0007'], ['ETH', 'BEP20', '0x8894e0a0c962cb723c1976a4421c95949be2d4e3'], ['ETH', 'BEP20', '0xa180fe01b906a1be37be6c534a3300785b20d947'], ['ETH', 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'], @@ -279,7 +278,7 @@ const assetList = [ ['ETH', 'OP', '0x5a52e96bacdabb82fd05763e25335261b270efcb'], ['ETH', 'OP', '0xacd03d601e5bb1b275bb94076ff46ed9d753435a'], ['ETH', 'OP', '0xf977814e90da44bfa03b6295a0616a897441acec'], - ['ETH', 'STK', '0x0213c67ed78bc280887234fe5ed5e77272465317978ae86c25a71531d9332a2d'], + // ['ETH', 'STK', ' 0x0213c67ed78bc280887234fe5ed5e77272465317978ae86c25a71531d9332a2d'], ['ETH', 'ERA', '0x7aed074ca56f5050d5a2e512ecc5bf7103937d76'], ['ETH', 'ERA', '0xa84fd90d8640fa63d194601e0b2d1c9094297083'], ['ETH', 'ERA', '0xf977814e90da44bfa03b6295a0616a897441acec'], @@ -287,19 +286,21 @@ const assetList = [ ['FDUSD', 'BEP20', '0x5a52e96bacdabb82fd05763e25335261b270efcb'], ['FDUSD', 'BEP20', '0x835678a611b28684005a5e2233695fb6cbbb0007'], ['FDUSD', 'BEP20', '0x8894e0a0c962cb723c1976a4421c95949be2d4e3'], + ['FDUSD', 'BEP20', '0xd3a22590f8243f8e83ac230d1842c9af0404c4a1'], ['FDUSD', 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'], - ['FDUSD', 'BEP20', '0xf977814e90da44bfa03b6295a0616a897441acec'], ['FDUSD', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'], ['FDUSD', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'], ['FDUSD', 'ETH', '0x4a9e49a45a4b2545cb177f79c7381a30e1dc261f'], ['FDUSD', 'ETH', '0x5a52e96bacdabb82fd05763e25335261b270efcb'], ['FDUSD', 'ETH', '0x835678a611b28684005a5e2233695fb6cbbb0007'], ['FDUSD', 'ETH', '0xa7c0d36c4698981fab42a7d8c783674c6fe2592d'], + ['FDUSD', 'ETH', '0xd3a22590f8243f8e83ac230d1842c9af0404c4a1'], ['FDUSD', 'ETH', '0xdfd5293d8e347dfe59e90efd55b2956a1343963d'], ['FDUSD', 'ETH', '0xf977814e90da44bfa03b6295a0616a897441acec'], ['FDUSD', 'OPBNB', '0x001ceb373c83ae75b9f5cf78fc2aba3e185d09e2'], ['FDUSD', 'OPBNB', '0xf977814e90da44bfa03b6295a0616a897441acec'], ['GRT', 'ARB', '0x5a52e96bacdabb82fd05763e25335261b270efcb'], + ['GRT', 'ARB', '0xb38e8c17e38363af6ebdcb3dae12e0243582891d'], ['GRT', 'ARB', '0xf977814e90da44bfa03b6295a0616a897441acec'], ['GRT', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'], ['GRT', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'], @@ -318,10 +319,10 @@ const assetList = [ ['HFT', 'ETH', '0xdfd5293d8e347dfe59e90efd55b2956a1343963d'], ['HFT', 'ETH', '0xf977814e90da44bfa03b6295a0616a897441acec'], ['LINK', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'], - ['LINK', 'BEP2', 'bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t'], ['LINK', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'], ['LINK', 'BEP20', '0x0e4158c85ff724526233c1aeb4ff6f0c46827fbe'], ['LINK', 'BEP20', '0x5a52e96bacdabb82fd05763e25335261b270efcb'], + ['LINK', 'BEP20', '0x835678a611b28684005a5e2233695fb6cbbb0007'], ['LINK', 'BEP20', '0x8894e0a0c962cb723c1976a4421c95949be2d4e3'], ['LINK', 'BEP20', '0xd3a22590f8243f8e83ac230d1842c9af0404c4a1'], ['LINK', 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'], @@ -334,7 +335,6 @@ const assetList = [ ['LINK', 'ETH', '0xdfd5293d8e347dfe59e90efd55b2956a1343963d'], ['LINK', 'ETH', '0xf977814e90da44bfa03b6295a0616a897441acec'], ['LTC', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'], - ['LTC', 'BEP2', 'bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t'], ['LTC', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'], ['LTC', 'BEP20', '0x0e4158c85ff724526233c1aeb4ff6f0c46827fbe'], ['LTC', 'BEP20', '0x5a52e96bacdabb82fd05763e25335261b270efcb'], @@ -346,30 +346,23 @@ const assetList = [ ['LTC', 'LTC', 'LbmGksLBwtwRXyxeazCZqKiAHX6cWN2AzN'], ['LTC', 'LTC', 'LhzEoDXHXASi4hSMxrKeVoSGrED9QsBpPq'], ['LTC', 'LTC', 'M8T1B2Z97gVdvmfkQcAtYbEepune1tzGua'], - ['LTC', 'LTC', 'MB8nnFMvR5cgvpzQ1QXTDVfUM91BcsLH3k'], - ['LTC', 'LTC', 'MBjKmoDwkuUbtnVd4vjymxjJx7Crca2s1z'], - ['LTC', 'LTC', 'MDwD5wYdeuoisfoaWKgeHK4Gq3YkbaCypJ'], ['LTC', 'LTC', 'MEhAHYijouCinmGKL6n1bRTXYznH1X24rD'], ['LTC', 'LTC', 'MG9aFQgTH5C4UPcur8S2bh5duKYMfaJFUS'], ['LTC', 'LTC', 'MGvUTN1PuWgBxuoFgTfkk4eJDzYgRivR8F'], ['LTC', 'LTC', 'MJto5wFLrE9t4TDXCgdSet8W6mxYqGijC3'], ['LTC', 'LTC', 'MJwFHGandYUFJTTHHSXg3q6u7ge4af1n4N'], ['LTC', 'LTC', 'MLjHNHuJy8VxxPzkL2MmYNoxG8b6BH4J4R'], - ['LTC', 'LTC', 'MLkNzCps6cXou2DELVfxDuRC4uZGwr397o'], ['LTC', 'LTC', 'MQd1fJwqBJvwLuyhr17PhEFx1swiqDbPQS'], ['LTC', 'LTC', 'MSeDRiNoH5Afr9b9rNo837hYzpxBXXqMZf'], ['LTC', 'LTC', 'MWGTiJBNEQSfxTCrdC2VKEa55Lck27wr67'], - ['LTC', 'LTC', 'MWkX1ZaFbrRPtcQvVpjvigxWU17JoinePy'], ['MASK', 'BEP20', '0x8894e0a0c962cb723c1976a4421c95949be2d4e3'], ['MASK', 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'], - ['MASK', 'BEP20', '0xf977814e90da44bfa03b6295a0616a897441acec'], ['MASK', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'], ['MASK', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'], ['MASK', 'ETH', '0x5a52e96bacdabb82fd05763e25335261b270efcb'], ['MASK', 'ETH', '0xdfd5293d8e347dfe59e90efd55b2956a1343963d'], ['MASK', 'ETH', '0xf977814e90da44bfa03b6295a0616a897441acec'], ['MATIC', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'], - ['MATIC', 'BEP2', 'bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t'], ['MATIC', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'], ['MATIC', 'BEP2', 'bnb1xrfwzlu9c5208lhtn7ywt0mjrhjh4nt4fjyqxy'], ['MATIC', 'BEP20', '0x0e4158c85ff724526233c1aeb4ff6f0c46827fbe'], @@ -408,7 +401,6 @@ const assetList = [ ['SHIB', 'BEP20', '0xdccf3b77da55107280bd850ea519df3705d1a75a'], ['SHIB', 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'], ['SHIB', 'BEP20', '0xeb2d2f1b8c558a40207669291fda468e50c8a0bb'], - ['SHIB', 'BEP20', '0xf977814e90da44bfa03b6295a0616a897441acec'], ['SHIB', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'], ['SHIB', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'], ['SHIB', 'ETH', '0x4976a4a02f38326660d17bf34b431dc6e2eb2327'], @@ -438,8 +430,6 @@ const assetList = [ ['SSV', 'ETH', '0xd3a22590f8243f8e83ac230d1842c9af0404c4a1'], ['SSV', 'ETH', '0xdfd5293d8e347dfe59e90efd55b2956a1343963d'], ['SSV', 'ETH', '0xf977814e90da44bfa03b6295a0616a897441acec'], - ['TUSD', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'], - ['TUSD', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'], ['TUSD', 'BEP20', '0x8894e0a0c962cb723c1976a4421c95949be2d4e3'], ['TUSD', 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'], ['TUSD', 'BEP20', '0xf977814e90da44bfa03b6295a0616a897441acec'], @@ -451,13 +441,12 @@ const assetList = [ ['TUSD', 'TRX', 'TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G'], ['TUSD', 'TRX', 'TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb'], ['UNI', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'], - ['UNI', 'BEP2', 'bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t'], ['UNI', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'], ['UNI', 'BEP20', '0x0e4158c85ff724526233c1aeb4ff6f0c46827fbe'], + ['UNI', 'BEP20', '0x5a52e96bacdabb82fd05763e25335261b270efcb'], ['UNI', 'BEP20', '0x8894e0a0c962cb723c1976a4421c95949be2d4e3'], ['UNI', 'BEP20', '0xd3a22590f8243f8e83ac230d1842c9af0404c4a1'], ['UNI', 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'], - ['UNI', 'BEP20', '0xf977814e90da44bfa03b6295a0616a897441acec'], ['UNI', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'], ['UNI', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'], ['UNI', 'ETH', '0x5a52e96bacdabb82fd05763e25335261b270efcb'], @@ -473,6 +462,7 @@ const assetList = [ ['USDC', 'AVAX', '0x4aefa39caeadd662ae31ab0ce7c8c2c9c0a013e8'], ['USDC', 'AVAX', '0x9f8c163cba728e99993abe7495f06c0a3c8ac8b9'], ['USDC', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'], + ['USDC', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'], ['USDC', 'BEP20', '0x0e4158c85ff724526233c1aeb4ff6f0c46827fbe'], ['USDC', 'BEP20', '0x1fbe2acee135d991592f167ac371f3dd893a508b'], ['USDC', 'BEP20', '0x3c783c21a0383057d128bae431894a5c19f9cf06'], @@ -487,14 +477,13 @@ const assetList = [ ['USDC', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'], ['USDC', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'], ['USDC', 'ETH', '0x4a9e49a45a4b2545cb177f79c7381a30e1dc261f'], - ['USDC', 'ETH', '0x5a52e96bacdabb82fd05763e25335261b270efcb'], + ['USDC', 'ETH', '0xbe0eb53f46cd790cd13851d5eff43d12404d33e8'], ['USDC', 'ETH', '0xd3a22590f8243f8e83ac230d1842c9af0404c4a1'], ['USDC', 'ETH', '0xdfd5293d8e347dfe59e90efd55b2956a1343963d'], - ['USDC', 'ETH', '0xf977814e90da44bfa03b6295a0616a897441acec'], ['USDC', 'MATIC', '0xe7804c37c13166ff0b37f5ae0bb07a3aebb6e245'], ['USDC', 'NEAR', '5c33c6218d47e00ef229f60da78d0897e1ee9665312550b8afd5f9c7bc6957d2'], + ['USDC', 'NEAR', 'binancecold3.near'], ['USDC', 'OP', '0xacd03d601e5bb1b275bb94076ff46ed9d753435a'], - // ['USDC', 'RON', '0xb32e9a84ae0b55b8ab715e4ac793a61b277bafa3'], ['USDC', 'SOL', '2ojv9BAiHUrvsm9gxDe7fJSzbNZSJcxZvf8dqmWGHG8S'], ['USDC', 'SOL', '5tzFkiKscXHK5ZXCGbXZxdw7gTjjD1mBwuoFbhUvuAi9'], ['USDC', 'SOL', '9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM'], @@ -502,15 +491,14 @@ const assetList = [ ['USDC', 'TRX', 'TKoMMAMrDCUY212N6M4pzmYABtgkgo7XZn'], ['USDC', 'TRX', 'TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G'], ['USDC', 'TRX', 'TVGDpgtCs45PJE7ZMHhiC76L3v77qAwJW9'], - // ['USDC', 'XLM', 'GBAIA5U6E3FSRUW55AXACIVGX2QR5JYAS74OWLED3S22EGXVYEHPLGPA'], - // ['USDC', 'XLM', 'GC5LF63GRVIT5ZXXCXLPI3RX2YXKJQFZVBSAO6AUELN3YIMSWPD6Z6FH'], + ['USDC', 'XLM', 'GBAIA5U6E3FSRUW55AXACIVGX2QR5JYAS74OWLED3S22EGXVYEHPLGPA'], + ['USDC', 'XLM', 'GC5LF63GRVIT5ZXXCXLPI3RX2YXKJQFZVBSAO6AUELN3YIMSWPD6Z6FH'], ['USDT', 'ARB', '0xb38e8c17e38363af6ebdcb3dae12e0243582891d'], ['USDT', 'ARB', '0xf977814e90da44bfa03b6295a0616a897441acec'], ['USDT', 'AVAX', '0x4aefa39caeadd662ae31ab0ce7c8c2c9c0a013e8'], ['USDT', 'AVAX', '0x5a52e96bacdabb82fd05763e25335261b270efcb'], ['USDT', 'AVAX', '0x9f8c163cba728e99993abe7495f06c0a3c8ac8b9'], ['USDT', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'], - ['USDT', 'BEP2', 'bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t'], ['USDT', 'BEP2', 'bnb1m5amny2gs3xdyta6pksmr43zu4727w24syyks7'], ['USDT', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'], ['USDT', 'BEP2', 'bnb1xrfwzlu9c5208lhtn7ywt0mjrhjh4nt4fjyqxy'], @@ -568,8 +556,8 @@ const assetList = [ ['USDT', 'TRX', 'TYASr5UV6HEcXatwdFQfmLVUqQQQMUxHLS'], ['WRX', 'BEP2', 'bnb142q467df6jun6rt5u2ar58sp47hm5f9wvz2cvg'], ['WRX', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'], - ['WRX', 'BEP2', 'bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t'], ['WRX', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'], + ['WRX', 'BEP20', '0x5a52e96bacdabb82fd05763e25335261b270efcb'], ['WRX', 'BEP20', '0x8894e0a0c962cb723c1976a4421c95949be2d4e3'], ['WRX', 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'], ['WRX', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'], @@ -577,7 +565,6 @@ const assetList = [ ['WRX', 'ETH', '0xdfd5293d8e347dfe59e90efd55b2956a1343963d'], ['WRX', 'ETH', '0xf977814e90da44bfa03b6295a0616a897441acec'], ['XRP', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'], - ['XRP', 'BEP2', 'bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t'], ['XRP', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'], ['XRP', 'BEP20', '0x0e4158c85ff724526233c1aeb4ff6f0c46827fbe'], ['XRP', 'BEP20', '0x5a52e96bacdabb82fd05763e25335261b270efcb'], @@ -599,17 +586,11 @@ const assetList = [ ['XRP', 'XRP', 'rP3mUZyCDzZkTSd1VHoBbFt8HGm8fyq8qV'], ['XRP', 'XRP', 'rPJ5GFpyDLv7gqeB1uZVUBwDwi41kaXN5A'], ['XRP', 'XRP', 'rPz2qA93PeRCyHyFCqyNggnyycJR1N4iNf'], + ['XRP', 'XRP', 'rarG6FaeYhnzSKSS5EEPofo4gFsPn2bZKk'], + ['XRP', 'XRP', 'rfQ9EcLkU6WnNmkS3EwUkFeXeN47Rk8Cvi'], + ['XRP', 'XRP', 'rhWj9gaovwu2hZxYW7p388P8GRbuXFLQkK'], ['XRP', 'XRP', 'rpmxpWis42eYV4oMhyxJNSzrLRdacJVooa'], - ['XRP', 'XRP', 'rs8ZPbYqgecRcDzQpJYAMhSxSi5htsjnza'], - // added on the 22/04/2024 - ['USDT', 'TRX', 'TJ5usJLLwjwn7Pw3TPbdzreG7dvgKzfQ5y'], - ['TRX', 'TRX', 'TJ5usJLLwjwn7Pw3TPbdzreG7dvgKzfQ5y'], - ['USDT', 'TRX', 'TK4ykR48cQQoyFcZ5N4xZCbsBaHcg6n3gJ'], - ['TRX', 'TRX', 'TK4ykR48cQQoyFcZ5N4xZCbsBaHcg6n3gJ'], - ['TRX', 'TRX', 'TCLgK89AnXbC9rewvhNb9UgXCc2qJJpBXh'], - ['USDT', 'TRX', 'TCLgK89AnXbC9rewvhNb9UgXCc2qJJpBXh'], - ['USDT', 'TRX', 'TJqwA7SoZnERE4zW5uDEiPkbz4B66h9TFj'], - ['TRX', 'TRX', 'TJqwA7SoZnERE4zW5uDEiPkbz4B66h9TFj'], + ['XRP', 'XRP', 'rs8ZPbYqgecRcDzQpJYAMhSxSi5htsjnza'], ] From f63336901158e762ee3c5d79aa87aa7fd7b27111 Mon Sep 17 00:00:00 2001 From: Kyrylo Riabov Date: Fri, 7 Jun 2024 15:19:25 +0300 Subject: [PATCH 244/855] Add Q Infinity Adapter (#10552) --- projects/helper/coreAssets.json | 4 +++- projects/helper/tokenMapping.js | 4 ++++ projects/q-infinity/index.js | 22 ++++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 projects/q-infinity/index.js diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 0f548bbf34fa..6251af69fb5b 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1699,7 +1699,9 @@ "q": { "WBTC": "0xde397e6C442A3E697367DecBF0d50733dc916b79", "WDAI": "0xDeb87c37Dcf7F5197026f574cd40B3Fc8Aa126D1", - "WUSDC": "0x79Cb92a2806BF4f82B614A84b6805963b8b1D8BB" + "WUSDC": "0x79Cb92a2806BF4f82B614A84b6805963b8b1D8BB", + "WETH": "0xd56F9ffF3fe3BD0C7B52afF9A42eb70E05A287Cc", + "ELK": "0xeEeEEb57642040bE42185f49C52F7E9B38f8eeeE" }, "zklink": { "WBTC": "0xda4aaed3a53962c83b35697cd138cc6df43af71f", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 95d8a211dce5..f67fed34636c 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -36,6 +36,10 @@ const ibcMappings = { } const fixBalancesTokens = { + q: { + [ADDRESSES.q.ELK]: { coingeckoId: "elk-finance", decimals: 18 }, + [ADDRESSES.q.WETH]: { coingeckoId: "ethereum", decimals: 18 }, + }, stellar: { "CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA": { coingeckoId: "stellar", decimals: 7}, "CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75": { coingeckoId: "usd-coin", decimals: 7}, diff --git a/projects/q-infinity/index.js b/projects/q-infinity/index.js new file mode 100644 index 000000000000..147ca102d43e --- /dev/null +++ b/projects/q-infinity/index.js @@ -0,0 +1,22 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const { sumTokensExport } = require('../helper/unwrapLPs') + +const WUSDC_VAULT = "0x41AA6785b4ffE18A79bba796793E828059Ff342a" +const WETH_VAULT = "0x367750af92a2C427Cc94E1c562DEa9753a42c27e" +const ELK_VAULT = "0x1EAf38375CA45685D3FCa0c53e9fa6b02bb9B0D5" + +const owners = [ + WUSDC_VAULT, + WETH_VAULT, + ELK_VAULT, +] +const tokens = [ + ADDRESSES.q.WUSDC, + ADDRESSES.q.WETH, + ADDRESSES.q.ELK, +] + +module.exports = { + q: { tvl: sumTokensExport({ owners, tokens }) }, +}; \ No newline at end of file From 7fc2f1496f82f133d034b0951a95b291a5b9564c Mon Sep 17 00:00:00 2001 From: 0scallion <150413244+0scallion@users.noreply.github.com> Date: Fri, 7 Jun 2024 20:24:54 +0800 Subject: [PATCH 245/855] Add zetachain data (#10550) * Add SubstanceX * minor fix * add tvl on zetachain --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/SubstanceX/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/projects/SubstanceX/index.js b/projects/SubstanceX/index.js index 5ac5fd3fdc7f..c9df8308421e 100644 --- a/projects/SubstanceX/index.js +++ b/projects/SubstanceX/index.js @@ -8,7 +8,15 @@ const USDT = ADDRESSES.arbitrum.USDT const USDCe = ADDRESSES.arbitrum.USDC const DAI = ADDRESSES.optimism.DAI +// zetaChain +const USDC_zeta = ADDRESSES.zeta.USDC +const USDT_zeta = ADDRESSES.zeta.USDT_1 +const dai_zeta = ADDRESSES.zeta.USDC_1 +const usdce_zeta = ADDRESSES.zeta.USDT +const USDX_zeta = '0x64663c58D42BA8b5Bb79aD924621e5742e2232D8' + module.exports = { arbitrum: { tvl: sumTokensExport({ owner: USDX, tokens: [USDC, USDT, USDCe, DAI], }), }, + zeta: { tvl: sumTokensExport({ owner: USDX_zeta, tokens: [USDC_zeta, USDT_zeta, dai_zeta, usdce_zeta], }),}, methodology: `The TVL of SubstanceX is equal to the total value of underlying assets locked in the USDX contract.`, }; From 08bceb26daf0c7533085bf30f6fae23e98926475 Mon Sep 17 00:00:00 2001 From: Ryan C Date: Fri, 7 Jun 2024 23:21:30 +0900 Subject: [PATCH 246/855] XY Finance: Add taiko config (#10554) * feat: add taiko for xy finance * feat: add LOOT LLT token --- projects/xy-finance/index.js | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/projects/xy-finance/index.js b/projects/xy-finance/index.js index 79387dddc3dc..07f7100730f7 100644 --- a/projects/xy-finance/index.js +++ b/projects/xy-finance/index.js @@ -67,6 +67,9 @@ const config = { }, xlayer: { chainId: '196' + }, + taiko: { + chainId: '167000' } } @@ -96,6 +99,10 @@ const yPoolDepositContract = { "eYe": { "contractAddress": "0xF0052C0B4F08078846aF48FE8C7bb365c9937c21", "tokenAddress": "0x9A257C90Fa239fBA07771ef7da2d554D148c2E89" + }, + "LOOT": { + "contractAddress": "0xD95841e7eC6b61f708829B57a3433C3Fd24B2A8c", + "tokenAddress": "0x721A1B990699eE9D90b6327FaaD0A3E840aE8335" } }, "25": { @@ -139,6 +146,10 @@ const yPoolDepositContract = { "contractAddress": "0x58F29F7d759aef5B8e34C8e4152d6117893017aB", "tokenAddress": "0xae620DC4B9b6e44FBeb4a949F63AC957Cc43b5dD" }, + "LLT": { + "contractAddress": "0x141E379505C3b89C5BBE4Bd2353f12CA4681e3D2", + "tokenAddress": "0x92073dE2706eB8f0265998bCf7B8F751e1349b8F" + } }, "56": { "ETH": { @@ -193,6 +204,10 @@ const yPoolDepositContract = { "contractAddress": "0xF98bfE69d069B40668D4F6aaeA22E73d1DC21A93", "tokenAddress": "0x925FAdb35B73720238cc78777d02ED4dD3100816", }, + "LLT": { + "contractAddress": "0x141E379505C3b89C5BBE4Bd2353f12CA4681e3D2", + "tokenAddress": "0x0DdE4811C4DD68Dc740A1D7997F33fF46CD186a9" + } }, "250": { "ETH": { @@ -354,6 +369,10 @@ const yPoolDepositContract = { "USDC": { "contractAddress": "0xA5Cb30E5d30A9843B6481fFd8D8D35DDED3a3251", "tokenAddress": ADDRESSES.base.USDbC + }, + "LOOT": { + "contractAddress": "0x141E379505C3b89C5BBE4Bd2353f12CA4681e3D2", + "tokenAddress": "0x94a42083948d86432246eAD625B30d49014A4BFF" } }, "5000": { @@ -368,6 +387,10 @@ const yPoolDepositContract = { "USDT": { "contractAddress": "0x0241fb446d6793866245b936F2C3418F818bDcD3", "tokenAddress": ADDRESSES.mantle.USDT + }, + "LOOT": { + "contractAddress": "0x141E379505C3b89C5BBE4Bd2353f12CA4681e3D2", + "tokenAddress": "0x94a42083948d86432246eAD625B30d49014A4BFF" } }, "534352": { @@ -385,6 +408,10 @@ const yPoolDepositContract = { "contractAddress": "0xFa77c2DecCB21ACb9Bf196408Bf6aD5973D07762", "tokenAddress": ethAddress }, + "LOOT": { + "contractAddress": "0xD95841e7eC6b61f708829B57a3433C3Fd24B2A8c", + "tokenAddress": "0x1C559a960aE5293eA56C40EFC3c0169B413DDcF3" + } }, "196": { "ETH": { @@ -395,6 +422,16 @@ const yPoolDepositContract = { "contractAddress": "0x1e4992E1Be86c9d8ed7dcBFcF3665FE568dE98Ab", "tokenAddress": ADDRESSES.xlayer.USDT } + }, + "167000": { + "ETH": { + "contractAddress": "0xFa77c2DecCB21ACb9Bf196408Bf6aD5973D07762", + "tokenAddress": ethAddress + }, + "USDC": { + "contractAddress": "0x1e4992E1Be86c9d8ed7dcBFcF3665FE568dE98Ab", + "tokenAddress": ADDRESSES.taiko.USDC + } } } From ac68426851e08884d625c969fc4d1559b8017720 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 7 Jun 2024 20:06:24 +0530 Subject: [PATCH 247/855] Add agentfi (#10555) * add agentfi * minor refactor --------- Co-authored-by: Max Zhou --- projects/agentfi/ca.js | 35 ++++++++ projects/agentfi/index.js | 50 +++++++++++ projects/agentfi/strategies/dex-balancer.js | 82 +++++++++++++++++ projects/agentfi/strategies/looper.js | 45 ++++++++++ projects/agentfi/utils.js | 99 +++++++++++++++++++++ 5 files changed, 311 insertions(+) create mode 100644 projects/agentfi/ca.js create mode 100644 projects/agentfi/index.js create mode 100644 projects/agentfi/strategies/dex-balancer.js create mode 100644 projects/agentfi/strategies/looper.js create mode 100644 projects/agentfi/utils.js diff --git a/projects/agentfi/ca.js b/projects/agentfi/ca.js new file mode 100644 index 000000000000..3ae558dce6f7 --- /dev/null +++ b/projects/agentfi/ca.js @@ -0,0 +1,35 @@ +const tokenAddress = { + USDB: "0x4300000000000000000000000000000000000003", + WETH: "0x4300000000000000000000000000000000000004", + ETH: "0x0000000000000000000000000000000000000000" +}; + +const collection = { + genesis: "0x5066A1975BE96B777ddDf57b496397efFdDcB4A9", + explorer: "0xFB0B3C31eAf58743603e8Ee1e122547EC053Bf18", + strategy: "0x73E75E837e4F3884ED474988c304dE8A437aCbEf" +} + +const agentRegistry = "0x12F0A3453F63516815fe41c89fAe84d218Af0FAF" +const balanceFetcher = "0x3f8Dc480BEAeF711ecE5110926Ea2780a1db85C5" + +const uniV2Lp = { + thruster: '0x12c69BFA3fb3CbA75a1DEFA6e976B87E233fc7df', + blasterswap: '0x3b5d3f610Cc3505f4701E9FB7D0F0C93b7713adD', + ring: '0x9BE8a40C9cf00fe33fd84EAeDaA5C4fe3f04CbC3' +} + +const uniV3NftManager = { + blasterswap: '0xa761d82F952e9998fE40a6Db84bD234F39122BAD', + blasterswap2: '0x1e60C4113C86231Ef4b5B0b1cbf689F1b30e7966', + thruster: '0x434575EaEa081b735C985FA9bf63CD7b87e227F9', +} + +module.exports = { + tokenAddress, + collection, + agentRegistry, + uniV2Lp, + uniV3NftManager, + balanceFetcher +} diff --git a/projects/agentfi/index.js b/projects/agentfi/index.js new file mode 100644 index 000000000000..3b0f57a84c1f --- /dev/null +++ b/projects/agentfi/index.js @@ -0,0 +1,50 @@ +const { tokenAddress, uniV2Lp, uniV3NftManager } = require('./ca') +const { getTvlForLooperWithOrbit } = require('./strategies/looper') +const { getTvlForDexBalancer } = require('./strategies/dex-balancer') +const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); +const { getAllAgent } = require("./utils"); + + +async function tvl(api) { + const allAgents = await getAllAgent(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 looperAgentsAddresses = allAgents.filter(i => i.moduleType === "Looper").map(i => i.agentAddress) + + + const thrusterv2 = dexBalancerAgents.map(i => [uniV2Lp.thruster, i.agentAddress]) + const blasterswapv2 = dexBalancerAgents.map(i => [uniV2Lp.blasterswap, i.agentAddress]) + const ringv2 = dexBalancerAgents.map(i => [uniV2Lp.ring, i.agentAddress]) + + const blasterswapV3 = concentratedLiquidityAgents.map(i => [uniV3NftManager.blasterswap, i.agentAddress]) + const blasterswap2V3 = concentratedLiquidityAgents.map(i => [uniV3NftManager.blasterswap2, i.agentAddress]) + const thrusterV3 = concentratedLiquidityAgents.map(i => [uniV3NftManager.thruster, i.agentAddress]) + + + await getTvlForDexBalancer(dexBalancerAgents.map(i => i.agentAddress), api) + await getTvlForLooperWithOrbit(looperAgentsAddresses, api) + await sumTokens2({ + tokensAndOwners: [ + ...thrusterv2, + ...blasterswapv2, + ...ringv2, + ], + uniV3nftsAndOwners: [ + ...blasterswapV3, + ...blasterswap2V3, + ...thrusterV3 + ], + resolveLP: true, + api, + }) + await api.sumTokens({ owners: allAgentsAddress, tokens: [tokenAddress.USDB, tokenAddress.WETH, nullAddress], }) +} + +module.exports = { + methodology: 'The TVL consists of the underlying capital held by all agents(ERC6551 token bound account)', + doublecounted: true, + blast: { + tvl, + } +}; diff --git a/projects/agentfi/strategies/dex-balancer.js b/projects/agentfi/strategies/dex-balancer.js new file mode 100644 index 000000000000..dd23b450d349 --- /dev/null +++ b/projects/agentfi/strategies/dex-balancer.js @@ -0,0 +1,82 @@ +const { balanceFetcher, uniV2Lp, tokenAddress } = require('../ca') +const BigNumber = require("bignumber.js"); + + +// underlying token mapping +const RingTokenMappings = { + // fwUSDB -> USDB + "0x866f2C06B83Df2ed7Ca9C2D044940E7CD55a06d6": tokenAddress.USDB, + // fwWETH -> WETH + "0x66714DB8F3397c767d0A602458B5b4E3C0FE7dd1": tokenAddress.WETH, +}; + +async function getTvlForDexBalancer(agentAddresses, api) { + // fetch pool info from balanceFetcher utility function + const ringPoolPromise = api.call({ + abi: 'function fetchPoolInfoV2(address poolAddress) public view returns (uint256 total, address address0, address address1, uint112 reserve0, uint112 reserve1)', + target: balanceFetcher, + params: [uniV2Lp.ring], + }) + const thrusterPoolPromise = api.call({ + abi: 'function fetchPoolInfoV2(address poolAddress) public view returns (uint256 total, address address0, address address1, uint112 reserve0, uint112 reserve1)', + target: balanceFetcher, + params: [uniV2Lp.thruster], + }) + + const ringlpBalancePromise = api.multiCall({ + abi: 'function balanceOf(uint256 index, address account) returns (uint256)', + calls: agentAddresses.map(agent => ({ + target: "0xEff87A51f5Abd015F1AFCD5737BBab450eA15A24", // ring staking contract + params: [3, agent], + })), + withMetadata: true, + permitFailure: true, + }) + + const hyperlocklpBalancePromise = api.multiCall({ + abi: 'function staked(address account, address token) returns (uint256)', + calls: agentAddresses.map(agent => ({ + target: "0xC3EcaDB7a5faB07c72af6BcFbD588b7818c4a40e", // hyperlock staking contract + params: [agent, "0x12c69BFA3fb3CbA75a1DEFA6e976B87E233fc7df"], + })), + withMetadata: true, + permitFailure: true, + }) + + const [ringPoolData, thrusterPoolData, ringlpBalances, hyperlocklpBalances] = await Promise.all([ringPoolPromise, thrusterPoolPromise, ringlpBalancePromise, hyperlocklpBalancePromise]) + + agentAddresses.forEach((address) => { + const ringlpBalance = ringlpBalances.find(b => b.input.params[1] === address) + if (ringlpBalance.success) { + const lpBalance = ringlpBalance.output + const [total, address0, address1, reserve0, reserve1] = ringPoolData; + const lpBalanceBigN = BigNumber(lpBalance) + const totalBigN = BigNumber(total) + const reserve0BigN = BigNumber(reserve0) + 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)) + } + const hyperlocklpBalance = hyperlocklpBalances.find(b => b.input.params[0] === address) + if (hyperlocklpBalance.success) { + const lpBalance = hyperlocklpBalance.output + const [total, address0, address1, reserve0, reserve1] = thrusterPoolData; + const lpBalanceBigN = BigNumber(lpBalance) + const totalBigN = BigNumber(total) + const reserve0BigN = BigNumber(reserve0) + const reserve1BigN = BigNumber(reserve1) + const token0Balance = lpBalanceBigN.times(reserve0BigN).div(totalBigN) + const token1Balance = lpBalanceBigN.times(reserve1BigN).div(totalBigN) + api.add(address0, token0Balance.toFixed(0)) + api.add(address1, token1Balance.toFixed(0)) + } + }) + + +} + +module.exports = { + getTvlForDexBalancer +} diff --git a/projects/agentfi/strategies/looper.js b/projects/agentfi/strategies/looper.js new file mode 100644 index 000000000000..1461966b209e --- /dev/null +++ b/projects/agentfi/strategies/looper.js @@ -0,0 +1,45 @@ +const BigNumber = require("bignumber.js"); +const { nullAddress } = require("../../helper/unwrapLPs"); + +async function getTvlForLooperWithOrbit(agentAddresses, api) { + const calls = agentAddresses.map(agent => ({ + target: agent, params: [] + })) + + const borrowBalancePromise = api.multiCall({ + abi: 'function borrowBalance() view returns (uint256)', + calls: calls, + withMetadata: true, + permitFailure: true, + }) + const supplyBalancePromise = api.multiCall({ + abi: 'function supplyBalance() view returns (uint256)', + calls: calls, + withMetadata: true, + permitFailure: true, + }) + const underlyingPromise = api.multiCall({ + abi: 'function underlying() view returns (address)', + calls: calls, + withMetadata: true, + permitFailure: true, + }) + const [borrowBalance, supplyBalance, underlying] = await Promise.all([borrowBalancePromise, supplyBalancePromise, underlyingPromise]) + agentAddresses.forEach((address) => { + const borrowBalanceResult = borrowBalance.find(b => b.input.target === address) + const supplyBalanceResult = supplyBalance.find(b => b.input.target === address) + const underlyingResult = underlying.find(b => b.input.target === address) + if (borrowBalanceResult.success && supplyBalanceResult.success && underlyingResult.success) { + const borrowBalance = borrowBalanceResult.output + const supplyBalance = supplyBalanceResult.output + const underlying = underlyingResult.output + const isEth = underlying === "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" + const tokenToAdd = isEth ? nullAddress : underlying + api.add(tokenToAdd, BigNumber(supplyBalance).minus(borrowBalance)) + } + }) +} + +module.exports = { + getTvlForLooperWithOrbit +} diff --git a/projects/agentfi/utils.js b/projects/agentfi/utils.js new file mode 100644 index 000000000000..b96518f17f7b --- /dev/null +++ b/projects/agentfi/utils.js @@ -0,0 +1,99 @@ +const { collection, agentRegistry } = require("./ca"); + +async function getAllAgent(api) { + const [genesisTotalSupply, explorerTotalSupply, strategyTotalSupply] = await api.multiCall({ + abi: 'uint256:totalSupply', calls: [collection.genesis, collection.explorer, collection.strategy] + }) + const genesisCalls = Array.from({ length: genesisTotalSupply }, (_, i) => i).map(i => ({ + target: agentRegistry, params: [collection.genesis, i + 1] + })) + const explorerCalls = Array.from({ length: explorerTotalSupply }, (_, i) => i).map(i => ({ + target: agentRegistry, params: [collection.explorer, i + 1] + })) + const strategyCalls = Array.from({ length: strategyTotalSupply }, (_, i) => i).map(i => ({ + target: agentRegistry, params: [collection.strategy, i + 1] + })) + + + const rootAgentAddressPromise = api.multiCall({ + permitFailure: true, + abi: "function getTbasOfNft(address collection, uint256 agentID) view returns (tuple(address agentAddress, address implementationAddress)[] tbas)", + calls: [...genesisCalls, ...explorerCalls], + requery: true, + }) + const strategyAgentAddressPromise = api.multiCall({ + permitFailure: true, + abi: "function getTbasOfNft(address collection, uint256 agentID) view returns (tuple(address agentAddress, address implementationAddress)[] tbas)", + calls: strategyCalls, + requery: true, + }) + + const [rootAgentAddresses, strategyAgentAddresses] = await Promise.all([rootAgentAddressPromise, strategyAgentAddressPromise]) + + const moduleCall = strategyAgentAddresses.map(i => i[0].agentAddress).map(i => ({ + target: i, params: ['0x82ccd330'] + })) + const moduleCall2 = strategyAgentAddresses.map(i => i[0].agentAddress).map(i => ({ + target: i, params: ['0x7bb485dc'] + })) + const modulePromise = api.multiCall({ + permitFailure: true, + abi: "function overrides(bytes4) view returns (address implementation, bool isProtected)", + calls: moduleCall, + withMetadata: true, + requery: true, + }) + const module2Promise = api.multiCall({ + permitFailure: true, + abi: "function overrides(bytes4) view returns (address implementation, bool isProtected)", + calls: moduleCall2, + withMetadata: true, + requery: true, + }) + const moduleResult = await Promise.all([modulePromise, module2Promise]) + const allAgentAddress = [...rootAgentAddresses, ...strategyAgentAddresses].map(i => ({ + agentAddress: i[0].agentAddress, + implementationAddress: i[0].implementationAddress, + })) + + const addressWithModuleType = allAgentAddress.map((i) => { + const agentAddress = i.agentAddress + const modules = moduleResult.flat().filter(x => x.success).filter(j => j.input.target === agentAddress).map(j => j.output[0]) + const DexBalancerModules = ["0x7e8280f5Ee5137f89d09FA61B356fa322a93415a", "0x35a4B9B95bc1D93Bf8e3CA9c030fc15726b83E6F", "0x067299A9C3F7E8d4A9d9dD06E2C1Fe3240144389"] + const MultioliooorModule = ["0x54D588243976F7fA4eaf68d77122Da4e6C811167"] + const ConcentratedLiquidityModule = ["0x10C02a975a748Db5B749Dc420154dD945e2e8657", "0x41D68d86545D6b931c1232f1E0aBB5844Ada4967", "0xa11D4dcD5a9ad75c609E1786cf1FD88b53C83A5E"] + const Looper = ["0x6A9D21A09A76808C444a89fE5fCc0a5f38dc0523", "0xe5fe6f280CEadc5c4DDE69eF2DF6234dd7Bd82E2"] + if (modules.some(i => DexBalancerModules.includes(i))) { + return { + ...i, + moduleType: "DexBalancer" + } + } else if (modules.some(i => MultioliooorModule.includes(i))) { + return { + ...i, + moduleType: "Multipliooor" + } + } else if (modules.some(i => ConcentratedLiquidityModule.includes(i))) { + return { + ...i, + moduleType: "ConcentratedLiquidity" + } + } else if (modules.some(i => Looper.includes(i))) { + return { + ...i, + moduleType: "Looper" + } + } else { + return { + ...i, + moduleType: "Unknown" + } + } + }) + + return addressWithModuleType +} + +module.exports = { + getAllAgent +} From fca3ef5633d7429589ea269f5e01624aeafab6fc Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 7 Jun 2024 20:14:03 +0530 Subject: [PATCH 248/855] Morpho-Blue (#10557) * feat(Morpho-Blue): adding the Blue deployment on Base at block:13977148 * minor fix * minor fix --------- Co-authored-by: Reppelin Tom --- projects/creditguild/index.js | 1 - projects/gearbox/index.js | 1 - projects/morpho-blue/index.js | 76 +++++++++++++++++++++++------------ projects/spectra/index.js | 2 - 4 files changed, 50 insertions(+), 30 deletions(-) diff --git a/projects/creditguild/index.js b/projects/creditguild/index.js index cee9d0c8a961..3aad117bbf35 100644 --- a/projects/creditguild/index.js +++ b/projects/creditguild/index.js @@ -12,7 +12,6 @@ Object.keys(config).forEach(chain => { const owners = [...PSMs] const logs = await getLogs2({ - skipCacheRead: true, api, factory, eventAbi: 'event TermCreated(uint256 indexed when, uint256 indexed gaugeType, address indexed term, bytes params)', diff --git a/projects/gearbox/index.js b/projects/gearbox/index.js index 6ffe93e7c12e..b492d66e140e 100644 --- a/projects/gearbox/index.js +++ b/projects/gearbox/index.js @@ -144,7 +144,6 @@ async function getV1CAs(creditManager, block, api) { const topics = []; cm.interface.forEachEvent((e) => topics.push(e.topicHash)); const rawLogs = await getLogs.getLogs({ - skipCache: true, target: creditManager, fromBlock: 13854983, toBlock: block, diff --git a/projects/morpho-blue/index.js b/projects/morpho-blue/index.js index c141c640b782..a06864916b6e 100644 --- a/projects/morpho-blue/index.js +++ b/projects/morpho-blue/index.js @@ -1,4 +1,4 @@ -const { getLogs } = require('../helper/cache/getLogs') +const { getLogs } = require("../helper/cache/getLogs"); const abi = require("../helper/abis/morpho.json"); module.exports = { @@ -7,39 +7,63 @@ module.exports = { }; const config = { - ethereum: { morphoBlue: '0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb', fromBlock: 18883124 } -} + ethereum: { + morphoBlue: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb", + fromBlock: 18883124, + }, + base: { + morphoBlue: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb", + fromBlock: 13977148, + }, +}; -Object.keys(config).forEach(chain => { - const { morphoBlue, fromBlock } = config[chain] +Object.keys(config).forEach((chain) => { + const { morphoBlue, fromBlock } = config[chain]; module.exports[chain] = { tvl: async (api) => { - const marketIds = await getMarkets(api) - const tokens = (await api.multiCall({ target: morphoBlue, calls: marketIds, abi: abi.morphoBlueFunctions.idToMarketParams })).map(i => [i.collateralToken, i.loanToken]).flat() - return api.sumTokens({ owner: morphoBlue, tokens }) + const marketIds = await getMarkets(api); + const tokens = ( + await api.multiCall({ + target: morphoBlue, + calls: marketIds, + abi: abi.morphoBlueFunctions.idToMarketParams, + }) + ) + .map((i) => [i.collateralToken, i.loanToken]) + .flat(); + return api.sumTokens({ owner: morphoBlue, tokens }); }, borrowed: async (api) => { - const marketIds = await getMarkets(api) - const marketInfo = await api.multiCall({ target: morphoBlue, calls: marketIds, abi: abi.morphoBlueFunctions.idToMarketParams }) - const marketData = await api.multiCall({ target: morphoBlue, calls: marketIds, abi: abi.morphoBlueFunctions.market }) + const marketIds = await getMarkets(api); + const marketInfo = await api.multiCall({ + target: morphoBlue, + calls: marketIds, + abi: abi.morphoBlueFunctions.idToMarketParams, + }); + const marketData = await api.multiCall({ + target: morphoBlue, + calls: marketIds, + abi: abi.morphoBlueFunctions.market, + }); marketData.forEach((i, idx) => { - api.add(marketInfo[idx].loanToken, i.totalBorrowAssets) - }) - return api.getBalances() + api.add(marketInfo[idx].loanToken, i.totalBorrowAssets); + }); + return api.getBalances(); }, - } + }; async function getMarkets(api) { const logs = await getLogs({ - api, target: morphoBlue, - skipCache: true, - eventAbi: 'event CreateMarket(bytes32 indexed id, (address loanToken, address collateralToken, address oracle, address irm, uint256 lltv) marketParams)', - onlyArgs: true, fromBlock, - topics: ['0xac4b2400f169220b0c0afdde7a0b32e775ba727ea1cb30b35f935cdaab8683ac'], - }) - if(logs.length < 29){ - throw new Error("Missing markets!") - } - return logs.map(i => i.id) + api, + target: morphoBlue, + eventAbi: + "event CreateMarket(bytes32 indexed id, (address loanToken, address collateralToken, address oracle, address irm, uint256 lltv) marketParams)", + onlyArgs: true, + fromBlock, + topics: [ + "0xac4b2400f169220b0c0afdde7a0b32e775ba727ea1cb30b35f935cdaab8683ac", + ], + }); + return logs.map((i) => i.id); } -}) \ No newline at end of file +}); diff --git a/projects/spectra/index.js b/projects/spectra/index.js index 98ab6066db49..87ea77c9e6a9 100644 --- a/projects/spectra/index.js +++ b/projects/spectra/index.js @@ -93,7 +93,6 @@ Object.keys(config).forEach((chain) => { "event CurvePoolDeployed(address indexed poolAddress, address indexed ibt, address indexed pt)", onlyArgs: true, fromBlock: fromBlock, - skipCache: true, }); return logs.map((i) => [i.poolAddress, i.ibt]); } @@ -106,7 +105,6 @@ Object.keys(config).forEach((chain) => { "event PTDeployed(address indexed pt, address indexed poolCreator)", onlyArgs: true, fromBlock: fromBlock, - skipCache: true, }); return logs.map((i) => i.pt); } From 1ee20d87bf321659ba473442f05f80077580c85c Mon Sep 17 00:00:00 2001 From: 0xngmi <80541789+0xngmi@users.noreply.github.com> Date: Fri, 7 Jun 2024 20:49:54 +0100 Subject: [PATCH 249/855] summerfi + instadapp lite (#9781) --- projects/instadapp-lite/index.js | 25 +++++++++++++++++++++++++ projects/summer-fi/index.js | 10 +++------- 2 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 projects/instadapp-lite/index.js diff --git a/projects/instadapp-lite/index.js b/projects/instadapp-lite/index.js new file mode 100644 index 000000000000..0631c8f3ec95 --- /dev/null +++ b/projects/instadapp-lite/index.js @@ -0,0 +1,25 @@ +const vaults = [ + { "vault": "0xc383a3833A87009fD9597F8184979AF5eDFad019", "token": "0x0000000000000000000000000000000000000000" }, + { "vault": "0xc8871267e07408b89aA5aEcc58AdCA5E574557F8", "token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" }, + { "vault": "0xEC363faa5c4dd0e51f3D9B5d0101263760E7cdeB", "token": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599" }, + { "vault": "0x40a9d39aa50871Df092538c5999b107f34409061", "token": "0x6B175474E89094C44Da98b954EedeAC495271d0F" } +] +const vaultsV2 = ["0xA0D3707c569ff8C87FA923d3823eC5D81c98Be78"] + +async function tvl(api) { + const calls = vaults.map(v => ({ target: v.vault })) + const prices = await api.multiCall({ + calls, + abi: "function getCurrentExchangePrice() public view returns (uint256 exchangePrice_, uint256 newTokenRevenue_)" + }) + const supply = await api.multiCall({ + calls, + abi: "erc20:totalSupply" + }) + prices.forEach((price, i)=>api.add(vaults[i].token, price.exchangePrice_*supply[i]/1e18)) + return api.erc4626Sum({ calls: vaultsV2, tokenAbi: 'address:asset', balanceAbi: 'uint256:totalAssets' }); +} + +module.exports = { + ethereum: { tvl } +} \ No newline at end of file diff --git a/projects/summer-fi/index.js b/projects/summer-fi/index.js index 7cfdf389d8b8..adcaec100584 100644 --- a/projects/summer-fi/index.js +++ b/projects/summer-fi/index.js @@ -1,8 +1,7 @@ -const { automationTvl, dpmPositions, makerTvl } = require("./handlers"); +const { automationTvl } = require("./handlers"); const { getAutomationCdpIdList, setCallCache } = require("./helpers"); const sdk = require("@defillama/sdk"); -const { getConfig, getCache, setCache } = require("../helper/cache"); -const { endpoints } = require("./constants/endpoints"); +const { getCache, setCache } = require("../helper/cache"); module.exports = { doublecounted: true, @@ -12,8 +11,7 @@ module.exports = { async function tvl(api) { await api.getBlock(); const executionStart = Date.now() / 1000; - const [confirmedSummerFiMakerVaults, cdpIdList, cache] = await Promise.all([ - await getConfig("summer-fi/maker-vaults", endpoints.makerVaults()), + const [cdpIdList, cache] = await Promise.all([ getAutomationCdpIdList({ api }), getCache("summer-fi/cache", api.chain), ]); @@ -23,9 +21,7 @@ async function tvl(api) { sdk.log([...cdpIdList].length, "cdpIdList"); await Promise.all([ - dpmPositions({ api }), automationTvl({ api, cdpIdList }), - makerTvl({ api, cdpIdList, confirmedSummerFiMakerVaults }), ]); await setCache("summer-fi/cache", api.chain, cache); From 796f5696ece12ecd026cac9927ac1c2c777b1233 Mon Sep 17 00:00:00 2001 From: plonkai <167075793+plonkai@users.noreply.github.com> Date: Sat, 8 Jun 2024 04:11:01 +0800 Subject: [PATCH 250/855] update for tradoor tvl methodology (#10558) * add tradoor * update for tradoor tvl methodology --- projects/tradoor/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/tradoor/index.js b/projects/tradoor/index.js index 8d44d395b7f3..ebe0c7c6bdc0 100644 --- a/projects/tradoor/index.js +++ b/projects/tradoor/index.js @@ -4,7 +4,7 @@ const ADDRESSES = require("../helper/coreAssets.json"); const evaaScAddr = "EQBPAMNu5Eud9AEvplOjNlRhxI4EkuJEhEMAmxh9erxmImKs" module.exports = { - methodology: 'Counts EVAA smartcontract balance as TVL.', + methodology: 'Counts Tradoor smartcontract balance as TVL.', ton: { tvl: sumTokensExport({ owner: evaaScAddr, tokens: [ADDRESSES.null]}), } From faf0bcaf4984f9c9802c9034a16a350147d81e2b Mon Sep 17 00:00:00 2001 From: tstemko <57684389+tstemko@users.noreply.github.com> Date: Fri, 7 Jun 2024 16:16:05 -0400 Subject: [PATCH 251/855] Add Linehub and Nile on Linea to tvl calcs (#10560) * Add Blast, Scroll, Spiritswap on Fantom, Metavault and Uni on Linea, PancakeSwap and QuickSwap on Polygon zkEVM * Add Linehub and Nile on Linea --------- Co-authored-by: Tatyana Stemkovski --- projects/ichifarm/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/ichifarm/index.js b/projects/ichifarm/index.js index 4d6adbe0c819..acf81a2b571f 100644 --- a/projects/ichifarm/index.js +++ b/projects/ichifarm/index.js @@ -102,8 +102,10 @@ const config = { // }, linea: { vaultConfigs: [ + { factory: '0xb0e7871d53BE1b1d746bBfD9511e2eF3cD70a6E7', fromBlock: 4722347, isAlgebra: false, }, // Linehub { factory: '0x0248b992ac2a75294b05286E9DD3A2bD3C9CFE4B', fromBlock: 1599561, isAlgebra: true, }, // Lynex { factory: '0x2592686212C164C1851dF2f62c5d5EC50600195E', fromBlock: 4148753, isAlgebra: false, }, // Metavault + { factory: '0xa29F3D5403D50Ea1BF597E2Ef01791A1Ce4F544E', fromBlock: 5033991, isAlgebra: false, }, // Nile { factory: '0x6E3eB904966B0158833852cAFD1200c171772b53', fromBlock: 3976012, isAlgebra: false, }, // Uniswap ] }, From 17332d8ce7420f04a50b4a5d255d1db5b837df30 Mon Sep 17 00:00:00 2001 From: LeviathanYou <168118002+LeviathanYou@users.noreply.github.com> Date: Sat, 8 Jun 2024 04:16:41 +0800 Subject: [PATCH 252/855] feat: update free protocol tvl (#10559) --- projects/free-protocol/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/projects/free-protocol/index.js b/projects/free-protocol/index.js index a4a848fbe72a..9c4a21af38f4 100644 --- a/projects/free-protocol/index.js +++ b/projects/free-protocol/index.js @@ -13,20 +13,23 @@ module.exports = { '0xB880fd278198bd590252621d4CD071b1842E9Bcd', '0xC5BD913eE3BEFD4721C609177F29a8770ACD7242', '0x41D9036454BE47d3745A823C4aaCD0e29cFB0f71', - '0x41D9036454BE47d3745A823C4aaCD0e29cFB0f71', ], }), }, ethereum: { tvl: sumTokensExport({ owners: [ + '0x1B5668Ca8edfC8AF5DcB9De014b4B08ed5d0615F', + '0x3111653DB0e7094b111b8e435Df9193b62C2C576', '0xd6572c7cd671ecf75d920adcd200b00343959600', '0xa97Fe3E9c1d3Be7289030684eD32A6710d2d02bA', '0xeea3A032f381AB1E415e82Fe08ebeb20F513c42c', ], tokens: [ + '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', '0x7122985656e38bdc0302db86685bb972b145bd3c', '0xdac17f958d2ee523a2206206994597c13d831ec7', + '0x7122985656e38BDC0302Db86685bb972b145bD3C', ] }) }, @@ -39,7 +42,6 @@ module.exports = { tokens: [ '0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9', '0xaf88d065e77c8cc2239327c5edb3a432268e5831', - '0xaf88d065e77c8cc2239327c5edb3a432268e5831', ] }) }, @@ -56,6 +58,7 @@ module.exports = { bsc: { tvl: sumTokensExport({ owners: [ + '0xF8aeD4da2598d3dF878488F40D982d6EcC8B13Ad', '0xBA43F3C8733b0515B5C23DFF46F47Af6EB46F85C', '0x0A80028d73Faaee6e57484E3335BeFda0de7f455', ], @@ -63,6 +66,7 @@ module.exports = { '0xc5f0f7b66764F6ec8C8Dff7BA683102295E16409', '0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c', '0xc5f0f7b66764F6ec8C8Dff7BA683102295E16409', + '0x4aae823a6a0b376De6A78e74eCC5b079d38cBCf7', ] }) }, From eae72670d73c6951841e68a4c1ed0df0da7c6cbe Mon Sep 17 00:00:00 2001 From: Kevin Mehrabi <4044328+KevinMehrabi@users.noreply.github.com> Date: Fri, 7 Jun 2024 13:18:49 -0700 Subject: [PATCH 253/855] Update TezFin adapter to include v2 contracts (#10542) --- projects/tezfin/index.js | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/projects/tezfin/index.js b/projects/tezfin/index.js index 727d5a792f4f..956de546b306 100644 --- a/projects/tezfin/index.js +++ b/projects/tezfin/index.js @@ -4,19 +4,29 @@ const { getStorage, sumTokens2 } = require("../helper/chain/tezos"); async function tvl() { return sumTokens2({ owners: [ - "KT1GYKoownVC1ukP2TBDgKx7bSXRM5XkV1W6", - "KT1MX7D6ZJp2DDSSeDS96JPTFPXKkNiHFhwb", - "KT1W8P4ZxD8eREKjDnxMe5882NP3GnAgrv46" - ], + // v1 contracts + "KT1GYKoownVC1ukP2TBDgKx7bSXRM5XkV1W6", // ꜰXTZ v1 + "KT1MX7D6ZJp2DDSSeDS96JPTFPXKkNiHFhwb", // ꜰUSDtz v1 + "KT1W8P4ZxD8eREKjDnxMe5882NP3GnAgrv46", // ꜰUSDt v1 + // v2 contracts + "KT1MCXxbtS62tk4CUxv29BHnqTBtvsFFGzBm", // ꜰXTZ v2 + "KT1WQM7wj64GHCndwV8REccQ6N4tqZ3uRNqs", // ꜰUSDtz v2 + "KT1HCRJhfqmWKRJtZXzvTkY4iisfuR4w6pkB" // ꜰUSDt v2 + ], includeTezos: true, }); } async function borrowed() { const borrowedTokensAddresses = [ - "KT1GYKoownVC1ukP2TBDgKx7bSXRM5XkV1W6", - "KT1MX7D6ZJp2DDSSeDS96JPTFPXKkNiHFhwb", - "KT1W8P4ZxD8eREKjDnxMe5882NP3GnAgrv46" + // v1 contracts + "KT1GYKoownVC1ukP2TBDgKx7bSXRM5XkV1W6", // ꜰXTZ v1 + "KT1MX7D6ZJp2DDSSeDS96JPTFPXKkNiHFhwb", // ꜰUSDtz v1 + "KT1W8P4ZxD8eREKjDnxMe5882NP3GnAgrv46", // ꜰUSDt v1 + // v2 contracts + "KT1MCXxbtS62tk4CUxv29BHnqTBtvsFFGzBm", // ꜰXTZ v2 + "KT1WQM7wj64GHCndwV8REccQ6N4tqZ3uRNqs", // ꜰUSDtz v2 + "KT1HCRJhfqmWKRJtZXzvTkY4iisfuR4w6pkB" // ꜰUSDt v2 ]; const balances = {}; @@ -48,4 +58,4 @@ module.exports = { borrowed, }, methodology: 'TVL counts the liquidity and reserves for each market. Borrowed amounts are calculated based on the total borrows from each contract address, with special handling for "tezos" to adjust for precision.', -}; \ No newline at end of file +}; From 8d9f6227b3e83ca82266c1c13c02d8822dba32a5 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 8 Jun 2024 10:12:18 +0200 Subject: [PATCH 254/855] update synonym --- projects/synonym-finance/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/synonym-finance/index.js b/projects/synonym-finance/index.js index 9f2abfc94c79..fe10fde97893 100644 --- a/projects/synonym-finance/index.js +++ b/projects/synonym-finance/index.js @@ -41,7 +41,9 @@ async function getTokenInfos(api) { switch (chainId[i]) { case '2': chain = 'ethereum'; break; case '24': chain = 'optimism'; break; - default: console.log('Unsupported chain ' + chainId[i]); return; + case '30': chain = 'base'; break; + case '34': chain = 'scroll'; break; + default: console.log('Unsupported chain ' + chainId[i] + "0x" + BigInt(natives[i]).toString(16)); return; } tokenMappings.push(chain + ':' + "0x" + BigInt(natives[i]).toString(16)) tokens.push(asset) From 28d9275858209f0e0b2b9c8981cf487657b9f0b2 Mon Sep 17 00:00:00 2001 From: leallenl Date: Sat, 8 Jun 2024 16:14:06 +0800 Subject: [PATCH 255/855] feat: Add Binlayer (#10563) Co-authored-by: leallenl --- projects/binlayer/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 projects/binlayer/index.js diff --git a/projects/binlayer/index.js b/projects/binlayer/index.js new file mode 100644 index 000000000000..ce82ce2927ef --- /dev/null +++ b/projects/binlayer/index.js @@ -0,0 +1,15 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getConfig } = require('../helper/cache') + +const chains = ['bsc'] + +chains.forEach(chain => { + module.exports[chain] = { + tvl: async function (api) { + const { result } = await getConfig(`binlayer/${api.chain}`, `https://api.binlayer.xyz/v1/stakeList?chainId=${api.chainId}`) + const vaults = result.map(f => f.strategyAddress) + const tokens = await api.multiCall({ abi: 'address:underlyingToken', calls: vaults }) + return sumTokens2({ api, tokensAndOwners2: [tokens, vaults], }) + } + } +}) From d2c97d65db730418e70bdff19926aa42dd249c51 Mon Sep 17 00:00:00 2001 From: hamur dev <122794657+tpktpj@users.noreply.github.com> Date: Sat, 8 Jun 2024 04:15:18 -0400 Subject: [PATCH 256/855] Update avalon finance tvl (#10562) Co-authored-by: jsmjsm --- projects/avalon-finance/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/projects/avalon-finance/index.js b/projects/avalon-finance/index.js index 2c5e1018f133..a4ed3b8752bf 100644 --- a/projects/avalon-finance/index.js +++ b/projects/avalon-finance/index.js @@ -4,15 +4,15 @@ const methodologies = require('../helper/methodologies') const { mergeExports } = require('../helper/utils') const mainMarket = { - merlin: aaveExports('', '0x6aB5d5E96aC59f66baB57450275cc16961219796', undefined, ['0x5F314b36412765f3E1016632fD1Ad528929536CA'], { v3: true }), - btr: aaveExports('', '0x6aB5d5E96aC59f66baB57450275cc16961219796', undefined, ['0x5F314b36412765f3E1016632fD1Ad528929536CA'], { v3: true }), - arbitrum: aaveExports('', '0xa2ddc06baDc817C612111137c0cf6Bd43634EE1a', undefined, ['0xEc579d2cE07401258710199Ff12a5bb56e086a6F'], { v3: true }), - bsc: aaveExports('', '0x5395201A4DD625a0d69b99D917282f75928416c1', undefined, ['0x672b19DdA450120C505214D149Ee7F7B6DEd8C39'], { v3: true }), - core: aaveExports('', '0x410d2D3Dc79ec66A2Cfc3A4a0AD4af3a38D38bd0', undefined, ['0x802CB61844325dc9A161bC3A498E3BE1B7b6FE00'], { v3: true }), + merlin: aaveExports('', '0x6aB5d5E96aC59f66baB57450275cc16961219796', undefined, ['0x5F314b36412765f3E1016632fD1Ad528929536CA']), + btr: aaveExports('', '0x6aB5d5E96aC59f66baB57450275cc16961219796', undefined, ['0x5F314b36412765f3E1016632fD1Ad528929536CA']), + arbitrum: aaveExports('', '0xa2ddc06baDc817C612111137c0cf6Bd43634EE1a', undefined, ['0xEc579d2cE07401258710199Ff12a5bb56e086a6F']), + bsc: aaveExports('', '0x5395201A4DD625a0d69b99D917282f75928416c1', undefined, ['0x672b19DdA450120C505214D149Ee7F7B6DEd8C39']), + core: aaveExports('', '0x410d2D3Dc79ec66A2Cfc3A4a0AD4af3a38D38bd0', undefined, ['0x802CB61844325dc9A161bC3A498E3BE1B7b6FE00']), } const innovativeMarket = { - merlin: aaveExports('', '0x91b212e9FaF20117Eae59d6289CB38749DDFc070', undefined, ['0x883cb2E2d9c5D4D9aF5b0d37fc39Fa2284405682'], { v3: true }), + merlin: aaveExports('', '0x91b212e9FaF20117Eae59d6289CB38749DDFc070', undefined, ['0x883cb2E2d9c5D4D9aF5b0d37fc39Fa2284405682']), } module.exports = mergeExports(mainMarket, innovativeMarket) From 60d6fa55970625bcf1d41ac73bb46fde98dab1fd Mon Sep 17 00:00:00 2001 From: hamur dev <122794657+tpktpj@users.noreply.github.com> Date: Sat, 8 Jun 2024 10:21:52 -0400 Subject: [PATCH 257/855] fix wrong borrowed tvl on btr (#10565) Co-authored-by: jsmjsm --- projects/avalon-finance/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/projects/avalon-finance/index.js b/projects/avalon-finance/index.js index a4ed3b8752bf..0b804e332194 100644 --- a/projects/avalon-finance/index.js +++ b/projects/avalon-finance/index.js @@ -4,15 +4,15 @@ const methodologies = require('../helper/methodologies') const { mergeExports } = require('../helper/utils') const mainMarket = { - merlin: aaveExports('', '0x6aB5d5E96aC59f66baB57450275cc16961219796', undefined, ['0x5F314b36412765f3E1016632fD1Ad528929536CA']), - btr: aaveExports('', '0x6aB5d5E96aC59f66baB57450275cc16961219796', undefined, ['0x5F314b36412765f3E1016632fD1Ad528929536CA']), - arbitrum: aaveExports('', '0xa2ddc06baDc817C612111137c0cf6Bd43634EE1a', undefined, ['0xEc579d2cE07401258710199Ff12a5bb56e086a6F']), - bsc: aaveExports('', '0x5395201A4DD625a0d69b99D917282f75928416c1', undefined, ['0x672b19DdA450120C505214D149Ee7F7B6DEd8C39']), - core: aaveExports('', '0x410d2D3Dc79ec66A2Cfc3A4a0AD4af3a38D38bd0', undefined, ['0x802CB61844325dc9A161bC3A498E3BE1B7b6FE00']), + merlin: aaveExports('', '0x6aB5d5E96aC59f66baB57450275cc16961219796', undefined, ['0x5F314b36412765f3E1016632fD1Ad528929536CA'], {v3: true}), + btr: aaveExports('', '0x6aB5d5E96aC59f66baB57450275cc16961219796', undefined, ['0x5F314b36412765f3E1016632fD1Ad528929536CA'], {v3: true}), + arbitrum: aaveExports('', '0xa2ddc06baDc817C612111137c0cf6Bd43634EE1a', undefined, ['0xEc579d2cE07401258710199Ff12a5bb56e086a6F'],{v3: true}), + bsc: aaveExports('', '0x5395201A4DD625a0d69b99D917282f75928416c1', undefined, ['0x672b19DdA450120C505214D149Ee7F7B6DEd8C39'],{v3: true}), + core: aaveExports('', '0x410d2D3Dc79ec66A2Cfc3A4a0AD4af3a38D38bd0', undefined, ['0x802CB61844325dc9A161bC3A498E3BE1B7b6FE00'],{v3: true}), } const innovativeMarket = { - merlin: aaveExports('', '0x91b212e9FaF20117Eae59d6289CB38749DDFc070', undefined, ['0x883cb2E2d9c5D4D9aF5b0d37fc39Fa2284405682']), + merlin: aaveExports('', '0x91b212e9FaF20117Eae59d6289CB38749DDFc070', undefined, ['0x883cb2E2d9c5D4D9aF5b0d37fc39Fa2284405682'],{v3: true}), } module.exports = mergeExports(mainMarket, innovativeMarket) From a6a458ecda712ee6a9655e3268a61224c59de241 Mon Sep 17 00:00:00 2001 From: Deadshot Ryker <151393124+deadshotryker@users.noreply.github.com> Date: Sat, 8 Jun 2024 18:23:25 +0400 Subject: [PATCH 258/855] Added ZERO staking and ZERO/ETH LP staking tvl for zerolend (#10564) * added xlayer for zerolend * added staking and lp for linea chain on zerolend * added zerolend treasury --- projects/treasury/zerolend.js | 23 +++++++++++++++++++++++ projects/zerolend/index.js | 22 +++++++++++++++++++--- 2 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 projects/treasury/zerolend.js diff --git a/projects/treasury/zerolend.js b/projects/treasury/zerolend.js new file mode 100644 index 000000000000..98d58291a70c --- /dev/null +++ b/projects/treasury/zerolend.js @@ -0,0 +1,23 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs.js"); + +const linea = { + weth: ADDRESSES.linea.WETH, + zero: "0x78354f8DcCB269a615A7e0a24f9B0718FDC3C7A7", + treasury: "0x14aAD4668de2115e30A5FeeE42CFa436899CCD8A", +}; + +module.exports = { + linea: { + tvl: sumTokensExport({ + owner: linea.treasury, + chain: "linea", + tokens: [linea.weth, nullAddress], + }), + ownTokens: sumTokensExport({ + owner: linea.treasury, + tokens: [linea.zero], + chain: "linea", + }), + }, +}; diff --git a/projects/zerolend/index.js b/projects/zerolend/index.js index 13d30abb2261..6f56ea6d819e 100644 --- a/projects/zerolend/index.js +++ b/projects/zerolend/index.js @@ -1,4 +1,6 @@ const { aaveExports } = require("../helper/aave"); +const { staking } = require("../helper/staking"); +const { pool2s } = require("../helper/pool2"); const config = { era: "0xB73550bC1393207960A385fC8b34790e5133175E", @@ -9,8 +11,22 @@ const config = { ethereum: "0x47223D4eA966a93b2cC96FFB4D42c22651FADFcf", }; +const linea = { + treasury: "0x14aAD4668de2115e30A5FeeE42CFa436899CCD8A", + zeroEthNileLP: "0x0040f36784dda0821e74ba67f86e084d70d67a3a", + zeroEthNileCLP: "0x179b4B1C19faF18Bed713304c870e9317bc79A84", + zeroEthLynexCLP: "0xb88261e0DBAAc1564f1c26D78781F303EC7D319B", + zero: "0x78354f8DcCB269a615A7e0a24f9B0718FDC3C7A7", + zlpLocker: "0x8bb8b092f3f872a887f377f73719c665dd20ab06", + zeroLocker: "0x08D5FEA625B1dBf9Bae0b97437303a0374ee02F8", +}; + +const data = {}; Object.keys(config).forEach((chain) => { - module.exports[chain] = aaveExports(chain, undefined, undefined, [ - config[chain], - ]); + data[chain] = aaveExports(chain, undefined, undefined, [config[chain]]); }); + +data.linea.staking = staking(linea.zeroLocker, linea.zero, "linea"); +data.linea.pool2 = pool2s([linea.zlpLocker], [linea.zeroEthNileLP], "linea"); // todo add the lynex and nile LPs from the treasury + +module.exports = data; From d6036a5d81b3ff3f4de39b824a9be27510150d0a Mon Sep 17 00:00:00 2001 From: Ben Date: Sat, 8 Jun 2024 07:37:34 -0700 Subject: [PATCH 259/855] Update adapter for Anzen (#10404) * add Anzen TVL * correct TVL calculation for Anzen * set adapter for Anzen V2 product * add anzen to V2 folder --- projects/anzen-v2/index.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 projects/anzen-v2/index.js diff --git a/projects/anzen-v2/index.js b/projects/anzen-v2/index.js new file mode 100644 index 000000000000..a315fbc51619 --- /dev/null +++ b/projects/anzen-v2/index.js @@ -0,0 +1,32 @@ +const sdk = require('@defillama/sdk') + +// Anzen USDz - digital dollar backed by Real World Assets + +const USDz = '0xa469b7ee9ee773642b3e93e842e5d9b5baa10067'; +const Base_USDz = '0x04d5ddf5f3a8939889f11e97f8c4bb48317f1938'; +const SPCT = '0xf30a29f1c540724fd8c5c4be1af604a6c6800d29'; // Secured collateral + +const mainnet_tvl = async (api) => { + const supply = await api.call({ abi: 'erc20:totalSupply', target: USDz }) + api.add(USDz, supply) +} + +const base_tvl = async (api) => { + const supply = await api.call({ abi: 'erc20:totalSupply', target: Base_USDz }) + api.add(Base_USDz, supply) +} + +const collateral_assets = async (api) => { + const supply = await api.call({ abi: 'erc20:totalSupply', target: SPCT }) + api.add(SPCT, supply) +} + +module.exports = { + methodology: "Sums total USDz in circulation across all chains", + ethereum: { + tvl: mainnet_tvl, + }, + base: { + tvl: base_tvl, + }, +}; From c9ef822f78d80c9c50acab1635e7a8c933f9a0b3 Mon Sep 17 00:00:00 2001 From: Aleksei Lushnikov Date: Sat, 8 Jun 2024 15:38:35 +0100 Subject: [PATCH 260/855] symbiosis adds pufETH and zeta chain (#10536) * symbiosis adds pufETH and zeta chain * move project specific tokens to project's config --- projects/helper/tokenMapping.js | 3 ++ projects/symbiosis-finance/config.js | 56 ++++++++++++++++++++++++---- 2 files changed, 52 insertions(+), 7 deletions(-) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index f67fed34636c..4a8f6ce3722e 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -158,6 +158,9 @@ const fixBalancesTokens = { planq: { "0xecEEEfCEE421D8062EF8d6b4D814efe4dc898265": { coingeckoId: 'usd-coin', decimals: 6 }, "0x75E20C5d4aade76143b8b74d1C5E2865347f9d3B": { coingeckoId: 'usd-coin', decimals: 18 }, + }, + zeta: { + "0x1e4bF3CaBD7707089138dD5a545B077413FA83Fc": { coingeckoId: 'pufeth', decimals: 18 }, } } diff --git a/projects/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js index e06ef05c2539..52682d590f67 100644 --- a/projects/symbiosis-finance/config.js +++ b/projects/symbiosis-finance/config.js @@ -1,5 +1,34 @@ const ADDRESSES = require('../helper/coreAssets.json') -const XDAO = '0x71eebA415A523F5C952Cc2f06361D5443545Ad28' + +const TOKENS = { + ethereum: { + pufETH: "0xD9A442856C234a39a81a089C06451EBAa4306a72", + LADYS: "0x12970E6868f88f6557B76120662c1B3E50A646bf", + XDAO: "0x71eebA415A523F5C952Cc2f06361D5443545Ad28" + }, + bsc: { + XDAO: "0x71eebA415A523F5C952Cc2f06361D5443545Ad28" + }, + polygon: { + XDAO: "0x71eebA415A523F5C952Cc2f06361D5443545Ad28" + }, + arbitrum: { + XDAO: "0x71eebA415A523F5C952Cc2f06361D5443545Ad28", + LADYS: "0x3b60FF35D3f7F62d636b067dD0dC0dFdAd670E4E" + }, + manta: { + pufETH: "0xA53E005Cecd3D7C89A4AE814617cC14828b6527E" + }, + scroll: { + pufETH: "0xc4d46E8402F476F269c379677C99F18E22Ea030e" + }, + zeta: { + pufETH: "0x1e4bF3CaBD7707089138dD5a545B077413FA83Fc" + }, + zklink: { + pufETH: "0x1B49eCf1A8323Db4abf48b2F5EFaA33F7DdAB3FC" + } +} module.exports = { chains: [ @@ -10,8 +39,9 @@ module.exports = { ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.WETH, ADDRESSES.ethereum.WBTC, - XDAO, - '0x12970E6868f88f6557B76120662c1B3E50A646bf', // LADYS + TOKENS.ethereum.XDAO, + TOKENS.ethereum.LADYS, + TOKENS.ethereum.pufETH, ], holders: [ '0xb80fDAA74dDA763a8A158ba85798d373A5E84d84', // portal v1 @@ -26,7 +56,7 @@ module.exports = { ADDRESSES.bsc.USDC, ADDRESSES.bsc.ETH, ADDRESSES.bsc.BTCB, - XDAO, + TOKENS.bsc.XDAO, ], holders: [ '0xD7F9989bE0d15319d13d6FA5d468211C89F0b147', // portal v1 @@ -53,7 +83,7 @@ module.exports = { tokens: [ ADDRESSES.polygon.USDC, ADDRESSES.polygon.WETH_1, - XDAO, + TOKENS.polygon.XDAO, ], holders: [ '0xD7F9989bE0d15319d13d6FA5d468211C89F0b147', // portal v1 @@ -145,8 +175,8 @@ module.exports = { ADDRESSES.arbitrum.USDC, // USDC.e ADDRESSES.arbitrum.USDC_CIRCLE, ADDRESSES.arbitrum.WETH, - XDAO, - '0x3b60FF35D3f7F62d636b067dD0dC0dFdAd670E4E', // LADYS + TOKENS.arbitrum.XDAO, + TOKENS.arbitrum.LADYS, ], holders: [ '0x01A3c8E513B758EBB011F7AFaf6C37616c9C24d9', // portal v2 @@ -230,6 +260,7 @@ module.exports = { tokens: [ ADDRESSES.scroll.WETH, ADDRESSES.scroll.USDC, + TOKENS.scroll.pufETH, ], holders: [ '0x5Aa5f7f84eD0E5db0a4a85C3947eA16B53352FD4', // portal v2 @@ -241,6 +272,7 @@ module.exports = { tokens: [ ADDRESSES.manta.WETH, ADDRESSES.manta.USDC, + TOKENS.manta.pufETH, ], holders: [ '0x5Aa5f7f84eD0E5db0a4a85C3947eA16B53352FD4', // portal v2 @@ -305,6 +337,7 @@ module.exports = { name: 'zklink', tokens: [ ADDRESSES.zklink.WETH, + TOKENS.zklink.pufETH, ], holders: [ '0x8Dc71561414CDcA6DcA7C1dED1ABd04AF474D189', // portal v2 @@ -338,5 +371,14 @@ module.exports = { '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 ] }, + { + name: 'zeta', + tokens: [ + TOKENS.zeta.pufETH, + ], + holders: [ + '0x8a7F930003BedD63A1ebD99C5917FD6aE7E3dedf', // portal v2 + ] + }, ] } \ No newline at end of file From 8e892feb2fa482b3d4f369d061a7cb54f28af04c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sun, 9 Jun 2024 10:52:54 +0200 Subject: [PATCH 261/855] update penpie --- projects/penpie/index.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/projects/penpie/index.js b/projects/penpie/index.js index cfee75dd7655..6a4d98f2f13c 100644 --- a/projects/penpie/index.js +++ b/projects/penpie/index.js @@ -3,7 +3,7 @@ const config = require("./config"); const { staking } = require('../helper/staking') async function tvl(api) { - const { masterPenpie, pendleStaking, vePENDLE, PENDLE, mPENDLE, } = config[api.chain]; + const { masterPenpie, vlPNP } = config[api.chain]; const poolTokens = await api.fetchList({ lengthAbi: MasterMagpieAbi.poolLength, @@ -11,13 +11,11 @@ async function tvl(api) { target: masterPenpie, }); const poolInfos = await api.multiCall({ abi: 'function getPoolInfo(address) view returns ( uint256 emission, uint256 allocpoint, uint256 sizeOfPool, uint256 totalPoint)', calls: poolTokens, target: masterPenpie, }) - const symbols = await api.multiCall({ abi: 'erc20:symbol', calls: poolTokens, }) poolTokens.forEach((token, i) => { - if (symbols[i] === 'vlPenpie' || symbols[i] === 'mPendle' || symbols[i] === 'mPendleOFT' || symbols[i] === 'mPendleSV') { - token = PENDLE - } api.add(token, poolInfos[i].sizeOfPool) }) + if (vlPNP) + api.removeTokenBalance(vlPNP) } Object.keys(config).forEach((chain) => { From eada03ccda90a17cf57ece2bf28e8e187c876aed Mon Sep 17 00:00:00 2001 From: Adolf998 <154962952+Adolf998@users.noreply.github.com> Date: Mon, 10 Jun 2024 02:28:05 +0800 Subject: [PATCH 262/855] add BounceBit-Ethena project (#10539) * update bouncebit-premium & bouncebitTvl * add bouncebit-ethena project --- projects/bouncebit-ethena/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/bouncebit-ethena/index.js diff --git a/projects/bouncebit-ethena/index.js b/projects/bouncebit-ethena/index.js new file mode 100644 index 000000000000..24fe61eaf06b --- /dev/null +++ b/projects/bouncebit-ethena/index.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/sumTokens'); + +const USDe = ADDRESSES.ethereum.USDe +const USDT = ADDRESSES.ethereum.USDT + +const contractAddress = '0x96E65d1ae193A15b19500AEA8F7f739989C810ea' + +module.exports = { + ethereum: { + tvl: sumTokensExport({ + owners: [contractAddress], + tokens: [USDe, USDT] + }), + } +} From 347981eb012bf4bccbc4527ece9b90f129fa10b2 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Sun, 9 Jun 2024 19:36:14 +0100 Subject: [PATCH 263/855] git push origin remove-bsc-beefy (#10567) --- projects/beefy/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/beefy/index.js b/projects/beefy/index.js index 2422c214110a..778e627e82b7 100644 --- a/projects/beefy/index.js +++ b/projects/beefy/index.js @@ -34,7 +34,7 @@ const chains = { ethereum: 1, optimism: 10, cronos: 25, - bsc: 56, +// bsc: 56, "stargate-v2-bsc-usdt" pool giving B xdai: 100, fuse: 122, heco: 128, From 1e209720dfef8e63d01bca79a5a9518b6d89300d Mon Sep 17 00:00:00 2001 From: 0xngmi <80541789+0xngmi@users.noreply.github.com> Date: Sun, 9 Jun 2024 23:47:42 +0100 Subject: [PATCH 264/855] Revert "git push origin remove-bsc-beefy (#10567)" (#10568) This reverts commit 347981eb012bf4bccbc4527ece9b90f129fa10b2. --- projects/beefy/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/beefy/index.js b/projects/beefy/index.js index 778e627e82b7..2422c214110a 100644 --- a/projects/beefy/index.js +++ b/projects/beefy/index.js @@ -34,7 +34,7 @@ const chains = { ethereum: 1, optimism: 10, cronos: 25, -// bsc: 56, "stargate-v2-bsc-usdt" pool giving B + bsc: 56, xdai: 100, fuse: 122, heco: 128, From f85669f6dcd2601a05ff0a58da4bce4f2e207e1e Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 10 Jun 2024 04:12:00 +0100 Subject: [PATCH 265/855] remove old weird tokens --- projects/gdl/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/gdl/index.js b/projects/gdl/index.js index faa400e3dcf5..144466efc0d1 100644 --- a/projects/gdl/index.js +++ b/projects/gdl/index.js @@ -40,9 +40,9 @@ async function poolBalance(owner, targets, block) { async function tvl(timestamp, ethereumBlock, chainBlocks) { const block = chainBlocks['avax']; let balances = {}; - balances['tether'] = await poolBalance(GDL_USD_POOL, [USDT, zUSDT], block); - balances['dai'] = await poolBalance(GDL_DAI_POOL, [DAI, zDAI], block); - balances['ethereum'] = await poolBalance(GDL_ETH_POOL, [ETH, zETH], block); + balances['tether'] = await poolBalance(GDL_USD_POOL, [USDT], block); + balances['dai'] = await poolBalance(GDL_DAI_POOL, [DAI], block); + balances['ethereum'] = await poolBalance(GDL_ETH_POOL, [ETH], block); balances['gondola-finance'] = await poolBalance(GDL_POOL, [GDL], block); return balances; } From 63e34b2294df49d72a27f1d94d4c3d8804af9aff Mon Sep 17 00:00:00 2001 From: dev Date: Mon, 10 Jun 2024 11:19:26 +0700 Subject: [PATCH 266/855] update calculator funible asset aptos --- projects/cellana/index.js | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/projects/cellana/index.js b/projects/cellana/index.js index 5d2acc955e99..72d1aaf09e69 100644 --- a/projects/cellana/index.js +++ b/projects/cellana/index.js @@ -1,20 +1,20 @@ -const { getResources, } = require("../helper/chain/aptos"); -const ADDRESSES = require('../helper/coreAssets.json') -const CELL_fungible_asset_address = '0x2ebb2ccac5e027a87fa0e2e5f656a3a4238d6a48d93ec9b610d570fc0aa0df12' -const APT_fungible_asset_address = '0xedc2704f2cef417a06d1756a04a16a9fa6faaed13af469be9cdfcac5a21a8e2e' - +const { getResources, function_view } = require("../helper/chain/aptos"); +let resourcesCache; +let poolsCache; async function _getResources() { - let resourcesCache; if (!resourcesCache) resourcesCache = getResources("0x3b38735644d0be8ac37ebd84a1e42fa5c2487495ef8782f6c694b1a147f82426") return resourcesCache } - +async function _getPools() { + if (!poolsCache) poolsCache = function_view({ functionStr: "0x4bf51972879e3b95c4781a5cdcb9e1ee24ef483e7d22f2d903626f126df62bd1::liquidity_pool::all_pool_addresses", type_arguments: [], args: [] }) + return poolsCache +} const extractCoinAddress = (str) => str.slice(str.indexOf("<") + 1, str.lastIndexOf(">")); const reserveContrainerFilter = (i) => i.type.includes("0x1::coin::CoinStore") -async function _getCELLbalances(api) { - const data = await getResources('0x4bf51972879e3b95c4781a5cdcb9e1ee24ef483e7d22f2d903626f126df62bd1') - const poolsAddresses = data.find(i => i.type.includes('::liquidity_pool::LiquidityPoolConfigs'))?.data.all_pools?.inline_vec +async function getfungibleAssetBalances(api) { + const data = await _getPools('0x4bf51972879e3b95c4781a5cdcb9e1ee24ef483e7d22f2d903626f126df62bd1') + const poolsAddresses = data[0]; for (const pool of poolsAddresses) { const fungibleAssetPoolStore = (await getResources(pool.inner)).find(i => i.type.includes('liquidity_pool::LiquidityPool'))?.data const fungibleAssetAddressToken1 = fungibleAssetPoolStore?.token_store_1?.inner @@ -24,16 +24,8 @@ async function _getCELLbalances(api) { const fungibleAssetTokenStore_2 = (await getResources(fungibleAssetAddressToken2)).find(i => i.type.includes('fungible_asset::FungibleStore'))?.data const token_1_address = fungibleAssetTokenStore_1?.metadata?.inner const token_2_address = fungibleAssetTokenStore_2?.metadata?.inner - if (token_1_address == CELL_fungible_asset_address) { - addBalance(token_2_address, fungibleAssetTokenStore_2?.balance || 0); - } else if (token_2_address == CELL_fungible_asset_address) { - addBalance(token_1_address, fungibleAssetTokenStore_1?.balance || 0); - } - } - - async function addBalance(token, balance) { - if (token === APT_fungible_asset_address) - api.add(ADDRESSES.aptos.APT, balance) + api.add(token_2_address, fungibleAssetTokenStore_2?.balance || 0); + api.add(token_1_address, fungibleAssetTokenStore_1?.balance || 0); } } @@ -44,6 +36,7 @@ module.exports = { "Counts the lamports in each coin container in the Cellena contract account.", aptos: { tvl: async (_, _1, _2, { api }) => { + //Get coin balance const data = await _getResources() const coinContainers = data.filter(reserveContrainerFilter) .map((i) => ({ @@ -54,7 +47,9 @@ module.exports = { coinContainers.forEach(({ lamports, tokenAddress }) => { api.add(tokenAddress, lamports); }); - await _getCELLbalances(api) + //get funible asset balance + await getfungibleAssetBalances(api) + console.log(api) } } } \ No newline at end of file From 826be3e5af7181d19f99a05ecd87b95e85af79f6 Mon Sep 17 00:00:00 2001 From: GausPeerzade <116433573+GausPeerzade@users.noreply.github.com> Date: Mon, 10 Jun 2024 12:29:10 +0530 Subject: [PATCH 267/855] New Degen Chain vault of Rivera (#10571) * Added Arbitrum vaults * Added new chains * New Degen Vaults Rivera --- projects/rivera_money/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/rivera_money/index.js b/projects/rivera_money/index.js index d743e285f269..4ee8512d0a3f 100644 --- a/projects/rivera_money/index.js +++ b/projects/rivera_money/index.js @@ -35,7 +35,9 @@ const config = { ], degen: [ - "0xA95417805d18d00844c3C6FB7742577Cd263fE05" + "0xA95417805d18d00844c3C6FB7742577Cd263fE05", + "0x39dD79E8b1e74E8B514D7e133b3671435Ec3Da42", + "0xE45F416eE25844281edF2780247E28569303c7Cd", ], bsquared: [ From c7300d7d5b4d88bf3dfa1de7b1d956332ed623b4 Mon Sep 17 00:00:00 2001 From: "Bladeswap.xyz" <160004157+Bladeswap@users.noreply.github.com> Date: Mon, 10 Jun 2024 16:00:22 +0900 Subject: [PATCH 268/855] add bladeswap-CL (#10570) Co-authored-by: bladeswap --- projects/bladeswap-CL/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/bladeswap-CL/index.js diff --git a/projects/bladeswap-CL/index.js b/projects/bladeswap-CL/index.js new file mode 100644 index 000000000000..b5dec6bc44ab --- /dev/null +++ b/projects/bladeswap-CL/index.js @@ -0,0 +1,14 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + blast: { + factory: "0xA87DbF5082Af26c9A6Ab2B854E378f704638CCa5", + fromBlock: 4466565, + isAlgebra: true, + blacklistedTokens: [ + '0xD1FedD031b92f50a50c05E2C45aF1aDb4CEa82f4', + '0xF8f2ab7C84CDB6CCaF1F699eB54Ba30C36B95d85', + ] + + }, +}); From f63b79a9142dbb051e3d1f1d0548bf6395858888 Mon Sep 17 00:00:00 2001 From: Thanh Nguyen Date: Mon, 10 Jun 2024 14:42:00 +0700 Subject: [PATCH 269/855] Create the branch --- projects/capybara-exchange/config.js | 8 ++++++++ projects/capybara-exchange/index.js | 24 ++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 projects/capybara-exchange/config.js create mode 100644 projects/capybara-exchange/index.js diff --git a/projects/capybara-exchange/config.js b/projects/capybara-exchange/config.js new file mode 100644 index 000000000000..f5272a6610a9 --- /dev/null +++ b/projects/capybara-exchange/config.js @@ -0,0 +1,8 @@ +module.exports = { + klaytn: { + pools: { + mainPool: "0x540cce8ed7d210f71eeabb9e7ed7698ac745e077", + volatilePool: "0x6389dbfa1427a3b0a89cddc7ea9bbda6e73dece7", + }, + }, +}; diff --git a/projects/capybara-exchange/index.js b/projects/capybara-exchange/index.js new file mode 100644 index 000000000000..da8de8f51dad --- /dev/null +++ b/projects/capybara-exchange/index.js @@ -0,0 +1,24 @@ +const config = require("./config"); +const { sumTokens2 } = require("../helper/unwrapLPs"); + +Object.keys(config).forEach((chain) => { + const arg = config[chain]; + module.exports[chain] = { + tvl: async (_, _b, { [chain]: block }, { api }) => { + const pools = Object.values(arg["pools"]); + + let allUnderlying = await api.multiCall({ abi: "address[]:getTokens", calls: pools, }); + + const tokens = []; + const calls = []; + pools.forEach((v, i) => { + allUnderlying[i].forEach((t) => { + tokens.push(t); + calls.push({ target: v, params: t }); + }); + }); + const wTokens = await api.multiCall({ abi: "function addressOfAsset(address) view returns (address)", calls, }); + return sumTokens2({ api, tokensAndOwners2: [tokens, wTokens], }); + }, + }; +}); From 927d79b6d187f16bb89252791da27d803814b897 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 10 Jun 2024 14:06:06 +0530 Subject: [PATCH 270/855] Update nimbora-yield functionality (#10574) * add nimbora-yield * fix(nimbora-yield): update methodology * update nimbora-yield * cache response --------- Co-authored-by: 0xSacha <90143060+0xSacha@users.noreply.github.com> --- projects/nimbora-yield/index.js | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/projects/nimbora-yield/index.js b/projects/nimbora-yield/index.js index 246218de50ea..41ba202628e5 100644 --- a/projects/nimbora-yield/index.js +++ b/projects/nimbora-yield/index.js @@ -1,6 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const { call, parseAddress } = require('../helper/chain/starknet') const { getConfig } = require('../helper/cache') +const { get } = require('../helper/http') const totalAssetsAbi = { "name": "total_assets", @@ -15,21 +16,27 @@ const totalAssetsAbi = { "stateMutability": "view" } - +async function fetcher() { + return get('https://backend.nimbora.io/yield-dex/strategies', { + headers: { + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36' + } + }) +} async function tvl(api) { - const strategyData = await getConfig('nimbora', "https://backend.nimbora.io/yield-dex/strategies") - for (let index = 0; index < strategyData.length; index++) { - const strategyInfo = strategyData[index]; - const underlying = parseAddress(strategyInfo.underlying) == "0x05574eb6b8789a91466f902c380d978e472db68170ff82a5b650b95a58ddf4ad" ? ADDRESSES.starknet.DAI : parseAddress(strategyInfo.underlying); - const strategyTvl = await call({ target: strategyInfo.tokenManager, abi: totalAssetsAbi }); - api.add(underlying, strategyTvl) - } + const strategyData = await getConfig('nimbora-yield', undefined, { fetcher }) + for (let index = 0; index < strategyData.length; index++) { + const strategyInfo = strategyData[index]; + const underlying = parseAddress(strategyInfo.underlying) == "0x05574eb6b8789a91466f902c380d978e472db68170ff82a5b650b95a58ddf4ad" ? ADDRESSES.starknet.DAI : parseAddress(strategyInfo.underlying); + const strategyTvl = await call({ target: strategyInfo.tokenManager, abi: totalAssetsAbi }); + api.add(underlying, strategyTvl) + } } module.exports = { - methodology: 'Computed by summing the total assets held by each strategy.', - starknet: { - tvl - }, + methodology: 'Computed by summing the total assets held by each strategy.', + starknet: { + tvl + }, } From 19ffc47b7de402ed17d7006c3bcfa8b362ff9505 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Mon, 10 Jun 2024 10:29:55 +0100 Subject: [PATCH 271/855] daiko hallmark (#10575) --- projects/daiko-dex/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/daiko-dex/index.js b/projects/daiko-dex/index.js index 3b94051348e4..f3b68c679024 100644 --- a/projects/daiko-dex/index.js +++ b/projects/daiko-dex/index.js @@ -1,3 +1,6 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('taiko', '0x2cFAe8F731D6a04f3E868deB03ad73576695271A') \ No newline at end of file +module.exports = uniTvlExport('taiko', '0x2cFAe8F731D6a04f3E868deB03ad73576695271A'), +module.exports.hallmarks = [ + [1717777624,"Rug Pull"] + ] \ No newline at end of file From 8be5b8779ff3a1700ff1799d3a559c5b3346d519 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Mon, 10 Jun 2024 11:24:36 +0100 Subject: [PATCH 272/855] remove doublecounting (#10576) --- projects/bouncebit-premium/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/bouncebit-premium/index.js b/projects/bouncebit-premium/index.js index 9af68c13fa4a..fde3876f9dca 100644 --- a/projects/bouncebit-premium/index.js +++ b/projects/bouncebit-premium/index.js @@ -23,7 +23,7 @@ module.exports = { ethereum: { tvl: sumTokensExport({ owners: ["0x1ddD6E5eA766511CC0f348DC8d17578a821B680F", "0xa2B283e4dbdFEA5461C36a59E3B94b3ef2883085"], - tokens: [BBTC, BBUSD] + tokens: [BBTC] // removed BBUSD because its tracked on bouncebit ethena listing }), }, bsc: { From d060bf4de8a63c404ed99286aadc4c48662af321 Mon Sep 17 00:00:00 2001 From: Thanh Nguyen Date: Mon, 10 Jun 2024 17:37:41 +0700 Subject: [PATCH 273/855] Simplify function's signature --- projects/capybara-exchange/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/capybara-exchange/index.js b/projects/capybara-exchange/index.js index da8de8f51dad..9810ad1be6ae 100644 --- a/projects/capybara-exchange/index.js +++ b/projects/capybara-exchange/index.js @@ -4,7 +4,7 @@ const { sumTokens2 } = require("../helper/unwrapLPs"); Object.keys(config).forEach((chain) => { const arg = config[chain]; module.exports[chain] = { - tvl: async (_, _b, { [chain]: block }, { api }) => { + tvl: async (api) => { const pools = Object.values(arg["pools"]); let allUnderlying = await api.multiCall({ abi: "address[]:getTokens", calls: pools, }); From c6d15e41a260101cf2405bfb8870eb305514d851 Mon Sep 17 00:00:00 2001 From: TJakubek <39831436+TJakubek@users.noreply.github.com> Date: Mon, 10 Jun 2024 19:42:17 +0200 Subject: [PATCH 274/855] Enosys farm update (#10580) * fix: updating farms * fix: missing BNZ farm * fix: incorrect pool2 farm * adding sFLR pools --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/flarefarm/flare.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/projects/flarefarm/flare.js b/projects/flarefarm/flare.js index 8e6a9dda21e5..6b18d43e9361 100644 --- a/projects/flarefarm/flare.js +++ b/projects/flarefarm/flare.js @@ -18,7 +18,13 @@ const LPs ={ WFLR_eQNT_LP: '0x80A08BbAbB0A5C51A9ae53211Df09EF23Debd4f3', HLN_eQNT_LP: '0xEd920325b7dB1e909DbE2d562fCD07f714395e10', eQNT_APS_LP: '0x33E2354928002766C27F7424EcA6f9B133E922a5', - WFLR_BNZ_LP: '0x2C934BbBD152A40419d3330e4d79f362Bc6691D6' + WFLR_BNZ_LP: '0x2C934BbBD152A40419d3330e4d79f362Bc6691D6', + sFLR_WFLR_LP: '0x7E8EB77Feb4b3Fe2C58B493DF6Ce38875806bebb', + sFLR_eUSDT_LP: '0xDf243D5631A68fDa74Db6572D7649aD341470c82', + sFLR_eETH_LP: '0x68cB5Bf8c9A54d664d9b6b483fC6A6401448223e', + sFLR_eQNT_LP: '0xb7C6F8cff4D5B7266225f624e03a27BE0998C726', + sFLR_HLN_LP: '0x6CbF760115F66502838B5622423D68DBCb4A9757', + sFLR_APS_LP: '0xf06eeBF7A66C80760Bd8343A6BCe84c9D61879ee', } const chain = 'flare' @@ -40,8 +46,14 @@ async function farmTvl(timestamp, ethblock, { [chain]: block }) { [LPs.eETH_APS_LP, "0x05B623fd361109D0e47169eBa9e0514c80c40409"], [LPs.WFLR_eQNT_LP, "0xc786B4a2F9c314743Ed713184e5c94c244fF6c8D"], [LPs.HLN_eQNT_LP, "0x02321f8030208de54dBd3e2DbdEfbd07cc88Ad6D"], - [LPs.eQNT_APS_LP, "0x5E69aD043AE8941969617aeF4487f15445D774C6"], - [LPs.WFLR_BNZ_LP, "0x8246A727510F471f8a61CBc218B60e5cf85739F6"] + [LPs.eQNT_APS_LP, "0x5E69aD043AE8941969617aeF4487f15445D774C6"], + [LPs.WFLR_BNZ_LP, "0x8246A727510F471f8a61CBc218B60e5cf85739F6"], + [HLN, "0x9032Cf50B469Eec548654E060d1c14fe5AA7038b"], + [LPs.sFLR_WFLR_LP, "0xeb4ed8662828735E2871493b957b29fD5Cb44fEB"], + [LPs.sFLR_eUSDT_LP, "0x31b3086D005a266864C014d4Ae09F5fc0F9Ea15d"], + [LPs.sFLR_eETH_LP, "0x03a9Fed1a21382d84c0c57eebba7DF293aca4e65"], + [LPs.sFLR_eQNT_LP, "0xcE5D8BB190eE88A96A23e69A50670907873f00e9"], + [LPs.sFLR_HLN_LP, "0xd06FFFb1908EAcC059d94cbA4004091dE4164e51"], ]; return sumUnknownTokens({ tokensAndOwners: tokens, chain, block, useDefaultCoreAssets: true, }) @@ -52,6 +64,8 @@ async function pool2(timestamp, ethblock, { [chain]: block }) { const tokens = [ ['0xef24D5155818d4bD16AF0Cea1148A147eb620743', "0x3DA590b357Cf17a413ec8db70FeB02119AfE707f"], ['0x87E0E33558c8e8EAE3c1E9EB276e05574190b48a', "0x2de4bC38f012DC90478f570083d3Da45B05659A9"], + [LPs.sFLR_APS_LP,'0xded2decC3028B700B8d124292868F195bb8F6467'] + ] return sumUnknownTokens({ tokensAndOwners: tokens, chain, block, useDefaultCoreAssets: true, }) } From 990ed18367cc9f1fc9c24bb5a544a8da598ac310 Mon Sep 17 00:00:00 2001 From: Rodolfo Lima <56616501+LimaRods@users.noreply.github.com> Date: Mon, 10 Jun 2024 14:44:47 -0300 Subject: [PATCH 275/855] Zkx adapter (#10579) * added adapter to list zkx protocol * updated methodolody * Delete projects/zkx/abi.json * Update index.js --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/zkx/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/zkx/index.js diff --git a/projects/zkx/index.js b/projects/zkx/index.js new file mode 100644 index 000000000000..9dffbaaa88d2 --- /dev/null +++ b/projects/zkx/index.js @@ -0,0 +1,8 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports = { + ethereum: { + tvl: sumTokensExport({ owners: ['0x8F5Af913D42DbC296d0e184B6356EC4256029D09'], tokens: [ADDRESSES.ethereum.USDC], }) + } +} From f5c56dc4f20ff708501267f78b0c0b3504ad8dbb Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Tue, 11 Jun 2024 01:11:32 +0100 Subject: [PATCH 276/855] add jigsaw --- projects/jigsaw/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/jigsaw/index.js diff --git a/projects/jigsaw/index.js b/projects/jigsaw/index.js new file mode 100644 index 000000000000..f7b83af14fd9 --- /dev/null +++ b/projects/jigsaw/index.js @@ -0,0 +1,11 @@ +const { sumERC4626VaultsExport } = require("../helper/erc4626"); + +module.exports = { + methodology: 'ETH and LSTs in vaults', + ethereum: { + tvl: sumERC4626VaultsExport({ + vaults: ["0x4412e5492C689CF13D585dCdb010B3b8b12dF16a", "0x9F5e6E972D76d4501900f4484622f9413E5Cc302", "0x3A10a803958e837599348621Edb42eF73c79aC22"], + tokenAbi: 'tokenIn', balanceAbi: 'totalSupply' + }) + } +}; \ No newline at end of file From cc64d019c9eb89d550368fb154b12296bb127e25 Mon Sep 17 00:00:00 2001 From: Byron Kim Barra <88365848+byyyyyyyyy@users.noreply.github.com> Date: Tue, 11 Jun 2024 00:09:39 -0700 Subject: [PATCH 277/855] Feat: Updated token address and borrowed data for Wiselending-v2 (#10589) * added wise lending project with tvl field * finalized tvl field * added arbitrum tvl * Update index.js * removed arbitrum changes and renamed project * Fixed wise-lending-v2 * Remove unnesarry changes * Remove unnesarry changes * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Co-authored-by: Jenelyn Castil Contillo <62682071+jenelyn0214@users.noreply.github.com> Co-authored-by: Jenelyn Castil Contillo --- projects/wise-lending-v2/index.js | 50 +++++++++++++++++-------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/projects/wise-lending-v2/index.js b/projects/wise-lending-v2/index.js index b344569aa7de..8abbfef260d5 100644 --- a/projects/wise-lending-v2/index.js +++ b/projects/wise-lending-v2/index.js @@ -1,32 +1,38 @@ - async function tvl(api) { - const { lending: lendingContract, feeManager } = config[api.chain] - const pools = await api.fetchList({ lengthAbi: 'uint256:getPoolTokenAddressesLength', itemAbi: 'function getPoolTokenAdressesByIndex(uint256) view returns (address)', target: feeManager }) - const isATokens = await api.multiCall({ abi: 'function isAaveToken(address) view returns (bool)', calls: pools, target: feeManager }) - const aTokens = pools.filter((_, i) => isATokens[i]) - let otherTokens = pools.filter((_, i) => !isATokens[i]) - const names = await api.multiCall({ abi: 'string:name', calls: otherTokens }) - const pendleTokens = otherTokens.filter((_, i) => names[i].includes(' Pendle ')) - otherTokens = otherTokens.filter(i => !pendleTokens.includes(i)) - const uaTokens = await api.multiCall({ abi: 'function underlyingToken(address) view returns (address)', calls: aTokens, target: feeManager }) + const { lending: lendingContract, tvlAddresses } = config[api.chain]; + + return api.sumTokens({ owner: lendingContract, tokens: tvlAddresses }); +} - // unwrap pendle - const pBals = await api.multiCall({ abi: 'erc20:balanceOf', calls: pendleTokens.map(t => ({ target: t, params: lendingContract })) }) - const pSupply = await api.multiCall({ abi: 'erc20:totalSupply', calls: pendleTokens }) - const pTotalAssets = await api.multiCall({ abi: 'uint256:totalLpAssets', calls: pendleTokens }) - const pUnderlying = await api.multiCall({ abi: 'address:UNDERLYING_PENDLE_MARKET', calls: pendleTokens }) +async function borrowed(api) { + const { lending: lendingContract, borrowAddresses } = config[api.chain]; - pUnderlying.forEach((token, i) => { - api.add(token, pBals[i] * pTotalAssets[i] / pSupply[i]) + const borrowAmounts = await api.multiCall({ + abi: 'function getPseudoTotalBorrowAmount(address) view returns (uint256)', + target: lendingContract, + calls: borrowAddresses }) - return api.sumTokens({ owner: lendingContract, tokens: [...otherTokens, ...uaTokens], }) + api.add(borrowAddresses, borrowAmounts) } +const aavePools = [ + "0x724dc807b04555b71ed48a6896b6F41593b8C637", + "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8", + "0x5979D7b546E38E414F7E9822514be443A4800529", + "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE", + "0x6ab707Aca953eDAeFBc4fD23bA73294241490620", +]; + const config = { - arbitrum: { lending: '0x9034a49587bd2c1af27598e0f04f30db66c87ebf', feeManager: '0x90a022796798f9dbA1Da0f8645234B284d4E8EC6' }, -} + arbitrum: { + lending: '0x9034a49587bD2c1Af27598E0f04F30Db66C87Ebf', + feeManager: '0x90a022796798f9dbA1Da0f8645234B284d4E8EC6', + tvlAddresses: aavePools, + borrowAddresses: aavePools + }, +}; Object.keys(config).forEach(chain => { - module.exports[chain] = { tvl } -}) + module.exports[chain] = { tvl, borrowed }; +}); From e643f59b898ae5292b74733eb56ff9f96db98da4 Mon Sep 17 00:00:00 2001 From: rockooor <121937361+rockooor@users.noreply.github.com> Date: Tue, 11 Jun 2024 10:45:17 +0200 Subject: [PATCH 278/855] Add The Vault (#10588) * Add the Vault * rename * pull staked sol value instead of LSD token supply --------- Co-authored-by: x Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/blazestake/index.js | 8 +- projects/helper/solana.js | 27 +++- projects/helper/utils/solana/layout.js | 4 +- .../helper/utils/solana/layouts/stakePool.js | 133 ++++++++++++++++++ projects/jpool.js | 23 ++- projects/marinade-native/index.js | 16 +-- projects/solana_miner/index.js | 1 + projects/thevault/index.js | 13 ++ 8 files changed, 193 insertions(+), 32 deletions(-) create mode 100644 projects/helper/utils/solana/layouts/stakePool.js create mode 100644 projects/thevault/index.js diff --git a/projects/blazestake/index.js b/projects/blazestake/index.js index 44d2d23beef4..f5d6c792089c 100644 --- a/projects/blazestake/index.js +++ b/projects/blazestake/index.js @@ -1,14 +1,12 @@ -const { getTokenSupply } = require("../helper/solana") +const { getStakedSol } = require("../helper/solana") async function tvl(api) { - const bSOL = 'bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1' - const supply = await getTokenSupply(bSOL) - api.add(bSOL, supply * 1e9) + // https://stake-docs.solblaze.org/developers/addresses + await getStakedSol('6WecYymEARvjG5ZyqkrVQ6YkhPfujNzWpSPwNKXHCbV2', api) } module.exports = { timetravel: false, - methodology: "bSOL total supply as it's equal to the SOL staked", solana: { tvl }, diff --git a/projects/helper/solana.js b/projects/helper/solana.js index 909acd71c6c7..6abf0c7c3398 100644 --- a/projects/helper/solana.js +++ b/projects/helper/solana.js @@ -3,7 +3,7 @@ const http = require('./http') const { getEnv } = require('./env') const { transformBalances: transformBalancesOrig, transformDexBalances, } = require('./portedTokens.js') const { getUniqueAddresses } = require('./tokenMapping') -const { Connection, PublicKey, Keypair } = require("@solana/web3.js") +const { Connection, PublicKey, Keypair, StakeProgram, } = require("@solana/web3.js") const { AnchorProvider: Provider, Wallet, } = require("@project-serum/anchor"); const { sleep, sliceIntoChunks, log, } = require('./utils') const { decodeAccount } = require('./utils/solana/layout') @@ -439,6 +439,29 @@ function readBigUInt64LE(buffer, offset) { return BigInt(lo) + (BigInt(hi) << BigInt(32)); } +async function getStakedSol(solAddress, api) { + const stakeAccounts = await getConnection().getProgramAccounts(StakeProgram.programId, { + filters: [{ + memcmp: { bytes: solAddress, offset: 4 + 8 } + }], + dataSlice: { offset: 0, length: 1 } // we dont care about the data, just the lamports + }) + const totalStakedSol = stakeAccounts.reduce((tvl, { account }) => { return tvl + account.lamports }, 0) + if (api) { + api.add(ADDRESSES.solana.SOL, totalStakedSol) + return api + } + return totalStakedSol +} + +async function getSolBalanceFromStakePool(address, api) { + const connection = getConnection() + if (typeof address === 'string') address = new PublicKey(address) + const accountInfo = await connection.getAccountInfo(address); + const deserializedAccountInfo = decodeAccount('stakePool', accountInfo) + return api.add(ADDRESSES.solana.SOL, +deserializedAccountInfo.totalLamports) +} + module.exports = { endpoint: endpoint(), getTokenSupply, @@ -466,4 +489,6 @@ module.exports = { getValidGeckoSolTokens, getOwnerAllAccount, blacklistedTokens_default, + getStakedSol, + getSolBalanceFromStakePool, }; diff --git a/projects/helper/utils/solana/layout.js b/projects/helper/utils/solana/layout.js index c5803bc3464e..9ad9a3e296cd 100644 --- a/projects/helper/utils/solana/layout.js +++ b/projects/helper/utils/solana/layout.js @@ -10,6 +10,7 @@ const { SCN_STAKE_POOL } = require("./layouts/scnSOL"); const { SANCTUM_INFINITY } = require("./layouts/sanctum-infinity-layout"); const { parseSanctumLstStateList } = require("./layouts/sanctum-validators-lsts-layout"); const { STAKE_POOL_PARTIAL } = require("./layouts/stake-pool-partial-layout"); +const { STAKE_POOL_LAYOUT } = require("./layouts/stakePool"); const parseReserve = (info) => { const pubkey = PublicKey.default @@ -59,7 +60,8 @@ const customDecoders = { phoenix: parsePhoenix, sanctumInfinity: defaultParseLayout(SANCTUM_INFINITY), sanctumValidatorLsts: parseSanctumLstStateList, - stakePoolPartial: defaultParseLayout(STAKE_POOL_PARTIAL) + stakePoolPartial: defaultParseLayout(STAKE_POOL_PARTIAL), + stakePool: defaultParseLayout(STAKE_POOL_LAYOUT), } function decodeAccount(layout, accountInfo) { diff --git a/projects/helper/utils/solana/layouts/stakePool.js b/projects/helper/utils/solana/layouts/stakePool.js new file mode 100644 index 000000000000..52b1107d0c91 --- /dev/null +++ b/projects/helper/utils/solana/layouts/stakePool.js @@ -0,0 +1,133 @@ +const { + struct, s32, u8, u16, seq, blob, Layout, bits, u32, publicKey, uint64, u64, uint128, u128, +} = require('./layout-base') + +// https://github.com/solana-labs/solana-program-library/blob/master/stake-pool/js/src/layouts.ts + +const feeFields = [u64('denominator'), u64('numerator')]; + +// https://github.com/solana-labs/solana-program-library/blob/master/stake-pool/js/src/codecs.ts +class OptionLayout extends Layout { + // layout; + // discriminator; + + constructor(layout, property) { + super(-1, property); + this.layout = layout; + this.discriminator = u8(); + } + + encode(src, b, offset = 0) { + if (src === null || src === undefined) { + return this.discriminator.encode(0, b, offset); + } + this.discriminator.encode(1, b, offset); + return this.layout.encode(src, b, offset + 1) + 1; + } + + decode(b, offset = 0) { + const discriminator = this.discriminator.decode(b, offset); + if (discriminator === 0) { + return null; + } else if (discriminator === 1) { + return this.layout.decode(b, offset + 1); + } + throw new Error('Invalid option ' + this.property); + } + + getSpan(b, offset = 0) { + const discriminator = this.discriminator.decode(b, offset); + if (discriminator === 0) { + return 1; + } else if (discriminator === 1) { + return this.layout.getSpan(b, offset + 1) + 1; + } + throw new Error('Invalid option ' + this.property); + } +} + +function option(layout, property) { + return new OptionLayout(layout, property); +} + +class FutureEpochLayout extends Layout { + // layout: Layout; + // discriminator: Layout; + + constructor(layout, property) { + super(-1, property); + this.layout = layout; + this.discriminator = u8(); + } + + encode(src, b, offset = 0) { + if (src === null || src === undefined) { + return this.discriminator.encode(0, b, offset); + } + // This isn't right, but we don't typically encode outside of tests + this.discriminator.encode(2, b, offset); + return this.layout.encode(src, b, offset + 1) + 1; + } + + decode(b, offset = 0) { + const discriminator = this.discriminator.decode(b, offset); + if (discriminator === 0) { + return null; + } else if (discriminator === 1 || discriminator === 2) { + return this.layout.decode(b, offset + 1); + } + throw new Error('Invalid future epoch ' + this.property); + } + + getSpan(b, offset = 0) { + const discriminator = this.discriminator.decode(b, offset); + if (discriminator === 0) { + return 1; + } else if (discriminator === 1 || discriminator === 2) { + return this.layout.getSpan(b, offset + 1) + 1; + } + throw new Error('Invalid future epoch ' + this.property); + } +} + +function futureEpoch(layout, property) { + return new FutureEpochLayout(layout, property); +} + +const STAKE_POOL_LAYOUT = struct([ + u8('accountType'), + publicKey('manager'), + publicKey('staker'), + publicKey('stakeDepositAuthority'), + u8('stakeWithdrawBumpSeed'), + publicKey('validatorList'), + publicKey('reserveStake'), + publicKey('poolMint'), + publicKey('managerFeeAccount'), + publicKey('tokenProgramId'), + u64('totalLamports'), + u64('poolTokenSupply'), + u64('lastUpdateEpoch'), + struct([u64('unixTimestamp'), u64('epoch'), publicKey('custodian')], 'lockup'), + struct(feeFields, 'epochFee'), + futureEpoch(struct(feeFields), 'nextEpochFee'), + option(publicKey(), 'preferredDepositValidatorVoteAddress'), + option(publicKey(), 'preferredWithdrawValidatorVoteAddress'), + struct(feeFields, 'stakeDepositFee'), + struct(feeFields, 'stakeWithdrawalFee'), + futureEpoch(struct(feeFields), 'nextStakeWithdrawalFee'), + u8('stakeReferralFee'), + option(publicKey(), 'solDepositAuthority'), + struct(feeFields, 'solDepositFee'), + u8('solReferralFee'), + option(publicKey(), 'solWithdrawAuthority'), + struct(feeFields, 'solWithdrawalFee'), + futureEpoch(struct(feeFields), 'nextSolWithdrawalFee'), + u64('lastEpochPoolTokenSupply'), + u64('lastEpochTotalLamports'), +]); + +module.exports = { + STAKE_POOL_LAYOUT +} + diff --git a/projects/jpool.js b/projects/jpool.js index 7ecab8add267..cf74565be23d 100644 --- a/projects/jpool.js +++ b/projects/jpool.js @@ -1,16 +1,15 @@ -const {getTokenSupply} = require('./helper/solana') -async function tvl(){ - const supply = await getTokenSupply("7Q2afV64in6N6SeZsAAB81TJzwDoD6zpqmHkzi9Dcavn") - return { - jpool: supply - } +const { getSolBalanceFromStakePool } = require('./helper/solana') + +async function tvl(api) { + // https://jpool.one/pool-info + await getSolBalanceFromStakePool('CtMyWsrUtAwXWiGr9WjHT5fC3p3fgV8cyGpLTo2LJzG1', api) } -module.exports={ - timetravel: false, - methodology: "JSOL total supply as it's equal to the SOL staked", - solana:{ - tvl - } +module.exports = { + timetravel: false, + methodology: "JSOL total supply as it's equal to the SOL staked", + solana: { + tvl + } } \ No newline at end of file diff --git a/projects/marinade-native/index.js b/projects/marinade-native/index.js index 8f84c77ce062..1bc54efeec1c 100644 --- a/projects/marinade-native/index.js +++ b/projects/marinade-native/index.js @@ -1,17 +1,7 @@ -const { StakeProgram } = require("@solana/web3.js") -const { getConnection } = require('../helper/solana') +const { getStakedSol } = require('../helper/solana') -async function tvl() { - const stakeAccounts = await getConnection().getProgramAccounts(StakeProgram.programId, { - filters: [{ - memcmp: { bytes: 'stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq', offset: 4 + 8 } - }], - dataSlice: { offset: 0, length: 1 } // we dont care about the data, just the lamports - }) - - return { - solana: stakeAccounts.reduce((tvl, { account }) => { return tvl + account.lamports / 1e9 }, 0) - } +async function tvl(api) { + await getStakedSol('stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq', api) } module.exports = { diff --git a/projects/solana_miner/index.js b/projects/solana_miner/index.js index 2578c00637c7..c7acdf352390 100644 --- a/projects/solana_miner/index.js +++ b/projects/solana_miner/index.js @@ -8,6 +8,7 @@ module.exports = { hallmarks: [ [1704834000, "Rug Pull"] ], + deadFrom: 1704834000, timetravel: false, methodology: "Solana Miner is designed to provide a user-friendly mining experience, minimizing technical barriers and facilitating newcomers. Our product focuses not only on building a community but also on delivering passive income for investors. See more: https://solanaminer.xyz", diff --git a/projects/thevault/index.js b/projects/thevault/index.js new file mode 100644 index 000000000000..dde245b270c7 --- /dev/null +++ b/projects/thevault/index.js @@ -0,0 +1,13 @@ +const { getStakedSol } = require("../helper/solana") + +async function tvl(api) { + // https://docs.thevault.finance/about/stake-pool-address + await getStakedSol('GdNXJobf8fbTR5JSE7adxa6niaygjx4EEbnnRaDCHMMW', api) +} + +module.exports = { + timetravel: false, + solana: { + tvl + }, +}; From df50f951dc720d26d0e58eed58ade6e139155370 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 11 Jun 2024 14:15:36 +0530 Subject: [PATCH 279/855] Add Maverick v2 and minor fix (#10595) * add maverick v2 * minor fix --------- Co-authored-by: Bob Baxley --- projects/maverick-v2/index.js | 77 +++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 projects/maverick-v2/index.js diff --git a/projects/maverick-v2/index.js b/projects/maverick-v2/index.js new file mode 100644 index 000000000000..a8018ec25844 --- /dev/null +++ b/projects/maverick-v2/index.js @@ -0,0 +1,77 @@ +// Maverick Protocol +const { sumTokens2 } = require("../helper/unwrapLPs"); +const { getLogs2 } = require("../helper/cache/getLogs"); + +function maverickTVL(config) { + const exports = {}; + + Object.keys(config).forEach((chain) => { + const { factories } = config[chain]; + exports[chain] = { + tvl: async (api) => { + let logs = []; + for (let k = 0; k < factories.length; k++) { + logs.push( + ...(await getLogs2({ + api, + target: factories[k].address, + fromBlock: factories[k].startBlock, + eventAbi: + "event PoolCreated(address poolAddress,uint8 protocolFeeRatio,uint256 feeAIn,uint256 feeBIn,uint256 tickSpacing,uint256 lookback,int32 activeTick,address tokenA,address tokenB,uint8 kinds,address accessor)", + })) + ); + } + + return sumTokens2({ + api, + ownerTokens: logs.map((i) => [[i.tokenA, i.tokenB], i.poolAddress]), + }); + }, + }; + }); + + return exports; +} + +module.exports = maverickTVL({ + ethereum: { + factories: [ + { + address: "0x0A7e848Aca42d879EF06507Fca0E7b33A0a63c1e", + startBlock: 20027236, + }, + ], + }, + era: { + factories: [ + { + address: "0x7A6902af768a06bdfAb4F076552036bf68D1dc56", + startBlock: 35938167, + }, + ], + }, + bsc: { + factories: [ + { + address: "0x0A7e848Aca42d879EF06507Fca0E7b33A0a63c1e", + startBlock: 39421941, + }, + ], + }, + base: { + factories: [ + { + address: "0x0A7e848Aca42d879EF06507Fca0E7b33A0a63c1e", + startBlock: 15321281, + }, + ], + }, + arbitrum: { + factories: [ + { + address: "0x0A7e848Aca42d879EF06507Fca0E7b33A0a63c1e", + startBlock: 219205177, + }, + ], + }, +}); From 3c38a9f18bf676fa3d1b303349c14e05e31bbdd4 Mon Sep 17 00:00:00 2001 From: 0xRen <167325683+0xRen@users.noreply.github.com> Date: Tue, 11 Jun 2024 16:46:17 +0800 Subject: [PATCH 280/855] Adapter for Hana Finance (#10586) --- projects/hana-finance/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/hana-finance/index.js diff --git a/projects/hana-finance/index.js b/projects/hana-finance/index.js new file mode 100644 index 000000000000..fb9a3b73d3d6 --- /dev/null +++ b/projects/hana-finance/index.js @@ -0,0 +1,16 @@ +const { aaveExports } = require("../helper/aave"); + +const config = { + taiko: { + "addressProviderRegistry": "0x47EC2cEF8468dbaC060410E2BDde35A3B8f725e5", + "poolDataProvider":"0x9E3D95b518f68349464da1b6dbd0B94DB59addc1", + } +}; + +const data = {}; +Object.keys(config).forEach((chain) => { + data[chain] = aaveExports(chain, config[chain]["addressProviderRegistry"], undefined, [config[chain]["poolDataProvider"]]); +}); + + +module.exports = data; \ No newline at end of file From d3e6e1883f428bea59f97cab86b0c6a761f52c71 Mon Sep 17 00:00:00 2001 From: Merchant Finance <167061514+merchantFi@users.noreply.github.com> Date: Tue, 11 Jun 2024 16:47:32 +0800 Subject: [PATCH 281/855] Update index.js (#10594) --- projects/merchant/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/merchant/index.js b/projects/merchant/index.js index 7eecdc199a6d..dfaa453da654 100644 --- a/projects/merchant/index.js +++ b/projects/merchant/index.js @@ -6,4 +6,7 @@ module.exports = { merlin: { ...compoundExports2({ comptroller: '0x1F2Aa5598f6543090C4c61A90917909fb5560A43'}), }, + linea: { + ...compoundExports2({ comptroller: '0xE54F37bbb8b7417EE4e0447DA0F8b922Fc7bb8Fa'}), + }, }; From a2cc030a3af863b2a4fd1390639975d7b09c1959 Mon Sep 17 00:00:00 2001 From: TsimakuridzeNikolozi <100114440+TsimakuridzeNikolozi@users.noreply.github.com> Date: Tue, 11 Jun 2024 12:47:55 +0400 Subject: [PATCH 282/855] Added ezEth to Blast registry (#10584) --- projects/hinkal/registryTokens.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/hinkal/registryTokens.js b/projects/hinkal/registryTokens.js index ac1bf27a8188..36eff5d81ac8 100644 --- a/projects/hinkal/registryTokens.js +++ b/projects/hinkal/registryTokens.js @@ -970,6 +970,7 @@ const BLAST_REGISTRY_TOKENS = [ "0x76da31d7c9cbeae102aff34d3398bc450c8374c1", "0x47c337bd5b9344a6f3d6f58c474d9d8cd419d8ca", "0x216a5a1135a9dab49fa9ad865e0f22fe22b5630a", + "0x2416092f143378750bb29b79ed961ab195cceea5", ]; const registryTokensByChain = { From 8dc0ed04212ebb28968a5459dd011c94ff8137bf Mon Sep 17 00:00:00 2001 From: Night Owl <159715684+9i94ch4d@users.noreply.github.com> Date: Tue, 11 Jun 2024 14:25:10 +0530 Subject: [PATCH 283/855] Added TVL for chad finance (#10585) * Added TVL for chad finance * code refactor --------- Co-authored-by: ktarun1419 Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/chad-finance/index.js | 4 +++- projects/chadfinance/index.js | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 projects/chadfinance/index.js diff --git a/projects/chad-finance/index.js b/projects/chad-finance/index.js index d764e1ca54ca..ac5524461370 100644 --- a/projects/chad-finance/index.js +++ b/projects/chad-finance/index.js @@ -5,4 +5,6 @@ const masterchad = "0xDA094Ee6bDaf65c911f72FEBfC58002e5e2656d1"; module.exports = { ...masterChefExports(masterchad, "fantom", chad, false) -} \ No newline at end of file +} + +module.exports.deadFrom = '2022-01-26' \ No newline at end of file diff --git a/projects/chadfinance/index.js b/projects/chadfinance/index.js new file mode 100644 index 000000000000..c2ec8199a70c --- /dev/null +++ b/projects/chadfinance/index.js @@ -0,0 +1,7 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +const factory = '0x0DF45d6e3BC41fd8e50d9e227215413053c003Ad' // same on all chains + +module.exports = uniV3Export({ + scroll: { factory, fromBlock: 5288937, } +}) \ No newline at end of file From f7795572a05d042c4d674195ff0ed77ee72ddbb5 Mon Sep 17 00:00:00 2001 From: Nyangbari <110552619+Nyangbari@users.noreply.github.com> Date: Tue, 11 Jun 2024 18:04:09 +0900 Subject: [PATCH 284/855] feat: catalist (#10592) * feat: catalist * feat: endurance chain added * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/catalist/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/catalist/index.js diff --git a/projects/catalist/index.js b/projects/catalist/index.js new file mode 100644 index 000000000000..319d091e1eea --- /dev/null +++ b/projects/catalist/index.js @@ -0,0 +1,14 @@ +const aceContract = "0xec46d5a0ee47e585fab59a15976d0f2413bfbb82"; + +async function ace(api) { + const pooledACE = await api.call({ target: aceContract, abi: "uint256:getTotalPooledAce", }) + api.addCGToken('endurance', pooledACE / 1e18) +} + +module.exports = { + methodology: + "Staked tokens are counted as TVL based on the chain that they are staked on and where the liquidity tokens are issued.", + ace: { + tvl: ace, + }, +}; From 3f9ddde80784c5db91d9f833ca91b057b1b36063 Mon Sep 17 00:00:00 2001 From: crews <64375250+TheYoungCrews@users.noreply.github.com> Date: Tue, 11 Jun 2024 05:07:06 -0400 Subject: [PATCH 285/855] add hyETH index - Update index.js (#10582) * add hyETH index - Update index.js add high yield eth index https://etherscan.io/address/0xc4506022fb8090774e8a628d5084eed61d9b99ee * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/indexcoop/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/indexcoop/index.js b/projects/indexcoop/index.js index 468486092eff..76b934016f9a 100644 --- a/projects/indexcoop/index.js +++ b/projects/indexcoop/index.js @@ -13,6 +13,7 @@ const bedAddress = "0x2aF1dF3AB0ab157e1E2Ad8F88A7D04fbea0c7dc6"; const dataAddress = "0x33d63Ba1E57E54779F7dDAeaA7109349344cf5F1"; const gmiAddress = "0x47110d43175f7f2c2425e7d15792acc5817eb44f"; const icethAddress = "0x7c07f7abe10ce8e33dc6c5ad68fe033085256a84"; +const hyETH = "0xc4506022Fb8090774E8A628d5084EED61D9B99Ee"; const dsETH = "0x341c05c0E9b33C0E38d64de76516b2Ce970bB3BE"; const aaveDebtToken = "0xf63b34710400cad3e044cffdcab00a0f32e33ecf"; const USDC = ADDRESSES.ethereum.USDC @@ -29,6 +30,7 @@ const sets = [ icethAddress, dsETH, gtcETH, + hyETH, ]; async function tvl(api) { From 5df670e54daf3e3aaba989aae6d45f64b790fcdb Mon Sep 17 00:00:00 2001 From: imfeng Date: Tue, 11 Jun 2024 17:07:32 +0800 Subject: [PATCH 286/855] update satoshi-protocol add bitlayer chain tvl (#10581) --- projects/satoshi-protocol/index.js | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/projects/satoshi-protocol/index.js b/projects/satoshi-protocol/index.js index 61dbc5640900..6a24763e7d94 100644 --- a/projects/satoshi-protocol/index.js +++ b/projects/satoshi-protocol/index.js @@ -1,17 +1,21 @@ const { sumTokens2 } = require("../helper/unwrapLPs") -const TROVE_MANAGER_LIST = [ - '0x0598Ef47508Ec11a503670Ac3B642AAE8EAEdEFA', // WBTC Collateral - '0xa794a7Fd668FE378E095849caafA8C8dC7E84780', // wstBTC Collateral -] - -async function tvl(api) { - const tokens = await api.multiCall({ abi: 'address:collateralToken', calls: TROVE_MANAGER_LIST}) - return sumTokens2({ api, tokensAndOwners2: [tokens, TROVE_MANAGER_LIST]}) +function createExports(troveList) { + return { + tvl: async (api) => { + const tokens = await api.multiCall({ abi: 'address:collateralToken', calls: troveList }) + return sumTokens2({ api, tokensAndOwners2: [tokens, troveList] }) + }, + } } module.exports = { - bevm: { - tvl, - } + bevm: createExports([ + '0x0598Ef47508Ec11a503670Ac3B642AAE8EAEdEFA', // BEVM WBTC Collateral + '0xa794a7Fd668FE378E095849caafA8C8dC7E84780', // BEVM wstBTC Collateral + ]), + btr: createExports([ + '0xf1A7b474440702BC32F622291B3A01B80247835E', // BITLAYER WBTC Collateral + '0xe9897fe6C8bf96D5ef8B0ECC7cBfEdef9818232c', // BITLAYER stBTC Collateral + ]), } From 2eb33ec35844f8211667c4d56eb66160e1999b0b Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 11 Jun 2024 15:01:35 +0530 Subject: [PATCH 287/855] Add symbiotic and refactor code (#10598) * add symbiotic * code refactor --------- Co-authored-by: Kresh --- projects/symbiotic/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 projects/symbiotic/index.js diff --git a/projects/symbiotic/index.js b/projects/symbiotic/index.js new file mode 100644 index 000000000000..fbc2c2c3169c --- /dev/null +++ b/projects/symbiotic/index.js @@ -0,0 +1,15 @@ +const { getLogs2 } = require('../helper/cache/getLogs') + +async function tvl(api) { + const logs = await getLogs2({ api, factory: '0x1BC8FCFbE6Aa17e4A7610F51B888f34583D202Ec', eventAbi: 'event AddEntity(address indexed entity)', fromBlock: 20011312, }) + const COLLATERALS = logs.map(log => log.entity) + const tokens = await api.multiCall({ abi: 'address:asset', calls: COLLATERALS, }) + return api.sumTokens({ tokensAndOwners2: [tokens, COLLATERALS] }) +} + +module.exports = { + start: 1718088924, + ethereum: { + tvl, + }, +} From 3a234c27557577efb698109c6bec630e2408a24c Mon Sep 17 00:00:00 2001 From: vfat Date: Tue, 11 Jun 2024 15:08:29 +0400 Subject: [PATCH 288/855] Vfatio update (#10599) * add chain configs * create helper functions for different chains * add arb/linea * add factories * add nft helper function * fixes * integrate pancake * remove logging * small fix * add fantom * add contract addresses * fantom tvl * add mode contracts * add mode * add helper function * typo * add mantle tvl --------- Co-authored-by: stepollo Co-authored-by: 0xChupaCabra <56636447+0xChupaCabra@users.noreply.github.com> --- projects/vfat/index.js | 430 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 381 insertions(+), 49 deletions(-) diff --git a/projects/vfat/index.js b/projects/vfat/index.js index 8565a945a6ef..afb8a4a3e484 100644 --- a/projects/vfat/index.js +++ b/projects/vfat/index.js @@ -8,6 +8,7 @@ const config = { gaugeFactory2: '0xD30677bd8dd15132F251Cb54CbDA552d2A05Fb08', voter: '0x16613524e02ad97edfef371bc883f2f5d6c480a5', NonfungiblePositionManager: '0x827922686190790b37229fd06084350E74485b72', + masterchefV3: '0xC6A2Db661D5a5690172d8eB0a7DEA2d3008665A3', fromBlock: 3200567, fromBlockSickle: 12116234, chainName: 'base', @@ -22,25 +23,82 @@ const config = { fromBlockSickle: 117753454, chainName: 'optimism', }, + arbitrum: { + factory: '0x53d9780DbD3831E3A797Fd215be4131636cD5FDf', + gaugeFactory: '0xAAA2564DEb34763E3d05162ed3f5C2658691f499', + gaugeFactory2: '0xaa2fbd0c9393964af7c66c1513e44a8caaae4fda', + NonfungiblePositionManager: '0xAA277CB7914b7e5514946Da92cb9De332Ce610EF', + masterchefV3: '0x5e09ACf80C0296740eC5d6F643005a4ef8DaA694', + fromBlock: 69820005, + fromBlockSickle: 197499243, + chainName: 'arbitrum', + }, + linea: { + factory: '0x0F6aBc6B808B377d6AeD8dA1FAD5E135C99C81a3', + fromBlockSickle: 4949355, + fromBlock: 381770, + gaugeFactory: '0xAAA932839641c037452f826BB9d7B2057129833b', + gaugeFactory2: '0xAAA2D4987EEd427Ba5E2c933EeFCD75C84b446B7', + voter: '0xAAAf3D9CDD3602d117c67D80eEC37a160C8d9869', + NonfungiblePositionManager: '0xAAA78E8C4241990B4ce159E105dA08129345946A', + masterchefV3: '0x22E2f236065B780FA33EC8C4E58b99ebc8B55c57', + chainName: 'linea', + }, + ethereum: { + factory: '0x9D70B9E5ac2862C405D64A0193b4A4757Aab7F95', + chainName: 'ethereum', + masterchefV3: '0x556B9306565093C855AEA9AE92A594704c2Cd59e', + fromBlockSickle: 19580798, + }, + mode: { + factory: '0x53d9780DbD3831E3A797Fd215be4131636cD5FDf', + chainName: 'mode', + fromBlockSickle: 7464171, + gaugeFactory: '0x31832f2a97Fd20664D76Cc421207669b55CE4BC0', + voter: '0xD2F998a46e4d9Dd57aF1a28EBa8C34E7dD3851D7', + fromBlock: 7453232, + }, + fantom: { + factory: '0x53d9780DbD3831E3A797Fd215be4131636cD5FDf', + chainName: 'fantom', + fromBlockSickle: 79166260, + NonfungiblePositionManager: '0x2B52294425a9a229322228de659eDE9D146D7c2f', + gaugeFactory: '0x5b3220cb732245ffe8e26df228ac93feb685c157', + fromBlock: 58469764, + voter: '0xe3d1a117df7dcac2eb0ac8219341bad92f18dac1', + }, + mantle: { + factory: '0xB4C31b0f0B76b351395D4aCC94A54dD4e6fbA1E8', + chainName: 'mantle', + fromBlockSickle: 62383980, + moeMasterchef: '0xA756f7D419e1A5cbd656A438443011a7dE1955b5' + }, + bsc: { + factory: '0x53d9780DbD3831E3A797Fd215be4131636cD5FDf', + chainName: 'bsc', + masterchefV3: '0x556B9306565093C855AEA9AE92A594704c2Cd59e', + fromBlockSickle: 37565801 + }, }; +// Helper function to fetch sickles +async function fetchSickles(api, factory, fromBlockSickle) { + const deployLogs = await getLogs({ + api, + target: factory, + fromBlock: fromBlockSickle, + eventAbi: 'event Deploy(address indexed admin, address sickle)', + }); + return deployLogs.map(log => log.args.sickle); +} -async function tvl(api) { - const { factory, gaugeFactory, gaugeFactory2, voter, NonfungiblePositionManager, fromBlock, fromBlockSickle, chainName } = config[api.chain]; - - // Fetch logs from both the factory and the voter contracts - const [deployLogs, deployAeroLogs] = await Promise.all([ - getLogs({ - api, - target: factory, - fromBlock: fromBlockSickle, - eventAbi: 'event Deploy(address indexed admin, address sickle)', - }), - getLogs({ - api, - target: voter, - fromBlock, - eventAbi: `event GaugeCreated( +// Helper function to fetch and process gauges +async function fetchGauges(api, voter, fromBlock, gaugeFactory, gaugeFactory2) { + const deployAeroLogs = await getLogs({ + api, + target: voter, + fromBlock, + eventAbi: `event GaugeCreated( address indexed poolFactory, address indexed votingRewardsFactory, address indexed gaugeFactory, @@ -50,15 +108,9 @@ async function tvl(api) { address gauge, address creator )`, - }), - ]); - + }); - // Get the addresses of deployed sickles - const sickles = deployLogs.map(log => log.args.sickle); - - // Separate gauges by type - const deployedAeroGauges = deployAeroLogs.reduce( + return deployAeroLogs.reduce( (acc, log) => { const gaugeFactoryAddress = log.args.gaugeFactory; const gaugeAddress = log.args.gauge; @@ -71,46 +123,326 @@ async function tvl(api) { }, { lp: [], nft: [] } ); +} - const stakingTokens = await api.multiCall({ abi: 'address:stakingToken', calls: deployedAeroGauges.lp }) - const gaugeTokenMapping = {} - stakingTokens.forEach((stakingToken, index) => { - gaugeTokenMapping[deployedAeroGauges.lp[index]] = stakingToken - }) +async function fetchGauges2(api, fromBlock, gaugeFactory, gaugeFactory2, voter, chainName) { + const eventAbi = `event GaugeCreated( + address indexed gauge, + address creator, + address feeDistributor, + address indexed pool + )`; + + const eventAbi2 = `event GaugeCreated(address indexed pool, address gauge)`; + + const deployRamsesLogs = await getLogs({ + api, + target: chainName === 'linea' ? voter : gaugeFactory, + fromBlock, + eventAbi, + skipCache: true, + }); + + const deployRamsesLogs2 = await getLogs({ + api, + target: gaugeFactory2, + fromBlock, + eventAbi: eventAbi2, + skipCache: true, + }); + + const lp = deployRamsesLogs.map(log => log.args.gauge); + const nft = deployRamsesLogs2.map(log => log.args.gauge); + + const nftSet = new Set(nft); + + const filteredLp = lp.filter(address => !nftSet.has(address)); + + return { lp: filteredLp, nft }; +} + +async function fetchSickleNftPositions(api, sickles, managerAddress, isMasterchef = false) { + const sickleBalances = {}; + for (const sickle of sickles) { + const balanceCallsSickle = [{ target: managerAddress, params: [sickle] }]; + const sickleBals = await api.multiCall({ abi: 'erc20:balanceOf', calls: balanceCallsSickle }); + const balance = sickleBals[0]; + + if (balance === '0') continue; + + const nftCalls = []; + for (let i = 0; i < balance; i++) { + nftCalls.push({ target: managerAddress, params: [sickle, i] }); + } + + const nftIds = await api.multiCall({ abi: 'function tokenOfOwnerByIndex(address owner, uint256 index) view returns (uint256)', calls: nftCalls }); + sickleBalances[sickle] = nftIds; + } + + const positionCalls = []; + for (const sickle in sickleBalances) { + const nftIds = sickleBalances[sickle]; + nftIds.forEach(nftId => { + positionCalls.push({ target: managerAddress, params: [nftId] }); + }); + } + + const positions = await api.multiCall({ + abi: isMasterchef + ? 'function userPositionInfos(uint256 tokenId) view returns (uint128 liquidity, uint128 boostLiquidity, int24 tickLower, int24 tickUpper, uint256 rewardGrowthInside, uint256 reward, address user, uint256 pid, uint256 boostMultiplier)' + : 'function positions(uint256 tokenId) view returns (uint96 nonce, address operator, address token0, address token1, int24 tickSpacing, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)', + calls: positionCalls, + }); + + if (isMasterchef) { + const poolInfoCalls = positions.map(position => ({ + target: managerAddress, + params: [position.pid], + })); + + const poolInfos = await api.multiCall({ + abi: 'function poolInfo(uint256 pid) view returns (uint256 allocPoint, address v3Pool, address token0, address token1, uint24 fee, uint256 totalLiquidity, uint256 totalBoostLiquidity)', + calls: poolInfoCalls, + }); + + positions.forEach((position, index) => { + const poolInfo = poolInfos[index]; + position.allocPoint = poolInfo.allocPoint; + position.v3Pool = poolInfo.v3Pool; + position.token0 = poolInfo.token0; + position.token1 = poolInfo.token1; + position.fee = poolInfo.fee; + position.totalLiquidity = poolInfo.totalLiquidity; + position.totalBoostLiquidity = poolInfo.totalBoostLiquidity; + }); + } + + return positions; +} + +async function fetchGauges3(api, voter, fromBlock) { + const eventAbi = `event StakingRewardsCreated( + address indexed pool, + address indexed stakingRewards, + address indexed rewardToken, + address stakingToken + )`; + + const deployLogs = await getLogs({ + api, + target: voter, + fromBlock, + eventAbi, + skipCache: true, + }); + + return deployLogs.map(log => log.args[2]); +} + +async function getLPBalances(api, gauges, sickles, stakingTokens) { + const gaugeTokenMapping = {}; + stakingTokens.forEach((stakingToken, index) => { + gaugeTokenMapping[gauges[index]] = stakingToken; + }); - // Prepare balance queries for each gauge-sickle pair const balanceCallsLP = []; const tokens = []; - - for (const gauge of deployedAeroGauges.lp) { + for (const gauge of gauges) { for (const sickle of sickles) { balanceCallsLP.push({ target: gauge, params: [sickle] }); - tokens.push(gaugeTokenMapping[gauge]) + tokens.push(gaugeTokenMapping[gauge]); } } - const lpBals = await api.multiCall({ abi: 'erc20:balanceOf', calls: balanceCallsLP, }) - api.add(tokens, lpBals) + const lpBals = await api.multiCall({ abi: 'erc20:balanceOf', calls: balanceCallsLP }); + return { + balances: lpBals, + tokens: tokens + }; +} - // process NFT gauges - const pools = await api.multiCall({ abi: 'address:pool', calls: deployedAeroGauges.nft }) - const slot0s = await api.multiCall({ abi: 'function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, bool unlocked)', calls: pools }) - let i = 0 +// TVL calculation for Base and Optimism +async function tvlBaseOptimism(api) { + const { factory, gaugeFactory, gaugeFactory2, voter, NonfungiblePositionManager, fromBlock, fromBlockSickle, chainName } = config[api.chain]; + + const sickles = await fetchSickles(api, factory, fromBlockSickle); + const deployedAeroGauges = await fetchGauges(api, voter, fromBlock, gaugeFactory, gaugeFactory2); + const stakingTokens = await api.multiCall({ abi: 'address:stakingToken', calls: deployedAeroGauges.lp }); + const { balances, tokens } = await getLPBalances(api, deployedAeroGauges.lp, sickles, stakingTokens); + + api.add(tokens, balances); + + const pools = await api.multiCall({ abi: 'address:pool', calls: deployedAeroGauges.nft }); + const slot0s = await api.multiCall({ abi: 'function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, bool unlocked)', calls: pools }); await Promise.all(deployedAeroGauges.nft.map(async (gauge, i) => { - const tick = slot0s[i].tick - const nftIds = (await api.multiCall({ abi: 'function stakedValues(address depositor) view returns (uint256[])', calls: sickles, target: gauge })).flat() - const positions = await api.multiCall({ abi: 'function positions(uint256 tokenId) view returns (uint96 nonce, address operator, address token0, address token1, int24 tickSpacing, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)', calls: nftIds, target: NonfungiblePositionManager }) - positions.forEach(position => addUniV3LikePosition({ ...position, tick, api })) - })) - - // unwrap uni v2 like LPs - return sumTokens2({ api, resolveLP: true, }) + const tick = slot0s[i].tick; + const nftIds = (await api.multiCall({ abi: 'function stakedValues(address depositor) view returns (uint256[])', calls: sickles, target: gauge })).flat(); + const positions = await api.multiCall({ abi: 'function positions(uint256 tokenId) view returns (uint96 nonce, address operator, address token0, address token1, int24 tickSpacing, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)', calls: nftIds, target: NonfungiblePositionManager }); + positions.forEach(position => addUniV3LikePosition({ ...position, tick, api })); + })); + + if (chainName === 'base') { + const masterchefPositions = await fetchSickleNftPositions(api, sickles, config[api.chain].masterchefV3, true); + masterchefPositions.forEach(position => addUniV3LikePosition({ ...position, api })); + } + + return sumTokens2({ api, resolveLP: true }); +} + +// TVL calculation for Arbitrum and Linea +async function tvlArbitrumLinea(api) { + const { factory, gaugeFactory, gaugeFactory2, voter, fromBlock, fromBlockSickle, chainName } = config[api.chain]; + + const sickles = await fetchSickles(api, factory, fromBlockSickle); + const gauges = await fetchGauges2(api, fromBlock, gaugeFactory, gaugeFactory2, voter, chainName); + const stakingTokens = await api.multiCall({ abi: 'address:stake', calls: gauges.lp }); + + const { balances, tokens } = await getLPBalances(api, gauges.lp, sickles, stakingTokens); + api.add(tokens, balances); + + const positions = await fetchSickleNftPositions(api, sickles, config[api.chain].NonfungiblePositionManager); + const masterchefPositions = await fetchSickleNftPositions(api, sickles, config[api.chain].masterchefV3, true); + + positions.forEach(position => addUniV3LikePosition({ ...position, api })); + masterchefPositions.forEach(position => addUniV3LikePosition({ ...position, api })); + + return sumTokens2({ api, resolveLP: true }); + +} + +async function modeTvl(api) { + const { factory, voter, fromBlock, fromBlockSickle, chainName } = config[api.chain]; + const sickles = await fetchSickles(api, factory, fromBlockSickle); + const gauges = await fetchGauges3(api, voter, fromBlock); + const stakingTokens = await api.multiCall({ abi: 'address:stakingToken', calls: gauges }); + const { balances, tokens } = await getLPBalances(api, gauges, sickles, stakingTokens); + api.add(tokens, balances); + return sumTokens2({ api, resolveLP: true }); +} + +// TVL calculation for chains with masterchefV3 +async function genericTvl(api) { + const { factory, fromBlockSickle, masterchefV3, NonfungiblePositionManager, chainName } = config[api.chain]; + + const sickles = await fetchSickles(api, factory, fromBlockSickle); + + if (masterchefV3) { + const masterchefPositions = await fetchSickleNftPositions(api, sickles, masterchefV3, true); + masterchefPositions.forEach(position => addUniV3LikePosition({ ...position, api })); + } + + if (NonfungiblePositionManager) { + const positions = await fetchSickleNftPositions(api, sickles, NonfungiblePositionManager); + positions.forEach(position => addUniV3LikePosition({ ...position, api })); + } + + return sumTokens2({ api, resolveLP: true }); +} + +async function fetchFantomGauges(api, fromBlock, gaugeFactory, voter, chainName) { + const eventAbi = `event GaugeCreated( + address indexed maker, + address indexed pool, + address g, + address b, + address v, + bool i, + address[] a + )`; + + const deployLogs = await getLogs({ + api, + target: gaugeFactory, + fromBlock, + eventAbi, + }); + + return deployLogs.map(log => log.args.g); +} + +// TVL calculation for Fantom +async function tvlFantom(api) { + const { factory, gaugeFactory, voter, fromBlock, fromBlockSickle, chainName } = config[api.chain]; + + const sickles = await fetchSickles(api, factory, fromBlockSickle); + const gauges = await fetchFantomGauges(api, fromBlock, gaugeFactory, voter, chainName); + const stakingTokens = await api.multiCall({ abi: 'address:stake', calls: gauges }); + const { balances, tokens } = await getLPBalances(api, gauges, sickles, stakingTokens); + api.add(tokens, balances); + + return sumTokens2({ api, resolveLP: true }); } +async function tvlMantle(api) { + const { factory, fromBlockSickle, moeMasterchef } = config[api.chain]; + + const sickles = await fetchSickles(api, factory, fromBlockSickle); + + const numberOfFarms = await api.call({ + abi: 'function getNumberOfFarms() view returns (uint256)', + target: moeMasterchef + }); + + const farmIds = Array.from({ length: numberOfFarms }, (_, i) => i); + const tokens = await api.multiCall({ + abi: 'function getToken(uint256 pid) view returns (address)', + calls: farmIds.map(pid => ({ target: moeMasterchef, params: [pid] })) + }); + + const farmTokenMap = farmIds.reduce((map, pid, index) => { + map[pid] = tokens[index]; + return map; + }, {}); + + const depositCalls = []; + sickles.forEach(sickle => { + farmIds.forEach(pid => { + depositCalls.push({ target: moeMasterchef, params: [pid, sickle] }); + }); + }); + + const deposits = await api.multiCall({ + abi: 'function getDeposit(uint256 pid, address account) view returns (uint256)', + calls: depositCalls + }); + + const tokenBalanceMap = {}; + + depositCalls.forEach((call, index) => { + const pid = call.params[0]; + const deposit = deposits[index]; + const token = farmTokenMap[pid]; + + if (!tokenBalanceMap[token]) { + tokenBalanceMap[token] = deposit; + } else { + tokenBalanceMap[token] = (BigInt(tokenBalanceMap[token]) + BigInt(deposit)).toString(); + } + }); + + const tokenList = Object.keys(tokenBalanceMap); + const balanceList = Object.values(tokenBalanceMap); + + api.add(tokenList, balanceList); + + return sumTokens2({ api, resolveLP: true }); +} Object.keys(config).forEach(chain => { - module.exports[chain] = { tvl } -}) \ No newline at end of file + if (['base', 'optimism'].includes(chain)) { + module.exports[chain] = { tvl: tvlBaseOptimism }; + } else if (['arbitrum', 'linea'].includes(chain)) { + module.exports[chain] = { tvl: tvlArbitrumLinea }; + } else if (chain === 'fantom') { + module.exports[chain] = { tvl: tvlFantom }; + } else if (chain === 'mode') { + module.exports[chain] = { tvl: modeTvl }; + } else if (chain === 'mantle') { + module.exports[chain] = { tvl: tvlMantle }; + } else if (!['base', 'optimism', 'arbitrum', 'linea', 'fantom', 'mode', 'mantle'].includes(chain)) { + module.exports[chain] = { tvl: genericTvl }; + } +}); \ No newline at end of file From 2e4d4c7e77a4ae7e04f334193847be8c946926ea Mon Sep 17 00:00:00 2001 From: 0xjosaphat <120175614+0xjosaphat@users.noreply.github.com> Date: Tue, 11 Jun 2024 13:15:57 +0200 Subject: [PATCH 289/855] Added LB TVL for Magicsea DEX (#10553) * added new chain polygon_zkevm * added marker for new chain launch on Polygon zkEVM * added new chain arbitrum * fixed type in methodology * added shimmersea adapter * added shimmersea adapter * added shimmer_evm to chainlist * added shimmer_evm as new chain to Swapline DEX * added shimmer_evm as new chain to Swapline DEX * added IOTA EVM as new chain to MagicSea DEX * moved /shimmersea to /magicsea; added /magicsea-lb-v2 for liquidy book tvl on MagicSea DEX * reverted move /magicsea to /shimmersea --- projects/magicsea-lb-v2/index.js | 37 ++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 projects/magicsea-lb-v2/index.js diff --git a/projects/magicsea-lb-v2/index.js b/projects/magicsea-lb-v2/index.js new file mode 100644 index 000000000000..667521ffeddd --- /dev/null +++ b/projects/magicsea-lb-v2/index.js @@ -0,0 +1,37 @@ +const {sumTokens2} = require('../helper/unwrapLPs') + +const factories = { + shimmer_evm: '0xEE0616a2DEAa5331e2047Bc61E0b588195A49cEa', + iotaevm: '0x8Cce20D17aB9C6F60574e678ca96711D907fD08c' +} + +async function tvl(api) { + const pools = await api.fetchList({ + target: factories[api.chain], + itemAbi: 'function getLBPairAtIndex(uint256) view returns (address)', + lengthAbi: 'uint256:getNumberOfLBPairs', + }) + const tokenA = await api.multiCall({ + abi: 'address:getTokenX', + calls: pools, + }) + const tokenB = await api.multiCall({ + abi: 'address:getTokenY', + calls: pools, + }) + const toa = [] + tokenA.map((_, i) => { + toa.push([tokenA[i], pools[i]]) + toa.push([tokenB[i], pools[i]]) + }) + let blacklistedTokens = [] + return sumTokens2({api, tokensAndOwners: toa, blacklistedTokens: blacklistedTokens}) +} + +module.exports = { + methodology: 'We count the token balances in in different liquidity book contracts', +} + +Object.keys(factories).forEach(chain => { + module.exports[chain] = {tvl} +}) \ No newline at end of file From 7ba9981e14ce919b3b4aad8a5088b95c90a78fb8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 11 Jun 2024 13:17:06 +0200 Subject: [PATCH 290/855] PR#10596 track mellow v2 --- projects/mellow-protocol-v2/index.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 projects/mellow-protocol-v2/index.js diff --git a/projects/mellow-protocol-v2/index.js b/projects/mellow-protocol-v2/index.js new file mode 100644 index 000000000000..44a634f7e1b9 --- /dev/null +++ b/projects/mellow-protocol-v2/index.js @@ -0,0 +1,26 @@ +const config = { + ethereum: { + vaults: [ + '0xBEEF69Ac7870777598A04B2bd4771c71212E6aBc', + '0x84631c0d0081FDe56DeB72F6DE77abBbF6A9f93a', + '0x5fD13359Ba15A84B76f7F87568309040176167cd', + '0x7a4EffD87C2f3C55CA251080b1343b605f327E3a' + ], + }, +} + +module.exports = { + doublecounted: true, +}; + +Object.keys(config).forEach(chain => { + const { vaults, } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const baseTvl = await api.multiCall({ abi: 'function underlyingTvl() public view returns (address[] tokens, uint256[] values)', calls: vaults }) + baseTvl.forEach(({ tokens, values}) => { + api.add(tokens, values) + }) + } + } +}) \ No newline at end of file From 4a326d6183717dc113ebe1385a60c47ae028bbc9 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 11 Jun 2024 13:29:41 +0200 Subject: [PATCH 291/855] add trader joe lb helper --- projects/E3/index.js | 36 ++--------------- projects/helper/traderJoeV2.js | 38 +++++++++++++++++ projects/helper/uniswapV3.js | 1 - projects/magicsea-lb-v2/index.js | 39 ++---------------- projects/merchant-moe-lb/index.js | 35 ++-------------- projects/swapline/index.js | 63 +++++------------------------ projects/traderjoe-lb-v2-1/index.js | 39 ++---------------- 7 files changed, 61 insertions(+), 190 deletions(-) create mode 100644 projects/helper/traderJoeV2.js diff --git a/projects/E3/index.js b/projects/E3/index.js index c70c70fe6487..96b3aa1e8b69 100644 --- a/projects/E3/index.js +++ b/projects/E3/index.js @@ -1,37 +1,7 @@ -const { sumTokens2 } = require('../helper/unwrapLPs') +const { joeV2Export } = require('../helper/traderJoeV2') -const factories = { +module.exports = joeV2Export({ fantom: '0x8597dB3ba8dE6BAAdEDa8cBa4dAC653E24a0e57B', arbitrum: '0x8597dB3ba8dE6BAAdEDa8cBa4dAC653E24a0e57B', base: '0x8597dB3ba8dE6BAAdEDa8cBa4dAC653E24a0e57B' - ///zkevm: tbd -} -async function tvl(api) { - const pools = await api.fetchList({ - target: factories[api.chain], - itemAbi: 'function getLBPairAtIndex(uint256) view returns (address)', - lengthAbi: 'uint256:getNumberOfLBPairs', - }) - const tokenA = await api.multiCall({ - abi: 'address:getTokenX', - calls: pools, - }) - const tokenB = await api.multiCall({ - abi: 'address:getTokenY', - calls: pools, - }) - const toa = [] - tokenA.map((_, i) => { - toa.push([tokenA[i], pools[i]]) - toa.push([tokenB[i], pools[i]]) - }) - return sumTokens2({ api, tokensAndOwners: toa, }) -} - -module.exports = { - methodology: 'Only the tokens inside E3 Liquidity Pools are counted in our TVL.', -} - -Object.keys(factories).forEach(chain => { - module.exports[chain] = { tvl } -}) +}) \ No newline at end of file diff --git a/projects/helper/traderJoeV2.js b/projects/helper/traderJoeV2.js new file mode 100644 index 000000000000..a80a48a61ad7 --- /dev/null +++ b/projects/helper/traderJoeV2.js @@ -0,0 +1,38 @@ +const { sumTokens2 } = require("./unwrapLPs") + +function joeV2Export(config) { + const exports = { + methodology: 'We count the token balances in in different liquidity book contracts', + } + + Object.keys(config).forEach(chain => { + let factory = config[chain] + let blacklistedTokens = [] + if (typeof factory !== 'string' && typeof factory.factory === 'string') { + blacklistedTokens = factory.blacklistedTokens || [] + factory = factory.factory + } + + exports[chain] = { + tvl: async (api) => { + const pools = await api.fetchList({ target: factory, itemAbi: 'getLBPairAtIndex', lengthAbi: 'getNumberOfLBPairs', }) + const tokenA = await api.multiCall({ abi: 'address:getTokenX', calls: pools, }) + const tokenB = await api.multiCall({ abi: 'address:getTokenY', calls: pools, }) + + const toa = [] + tokenA.map((_, i) => { + toa.push([tokenA[i], pools[i]]) + toa.push([tokenB[i], pools[i]]) + }) + return sumTokens2({ api, tokensAndOwners: toa, blacklistedTokens, permitFailure: true, }) + } + } + }) + + return exports +} + + +module.exports = { + joeV2Export, +} diff --git a/projects/helper/uniswapV3.js b/projects/helper/uniswapV3.js index f3f6fd0b2b72..726e43b289ff 100644 --- a/projects/helper/uniswapV3.js +++ b/projects/helper/uniswapV3.js @@ -1,7 +1,6 @@ const { sumTokens2 } = require('./unwrapLPs') const { getLogs } = require('./cache/getLogs') const { cachedGraphQuery } = require('./cache') -const { request, } = require('graphql-request') const uniswapConfig = { eventAbi: 'event PoolCreated(address indexed token0, address indexed token1, uint24 indexed fee, int24 tickSpacing, address pool)', diff --git a/projects/magicsea-lb-v2/index.js b/projects/magicsea-lb-v2/index.js index 667521ffeddd..a0a0d2c92084 100644 --- a/projects/magicsea-lb-v2/index.js +++ b/projects/magicsea-lb-v2/index.js @@ -1,37 +1,6 @@ -const {sumTokens2} = require('../helper/unwrapLPs') +const { joeV2Export } = require('../helper/traderJoeV2') -const factories = { - shimmer_evm: '0xEE0616a2DEAa5331e2047Bc61E0b588195A49cEa', - iotaevm: '0x8Cce20D17aB9C6F60574e678ca96711D907fD08c' -} - -async function tvl(api) { - const pools = await api.fetchList({ - target: factories[api.chain], - itemAbi: 'function getLBPairAtIndex(uint256) view returns (address)', - lengthAbi: 'uint256:getNumberOfLBPairs', - }) - const tokenA = await api.multiCall({ - abi: 'address:getTokenX', - calls: pools, - }) - const tokenB = await api.multiCall({ - abi: 'address:getTokenY', - calls: pools, - }) - const toa = [] - tokenA.map((_, i) => { - toa.push([tokenA[i], pools[i]]) - toa.push([tokenB[i], pools[i]]) - }) - let blacklistedTokens = [] - return sumTokens2({api, tokensAndOwners: toa, blacklistedTokens: blacklistedTokens}) -} - -module.exports = { - methodology: 'We count the token balances in in different liquidity book contracts', -} - -Object.keys(factories).forEach(chain => { - module.exports[chain] = {tvl} +module.exports = joeV2Export({ + // shimmer_evm: '0xEE0616a2DEAa5331e2047Bc61E0b588195A49cEa', // excluded since tvl is already counted in swapline + iotaevm: '0x8Cce20D17aB9C6F60574e678ca96711D907fD08c' }) \ No newline at end of file diff --git a/projects/merchant-moe-lb/index.js b/projects/merchant-moe-lb/index.js index f86f584aba12..9f4e59c4e1da 100644 --- a/projects/merchant-moe-lb/index.js +++ b/projects/merchant-moe-lb/index.js @@ -1,34 +1,5 @@ -const { sumTokens2 } = require('../helper/unwrapLPs') +const { joeV2Export } = require('../helper/traderJoeV2') -const factories = { - mantle: '0xa6630671775c4EA2743840F9A5016dCf2A104054', -} -async function tvl(api) { - const pools = await api.fetchList({ - target: factories[api.chain], - itemAbi: 'function getLBPairAtIndex(uint256) view returns (address)', - lengthAbi: 'uint256:getNumberOfLBPairs', - }) - const tokenA = await api.multiCall({ - abi: 'address:getTokenX', - calls: pools, - }) - const tokenB = await api.multiCall({ - abi: 'address:getTokenY', - calls: pools, - }) - const toa = [] - tokenA.map((_, i) => { - toa.push([tokenA[i], pools[i]]) - toa.push([tokenB[i], pools[i]]) - }) - return sumTokens2({ api, tokensAndOwners: toa, }) -} - -module.exports = { - methodology: 'We count the token balances in in different liquidity book contracts', -} - -Object.keys(factories).forEach(chain => { - module.exports[chain] = { tvl } +module.exports = joeV2Export({ + mantle: '0xa6630671775c4EA2743840F9A5016dCf2A104054' }) \ No newline at end of file diff --git a/projects/swapline/index.js b/projects/swapline/index.js index a7d6bf69ae07..0e6c329e3753 100644 --- a/projects/swapline/index.js +++ b/projects/swapline/index.js @@ -1,62 +1,17 @@ -const { sumTokens2 } = require('../helper/unwrapLPs') +const { joeV2Export } = require('../helper/traderJoeV2') -const factories = { +module.exports = joeV2Export({ fantom: '0x640801a6983c109805E928dc7d9794080C21C88E', optimism: '0xd08C98F6409fCAe3E61f3157B4147B6595E60cf3', polygon_zkevm: '0x5A5c0C4832828FF878CE3ab4fEc44d21200b1496', arbitrum: '0xEE0616a2DEAa5331e2047Bc61E0b588195A49cEa', base: '0x5A5c0C4832828FF878CE3ab4fEc44d21200b1496', shimmer_evm: '0xEE0616a2DEAa5331e2047Bc61E0b588195A49cEa', -} -async function tvl(api) { - let blacklistedTokens = [] - if (api.chain === 'fantom') blacklistedTokens = ['0xdc6ff44d5d932cbd77b52e5612ba0529dc6226f1'] - const pools = await api.fetchList({ - target: factories[api.chain], - itemAbi: 'function getLBPairAtIndex(uint256) view returns (address)', - lengthAbi: 'uint256:getNumberOfLBPairs', - }) - const tokenA = await api.multiCall({ - abi: 'address:getTokenX', - calls: pools, - }) - const tokenB = await api.multiCall({ - abi: 'address:getTokenY', - calls: pools, - }) - const toa = [] - tokenA.map((_, i) => { - toa.push([tokenA[i], pools[i]]) - toa.push([tokenB[i], pools[i]]) - }) - return sumTokens2({...api, tokensAndOwners: toa, blacklistedTokens,}) -} +}) -module.exports = { - hallmarks: [ - [1682298000,"Launch on Optimism"], - [1687827600,"Launch on Polygon zkEVM"], - [1689037200,"Launch on Arbitrum"], - [1690848000,"Launch on Base"], - [1702857600,"Launch on ShimmerEVM"] - ], - methodology: 'We count the token balances in different liquidity book contracts', - fantom:{ - tvl, - }, - optimism:{ - tvl, - }, - polygon_zkevm:{ - tvl, - }, - arbitrum:{ - tvl, - }, - base:{ - tvl, - }, - shimmer_evm: { - tvl, - }, -}; \ No newline at end of file +module.exports.hallmarks = [ + [1682298000, "Launch on Optimism"], + [1689037200, "Launch on Arbitrum"], + [1690848000, "Launch on Base"], + [1702857600, "Launch on ShimmerEVM"] +] \ No newline at end of file diff --git a/projects/traderjoe-lb-v2-1/index.js b/projects/traderjoe-lb-v2-1/index.js index 6921e438112d..381f8ebd8794 100644 --- a/projects/traderjoe-lb-v2-1/index.js +++ b/projects/traderjoe-lb-v2-1/index.js @@ -1,42 +1,11 @@ -const { sumTokens2 } = require('../helper/unwrapLPs') -const { staking } = require("../helper/staking.js"); +const { staking } = require("../helper/staking.js") +const { joeV2Export } = require('../helper/traderJoeV2') -const factories = { +module.exports = joeV2Export({ avax: '0x8e42f2F4101563bF679975178e880FD87d3eFd4e', arbitrum: '0x8e42f2F4101563bF679975178e880FD87d3eFd4e', bsc: '0x8e42f2F4101563bF679975178e880FD87d3eFd4e', - ethereum: '0xDC8d77b69155c7E68A95a4fb0f06a71FF90B943a' -} -async function tvl(api) { - const pools = await api.fetchList({ - target: factories[api.chain], - itemAbi: 'function getLBPairAtIndex(uint256) view returns (address)', - lengthAbi: 'uint256:getNumberOfLBPairs', - }) - const tokenA = await api.multiCall({ - abi: 'address:getTokenX', - calls: pools, - }) - const tokenB = await api.multiCall({ - abi: 'address:getTokenY', - calls: pools, - }) - const toa = [] - tokenA.map((_, i) => { - toa.push([tokenA[i], pools[i]]) - toa.push([tokenB[i], pools[i]]) - }) - return sumTokens2({ api, tokensAndOwners: toa, blacklistedTokens: [ - '0x77ea44CB68Eaadd5D7372e5602b5646475ea1C81', - ] }) -} - -module.exports = { - methodology: 'We count the token balances in in different liquidity book contracts', -} - -Object.keys(factories).forEach(chain => { - module.exports[chain] = { tvl } + ethereum: '0xDC8d77b69155c7E68A95a4fb0f06a71FF90B943a', }) module.exports.arbitrum.staking = staking("0x43646A8e839B2f2766392C1BF8f60F6e587B6960", "0x371c7ec6D8039ff7933a2AA28EB827Ffe1F52f07") \ No newline at end of file From cc032b57b844bcc306db58606ab1a8294ba2ef1b Mon Sep 17 00:00:00 2001 From: ken-movegpt <163412206+ken-movegpt@users.noreply.github.com> Date: Tue, 11 Jun 2024 18:32:48 +0700 Subject: [PATCH 292/855] Add MOVE GPT project (#10547) * update * code refactor --------- Co-authored-by: dev Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/movegpt/index.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 projects/movegpt/index.js diff --git a/projects/movegpt/index.js b/projects/movegpt/index.js new file mode 100644 index 000000000000..16f351193f5d --- /dev/null +++ b/projects/movegpt/index.js @@ -0,0 +1,32 @@ +const { function_view } = require("../helper/chain/aptos"); +const MGPT_ADDRESS = '0x63be1898a424616367e19bbd881f456a78470e123e2770b5b5dcdceb61279c54::movegpt_token::MovegptCoin' +const POOL_1 = "0xd22d0e14b278b8463c6a8c86baa0e89d1a982028c0d79b4c3584d74238a0dc6d" +const POOL_2 = "0x9141a7ebbf2c8ab9101d6b657321e1cc78314b71b8e8780508986119660ffee8" + +async function get_staking(api) { + async function addBalance(pool) { + let [balance] = await function_view( + { + functionStr: + "0xccd92a8a4b4ee351190346bb04de9941b840bf42a2f003372ccec232d2b5bdcf::staking_fix_lock_duration::get_pool_staked_amount", + type_arguments: [MGPT_ADDRESS], + args: [pool] + } + ) + api.addCGToken('movegpt', balance / 1e8) + } + await Promise.all([POOL_1, POOL_2].map(addBalance)) +} + +module.exports = { + timetravel: false, + methodology: + "THE MOST TRUSTED #MOVE LAUNCHPAD ON APTOS.", + aptos: { + tvl: () => ({ + }), + staking: async (api) => { + await get_staking(api) + }, + } +} \ No newline at end of file From 3f19c3d61d491cf46683584be077ffcfe1810eef Mon Sep 17 00:00:00 2001 From: aparkalov Date: Tue, 11 Jun 2024 16:52:25 +0300 Subject: [PATCH 293/855] add taiko network for minterest tvl calculation (#10603) Co-authored-by: Aliaksei Parkalau --- projects/minterest/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/minterest/index.js b/projects/minterest/index.js index 976390a17232..f32246396ee5 100644 --- a/projects/minterest/index.js +++ b/projects/minterest/index.js @@ -4,12 +4,14 @@ module.exports = { hallmarks: [ [1677133355, "MINTY distribution begins on Ethereum"], [1704369540, "MINTY distribution begins on Mantle"], + [1717164347, "MINTY distribution begins on Taiko"], ], } const config = { ethereum: "0xD13f50274a68ABF2384C79248ADc259b3777c081", mantle: "0xe53a90EFd263363993A3B41Aa29f7DaBde1a932D", + taiko: "0xe56c0d4d6A08C05ec42E923EFd06497F115D4799", } From 02c16d47f684a641233fbc6f79ec749fc41a268c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 11 Jun 2024 19:24:17 +0530 Subject: [PATCH 294/855] Add Credbull vaults functionality (#10604) * feat: add credbull vaults * feat: add credbull vaults * feat: add credbull vaults * feat: add credbull vaults * count off chain assets as borrowed --------- Co-authored-by: Pedro Viegas --- projects/credbull/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/credbull/index.js diff --git a/projects/credbull/index.js b/projects/credbull/index.js new file mode 100644 index 000000000000..963e7702c7a7 --- /dev/null +++ b/projects/credbull/index.js @@ -0,0 +1,23 @@ +const { getConfig } = require('../helper/cache'); + +async function tvl(api) { + let vaults = await getConfig('credbull', "https://incredbull.io/api/vaults") + vaults = vaults[api.chain] + const tokens = await api.multiCall({ abi: 'address:asset', calls: vaults }) + return api.sumTokens({ tokensAndOwners2: [tokens, vaults] }) +} + +async function borrowed(api) { + let vaults = await getConfig('credbull', "https://incredbull.io/api/vaults") + vaults = vaults[api.chain] + const tokens = await api.multiCall({ abi: 'address:asset', calls: vaults }) + const bals = await api.multiCall({ abi: 'address:totalAssets', calls: vaults }) + api.add(tokens, bals) + const tBals = (await api.multiCall({ abi: 'erc20:balanceOf', calls: tokens.map((t,i) => ({ target: t, params: vaults[i] })) })).map(i => i * -1) + api.add(tokens, tBals) +} + +module.exports = { + methodology: 'TVL consist of the sum of every deposit of all vaults for a given asset.', + btr: { tvl, borrowed, }, +}; From 89802b29bacbf4d539999c5008390277800e9712 Mon Sep 17 00:00:00 2001 From: sthitpragnya-ethosx <115890450+sthitpragnya-ethosx@users.noreply.github.com> Date: Tue, 11 Jun 2024 19:25:51 +0530 Subject: [PATCH 295/855] ethosx operps tvl (#10601) --- projects/ethosx/index.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 projects/ethosx/index.js diff --git a/projects/ethosx/index.js b/projects/ethosx/index.js new file mode 100644 index 000000000000..98a71c0a118c --- /dev/null +++ b/projects/ethosx/index.js @@ -0,0 +1,36 @@ +const { sumTokensExport } = require("../helper/unwrapLPs"); +const ETH_PUT_CONTROLLER_ADDRESS = "0x55E008E3b0Aa6808Ca8B8Ba1DC319EC132554aCd"; +const ETH_CALL_CONTROLLER_ADDRESS = + "0x2eEFcBCa065bE1763be58276AFA41627A82dfa2D"; +const BTC_PUT_CONTROLLER_ADDRESS = "0x3273C69432b2B0D808499F4Cc56113Be6c7A673F"; +const BTC_CALL_CONTROLLER_ADDRESS = + "0x18AadF2a220D3FEb958Ed161263185f0805D11a1"; +const USDC_ARB_ADDRESS = "0xaf88d065e77c8cC2239327C5EDb3A432268e5831"; +const USDC_BSC_ADDRESS = "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"; + +module.exports = { + methodology: "TVL counts the USDC held in the controller contracts.", + start: 1715693000, + arbitrum: { + tvl: sumTokensExport({ + owners: [ + ETH_PUT_CONTROLLER_ADDRESS, + ETH_CALL_CONTROLLER_ADDRESS, + BTC_PUT_CONTROLLER_ADDRESS, + BTC_CALL_CONTROLLER_ADDRESS, + ], + tokens: [USDC_ARB_ADDRESS], + }), + }, + bsc: { + tvl: sumTokensExport({ + owners: [ + ETH_PUT_CONTROLLER_ADDRESS, + ETH_CALL_CONTROLLER_ADDRESS, + BTC_PUT_CONTROLLER_ADDRESS, + BTC_CALL_CONTROLLER_ADDRESS, + ], + tokens: [USDC_BSC_ADDRESS], + }), + }, +}; // node test.js projects/mint-club/index.js From aebca7153f93a58068b9b4b422b7796c392ef5ec Mon Sep 17 00:00:00 2001 From: usr-icon-foundation <111794534+usr-icon-foundation@users.noreply.github.com> Date: Tue, 11 Jun 2024 15:56:47 +0200 Subject: [PATCH 296/855] USDC Price tracking fix + Addition of Base and Arbitrum chains to TVL tracking (#10602) Fix issue with wrong decimal allocation for USDC across several chains. Added Base + Arbitrum to chain TVL tracking --- projects/balanced/helper.js | 4 +++- projects/balanced/index.js | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/projects/balanced/helper.js b/projects/balanced/helper.js index bd68fe5d28a9..68a9223e4459 100644 --- a/projects/balanced/helper.js +++ b/projects/balanced/helper.js @@ -40,6 +40,8 @@ const networkIdentifiers = { "0xa86a.avax": "avalanche", "archway-1": "archway", "injective-1/inj": "injective", + "0xa4b1.arbitrum": "arbitrum", + "0x2105.base": "base" } // Get decimals of cross-chain Balanced assets in balancedAssetManagerContract @@ -71,7 +73,7 @@ async function getExternalChainDeposits() { try { const priceData = await call(balancedOracle, "getPriceDataInUSD", { symbol: tokenSymbol, }) const rateHex = priceData.rate - rateDecimal = parseInt(rateHex, 16) / decimals[tokenNetworkAddress] + rateDecimal = parseInt(rateHex, 16) / 1e18 // price value always has 18 decimals no matter the token decimals } catch (error) { // console.log( // `No price data available for ${tokenSymbol}, moving to Peg Stability pricing` diff --git a/projects/balanced/index.js b/projects/balanced/index.js index 9e960219dac2..bfa389909ee9 100644 --- a/projects/balanced/index.js +++ b/projects/balanced/index.js @@ -35,4 +35,10 @@ module.exports = { injective: { tvl: async () => await computeTVL("injective"), }, + base: { + tvl: async () => await computeTVL("base"), + }, + arbitrum: { + tvl: async () => await computeTVL("arbitrum"), + }, }; From 5dfed6b8cdf36d3a36b7176ae1f26ca5c1ea2af0 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Tue, 11 Jun 2024 21:33:59 +0100 Subject: [PATCH 297/855] add bob new wallet (#10609) --- projects/bob/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/bob/index.js b/projects/bob/index.js index 4639d756a3fe..07184113b5e9 100644 --- a/projects/bob/index.js +++ b/projects/bob/index.js @@ -10,10 +10,12 @@ const tokens = [ ADDRESSES.ethereum.WSTETH, ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.WETH, "0x7122985656e38BDC0302Db86685bb972b145bD3C", // STONE "0xbdBb63F938c8961AF31eaD3deBa5C96e6A323DD1", // eDLLR "0xbdab72602e9AD40FC6a6852CAf43258113B8F7a5", // eSOV "0xe7c3755482d0dA522678Af05945062d4427e0923", // ALEX + ]; module.exports = { @@ -25,7 +27,8 @@ module.exports = { owners: [ "0x3F6cE1b36e5120BBc59D0cFe8A5aC8b6464ac1f7", "0x091dF5E1284E49fA682407096aD34cfD42B95B72", - "0x450D55a4B4136805B0e5A6BB59377c71FC4FaCBb" + "0x450D55a4B4136805B0e5A6BB59377c71FC4FaCBb", + "0x8AdeE124447435fE03e3CD24dF3f4cAE32E65a3E" ], fetchCoValentTokens: true, }), From 90a645cd00f457ee63fe95333fe90c2d8113c0ee Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Tue, 11 Jun 2024 21:56:39 +0100 Subject: [PATCH 298/855] add hallmark (#10610) --- projects/baseline/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/baseline/index.js b/projects/baseline/index.js index fa6eddf3d536..2d901efeb966 100644 --- a/projects/baseline/index.js +++ b/projects/baseline/index.js @@ -18,6 +18,9 @@ async function borrowed(api) { } module.exports = { + hallmarks: [ + [1714251306,"self-whitehack"] + ], doublecounted: true, blast: { tvl, From 9cae5dcab38e829b3087da6b624a4f8ab7e81808 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Tue, 11 Jun 2024 22:47:15 +0100 Subject: [PATCH 299/855] fix zksync era bridge --- projects/txBridge/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/txBridge/index.js b/projects/txBridge/index.js index 5e7d9d935dd2..3c27fe98449b 100644 --- a/projects/txBridge/index.js +++ b/projects/txBridge/index.js @@ -8,6 +8,7 @@ module.exports = { owners: [ "0x32400084C286CF3E17e7B677ea9583e60a000324", "0x57891966931Eb4Bb6FB81430E6cE0A03AAbDe063", + "0xD7f9f54194C633F36CCD5F3da84ad4a1c38cB2cB" ], fetchCoValentTokens: true, }), From 48c488187d1763082f1df9d516efddcbb071b673 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 12 Jun 2024 01:24:56 +0100 Subject: [PATCH 300/855] update methodology --- projects/movegpt/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/movegpt/index.js b/projects/movegpt/index.js index 16f351193f5d..75d2ac6e69d3 100644 --- a/projects/movegpt/index.js +++ b/projects/movegpt/index.js @@ -21,7 +21,7 @@ async function get_staking(api) { module.exports = { timetravel: false, methodology: - "THE MOST TRUSTED #MOVE LAUNCHPAD ON APTOS.", + "TVL is calculated by summing the staked amounts in the specified staking pools on the Aptos blockchain.", aptos: { tvl: () => ({ }), From d987b893e2e12bb11c29705f13ab10e56842f519 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 12 Jun 2024 13:12:00 +0530 Subject: [PATCH 301/855] Add Rize TVL calculation for Ethereum blockchain (#10615) * feat: rize protocol * feat: add rize project * add rize tvl * add rize tvl, parsing eth log * add rize tvl by sui * code refactor --------- Co-authored-by: Aaric Co-authored-by: zhan --- projects/rize/index.js | 112 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 projects/rize/index.js diff --git a/projects/rize/index.js b/projects/rize/index.js new file mode 100644 index 000000000000..693688e5ae5a --- /dev/null +++ b/projects/rize/index.js @@ -0,0 +1,112 @@ +const sui = require("../helper/chain/sui"); +const ADDRESSES = require('../helper/coreAssets.json') + +const suiScallopPools = { + usdc: { + poolId: "0x4ace6648ddc64e646ba47a957c562c32c9599b3bba8f5ac1aadb2ae23a2f8ca0", + rewardPoolId: "0xf4268cc9b9413b9bfe09e8966b8de650494c9e5784bf0930759cfef4904daff8", + type: "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN", + stakeType: "0xefe8b36d5b2e43728cc323298626b83177803521d195cfb11e15b910e892fddf::reserve::MarketCoin<0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN>", + balanceSheet: '0x2f4df5e1368fbbdaa5c712d28b837b3d41c2d3872979ccededcdfdac55ff8a93', + spoolAccount: 'a5a2d2afe12ed353ca32a3d5f7592a7a57945040ee7beacab6d82a5fe5b34734', + decimals: 6, + }, + usdt: { + poolId: "0xcb328f7ffa7f9342ed85af3fdb2f22919e1a06dfb2f713c04c73543870d7548f", + rewardPoolId: "0x2c9f934d67a5baa586ceec2cc24163a2f049a6af3d5ba36b84d8ac40f25c4080", + type: "0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN", + stakeType: "0xefe8b36d5b2e43728cc323298626b83177803521d195cfb11e15b910e892fddf::reserve::MarketCoin<0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN>", + balanceSheet: '0xfbc056f126dd35adc1f8fe985e2cedc8010e687e8e851e1c5b99fdf63cd1c879', + spoolAccount: '775206c05243da6b1a29a45c74bd3d3e7db4b3f8303342cbf34c3d12725eac70', + decimals: 6, + }, + weth: { + poolId: "0xeec40beccb07c575bebd842eeaabb835f77cd3dab73add433477e57f583a6787", + rewardPoolId: "0x957de68a18d87817de8309b30c1ec269a4d87ae513abbeed86b5619cb9ce1077", + type: "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN", + stakeType: "0xefe8b36d5b2e43728cc323298626b83177803521d195cfb11e15b910e892fddf::reserve::MarketCoin<0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN>", + balanceSheet: '0xc8fcdff48efc265740ae0b74aae3faccae9ec00034039a113f3339798035108c', + spoolAccount: '3865596e3ea8860e4d479b91d2b9f5c57adab00d70b13ac6c7eb410fd092d2cc', + decimals: 8, + }, +} +const suiNaviPools = { + naviAddress: "0x966231078dda644567e71131267946b0e4cef7740d298f94b30af3293be1a755", + reserveParentId: "0xe6d4c6610b86ce7735ea754596d71d72d10c7980b5052fc3c8cdf8d09fea9b4b", + usdc: { + supplyBalanceParentId: "0x8d0a4467806458052d577c8cd2be6031e972f2b8f5f77fce98aa12cd85330da9", + assetId: 1, + decimals: 6, + }, + usdt: { + supplyBalanceParentId: "0x7e2a49ff9d2edd875f82b76a9b21e2a5a098e7130abfd510a203b6ea08ab9257", + assetId: 2, + decimals: 6, + }, + weth: { + supplyBalanceParentId: "0xa668905b1ad445a3159b4d29b1181c4a62d864861b463dd9106cc0d97ffe8f7f", + assetId: 3, + decimals: 6, + }, +} + +async function tvl(api) { + const [ethInNaviSui, ethInScallopSui, usdtInNaviSui, usdtInScallopSui, usdcInNaviSui, usdcInScallopSui] = await Promise.all([ + naviSui("weth"), + scallopSui("weth"), + naviSui("usdt"), + scallopSui("usdt"), + naviSui("usdc"), + scallopSui("usdc"), + ]); + api.addGasToken(ethInNaviSui * 1e18) + api.addGasToken(ethInScallopSui * 1e18) + api.add(ADDRESSES.ethereum.USDT, usdtInNaviSui * 1e6) + api.add(ADDRESSES.ethereum.USDT, usdtInScallopSui * 1e6) + api.add(ADDRESSES.ethereum.USDC, usdcInNaviSui * 1e6) + api.add(ADDRESSES.ethereum.USDC, usdcInScallopSui * 1e6) +} + + +async function scallopSui(coinSymbol) { + const spoolAccountResp = await sui.getObject(suiScallopPools[coinSymbol].spoolAccount); + const stakesBalance = spoolAccountResp?.fields?.stakes ?? 0 + const stakeBalance = stakesBalance / 10 ** suiScallopPools[coinSymbol].decimals + const balanceSheetResp = await sui.getObject(suiScallopPools[coinSymbol].balanceSheet); + const cash = balanceSheetResp?.fields?.value?.fields?.cash ?? 0 + const debt = balanceSheetResp?.fields?.value?.fields?.debt ?? 0 + const revenue = balanceSheetResp?.fields?.value?.fields?.revenue ?? 0 + const marketCoinSupply = balanceSheetResp?.fields?.value?.fields?.market_coin_supply ?? 0 + const conversionRate = (+cash + +debt - +revenue) / marketCoinSupply + const tvl = stakeBalance * conversionRate + return tvl; +} + +async function naviSui(coinSymbol) { + const naviResp = await sui.getDynamicFieldObject( + suiNaviPools[coinSymbol].supplyBalanceParentId, + suiNaviPools.naviAddress, + { idType: 'address' }); + + const currentSupply = naviResp?.fields?.value ?? 0 + + const assetResp = await sui.getDynamicFieldObject( + suiNaviPools.reserveParentId, + suiNaviPools[coinSymbol].assetId, + { idType: 'u8' } + ); + const currentSupplyIndexOrg = assetResp?.fields?.value?.fields?.current_supply_index; + const currentSupplyIndex = currentSupplyIndexOrg / 1e27 + + const decimals = suiNaviPools[coinSymbol].decimals + const tvl = (currentSupply / 1e9) * currentSupplyIndex + return tvl; +} + +module.exports = { + start: 1716599207, + timetravel: false, + ethereum: { + tvl + } +}; \ No newline at end of file From 19df7f528721be9596bbe54725ec933c293d20f5 Mon Sep 17 00:00:00 2001 From: Tigris of Gaul <81036209+tigris-of-gaul@users.noreply.github.com> Date: Wed, 12 Jun 2024 07:44:15 +0000 Subject: [PATCH 302/855] Add Tarot factory for Linea (#10608) --- projects/tarot/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/tarot/index.js b/projects/tarot/index.js index 779def2d5409..541ce31315f4 100644 --- a/projects/tarot/index.js +++ b/projects/tarot/index.js @@ -69,6 +69,11 @@ const config = { '0xf450b51fb2E1e4f05DAf9Cf7D9BB97714540B4f4', // Tarot Zeniths ] }, + linea: { + factories: [ + '0xb6193DF61351736e5190bF1DEB2E4f0769bd1BF2', // Tarot Leyline + ] + }, } tarotHelper(module.exports, config) From d88840e9470a121f57924ed6a53c009398f56df2 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 12 Jun 2024 13:21:54 +0530 Subject: [PATCH 303/855] Add Clober-v2 and update methodology (#10616) * feat: add clober-v2 * fix: module export * feat: update methodology * code refactor --------- Co-authored-by: Xavier --- projects/clober-v2/index.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 projects/clober-v2/index.js diff --git a/projects/clober-v2/index.js b/projects/clober-v2/index.js new file mode 100644 index 000000000000..84fd0a858615 --- /dev/null +++ b/projects/clober-v2/index.js @@ -0,0 +1,25 @@ +const { getLogs2 } = require('../helper/cache/getLogs') + +const abi = { + openEvent: 'event Open(uint192 indexed id, address indexed base, address indexed quote, uint64 unitSize, uint24 makerPolicy, uint24 takerPolicy, address hooks)', +} + +const config = { + base: { factory: '0x382CCccbD3b142D7DA063bF68cd0c89634767F76', fromBlock: 14528050, }, + era: { factory: '0xAaA0e933e1EcC812fc075A81c116Aa0a82A5bbb8', fromBlock: 34448160, }, +} + +async function tvl(api) { + const { factory, fromBlock } = config[api.chain] + const logs = await getLogs2({ api, factory, eventAbi: abi.openEvent, fromBlock, }) + const tokens = logs.map(({ base, quote }) => [base, quote]).flat() + return api.sumTokens({ owner: factory, tokens, }) +} + +module.exports = { + methodology: "TVL consists of assets deposited into the Clober Book Manager contract", +}; + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file From 08e2c17ccf478d760748592a90f3269c86cb2c42 Mon Sep 17 00:00:00 2001 From: eepdev <78463658+eepdev@users.noreply.github.com> Date: Wed, 12 Jun 2024 03:54:01 -0400 Subject: [PATCH 304/855] Added Adamant Finance Fraxtal vaults (#10611) * Update utils.js feat: add Fraxtal Fraxswap LP tokens * Update index.js - Adamant feat: fetch vault data from new json file that contains vaults on all chains added Fraxtal vaults --- projects/adamantfinance/index.js | 54 +++++++++++++++++++++++++++++--- projects/helper/utils.js | 1 + 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/projects/adamantfinance/index.js b/projects/adamantfinance/index.js index b3ad679c36fc..8ef3d10fba1c 100644 --- a/projects/adamantfinance/index.js +++ b/projects/adamantfinance/index.js @@ -16,6 +16,19 @@ const vaultsUrl = { "https://raw.githubusercontent.com/eepdev/vaults/main/arbitrum_vaults.json", cronos: "https://raw.githubusercontent.com/eepdev/vaults/main/cronos_vaults.json", + fraxtal: + "https://raw.githubusercontent.com/eepdev/vaults/main/current_vaults_all_chains.json" +}; + +const allVaultsUrl = "https://raw.githubusercontent.com/eepdev/vaults/main/current_vaults_all_chains.json"; + +const NetworkID = { + ETH_MAINNET: 1, + POLYGON: 137, + ARBITRUM: 42161, + CRONOS: 25, + FRAXTAL: 252, + OPTIMISM: 10 }; /*** Polygon Addresses ***/ @@ -28,6 +41,7 @@ const vaultAddresses_polygon = ["0xF7661EE874Ec599c2B450e0Df5c40CE823FEf9d3"]; / const lpAddresses_polygon = ["0xa5bf14bb945297447fe96f6cd1b31b40d31175cb"]; //ADDY/WETH const ADDY = "0xc3fdbadc7c795ef1d6ba111e06ff8f16a20ea539"; +const adMESH = "0x459dc0fB79653A48469F2C3c375d0A522750Dd40"; /*** Arbitrum Addresses ***/ const stakingContracts_Arbitrum = [ @@ -66,7 +80,7 @@ async function pool2Polygon(api) { } async function polygonTvl(timestamp, block, chainBlocks) { - return await tvl(timestamp, "polygon", chainBlocks, lpAddresses_polygon); + return await tvl2(timestamp, "polygon", NetworkID.POLYGON, chainBlocks, lpAddresses_polygon); } async function arbitrumTvl(timestamp, block, chainBlocks) { @@ -74,7 +88,11 @@ async function arbitrumTvl(timestamp, block, chainBlocks) { } async function cronosTvl(timestamp, block, chainBlocks) { - return await tvl(timestamp, "cronos", chainBlocks, lpAddresses_cronos); + return await tvl2(timestamp, "cronos", NetworkID.CRONOS, chainBlocks, lpAddresses_cronos); +} + +async function fraxtalTvl(timestamp, block, chainBlocks) { + return await tvl2(timestamp, "fraxtal", NetworkID.FRAXTAL, chainBlocks, []); //no Adamant platform token on Fraxtal } async function uniTvl(balances, chain, block, uniVaults, lpAddressesIgnored, transformAddress = (a) => a) { @@ -98,7 +116,6 @@ async function uniTvl(balances, chain, block, uniVaults, lpAddressesIgnored, tra sdk.util.sumSingleBalance(balances, chain + ':' + v.lpAddress, vault_balances[idx]) } }); - await unwrapLPsAuto({ balances, block, chain, }); return balances; } @@ -114,7 +131,7 @@ const tvl = async (timestamp, chain, chainBlocks, lpAddressesIgnored) => { let uniVaults = resp .filter( (vault) => - vault.vaultAddress !== '0x459dc0fB79653A48469F2C3c375d0A522750Dd40' && + vault.vaultAddress !== adMESH && vault.platform !== "dodo" ) .map((vault) => ({ @@ -126,6 +143,32 @@ const tvl = async (timestamp, chain, chainBlocks, lpAddressesIgnored) => { return balances; }; +const tvl2 = async (timestamp, chain, chainId, chainBlocks, lpAddressesIgnored) => { + + const block = chainBlocks[chain]; + const transformAddress = await getChainTransform(chain) + let balances = {}; + + let resp = await getConfig('adamant-fi/'+chain, allVaultsUrl); + + let uniVaults = resp + .filter( + (vault) => + vault.vaultAddress !== adMESH && + vault.vaultAddress !== "0x01d2833e6d86D5Ad8380044DEb2cA520fc60D326" && //adMESH related token/deposit + vault.vaultAddress !== "0xbe6aa0AF32984fE3f65a73071DECC09Ab607e310" && //adMESH related token/deposit + vault.platform !== "dodo" && + vault.chainId == chainId + ) + .map((vault) => ({ + vaultAddress: vault.vaultAddress, + lpAddress: vault.lpAddress, + })); + + balances = await uniTvl(balances, chain, block, uniVaults, lpAddressesIgnored, transformAddress); + return balances; +}; + module.exports = { polygon: { staking: stakings(stakingContracts_polygon, ADDY), @@ -140,6 +183,9 @@ module.exports = { staking: stakingUnknown({ owners: stakingContracts_cronos, tokens: [CADDY], chain: 'cronos', lps: lpAddresses_cronos, useDefaultCoreAssets: true }), tvl: cronosTvl, }, + fraxtal: { + tvl: fraxtalTvl, + }, methodology: "The current vaults on Adamant Finance are found on the Github. Once we have the vaults, we filter out the LP addresses of each vault and unwrap the LPs so that each token can be accounted for. Coingecko is used to price the tokens and the sum of all tokens is provided as the TVL", }; diff --git a/projects/helper/utils.js b/projects/helper/utils.js index 0e4dccd218e9..153da04c3d86 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -84,6 +84,7 @@ function isLP(symbol, token, chain) { if (chain === 'functionx' && ['FX-V2'].includes(symbol)) return true if (chain === 'mantle' && ['MoeLP'].includes(symbol)) return true if (chain === 'blast' && ['RING-V2'].includes(symbol)) return true + if (chain === 'fraxtal' && ['FS-V2'].includes(symbol)) return true if (chain === 'era' && /(ZFLP)$/.test(symbol)) return true // for syncswap if (chain === 'flare' && symbol.endsWith('_LP')) return true // for enosys dex if (chain === 'songbird' && ['FLRX', 'OLP'].includes(symbol)) return true From 4f5e137f942d5c17f25f19c5c394a6609616e0d6 Mon Sep 17 00:00:00 2001 From: Ludovit Scholtz Date: Wed, 12 Jun 2024 09:56:03 +0200 Subject: [PATCH 305/855] add ASAGold (#10607) --- projects/asa-gold/index.js | 40 +++++++++++++++++++++++++++++++ projects/helper/chain/algorand.js | 1 + 2 files changed, 41 insertions(+) create mode 100644 projects/asa-gold/index.js diff --git a/projects/asa-gold/index.js b/projects/asa-gold/index.js new file mode 100644 index 000000000000..3da3e89173cf --- /dev/null +++ b/projects/asa-gold/index.js @@ -0,0 +1,40 @@ +const { tokens, getAssetInfo } = require('../helper/chain/algorand') +const sdk = require('@defillama/sdk') + +async function tvl() { + const abi = 'function latestRoundData() view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)' + const api = new sdk.ChainApi({}) + let totalMeldMarketCap = 0 + + // Gold is priced in tory oz, silver is priced in oz, but Meld Tokens are both priced in grams + const ozToGrams = 31.10347687 + + // ASA.Gold tokens + const assetInfo = [ + { + assetId: tokens.ASAGold, + grams: ozToGrams, + priceFeed: '0x214eD9Da11D2fbe465a6fc601a91E62EbEc1a0D6', + } + ] + + // Get total market cap of all Meld tokens + for (const asset of assetInfo) { + const { assetId, grams, priceFeed } = asset + const { answer: price } = await api.call({ abi, target: priceFeed }) + const assetInfo = await getAssetInfo(assetId) + const circulatingSupply = assetInfo.circulatingSupply + const marketCap = (circulatingSupply / grams / 10 ** 6) * (price / 10 ** 8) + totalMeldMarketCap += marketCap + } + + return { tether: totalMeldMarketCap } +} + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + algorand: { + tvl, + }, +} diff --git a/projects/helper/chain/algorand.js b/projects/helper/chain/algorand.js index f59755bd1b4f..9a36d84581f2 100644 --- a/projects/helper/chain/algorand.js +++ b/projects/helper/chain/algorand.js @@ -159,6 +159,7 @@ const tokens = { gard: 684649988, gold$: 246516580, silver$: 246519683, + ASAGold: 1241944285 }; // store all asset ids as string From 8fa193fd7ec245bfaf6fe620ec6c5ae1bea8ad27 Mon Sep 17 00:00:00 2001 From: Hiro <152849689+drummaster98@users.noreply.github.com> Date: Wed, 12 Jun 2024 17:48:41 +0800 Subject: [PATCH 306/855] add kodo exchange (on taiko) (#10617) * add kodo exchange * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/kodo-exchange/index.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 projects/kodo-exchange/index.js diff --git a/projects/kodo-exchange/index.js b/projects/kodo-exchange/index.js new file mode 100644 index 000000000000..59e0d67d2f83 --- /dev/null +++ b/projects/kodo-exchange/index.js @@ -0,0 +1,3 @@ +const {uniTvlExport} = require('../helper/unknownTokens.js') + +module.exports = uniTvlExport('taiko', '0x535E02960574d8155596a73c7Ad66e87e37Eb6Bc', { hasStablePools: true}) From a07f6063417a8f2ce856871bbcfa780d7751554f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 12 Jun 2024 15:35:46 +0530 Subject: [PATCH 307/855] Add support for Stacks TVL (#10619) * XLink * added stacks support * include some stacks tvl * revert package.json * handle stacks separately * handle stacks separately * handle stacks separately * add api.js * code refactor --------- Co-authored-by: fiftyeightandeight --- projects/helper/tokenMapping.js | 5 +++++ projects/xlink/index.js | 31 +++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 projects/xlink/index.js diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 4a8f6ce3722e..172986f2aacf 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -40,6 +40,11 @@ const fixBalancesTokens = { [ADDRESSES.q.ELK]: { coingeckoId: "elk-finance", decimals: 18 }, [ADDRESSES.q.WETH]: { coingeckoId: "ethereum", decimals: 18 }, }, + stacks: { + "SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.token-vlqstx::vlqstx": { coingeckoId: "blockstack", decimals: 6 }, + "SP2XD7417HGPRTREMKF748VNEQPDRR0RMANB7X1NK.token-abtc::bridged-btc": { coingeckoId: "xlink-bridged-btc-stacks", decimals: 8 }, + "SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.token-alex::alex": { coingeckoId: "alexgo", decimals: 8 }, + }, stellar: { "CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA": { coingeckoId: "stellar", decimals: 7}, "CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75": { coingeckoId: "usd-coin", decimals: 7}, diff --git a/projects/xlink/index.js b/projects/xlink/index.js new file mode 100644 index 000000000000..8a9d91ab9af5 --- /dev/null +++ b/projects/xlink/index.js @@ -0,0 +1,31 @@ +const { sumTokensExport } = require('../helper/sumTokens'); +const ADDRESSES = require('../helper/coreAssets.json'); + +module.exports = { + methodology: "TVL of XLink is the sum of the tokens locked in its contracts", + timetravel: false, +}; + +const config = { + bitcoin: { + owners: + [ + 'bc1q9hs56nskqsxmgend4w0823lmef33sux6p8rzlp', + '32jbimS6dwSEebMb5RyjGxcmRoZEC5rFrS', + 'bc1qlhkfxlzzzcc25z95v7c0v7svlp5exegxn0tf58', + '3MJ8mbu4sNseNeCprG85emwgG9G9SCort7' + ], + }, + 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 + ] }, +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { + tvl: sumTokensExport(config[chain]) + } +}) \ No newline at end of file From bf4d857d8bbad1cb77b6ae774cf7b41b1a98474b Mon Sep 17 00:00:00 2001 From: joltbrian <144665672+briangarden@users.noreply.github.com> Date: Wed, 12 Jun 2024 18:08:18 +0800 Subject: [PATCH 308/855] Add Joltify RWA Adapter (#10606) * add Joltify RWA adapter * update rwa adapter --- projects/joltify-rwa/index.js | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 projects/joltify-rwa/index.js diff --git a/projects/joltify-rwa/index.js b/projects/joltify-rwa/index.js new file mode 100644 index 000000000000..8d3810eb45e3 --- /dev/null +++ b/projects/joltify-rwa/index.js @@ -0,0 +1,37 @@ +const { queryV1Beta1 } = require('../helper/chain/cosmos'); +const chain = 'joltify' + +const tvl = async (api) => { + const [pools] = await Promise.all([ + queryV1Beta1({ chain, url: `spv/list_pools` }), + ]); + + pools.pools_info.forEach(async pool => { + api.add(pool.usable_amount.denom, pool.usable_amount.amount); + }); +} + +const borrowed = async (api) => { + const [pools] = await Promise.all([ + queryV1Beta1({ chain, url: `spv/list_pools` }), + ]); + + const [price_info] = await Promise.all([ + queryV1Beta1({ chain, url: `third_party/pricefeed/v1beta1/prices` }), + ]); + + pools.pools_info.forEach(async pool => { + const [market, borrowed_denom] = pool.borrowed_amount.denom.split('-'); + const market_id = `${market}:usd`; + const price = price_info.prices.find(price => price.market_id === market_id)?.price; + api.add(borrowed_denom, pool.borrowed_amount.amount * price); + }); +} + +module.exports = { + timetravel: false, + joltify: { + tvl, + borrowed + } +} \ No newline at end of file From 68992bc4bae25f251629a6734868da0ffb9399bf Mon Sep 17 00:00:00 2001 From: 0xmer1in <39942523+0xmer1in@users.noreply.github.com> Date: Wed, 12 Jun 2024 21:45:10 +0800 Subject: [PATCH 309/855] chore: update WOOFi config --- projects/woofi.js | 66 +++++++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/projects/woofi.js b/projects/woofi.js index f8859416270d..1dcba24a856b 100644 --- a/projects/woofi.js +++ b/projects/woofi.js @@ -4,16 +4,16 @@ const { staking, stakings } = require('./helper/staking') const wooPPConfig = { fantom: [ ADDRESSES.fantom.WFTM, // WFTM - '0x74b23882a30290451A17c44f4F05243b6b58C76d', // ETH - '0x321162Cd933E2Be498Cd2267a90534A804051b11', // BTC + '0x74b23882a30290451A17c44f4F05243b6b58C76d', // WETH + '0x321162Cd933E2Be498Cd2267a90534A804051b11', // WBTC '0x6626c47c00F1D87902fc13EECfaC3ed06D5E8D8a', // WOO ADDRESSES.fantom.USDC, // USDC - ADDRESSES.fantom.fUSDT, + ADDRESSES.fantom.fUSDT, // fUSDT ], bsc: [ ADDRESSES.bsc.WBNB, // WBNB ADDRESSES.bsc.ETH, // ETH - ADDRESSES.bsc.BTCB, // BTC + ADDRESSES.bsc.BTCB, // BTCB '0x4691937a7508860F876c9c0a2a617E7d9E945D4B', // WOO ADDRESSES.bsc.USDT, // USDT ADDRESSES.bsc.BUSD, // BUSD @@ -25,55 +25,59 @@ const wooPPConfig = { ADDRESSES.avax.BTC_b, // BTC.b '0xaBC9547B534519fF73921b1FBA6E672b5f58D083', // WOO.e ADDRESSES.avax.USDC, // USDC - ADDRESSES.avax.USDt, + ADDRESSES.avax.USDt, // USDt ], polygon: [ ADDRESSES.polygon.WMATIC_2, // WMATIC ADDRESSES.polygon.WETH_1, // WETH ADDRESSES.polygon.WBTC, // WBTC '0x1B815d120B3eF02039Ee11dC2d33DE7aA4a8C603', // WOO - ADDRESSES.polygon.USDC, // USDC - ADDRESSES.polygon.USDT, + ADDRESSES.polygon.USDC, // USDC.e + ADDRESSES.polygon.USDC_CIRCLE, // native USDC + ADDRESSES.polygon.USDT, // USDT ], arbitrum: [ ADDRESSES.arbitrum.WETH, // WETH ADDRESSES.arbitrum.WBTC, // WBTC '0xcAFcD85D8ca7Ad1e1C6F82F651fA15E33AEfD07b', // WOO ADDRESSES.arbitrum.ARB, // ARB - ADDRESSES.arbitrum.USDC, // USDC + ADDRESSES.arbitrum.USDC, // USDC.e ADDRESSES.arbitrum.USDC_CIRCLE, // native USDC - ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.USDT, // USDT ], optimism: [ ADDRESSES.optimism.WETH_1, // WETH ADDRESSES.optimism.WBTC, // WBTC ADDRESSES.optimism.OP, // OP - ADDRESSES.optimism.USDC, // USDC - ADDRESSES.optimism.USDT, + ADDRESSES.optimism.USDC, // USDC.e + ADDRESSES.optimism.USDC_CIRCLE, // native USDC + ADDRESSES.optimism.USDT, // USDT '0x871f2F2ff935FD1eD867842FF2a7bfD051A5E527', // WOO ], ethereum: [], era: [ ADDRESSES.era.WETH, // WETH - ADDRESSES.era.USDC, // USDC + ADDRESSES.era.USDC, // USDC.e + '0x1d17CBcF0D6D143135aE902365D2E5e2A16538D4', // native USDC ], polygon_zkevm: [ - ADDRESSES.polygon_zkevm.WETH, - ADDRESSES.polygon_zkevm.USDC, + ADDRESSES.polygon_zkevm.WETH, // WETH + ADDRESSES.polygon_zkevm.USDC, // USDC ], linea: [ - ADDRESSES.linea.WETH, - ADDRESSES.linea.USDC, + ADDRESSES.linea.WETH, // WETH + ADDRESSES.linea.USDC, // native USDC ], base: [ - ADDRESSES.base.WETH, - ADDRESSES.base.USDbC, + ADDRESSES.base.WETH, // WETH + ADDRESSES.base.USDbC, // USDbC + ADDRESSES.base.USDC, // native USDC ], mantle: [ - ADDRESSES.mantle.WMNT, - ADDRESSES.mantle.WETH, - ADDRESSES.mantle.USDT, - ADDRESSES.mantle.USDC, + ADDRESSES.mantle.WMNT, // WMNT + ADDRESSES.mantle.WETH, // WETH + ADDRESSES.mantle.USDT, // USDT + ADDRESSES.mantle.USDC, // USDC ], } @@ -85,31 +89,31 @@ const chainConfig = { stakingContractV2: '0x1416E1378682b5Ca53F76656549f7570ad0703d9', }, bsc: { - wooPPContract: '0x59dE3B49314Bf5067719364A2Cb43e8525ab93FA', + wooPPContract: '0xEd9e3f98bBed560e66B89AaC922E29D4596A9642', woo: '0x4691937a7508860f876c9c0a2a617e7d9e945d4b', stakingContract: '0x2AEab1a338bCB1758f71BD5aF40637cEE2085076', stakingContractV2: '0xba91ffD8a2B9F68231eCA6aF51623B3433A89b13', }, avax: { - wooPPContract: '0x3b3E4b4741e91aF52d0e9ad8660573E951c88524', + wooPPContract: '0xEd9e3f98bBed560e66B89AaC922E29D4596A9642', woo: '0xabc9547b534519ff73921b1fba6e672b5f58d083', stakingContract: '0xcd1B9810872aeC66d450c761E93638FB9FE09DB0', stakingContractV2: '0x3Bd96847C40De8b0F20dA32568BD15462C1386E3', }, polygon: { - wooPPContract: '0x7081A38158BD050Ae4a86e38E0225Bc281887d7E', + wooPPContract: '0xEd9e3f98bBed560e66B89AaC922E29D4596A9642', woo: '0x1b815d120b3ef02039ee11dc2d33de7aa4a8c603', stakingContract: '0x9BCf8b0B62F220f3900e2dc42dEB85C3f79b405B', stakingContractV2: '0xba91ffD8a2B9F68231eCA6aF51623B3433A89b13', }, arbitrum: { - wooPPContract: '0xeFF23B4bE1091b53205E35f3AfCD9C7182bf3062', + wooPPContract: '0xEd9e3f98bBed560e66B89AaC922E29D4596A9642', woo: '0xcafcd85d8ca7ad1e1c6f82f651fa15e33aefd07b', stakingContract: '0x9321785D257b3f0eF7Ff75436a87141C683DC99d', stakingContractV2: '0x2CFa72E7f58dc82B990529450Ffa83791db7d8e2', }, optimism: { - wooPPContract: '0xd1778F9DF3eee5473A9640f13682e3846f61fEbC', + wooPPContract: '0xEd9e3f98bBed560e66B89AaC922E29D4596A9642', woo: '0x871f2f2ff935fd1ed867842ff2a7bfd051a5e527', stakingContract: null, stakingContractV2: '0xba91ffD8a2B9F68231eCA6aF51623B3433A89b13', @@ -121,7 +125,7 @@ const chainConfig = { stakingContractV2: '0xba91ffD8a2B9F68231eCA6aF51623B3433A89b13', }, era: { - wooPPContract: '0x42ED123EB5266A5B8E2B54B2C76180CCF5e72FEe', + wooPPContract: '0xE656d70bc3550e3EEE9dE7dC79367A44Fd13d975', woo: null, stakingContract: null, stakingContractV2: null, @@ -133,19 +137,19 @@ const chainConfig = { stakingContractV2: null, }, linea: { - wooPPContract: '0xF5d215d9C84778F85746D15762DaF39B9E83a2d6', + wooPPContract: '0xEd9e3f98bBed560e66B89AaC922E29D4596A9642', woo: null, stakingContract: null, stakingContractV2: null, }, base: { - wooPPContract: '0xb130a49065178465931d4f887056328CeA5D723f', + wooPPContract: '0xEd9e3f98bBed560e66B89AaC922E29D4596A9642', woo: null, stakingContract: null, stakingContractV2: null, }, mantle: { - wooPPContract: '0x9D1A92e601db0901e69bd810029F2C14bCCA3128', + wooPPContract: '0xEd9e3f98bBed560e66B89AaC922E29D4596A9642', woo: null, stakingContract: null, stakingContractV2: null, From bb9fc2488fd016fd74256150abd223e86cf85dcc Mon Sep 17 00:00:00 2001 From: senorpapasito Date: Wed, 12 Jun 2024 11:45:28 -0400 Subject: [PATCH 310/855] add mstETH apxETH mswETH to blackwing project --- projects/blackwing/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/blackwing/index.js b/projects/blackwing/index.js index cfe27b8300f1..f1c0f529b97f 100644 --- a/projects/blackwing/index.js +++ b/projects/blackwing/index.js @@ -31,6 +31,9 @@ const ETHEREUM_MAINNET_SHIB_ADDRESS = "0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4c const ETHEREUM_MAINNET_PEPE_ADDRESS = "0x6982508145454Ce325dDbE47a25d4ec3d2311933"; const ETHEREUM_MAINNET_EGETH_ADDRESS = "0x18f313Fc6Afc9b5FD6f0908c1b3D476E3feA1DD9"; const ETHEREUM_MAINNET_PUFETH_ADDRESS = "0xD9A442856C234a39a81a089C06451EBAa4306a72"; +const ETHEREUM_MAINNET_MSTETH_ADDRESS = "0x49446A0874197839D15395B908328a74ccc96Bc0"; +const ETHEREUM_MAINNET_APXETH_ADDRESS = "0x9Ba021B0a9b958B5E75cE9f6dff97C7eE52cb3E6"; +const ETHEREUM_MAINNET_MSWETH_ADDRESS = "0x32bd822d615A3658A68b6fDD30c2fcb2C996D678"; module.exports = { arbitrum: { @@ -70,7 +73,10 @@ module.exports = { ETHEREUM_MAINNET_SHIB_ADDRESS, ETHEREUM_MAINNET_PEPE_ADDRESS, ETHEREUM_MAINNET_EGETH_ADDRESS, - ETHEREUM_MAINNET_PUFETH_ADDRESS + ETHEREUM_MAINNET_PUFETH_ADDRESS, + ETHEREUM_MAINNET_MSTETH_ADDRESS, + ETHEREUM_MAINNET_APXETH_ADDRESS, + ETHEREUM_MAINNET_MSWETH_ADDRESS ], owner: BLACKWING_VAULT_ETH, fetchCoValentTokens: true, }) }, From 6cc412ffcbb53dfabb519cacd5920514ccdaeb5b Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 12 Jun 2024 21:40:06 +0200 Subject: [PATCH 311/855] graph migration: part 1 --- package-lock.json | 6 +- projects/88mph/index.js | 72 ++++++++++++++++++----- projects/aelin/index.js | 2 - projects/aktionariat/index.js | 19 ++---- projects/atlendis/index.js | 85 +++------------------------ projects/dodo/index.js | 86 ---------------------------- projects/helper/cache.js | 2 + projects/helper/getUniSubgraphTvl.js | 6 +- projects/helper/http.js | 3 + projects/unifarm/helper.js | 3 +- projects/uniswap-v1/index.js | 2 +- projects/uniswap-v2/index.js | 2 +- projects/uniswap/index.js | 23 ++++---- projects/yieldyak/index.js | 3 +- test.js | 2 +- volume.md | 34 ----------- 16 files changed, 101 insertions(+), 249 deletions(-) delete mode 100644 volume.md diff --git a/package-lock.json b/package-lock.json index 2143492e47f2..911a406bb5b3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -886,9 +886,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "5.0.61", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.61.tgz", - "integrity": "sha512-t7nOMdpQ29y1eZmQothokRqsrfmGSTcu/ZHauvl/CvDEcUuWK+uNpdSAYG0cf93Z3XUXKH4eyRI7XLZcYR7/6w==", + "version": "5.0.67", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.67.tgz", + "integrity": "sha512-gOJACkDuPyNicL2zs0J93LkbDOkcviSaNQAvRH/wQkeXcdo7tHwN5YH59sFFE6Ge6gsCgcI0KnyuO6E0yjmo8g==", "dependencies": { "@aws-sdk/client-s3": "^3.400.0", "@elastic/elasticsearch": "^8.13.1", diff --git a/projects/88mph/index.js b/projects/88mph/index.js index 215d749e0813..a931e7e9ed51 100644 --- a/projects/88mph/index.js +++ b/projects/88mph/index.js @@ -2,10 +2,26 @@ const sdk = require('@defillama/sdk') const { staking } = require('../helper/staking') const { getUniqueAddresses } = require('../helper/utils') -const { graphQuery } = require('../helper/http') const config = { - ethereum: { dpools: 'https://api.thegraph.com/subgraphs/name/bacon-labs/eighty-eight-mph', vPools: [ + ethereum: { dpools: [ + "0x19e10132841616ce4790920d5f94b8571f9b9341", + "0x22e6b9a65163ce1225d1f65ef7942a979d093039", + "0x23fa6b36e870ca5753853538d17c3ca7f5269e84", + "0x2f3efd1a90a2336ab8fa1b9060380dc37361ca55", + "0x303cb7ede0c3ad99ce017cdc3abacd65164ff486", + "0x35966201a7724b952455b73a36c8846d8745218e", + "0x374226dbaa3e44bf3923afb63f5fd83928b7e148", + "0x3f5611f7762cc39fc11e10c864ae38526f650e9d", + "0x6712baab01fa2dc7be6635746ec2da6f8bd73e71", + "0x681aaa7cf3f7e1f110842f0149ba8a4af53ef2fd", + "0x904f81eff3c35877865810cca9a63f2d9cb7d4dd", + "0xb1abaac351e06d40441cf2cd97f6f0098e6473f2", + "0xd4837145c7e13d580904e8431cfd481f9794fc41", + "0xdc86ac6140026267e0873b27c8629efe748e7146", + "0xe615e59353f70ca2424aa0f24f49c639b8e924d3", + "0xe8c52367b81113ed32bb276184e521c2fbe9393a", + ], vPools: [ "0x062214fbe3f15d217512deb14572eb01face0392", "0x085d70ca0dade4683d0f59d5a5b7d3298011b4de", "0x0f834c3601088d1b060c47737a2f5ce4ffa5ac1d", @@ -40,8 +56,36 @@ const config = { "0x8eb1b3ac29e0dcbd7f519c86f1eb76a3aea41b76", "0xc1f147db2b6a9c9fbf322fac3d1fbf8b8aaeec10" ] }, - avax: { dpools: 'https://api.thegraph.com/subgraphs/name/88mphapp/88mph-avalanche' }, - fantom: { dpools: 'https://api.thegraph.com/subgraphs/name/88mphapp/88mph-fantom', vPools: [ + avax: { dpools: [ + "0x2252185532317932b1883b3429407296a2c69244", + "0x336c38657837aa2b5fd21d41ea651b6d792291d9", + "0x4f28fc2be45682d1be1d0f155f4a52d4509db629", + "0x58e65f624c5ecf595824c96b3853ea8da2f9adf1", + "0x747cdec7d885ca961baec11481cda651bf4d1004", + "0xa78276c04d8d807feb8271fe123c1f94c08a414d", + "0xbcd1571761c2f3d8e0ae93651753aa968e357425", + "0xc7cbb403d1722ee3e4ae61f452dc36d71e8800de", + "0xd1fea1b2dc4e0be1f5f16bacf1dfeb7fc3434b5f", + "0xd9f46096801799f59f34c95e0b4df0f6a76bfcf3", + "0xeb706249f3b4640839e64211336b2063a3cdfbb9", + "0xf0ca068be757e61cdfa6314bf59f5243767f1bfd" + ] }, + fantom: { dpools: [ + "0x23fe5a2ba80ea2251843086ec000911cfc79c864", + "0x2744b79c985ae0c6b81f1da8eed1a4c67eb4b732", + "0x3cab1cb5a9b68350b39ddf7ce23518d609a8bc78", + "0x7e4697f650934ea6743b8b0619fc2454db02405a", + "0xa1857578cec558eaed9120739b0c533549bdcb61", + "0xa78276c04d8d807feb8271fe123c1f94c08a414d", + "0xbdf43e9c6cf68359deff9292098622643ede5ec3", + "0xc0710b3564fd4768f912150d39d519b66f2952d4", + "0xc7cbb403d1722ee3e4ae61f452dc36d71e8800de", + "0xc80cc61910c6f8f47aadc69e40ab8d1b2fa2c4df", + "0xc91c2255525e80630eee710e7c0637bce7d98978", + "0xcb29ce2526ff5f80ad1536c6a1b13238d615b4b9", + "0xd62f71937fca1c7c05da08cec4c451f12fc64964", + "0xf7fb7f095c8d0f4ee8ffbd142fe0b311491b45f3" + ], vPools: [ "0x3cab1cb5a9b68350b39ddf7ce23518d609a8bc78", "0xa1857578cec558eaed9120739b0c533549bdcb61", "0xa78276c04d8d807feb8271fe123c1f94c08a414d", @@ -57,26 +101,24 @@ const config = { "0x2744b79c985ae0c6b81f1da8eed1a4c67eb4b732", "0xc91c2255525e80630eee710e7c0637bce7d98978" ] }, - polygon: { dpools: 'https://api.thegraph.com/subgraphs/name/88mphapp/88mph-polygon' }, + polygon: { dpools: [ + "0x0e99145166e2982bb67054a1e5d3a902fc4d2b59", + "0x3933baac41f04d0ffa0977b0e879bc56482ad667", + "0x3b79eb9675ed29554f57b719dc66a461a4c84970", + "0x4f28fc2be45682d1be1d0f155f4a52d4509db629", + "0xa78276c04d8d807feb8271fe123c1f94c08a414d", + "0xf5ef24a27f35cbe8a2b0a954acf81d7064ce6b70" + ] }, } -const dPoolQuery = `{ - dpools { - id - address - } -}` - const tvlExports = {}; Object.keys(config).forEach(chain => { - const { dpools, vPools = [], } = config[chain] + let { dpools: pools, vPools = [], } = config[chain] tvlExports[chain] = { tvl: async (api) => { const balances = {} - const logs = await graphQuery(dpools, dPoolQuery) - let pools = logs.dpools.map(i => i.address) pools.push(...vPools) pools = getUniqueAddresses(pools) const tokens = await api.multiCall({ abi: 'address:stablecoin', calls: pools }) diff --git a/projects/aelin/index.js b/projects/aelin/index.js index ce32d40dc98d..9470314fdf65 100644 --- a/projects/aelin/index.js +++ b/projects/aelin/index.js @@ -10,7 +10,6 @@ const aelin_data = { { target: '0x2c0979b0de5f99c2bde1e698aeca13b55695951e', fromBlock: 13996006 }, { target: '0x5541da82549d732878c4104c9887c408790397af', fromBlock: 13846412 }, ], - 'graphUrl': 'https://api.thegraph.com/subgraphs/name/aelin-xyz/aelin', 'AELIN_ETH_LP': '0x974d51fafc9013e42cbbb9465ea03fe097824bcc', 'AELIN_ETH_staking': '0x944cb90082fc1416d4b551a21cfe6d7cc5447c80', 'AELIN': '0xa9c125bf4c8bb26f299c00969532b66732b1f758' @@ -21,7 +20,6 @@ const aelin_data = { { target: '0x87525307974a312AF13a78041F88B0BAe23ebb10', fromBlock: 1487918 }, { target: '0x914ffc8dc0678911aae77f51b8489d6e214da20f', fromBlock: 1971285 }, ], - 'graphUrl': 'https://api.thegraph.com/subgraphs/name/aelin-xyz/optimism', 'AELIN': '0x61BAADcF22d2565B0F471b291C475db5555e0b76', 'AELIN_staking': '0xfe757a40f3eda520845b339c698b321663986a4d', 'AELIN_ETH_LP': '0x665d8D87ac09Bdbc1222B8B9E72Ddcb82f76B54A', diff --git a/projects/aktionariat/index.js b/projects/aktionariat/index.js index 38c548467a7b..206de03205a1 100644 --- a/projects/aktionariat/index.js +++ b/projects/aktionariat/index.js @@ -1,5 +1,4 @@ -const { request, gql } = require('graphql-request'); -const { sumTokens2 } = require('../helper/unwrapLPs') +const { cachedGraphQuery } = require('../helper/cache') const graphs = { ethereum: "https://api.thegraph.com/subgraphs/name/aktionariat/brokerbot", @@ -8,11 +7,8 @@ const graphs = { function tvlPaged(chain) { return async (api) => { - const block = await api.getBlock() const size = 1000 - let lastId = '' - let brokerbots - let graphQueryPaged = gql` + let graphQueryPaged = ` query brokerbotQuery($lastId: String, $block: Int) { brokerbots(block: { number: $block } first:${size} where: {id_gt: $lastId totalValueLockedUSD_gt: 100}) { id @@ -21,14 +17,9 @@ function tvlPaged(chain) { } } ` - - do { - const res = await request(graphs[chain], graphQueryPaged, { lastId, block: block - 5000 }); - brokerbots = res.brokerbots - const tokensAndOwners = brokerbots.map(i => ([[i.token.id, i.id], [i.base.id, i.id]])).flat() - await sumTokens2({ tokensAndOwners, api }) - lastId = brokerbots[brokerbots.length - 1]?.id - } while (brokerbots.length === size) + const data = await cachedGraphQuery('aktionariat-brokerbot/' + chain, graphs[chain], graphQueryPaged, { useBlock: true, api, fetchById: true, }) + const ownerTokens = data.map(i => [[i.token.id, i.base.id], i.id]) + return api.sumTokens({ ownerTokens }) } } diff --git a/projects/atlendis/index.js b/projects/atlendis/index.js index 218c42d3fd57..974018c13e64 100644 --- a/projects/atlendis/index.js +++ b/projects/atlendis/index.js @@ -1,81 +1,12 @@ -const { GraphQLClient, gql } = require('graphql-request') -const { getBlock } = require('../helper/http') -const sdk = require('@defillama/sdk') - - -async function fetchData(block, balances, transform, borrowed = false) { - const baseUrl = 'https://api.thegraph.com/subgraphs/name/atlendis'; - const urlPolygon = `${baseUrl}/atlendis-hosted-service-polygon`; - const graphQLClient = new GraphQLClient(urlPolygon) - - const query = gql` - query get_tvl($block: Int) { - poolStatuses (block: { number: $block }) { - state - pool { - id - identifier - parameters { - underlyingToken - } - } - normalizedAvailableAmount - normalizedBorrowedAmount - adjustedPendingAmount - } - } - `; - - // pull data - const data = await graphQLClient.request(query, { - block: block - 50 - }); - - // calculate TVL - const agEUR = 'polygon:0xe0b52e49357fd4daf2c15e02058dce6bc0057db4'.toLowerCase() - if (!borrowed) { - for (let i = 0; i < data.poolStatuses.length; i++) { - let amount = parseInt(data.poolStatuses[i].normalizedAvailableAmount) - let assetAddress = data.poolStatuses[i].pool.parameters.underlyingToken; - - assetAddress = transform(assetAddress); - if (assetAddress === agEUR) amount *= 1e12 - sdk.util.sumSingleBalance(balances, assetAddress, amount / 1e12) - } - } else { - for (let i = 0; i < data.poolStatuses.length; i++) { - let amount = parseInt(data.poolStatuses[i].normalizedBorrowedAmount) - + parseInt(data.poolStatuses[i].adjustedPendingAmount); - let assetAddress = data.poolStatuses[i].pool.parameters.underlyingToken; - - assetAddress = transform(assetAddress); - if (assetAddress === agEUR) amount *= 1e12 - sdk.util.sumSingleBalance(balances, assetAddress, amount / 1e12) - } - } -} - - -async function tvl(timestamp, _, chainBlocks) { - const balances = {}; - const block = await getBlock(timestamp, 'polygon', chainBlocks) - const transform = i => `polygon:${i}`; - await fetchData(block, balances, transform); - return balances; -} - -async function borrowed(timestamp, _, chainBlocks) { - const balances = {}; - const transform = i => `polygon:${i}`; - const block = await getBlock(timestamp, 'polygon', chainBlocks) - await fetchData(block, balances, transform, true); - return balances; -} - +const { sumTokensExport } = require('../helper/unwrapLPs'); module.exports = { - polygon: { - tvl, - borrowed, + polygon: { + tvl: sumTokensExport({ owners: ['0xbc13e1B5DA083b10622Ff5B52c9cFa1912F10B1F', '0x2fA375961A0cB525dB0f00af4E081a806A8639Fd'], tokens: [ + '0x60D55F02A771d515e077c9C2403a1ef324885CeC', + '0x1a13f4ca1d028320a707d99520abfefca3998b7f', + '0xE0B52e49357Fd4DAf2c15e02058DCE6BC0057db4', + ], }), + borrowed: () => ({}), } }; \ No newline at end of file diff --git a/projects/dodo/index.js b/projects/dodo/index.js index 518429908e84..f2fd2fac38df 100644 --- a/projects/dodo/index.js +++ b/projects/dodo/index.js @@ -1,92 +1,6 @@ -const { request, } = require("graphql-request"); -const { getBlock } = require('../helper/http') -const sdk = require('@defillama/sdk') const { getLogs } = require('../helper/cache/getLogs') const ADDRESSES = require('../helper/coreAssets.json') -const graphEndpoints = { - // ethereum: "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2", - // "bsc": "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2-bsc", - // //"heco": "https://q.hg.network/subgraphs/name/dodoex/heco", - // "polygon": "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2-polygon", - // "arbitrum": "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2-arbitrum", - // "aurora": "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2-aurora", - // "avax": "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2-avax", - // "optimism": "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2-optimism", - // "base": "https://api.studio.thegraph.com/query/2860/dodoex_v2_base/v0.0.5", - // "linea": "https://api.dodoex.io/graphql?chainId=59144&schemaName=dodoex&apikey=graphqldefiLlamadodoYzj5giof", - // "scroll": "https://api.dodoex.io/graphql?chain=src&schemaName=dodoex&apikey=graphqldefiLlamadodoYzj5giof", // ChainId mapping error, so using chain - // "manta": "https://api.dodoex.io/graphql?chainId=169&schemaName=dodoex&apikey=graphqldefiLlamadodoYzj5giof", - // "mantle": "https://api.dodoex.io/graphql?chainId=5000&schemaName=dodoex&apikey=graphqldefiLlamadodoYzj5giof" -} -const graphQuery = `query get_pairs($lastId: ID, $block: Int!) { - pairs( - first: 1000 - block: {number: $block} - where: {and: [{id_gt: $lastId}, {or: [{baseReserve_gt: 0}, {quoteReserve_gt: 0}]}]} - ) { - id - baseReserve - quoteReserve - baseToken { - id - symbol - usdPrice - decimals - } - quoteToken { - id - symbol - usdPrice - decimals - } - } -}` - -Object.keys(graphEndpoints).forEach(chain => { - module.exports[chain] = { - tvl: async (ts, _, chainBlocks) => { - - const block = await getBlock(ts, chain, chainBlocks) - let allPairs = [] - let lastId = "" - let response; - do { - response = await request( - graphEndpoints[chain], - graphQuery, - { lastId, block: block - 500, } - ); - allPairs = allPairs.concat(response.pairs) - lastId = response.pairs[response.pairs.length - 1].id - } while (response.pairs.length >= 1000); - - const balances = {} - const blacklist = [ - '0xd79d32a4722129a4d9b90d52d44bf5e91bed430c', - '0xdb1e780db819333ea79c9744cc66c89fbf326ce8', // this token is destroyed - '0xa88c5693c9c2549a75acd2b44f052f6a5568e918', // this token is destroyed - '0x738076a6cb6c30d906bcb2e9ba0e0d9a58b3292e', // SRSB is absuredly priced - '0x95e7c70b58790a1cbd377bc403cd7e9be7e0afb1', // YSL is absuredly priced - '0x2b1e9ded77ff8ecd81f71ffc5751622e6f1291c3', // error querying balance - '0x272c2CF847A49215A3A1D4bFf8760E503A06f880', // abnb LP mispriced - '0xd4ca5c2aff1eefb0bea9e9eab16f88db2990c183', // XRPC - ].map(i => i.toLowerCase()) - - allPairs.forEach(pair => { - if (pair.id.includes('-')) - return null - if (!blacklist.includes(pair.baseToken.id.toLowerCase()) && +pair.baseReserve > 1 && +pair.baseToken.usdPrice > 0) - sdk.util.sumSingleBalance(balances, chain + ':' + pair.baseToken.id, pair.baseReserve * (10 ** pair.baseToken.decimals)) - if (!blacklist.includes(pair.quoteToken.id.toLowerCase()) && +pair.quoteReserve > 1 && +pair.quoteToken.usdPrice > 0) - sdk.util.sumSingleBalance(balances, chain + ':' + pair.quoteToken.id, pair.quoteReserve * (10 ** pair.quoteToken.decimals)) - }) - - return balances - } - } -}) - const config = { ethereum: { dvmFactory: '0x72d220cE168C4f361dD4deE5D826a01AD8598f6C', dodoBirthFactory: '0x3a97247df274a17c59a3bd12735ea3fcdfb49950', fromBlock: 10613640, dspFactory: '0x6fddb76c93299d985f4d3fc7ac468f9a168577a4', dppFactory: ['0x5336ede8f971339f6c0e304c66ba16f1296a2fbe', '0xb5dc5e183c2acf02ab879a8569ab4edaf147d537', '0x6b4fa0bc61eddc928e0df9c7f01e407bfcd3e5ef'] }, arbitrum: { dvmFactory: '0xDa4c4411c55B0785e501332354A036c04833B72b', fromBlock: 226578, dspFactory: '0xC8fE2440744dcd733246a4dB14093664DEFD5A53', dodoBirthFactory: '0xbcc3401e16c25eaf4d3fed632ce3288503883b1f', dppFactory: ['0xDdB13e6dd168E1a68DC2285Cb212078ae10394A9', '0xa6cf3d163358af376ec5e8b7cc5e102a05fde63d'] }, diff --git a/projects/helper/cache.js b/projects/helper/cache.js index 2af57d6be668..356371460456 100644 --- a/projects/helper/cache.js +++ b/projects/helper/cache.js @@ -106,6 +106,7 @@ async function configPost(project, endpoint, data) { async function cachedGraphQuery(project, endpoint, query, { api, useBlock = false, variables = {}, fetchById, safeBlockLimit, } = {}) { if (!project || !endpoint) throw new Error('Missing parameters') + endpoint = sdk.graph.modifyEndpoint(endpoint) const key = 'config-cache' const cacheKey = getKey(key, project) if (!configCache[cacheKey]) configCache[cacheKey] = _cachedGraphQuery() @@ -137,6 +138,7 @@ async function cachedGraphQuery(project, endpoint, query, { api, useBlock = fals async function graphFetchById({ endpoint, query, params = {}, api, options: { useBlock = false, safeBlockLimit = 500 } = {} }) { if (useBlock && !params.block) params.block = await api.getBlock() - safeBlockLimit + endpoint = sdk.graph.modifyEndpoint(endpoint) let data = [] let lastId = "" diff --git a/projects/helper/getUniSubgraphTvl.js b/projects/helper/getUniSubgraphTvl.js index 2958f965233f..d48eefa6f8d7 100644 --- a/projects/helper/getUniSubgraphTvl.js +++ b/projects/helper/getUniSubgraphTvl.js @@ -1,6 +1,7 @@ const { request, gql } = require("graphql-request"); const { toUSDTBalances } = require('../helper/balances'); const { blockQuery, getBlock, } = require('./http') +const sdk = require('@defillama/sdk') function getChainTvl(graphUrls, factoriesName = "uniswapFactories", tvlName = "totalLiquidityUSD", blockCatchupLimit = 500) { const graphQuery = gql` @@ -17,11 +18,12 @@ query get_tvl($block: Int) { await api.getBlock() const block = api.block let uniswapFactories + const endpoint = sdk.graph.modifyEndpoint(graphUrls[chain]) if (!blockCatchupLimit) { - uniswapFactories = (await request(graphUrls[chain], graphQuery, { block, }))[factoriesName]; + uniswapFactories = (await request(endpoint, graphQuery, { block, }))[factoriesName]; } else { - uniswapFactories = (await blockQuery(graphUrls[chain], graphQuery, { api, blockCatchupLimit, }))[factoriesName]; + uniswapFactories = (await blockQuery(endpoint, graphQuery, { api, blockCatchupLimit, }))[factoriesName]; } const usdTvl = Number(uniswapFactories[0][tvlName]) diff --git a/projects/helper/http.js b/projects/helper/http.js index a33215ba15bf..327b3436e7ad 100644 --- a/projects/helper/http.js +++ b/projects/helper/http.js @@ -49,6 +49,8 @@ async function post(endpoint, body, options) { } async function graphQuery(endpoint, graphQuery, params = {}, { api, timestamp, chain, chainBlocks, useBlock = false } = {}) { + + endpoint = sdk.graph.modifyEndpoint(endpoint) if (typeof timestamp === "object" && timestamp.timestamp) timestamp = timestamp.timestamp if (api) { if (!timestamp) timestamp = api.timestamp @@ -63,6 +65,7 @@ async function graphQuery(endpoint, graphQuery, params = {}, { api, timestamp, c } async function blockQuery(endpoint, query, { api, blockCatchupLimit = 500, }) { + endpoint = sdk.graph.modifyEndpoint(endpoint) const graphQLClient = new GraphQLClient(endpoint) await api.getBlock() const block = api.block diff --git a/projects/unifarm/helper.js b/projects/unifarm/helper.js index d73021b1fb83..c15e19c096c3 100644 --- a/projects/unifarm/helper.js +++ b/projects/unifarm/helper.js @@ -1,3 +1,4 @@ +const { cachedGraphQuery } = require('../helper/cache') const { graphQuery, } = require('../helper/http') const { sleep, log } = require('../helper/utils') const v1Data = require('./v1Data.json') @@ -95,7 +96,7 @@ const getV1Calls = async (chain) => { }; const getV2Calls = async (chain) => { - const { cohorts } = await graphQuery(v2EndPoints[chain], v2Query) + const { cohorts } = await cachedGraphQuery('unifarm/'+chain, v2EndPoints[chain], v2Query) let calls = []; for (let i = 0; i < cohorts.length; i++) { const owner = cohorts[i].id diff --git a/projects/uniswap-v1/index.js b/projects/uniswap-v1/index.js index 4cf141221856..305756f2744e 100644 --- a/projects/uniswap-v1/index.js +++ b/projects/uniswap-v1/index.js @@ -1,7 +1,7 @@ const { getChainTvl } = require('../helper/getUniSubgraphTvl'); const v1graph = getChainTvl({ - ethereum: 'https://api.thegraph.com/subgraphs/name/ianlapham/uniswap' + ethereum: 'ESnjgAG9NjfmHypk4Huu4PVvz55fUwpyrRqHF21thoLJ' }, "uniswaps", "totalLiquidityUSD") module.exports = { diff --git a/projects/uniswap-v2/index.js b/projects/uniswap-v2/index.js index f6c9eca28977..631ec062bdf3 100644 --- a/projects/uniswap-v2/index.js +++ b/projects/uniswap-v2/index.js @@ -2,7 +2,7 @@ const { getChainTvl } = require('../helper/getUniSubgraphTvl'); const { getUniTVL } = require('../helper/unknownTokens'); const v2graph = getChainTvl({ - ethereum: 'https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-v2-dev' + ethereum: 'A3Np3RQbaBA6oKJgiwDJeo5T3zrYfGHPWFYayMwtNDum' }) module.exports = { diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index 96e2f7707097..c8d11e93080f 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -3,14 +3,14 @@ const { cachedGraphQuery, configPost } = require('../helper/cache') const { sumTokens2 } = require('../helper/unwrapLPs') const graphs = { - ethereum: "https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3", - optimism: "https://api.thegraph.com/subgraphs/name/ianlapham/optimism-post-regenesis", - arbitrum: 'https://api.thegraph.com/subgraphs/name/ianlapham/arbitrum-dev', - polygon: "https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-v3-polygon", - celo: "https://api.thegraph.com/subgraphs/name/jesse-sawa/uniswap-celo", - bsc: "https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-v3-bsc", - avax: "https://api.thegraph.com/subgraphs/name/lynnshaoyu/uniswap-v3-avax", - base: "https://api.studio.thegraph.com/query/48211/uniswap-v3-base/version/latest", + ethereum: "5AXe97hGLfjgFAc6Xvg6uDpsD5hqpxrxcma9MoxG7j7h", + optimism: "Cghf4LfVqPiFw6fp6Y5X5Ubc8UpmUhSfJL82zwiBFLaj", + arbitrum: 'FbCGRftH4a3yZugY7TnbYgPJVEv2LvMT6oF1fxPe9aJM', + polygon: "3hCPRGf4z88VC5rsBKU5AA9FBBq5nF3jbKJG7VZCbhjm", + celo: "ESdrTJ3twMwWVoQ1hUE2u7PugEHX3QkenudD6aXCkDQ4", + bsc: "F85MNzUGYqgSHSHRGgeVMNsdnW1KtZSVgFULumXRZTw2", + // avax: "3Pwd3cqFKbqKAyaJfGUVmJJ7oYbFQLDa19iB27iMxebD", + base: "43Hwfi3dJSoGpyas9VwNoDAv55yjgGrPpNSmbQZArzMG", } const blacklists = { @@ -82,14 +82,15 @@ module.exports = { scroll: { factory: "0x70C62C8b8e801124A4Aa81ce07b637A3e83cb919", fromBlock: 1367, }, blast: { factory: "0x792edade80af5fc680d96a2ed80a44247d2cf6fd", fromBlock: 400903, }, linea: { factory: "0x31FAfd4889FA1269F7a13A66eE0fB458f27D72A9", fromBlock: 25247, }, - manta: {factory: "0x06D830e15081f65923674268121FF57Cc54e4e23", fromBlock: 1191705}, - taiko: {factory: "0x75FC67473A91335B5b8F8821277262a13B38c9b3", fromBlock: 961} + manta: { factory: "0x06D830e15081f65923674268121FF57Cc54e4e23", fromBlock: 1191705 }, + avax: { factory: "0x740b1c1de25031C31FF4fC9A62f554A55cdC1baD", fromBlock: 27832972 }, + taiko: { factory: "0x75FC67473A91335B5b8F8821277262a13B38c9b3", fromBlock: 961 } }), filecoin: { tvl: filecoinTvl }, } -const chains = ['ethereum', 'arbitrum', 'optimism', 'polygon', 'bsc', 'avax', 'base'] +const chains = ['ethereum', 'arbitrum', 'optimism', 'polygon', 'bsc', 'base'] chains.forEach(chain => { module.exports[chain] = { diff --git a/projects/yieldyak/index.js b/projects/yieldyak/index.js index 5d77fe99e154..be43bc712806 100644 --- a/projects/yieldyak/index.js +++ b/projects/yieldyak/index.js @@ -1,7 +1,8 @@ const { staking } = require('../helper/staking'); const { cachedGraphQuery, getConfig } = require('../helper/cache') +const sdk = require('@defillama/sdk') -const graphUrl = 'https://api.thegraph.com/subgraphs/name/yieldyak/reinvest-tracker' +const graphUrl = sdk.graph.modifyEndpoint('7oSYYdK5RKmqggdzFyfUnojP6puDAj31C4ezDGrgVfk9') const graphQuery = `{ farms(first: 1000) { id }}`; async function tvl(api) { diff --git a/test.js b/test.js index c77936d29d57..b25607f07500 100644 --- a/test.js +++ b/test.js @@ -27,7 +27,7 @@ const currentCacheVersion = sdk.cache.currentVersion // load env for cache if (process.env.LLAMA_SANITIZE) Object.keys(process.env).forEach((key) => { if (key.endsWith('_RPC')) return; - if (['TVL_LOCAL_CACHE_ROOT_FOLDER', 'LLAMA_DEBUG_MODE', ...ENV_KEYS].includes(key) || key.includes('SDK')) return; + if (['TVL_LOCAL_CACHE_ROOT_FOLDER', 'LLAMA_DEBUG_MODE', 'GRAPH_API_KEY', ...ENV_KEYS].includes(key) || key.includes('SDK')) return; delete process.env[key] }) process.env.SKIP_RPC_CHECK = 'true' diff --git a/volume.md b/volume.md deleted file mode 100644 index 03e6490bc405..000000000000 --- a/volume.md +++ /dev/null @@ -1,34 +0,0 @@ -#### 1inch -https://api.thegraph.com/subgraphs/name/1inch-exchange/oneinch-liquidity-protocol-v2 - -#### Balancer -https://api.thegraph.com/subgraphs/name/balancer-labs/balancer - -#### Bancor -https://thegraph.com/explorer/subgraph/blocklytics/bancor - -#### Carthage -https://thegraph.cndlchain.com/subgraphs/name/ianlapham/uniswap-v3-test - -#### Curve -https://www.curve.fi/raw-stats/ren-1440m.json //where ren is the pool name - -#### Dodo -https://thegraph.com/explorer/subgraph/dodoex/dodoex-v2 - -#### Dydx -https://docs.dydx.exchange/#get-markets - -#### Pancake Swap -https://api.pancakeswap.finance/api/v1/stat - -#### Champagne Swap -https://api.thegraph.com/subgraphs/name/champagneswap/exchangev3 - - -#### Perp -https://thegraph.com/explorer/subgraph/perpetual-protocol/perp-position-subgraph -https://perp.gq/pairs - -#### Uniswap -https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2 From 3f1e0d3c9368901e86be6ee1fec41c1ff0dec356 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 12 Jun 2024 23:09:36 +0200 Subject: [PATCH 312/855] graph migration: part 2 --- projects/behodler/index.js | 29 ---- projects/bishares/config.js | 3 - projects/bunicorn/index.js | 84 ++--------- projects/chickenswap/index.js | 3 - projects/enso-finance/index.js | 47 +----- projects/gardensdao/index.js | 119 ++------------- projects/kleros/index.js | 12 +- projects/kyber/index.js | 16 +- projects/mcdex/index.js | 62 +++----- projects/olympus/index.js | 6 +- projects/origami/index.js | 1 + projects/platypus-finance/index.js | 1 + projects/quickswap/index.js | 2 +- projects/sablier-v2/index.js | 10 +- projects/soulswap/abis/factory.json | 4 - projects/soulswap/helper/getUsdSoulTvl.js | 171 ---------------------- projects/soulswap/index.js | 24 ++- 17 files changed, 93 insertions(+), 501 deletions(-) delete mode 100644 projects/soulswap/abis/factory.json delete mode 100644 projects/soulswap/helper/getUsdSoulTvl.js diff --git a/projects/behodler/index.js b/projects/behodler/index.js index 5965599a20f8..42234bdf24fa 100644 --- a/projects/behodler/index.js +++ b/projects/behodler/index.js @@ -1,36 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { request, gql } = require("graphql-request"); -const { toUSDTBalances } = require('../helper/balances'); const { sumTokensExport } = require("../helper/unwrapLPs"); -const graphUrl = 'https://api.thegraph.com/subgraphs/name/arrenv/behodler' -const graphQuery = gql` -query get_tvl($block: Int) { - behodlers( - block: { number: $block } - ) { - id - usdVolume - usdLiquidity - } -} -`; - -async function tvl(timestamp, block) { - const {behodlers} = await request( - graphUrl, - graphQuery, - { - block, - } - ); - const usdTvl = Number(behodlers[0].usdLiquidity) - - return toUSDTBalances(usdTvl) -} - module.exports = { - methodology: `ERC20 tokens deposited as liquidity on the AMM. You can see this on https://analytics.behodler.io/#/, pulling the data from the 'arrenv/behodler' subgraph`, ethereum:{ tvl: sumTokensExport({ owner: '0x1B8568FbB47708E9E9D31Ff303254f748805bF21', diff --git a/projects/bishares/config.js b/projects/bishares/config.js index ea8301d2b218..d62ab01cddbe 100644 --- a/projects/bishares/config.js +++ b/projects/bishares/config.js @@ -1,8 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') // data taken from -// https://api.thegraph.com/subgraphs/name/toffick/bisharesfunds -// https://api.thegraph.com/subgraphs/name/bisharesindexfund/bisharesfunds-ybf-fantom -// https://api.thegraph.com/subgraphs/name/toffick/bisharesfunds-fantom module.exports = { toa: { diff --git a/projects/bunicorn/index.js b/projects/bunicorn/index.js index 538e54a77b60..1460356ccd6a 100644 --- a/projects/bunicorn/index.js +++ b/projects/bunicorn/index.js @@ -1,79 +1,23 @@ -const BigNumber = require("bignumber.js"); -const { toUSDTBalances } = require("../helper/balances"); const sdk = require("@defillama/sdk"); -const { request, gql } = require("graphql-request"); -const tokenSubgraphUrl = - "https://api.thegraph.com/subgraphs/name/bunicorndefi/buni-token"; -const stableSubgraphUrl = - "https://api.thegraph.com/subgraphs/name/bunicorndefi/buni-stablecoins"; +const { v1Tvl } = require("../helper/balancer"); +const { uniTvlExport } = require('../helper/unknownTokens') const BUNI_CONTRACT_ADDRESS = "0x0e7beec376099429b85639eb3abe7cf22694ed49"; -const MASTERCHEF_CONTRACT_ADDRESS = - "0xA12c974fE40ea825E66615bA0Dc4Fd19be4D7d24"; +const MASTERCHEF_CONTRACT_ADDRESS = "0xA12c974fE40ea825E66615bA0Dc4Fd19be4D7d24"; -const graphTotalTokenTVLQuery = gql` -{\n bunis(where: {id: \"1\"}) {\n totalLiquidity\n }\n} -`; -const graphTotalStableTVLQuery = gql` -{\n buniCornFactories( where: {id: \"0x86873f85bc12ce40321340392c0ff39c3bdb8d68\"}) {\n id\n totalLiquidityUSD\n }\n\n} -`; - -async function getTotalFarmTVL(timestamp, ethBlock, chainBlocks) { - try { - const balances = {}; - const stakedBuni = sdk.api.erc20.balanceOf({ - target: BUNI_CONTRACT_ADDRESS, - owner: MASTERCHEF_CONTRACT_ADDRESS, - chain: "bsc", - block: chainBlocks.bsc, - }); - sdk.util.sumSingleBalance( - balances, - "bsc:" + BUNI_CONTRACT_ADDRESS, - (await stakedBuni).output - ); - return balances; - } catch (e) { - throw new Error("getTotalFarmTVL has exception:" + e.message); - } -} -async function getTotalTokenTVL(timestamp, ethBlock, chainBlocks) { - try { - const { bunis } = await request(tokenSubgraphUrl, graphTotalTokenTVLQuery, { - block: chainBlocks.bsc, - }); - return (bunis[0] && bunis[0].totalLiquidity) || 0; - } catch (e) { - throw new Error("getTotalTokenTVL has exception:" + e.message); - } -} -async function getTotalStableTVL(timestamp, ethBlock, chainBlocks) { - try { - const { buniCornFactories } = await request( - stableSubgraphUrl, - graphTotalStableTVLQuery, - { - block: chainBlocks.bsc, - } - ); - return ( - (buniCornFactories[0] && buniCornFactories[0].totalLiquidityUSD) || 0 - ); - } catch (e) { - throw new Error("getTotalStableTVL has exception:" + e.message); - } -} -async function getTotalTVL(timestamp, ethBlock, chainBlocks) { - const [tokensSummary, stableSummary] = await Promise.all([ - getTotalTokenTVL(timestamp, ethBlock, chainBlocks), - getTotalStableTVL(timestamp, ethBlock, chainBlocks), - ]); - return toUSDTBalances(new BigNumber(tokensSummary).plus(stableSummary)); +async function staking(api) { + return api.sumTokens({ owner: MASTERCHEF_CONTRACT_ADDRESS, tokens: [BUNI_CONTRACT_ADDRESS] }); } module.exports = { - misrepresentedTokens: true, bsc: { - tvl: getTotalTVL, - staking: getTotalFarmTVL, + tvl: v1Tvl('0x48ab312150E1802D57639859d7C3107aE751FE35', 8973039), + tvl: sdk.util.sumChainTvls([v1Tvl('0x48ab312150E1802D57639859d7C3107aE751FE35', 8973039), uniTvlExport('bsc', '0x86873f85bc12ce40321340392c0ff39c3bdb8d68', { + abis: { + allPairsLength: 'uint256:allPoolsLength', + allPairs: 'function allPools(uint256) view returns (address)', + }, + fetchBalances: true, + }).bsc.tvl]), + staking, }, }; diff --git a/projects/chickenswap/index.js b/projects/chickenswap/index.js index a26158a4c6d0..4e70c5946575 100644 --- a/projects/chickenswap/index.js +++ b/projects/chickenswap/index.js @@ -67,7 +67,4 @@ module.exports = { pool2: pool2(chickenChefContract, WETH_KFC_UNIV2), tvl: sdk.util.sumChainTvls([dexTVL, ethTvl,]), }, - methodology: - `We count liquidity on the Vaults (only single tokens) through ChickenChef Contract and the liquuidity on the AMM Pools (only pairs) - pulling data from the subgraph at https://api.thegraph.com/subgraphs/name/chickenswap/graph`, }; \ No newline at end of file diff --git a/projects/enso-finance/index.js b/projects/enso-finance/index.js index 7cacc6837212..10f6ea4e268a 100644 --- a/projects/enso-finance/index.js +++ b/projects/enso-finance/index.js @@ -1,48 +1,17 @@ -const sdk = require('@defillama/sdk'); -const { request, gql } = require('graphql-request'); +const { sumTokensExport } = require('../helper/unwrapLPs'); // Enso finance TVL lies for now in the index tokens held by the liquidityMigration contracts const liquidityMigrationV2_contract = '0x0c6D898ac945E493D25751Ea43BE2c8Beb881D8C'; -const graphUrl = 'https://api.thegraph.com/subgraphs/name/ensofinance/enso-liquidity-migration' -const graphQuery = gql` -query GET_WHITELISTED_TOKENS($block: Int) { - tokens ( - first: 1000 - skip: 0 - block: { number: $block } - ) { - id - name - stakedAmount - } -}` - -async function tvl(timestamp, block) { - const { tokens } = await request( - graphUrl, - graphQuery, - {block} - ); - const tokens_contracts = tokens.map(t => t.id) - - const tokenBalances = await sdk.api.abi.multiCall({ - calls: tokens_contracts.map((t) => ({ - target: t, - params: [liquidityMigrationV2_contract], - })), - abi: 'erc20:balanceOf', - block, - chain: 'ethereum', - }) - - const balances = {}; - sdk.util.sumMultiBalanceOf(balances, tokenBalances); - return balances; -} module.exports = { ethereum: { - tvl, + tvl: sumTokensExport({ owner: liquidityMigrationV2_contract, fetchCoValentTokens: true, tokens: [ + '0x0327112423f3a68efdf1fcf402f6c5cb9f7c33fd', + '0x126c121f99e1e211df2e5f8de2d96fa36647c855', + '0x7b18913d945242a9c313573e6c99064cd940c6af', + '0xad6a626ae2b43dcb1b39430ce496d2fa0365ba9c', + '0xe5feeac09d36b18b3fa757e5cf3f8da6b8e27f4c', + ] }), }, methodology: `Get the list of whitelisted index tokens from accepted adapters - TokenSet IndexCoop Indexed PowerPool and PieDAO - and query the amounts held by the vampire LiquidityMigrationV2 contract`, diff --git a/projects/gardensdao/index.js b/projects/gardensdao/index.js index 2c27b67ad878..d9261a3f9051 100644 --- a/projects/gardensdao/index.js +++ b/projects/gardensdao/index.js @@ -1,18 +1,9 @@ -const { request, gql } = require("graphql-request"); -const sdk = require('@defillama/sdk') +const SUBGRAPH_GARDENS_XDAI = "G4EbcSW588SUy8CdprPPxCN69VN8mxvnwt4oyR6YpGza"; +const { cachedGraphQuery } = require('../helper/cache') -const SUBGRAPH_HONEYSWAP_V2 = - "https://api.thegraph.com/subgraphs/name/1hive/honeyswap-v2"; -const SUBGRAPH_GARDENS_XDAI = - "https://api.thegraph.com/subgraphs/name/1hive/gardens-xdai"; - - -const balanceAbi = 'function balance(address _token) view returns (uint256)' - - -const ALL_ORGS_GQL = gql` - query allOrgs($lastID: ID) { - organizations(first: 1000, where: { id_gt: $lastID, active: true }) { +const ALL_ORGS_GQL = ` + query allOrgs($lastId: ID) { + organizations(first: 1000, where: { id_gt: $lastId, active: true }) { id token { name @@ -31,100 +22,22 @@ const ALL_ORGS_GQL = gql` active } } -`; - -const ALL_TOKEN_PRICE_QUERY = gql` - query pricesTokens($tokenAddress: [ID]) { - tokens(where: { id_in: $tokenAddress }) { - id - derivedETH - tradeVolume - tradeVolumeUSD - untrackedVolumeUSD - totalLiquidity - } - } -`; - -async function getAllOrgs() { - let allFound = false; - let lastID = ""; - let data = []; - - while (!allFound) { - const orgs = await request( - SUBGRAPH_GARDENS_XDAI, - ALL_ORGS_GQL, - { lastID } - ); - - const numOrgs = orgs.organizations.length; - - if (numOrgs < 1000) { - allFound = true; - } - lastID = orgs.organizations[numOrgs - 1].id; - data = data.concat(orgs.organizations); - } - return data; -} - -const chain = 'xdai' - -async function tvl(timestamp, _block, { xdai: block }) { - const balances = {}; - - const orgs = await getAllOrgs() - const calls = orgs.map(org => { - return { params: org.config.conviction?.requestToken.id, target: org.config.conviction?.fundsManager, } - }).filter(i => i.params && i.target) - - const { output } = await sdk.api.abi.multiCall({ - abi: balanceAbi, - calls, chain, block, - permitFailure: true, - }) - - output.forEach(({ input, output }) => { - if (output) sdk.util.sumSingleBalance(balances, input.params[0].toLowerCase(), output) - }) - - const tokens = Object.keys(balances) - const calls2 = tokens.map(i => ({ target: i })) - - const { output: decimals } = await sdk.api.abi.multiCall({ - abi: 'erc20:decimals', - calls: calls2, - chain, block, +` + +async function tvl(api) { + const orgs = await cachedGraphQuery('gardensdao', SUBGRAPH_GARDENS_XDAI, ALL_ORGS_GQL, { fetchById: true}) + const toa = [] + orgs.forEach(({config: { conviction } = {}} = {}) => { + const token = conviction?.requestToken.id + const owner = conviction?.fundsManager + if (token && owner) + toa.push([token, owner]) }) + return api.sumTokens({ tokensAndOwners: toa }) - decimals.forEach(({ input: { target: token }, output: decimal }) => { - balances[token] /= 10 ** +decimal - }) - - const tokenPrices = await request( - SUBGRAPH_HONEYSWAP_V2, - ALL_TOKEN_PRICE_QUERY, - { tokenAddress: tokens } - ) - - let tvl = 0 - - tokenPrices.tokens.forEach(({ id, totalLiquidity, derivedETH }) => { - if (+totalLiquidity < 1e4 || !balances[id] || !derivedETH) // if liquidity is below 10k or token not found or price is missing, ignore and move on - return; - tvl += +balances[id] * +derivedETH - }) - - return { - tether: tvl - } } module.exports = { - methodology: - '"Uses Gardens and Honeyswap Subgraph to finds USD value of Common Pool treasuries for tokens with greater than $10k of liquidity on Honeyswap"', - misrepresentedTokens: true, xdai: { tvl, }, diff --git a/projects/kleros/index.js b/projects/kleros/index.js index 91d11f593574..85cf7f353eda 100644 --- a/projects/kleros/index.js +++ b/projects/kleros/index.js @@ -1,12 +1,12 @@ -const { request, gql } = require("graphql-request"); const { getBlock } = require('../helper/http') +const sdk = require('@defillama/sdk') const graphUrls = { - ethereum: 'https://api.thegraph.com/subgraphs/name/salgozino/klerosboard', - xdai: 'https://api.thegraph.com/subgraphs/name/salgozino/klerosboard-xdai', + ethereum: 'ECENsJRfqi6Mwj6kF9diShPzFKkgyyo79aSCkSwAShHL', + xdai: 'Ck26N16xgimEuuuNSJqYVWBKcWSwPmkk36BWZGtfx1ox', } -const totalStakedQuery = gql` +const totalStakedQuery = ` query($block: Int) { klerosCounters(block: { number: $block }) { tokenStaked @@ -21,10 +21,10 @@ function getStakedTvl(chain) { const graphUrl = graphUrls[chain] const block = await getBlock(timestamp, chain, chainBlocks) - const { klerosCounters } = await request( + const { klerosCounters } = await sdk.graph.request( graphUrl, totalStakedQuery, - { block: block - 500 } + { variables: { block: block - 500 }} ) balances.kleros = klerosCounters[0].tokenStaked / (10 ** 18); diff --git a/projects/kyber/index.js b/projects/kyber/index.js index 9374d46c2e5e..6b7254639eda 100644 --- a/projects/kyber/index.js +++ b/projects/kyber/index.js @@ -1,4 +1,4 @@ -const { graphQuery } = require("../helper/http"); +const { cachedGraphQuery } = require("../helper/cache"); const { sumTokens2 } = require('../helper/unwrapLPs') const chains = { @@ -47,8 +47,6 @@ async function fetchPools(chain) { case "scroll": url = 'https://scroll-graph.kyberengineering.io/subgraphs/name/kybernetwork/kyberswap-elastic-scroll'; break; default: url = `https://api.thegraph.com/subgraphs/name/kybernetwork/kyberswap-elastic-${chain}`; } - let length - let lastId = '' let toa = []; const poolQuery = ` query pools($lastId: String) { @@ -62,25 +60,21 @@ async function fetchPools(chain) { } } }`; - do { - const {pools} = await graphQuery(url, poolQuery, { lastId }) + const pools = await cachedGraphQuery('kyber/'+chain, url, poolQuery, { fetchById: true, }) pools.forEach(({ id, token0, token1}) => { toa.push([token0.id, id]) toa.push([token1.id, id]) }) - lastId = pools[pools.length - 1].id - } while (length === 1000) return toa; } function elastic(chain) { - return async (_, block, chainBlocks) => { + return async (api) => { if (!("graphId" in chains[chain])) return {}; - block = chainBlocks[chain]; const pools = await fetchPools(chains[chain].graphId); - return sumTokens2({ chain, block, tokensAndOwners: pools }) + return sumTokens2({ api, tokensAndOwners: pools }) } } @@ -96,3 +90,5 @@ Object.keys(chains).forEach(chain => { tvl: elastic(chain) }; }); + +module.exports.base.tvl = () => ({}) // setting base to 0 for now as I could not find the graph endpoint \ No newline at end of file diff --git a/projects/mcdex/index.js b/projects/mcdex/index.js index 7646a75a0c19..f801a5f6bf3f 100644 --- a/projects/mcdex/index.js +++ b/projects/mcdex/index.js @@ -1,47 +1,33 @@ -const {gql} = require('graphql-request') -const { blockQuery } = require('../helper/http') -const {toUSDTBalances} = require('../helper/balances'); +const { getLogs2 } = require('../helper/cache/getLogs') const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') async function ethereum(timestamp, block) { - return sumTokens2({ block, owner: '0x220a9f0DD581cbc58fcFb907De0454cBF3777f76', tokens: [nullAddress]}) + return sumTokens2({ block, owner: '0x220a9f0DD581cbc58fcFb907De0454cBF3777f76', tokens: [nullAddress] }) } -async function getTVL(subgraphName, api) { - const endpoint = `https://api.thegraph.com/subgraphs/name/mcdexio/${subgraphName}` - - const query = gql` - query getTvl ($block: Int) { - factories ( - block: { number: $block } - ){ - id - totalValueLockedUSD - } - } - `; - const results = await blockQuery(endpoint, query, { api, blockCatchupLimit: 600, }) - return results.factories[0].totalValueLockedUSD; -} - -async function arbitrum(api) { - return toUSDTBalances(await getTVL("mcdex3-arb-perpetual", api)) +module.exports = { + methodology: `Includes all locked liquidity in AMM pools, pulling the data from the mcdex subgraph`, + ethereum: { + tvl: ethereum + }, } -async function bsc(api) { - return toUSDTBalances(await getTVL("mcdex3-bsc-perpetual", api)) +const config = { + arbitrum: { factory: "0xA017B813652b93a0aF2887913EFCBB4ab250CE65", fromBlock: 219937, }, + bsc: { factory: "0xfb4cd1bf5c5919a29fb894c8ddc4a69a36f5ec87", fromBlock: 11137817, }, } -module.exports = { - misrepresentedTokens: true, - methodology: `Includes all locked liquidity in AMM pools, pulling the data from the mcdex subgraph`, - arbitrum: { - tvl: arbitrum - }, - bsc: { - tvl: bsc - }, - ethereum: { - tvl: ethereum - }, -} +Object.keys(config).forEach(chain => { + const { factory, fromBlock, } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const logs = await getLogs2({ + api, + factory, + eventAbi: 'event CreateLiquidityPool(bytes32 versionKey, address indexed liquidityPool, address indexed governor, address indexed operator, address shareToken, address collateral, uint256 collateralDecimals, bytes initData)', + fromBlock, + }) + return api.sumTokens({ tokensAndOwners: logs.map(log => [log.collateral, log.liquidityPool]) }) + } + } +}) diff --git a/projects/olympus/index.js b/projects/olympus/index.js index 44ffdbd06275..d7b4f374a626 100644 --- a/projects/olympus/index.js +++ b/projects/olympus/index.js @@ -90,13 +90,13 @@ function sumBalancesByTokenAddress(arr) { ***/ async function tvl(api, isOwnTokensMode = false) { const subgraphUrls = { - ethereum: `https://gateway-arbitrum.network.thegraph.com/api/${getEnv("OLYMPUS_GRAPH_API_KEY")}/subgraphs/id/7jeChfyUTWRyp2JxPGuuzxvGt3fDKMkC9rLjm7sfLcNp`, + ethereum: `7jeChfyUTWRyp2JxPGuuzxvGt3fDKMkC9rLjm7sfLcNp`, arbitrum: - "https://api.thegraph.com/subgraphs/name/olympusdao/protocol-metrics-arbitrum", + "2XQDRQ9AXhp5us6PsNyRM5BxKWeXhy3BNQLynA6YmmjA", fantom: "https://api.thegraph.com/subgraphs/name/olympusdao/protocol-metrics-fantom", polygon: - "https://api.thegraph.com/subgraphs/name/olympusdao/protocol-metrics-polygon", + "JCVMW1dbqectgaSLRuKSen6FKe9RPMJRQhNYZa4iTgFb", }; //filter out problematic pools that dont have a decimals function. diff --git a/projects/origami/index.js b/projects/origami/index.js index b666da8dc9e6..c92c4889f5b3 100644 --- a/projects/origami/index.js +++ b/projects/origami/index.js @@ -14,6 +14,7 @@ Object.keys(GRAPH_URLS).forEach(chain => { module.exports[chain] = { tvl: async (api) => { const { metrics: [{ investmentVaults }] } = await cachedGraphQuery('origami/' + chain, endpoint, '{ metrics { investmentVaults { id } } }') + console.log(investmentVaults) const vaults = investmentVaults.map(vault => vault.id) let tokens = await api.multiCall({ abi: 'address:reserveToken', calls: vaults }) if (chain === 'arbitrum') diff --git a/projects/platypus-finance/index.js b/projects/platypus-finance/index.js index 3b8368e1bdab..de5523078740 100644 --- a/projects/platypus-finance/index.js +++ b/projects/platypus-finance/index.js @@ -14,6 +14,7 @@ const query = `{ async function tvl(api) { if (api.timestamp > +new Date("2023-02-17") / 1e3) blacklistedTokens.push("0xdaCDe03d7Ab4D81fEDdc3a20fAA89aBAc9072CE2") // USP was hacked const { pools } = await cachedGraphQuery("platypus-finance", "https://api.thegraph.com/subgraphs/name/platypus-finance/platypus-dashboard", query) + console.log(pools) const tokensAndOwners = pools.map(i => i.assetsList.map(v => [v.token.id, v.id])).flat() return sumTokens2({ api, tokensAndOwners, blacklistedTokens }); } diff --git a/projects/quickswap/index.js b/projects/quickswap/index.js index a8d6014a8195..e3f0619628f7 100644 --- a/projects/quickswap/index.js +++ b/projects/quickswap/index.js @@ -17,6 +17,6 @@ module.exports = { [1619611200, "DeFi season on Polygon PoS begun"], [1623851400, "Iron Finance V1 collapse"], [1651668418, "QUICK split by 1:1000"], - [1652481840, "QuickSwap’s GoDaddy Domain Hijack"] + [1652481840, "QuickSwap GoDaddy Domain Hijack"] ] } diff --git a/projects/sablier-v2/index.js b/projects/sablier-v2/index.js index a48b04a09ec0..547f0c150418 100644 --- a/projects/sablier-v2/index.js +++ b/projects/sablier-v2/index.js @@ -22,22 +22,20 @@ async function getTokensConfig(api, isVesting) { } async function tvl(api) { - const { owners } = config[api.chain] return api.sumTokens(await getTokensConfig(api, false)) } async function vesting(api) { - const { owners } = config[api.chain] return api.sumTokens(await getTokensConfig(api, true)) } const config = { - ethereum: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2'], }, - arbitrum: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-arbitrum'], }, - bsc: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-bsc'], }, + ethereum: { endpoints: ['5EgaXheiBXZBCkepyGUYAu8pN31Dkbh7bpGtnLPqaT5m'], }, + arbitrum: { endpoints: ['AR77w8PwmkAG7c9DJSsfW6yTrC5UdvdQ1Hz5ZTCuaUWz'], }, + bsc: { endpoints: ['BVyi15zcH5eUg5PPKfRDDesezMezh6cAkn8LPvh7MVAF'], }, xdai: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-gnosis'], }, optimism: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-optimism'], }, - polygon: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-polygon'], }, + polygon: { endpoints: ['J8XJaFtxcz7xowzVJ5LwZhi35N5Lbtwfrt4sea6G1ysJ'], }, avax: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-avalanche'], }, base: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-base'], }, blast: { endpoints: ['https://api.studio.thegraph.com/query/57079/sablier-v2-blast/version/latest'], }, diff --git a/projects/soulswap/abis/factory.json b/projects/soulswap/abis/factory.json deleted file mode 100644 index 9a147cdfb8a6..000000000000 --- a/projects/soulswap/abis/factory.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "allPairs": "function allPairs(uint256) view returns (address)", - "totalPairs": "uint256:totalPairs" -} \ No newline at end of file diff --git a/projects/soulswap/helper/getUsdSoulTvl.js b/projects/soulswap/helper/getUsdSoulTvl.js deleted file mode 100644 index a6d888b7d14c..000000000000 --- a/projects/soulswap/helper/getUsdSoulTvl.js +++ /dev/null @@ -1,171 +0,0 @@ -const sdk = require('@defillama/sdk'); -const token0 = 'address:token0' -const token1 = 'address:token1' -const getReserves = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)' -const factoryAbi = require('../abis/factory.json'); - -async function requery(results, chain, block, abi) { - if (results.some(r => !r.success)) { - const failed = results.map((r, i) => [r, i]).filter(r => !r[0].success) - const newResults = await sdk.api.abi - .multiCall({ - abi, - chain, - calls: failed.map((f) => f[0].input), - block, - }).then(({ output }) => output); - failed.forEach((f, i) => { - results[f[1]] = newResults[i] - }) - } -} - -function sum(balances, token, amount) { - if (balances[token] === undefined) { - balances[token] = 0 - } - balances[token] += Number(amount) -} - -function setPrice(prices, address, coreAmount, tokenAmount) { - if (prices[address] !== undefined) { - const currentCoreAmount = prices[address][0] - if (coreAmount < currentCoreAmount) { - return - } - } - prices[address] = [Number(coreAmount), Number(coreAmount) / Number(tokenAmount)] -} - -function calculateUsdSoulTvl(FACTORY, chain, coreAssetRaw, whitelistRaw, coreAssetName, decimals = 18) { - const whitelist = whitelistRaw.map(t => t.toLowerCase()) - const coreAsset = coreAssetRaw.toLowerCase() - return async (timestamp, ethBlock, {[chain]: block}) => { - - let pairAddresses; - const pairLength = (await sdk.api.abi.call({ - target: FACTORY, - abi: factoryAbi.totalPairs, - chain, - block - })).output - if (pairLength === null) { - throw new Error("totalPairs() failed") - } - const pairNums = Array.from(Array(Number(pairLength)).keys()) - { - const pairs = (await sdk.api.abi.multiCall({ - abi: factoryAbi.allPairs, - chain, - calls: pairNums.map(num => ({ - target: FACTORY, - params: [num] - })), - block - })).output - await requery(pairs, chain, block, factoryAbi.allPairs); - pairAddresses = pairs.map(result => result.output.toLowerCase()) - } - - const [token0Addresses, token1Addresses, reserves] = await Promise.all([ - sdk.api.abi - .multiCall({ - abi: token0, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: token1, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: getReserves, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }).then(({ output }) => output), - ]); - await requery(token0Addresses, chain, block, token0); - await requery(token1Addresses, chain, block, token1); - await requery(reserves, chain, block, getReserves); - - const pairs = {}; - // add token0Addresses - token0Addresses.forEach((token0Address) => { - const tokenAddress = token0Address.output.toLowerCase(); - - const pairAddress = token0Address.input.target.toLowerCase(); - pairs[pairAddress] = { - token0Address: tokenAddress, - } - }); - - // add token1Addresses - token1Addresses.forEach((token1Address) => { - const tokenAddress = token1Address.output.toLowerCase(); - const pairAddress = token1Address.input.target.toLowerCase(); - pairs[pairAddress] = { - ...(pairs[pairAddress] || {}), - token1Address: tokenAddress, - } - }); - - const balances = {} - let coreBalance = 0 - const prices = {} - const list = [] - for (let i = 0; i < reserves.length; i++) { - const pairAddress = reserves[i].input.target.toLowerCase(); - const pair = pairs[pairAddress]; - const token0Address = pair.token0Address.toLowerCase() - const token1Address = pair.token1Address.toLowerCase() - const reserveAmounts = reserves[i].output - if (token0Address === coreAsset) { - coreBalance += Number(reserveAmounts[0]) * 2 - if (whitelist.includes(token1Address)) { - setPrice(prices, token1Address, reserveAmounts[0], reserveAmounts[1]) - } - list.push([pairAddress, Number(reserveAmounts[0]), reserveAmounts]) - } else if (token1Address === coreAsset) { - coreBalance += Number(reserveAmounts[1]) * 2 - if (whitelist.includes(token0Address)) { - setPrice(prices, token0Address, reserveAmounts[1], reserveAmounts[0]) - } - } else { - const whitelistedToken0 = whitelist.find(t => t === token0Address) - const whitelistedToken1 = whitelist.find(t => t === token1Address) - if (whitelistedToken0 !== undefined) { - sum(balances, whitelistedToken0, Number(reserveAmounts[0]) * 2) - } else if (whitelistedToken1 !== undefined) { - sum(balances, whitelistedToken1, Number(reserveAmounts[1]) * 2) - } - } - } - Object.entries(balances).forEach(([address, amount]) => { - const price = prices[address]; - if (price !== undefined) { - coreBalance += price[1] * (amount ?? 0) - } - }) - return { - [coreAssetName]: (coreBalance) / (10 ** decimals) - } - } -} - -module.exports = { - calculateUsdSoulTvl, -}; diff --git a/projects/soulswap/index.js b/projects/soulswap/index.js index 18b015606b56..4c13ede8c9e9 100644 --- a/projects/soulswap/index.js +++ b/projects/soulswap/index.js @@ -1,36 +1,30 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { calculateUsdSoulTvl } = require('./helper/getUsdSoulTvl.js') const { staking } = require('../helper/staking.js'); const { underworldLending } = require('./underworld-lending.js') +const { getUniTVL } = require('../helper/unknownTokens') + +const abis = { + "allPairs": "function allPairs(uint256) view returns (address)", + "allPairsLength": "uint256:totalPairs" +} const factory_fantom = '0x1120e150dA9def6Fe930f4fEDeD18ef57c0CA7eF' const farm_fantom = '0xb898226dE3c5ca980381fE85F2Bc10e35e00634c' const soul_fantom = '0xe2fb177009ff39f52c0134e8007fa0e4baacbd07' -const wftm_fantom = ADDRESSES.fantom.WFTM -const rndm_fantom = '0x49ac072c793fb9523f0688a0d863aadfbfb5d475' -const usdc_fantom = ADDRESSES.fantom.USDC -const wbtc_fantom = '0x321162cd933e2be498cd2267a90534a804051b11' const factory_avax = '0x5BB2a9984de4a69c05c996F7EF09597Ac8c9D63a' const farm_avax = '0xB1e330401c920077Ddf157AbA5594238d36b54B1' const soul_avax = '0x11d6DD25c1695764e64F439E32cc7746f3945543' -const wavax_avax = ADDRESSES.avax.WAVAX -const usdc_avax = ADDRESSES.avax.USDC -const wbtc_avax = ADDRESSES.avax.WBTC_e -const weth_avax = ADDRESSES.avax.WETH_e - -const wl_fantom = [ usdc_fantom, soul_fantom, rndm_fantom, wbtc_fantom ] -const wl_avax = [ usdc_avax, soul_avax, wbtc_avax, weth_avax ] module.exports = { + misrepresentedTokens: true, fantom:{ staking: staking(farm_fantom, soul_fantom), - tvl: calculateUsdSoulTvl(factory_fantom, 'fantom', wftm_fantom, wl_fantom, 'fantom'), + tvl: getUniTVL({ factory: factory_fantom, useDefaultCoreAssets: true, abis, }), borrowed: underworldLending('fantom', true) }, avax:{ staking: staking(farm_avax, soul_avax), - tvl: calculateUsdSoulTvl(factory_avax, 'avax', wavax_avax, wl_avax, 'avax'), + tvl: getUniTVL({ factory: factory_avax, useDefaultCoreAssets: true, abis, }), borrowed: underworldLending('avax', true) }, misrepresentedTokens: true, From 535c3801637c3cc903f2543754b02d9c1c4fd43e Mon Sep 17 00:00:00 2001 From: Seiji Date: Thu, 13 Jun 2024 03:10:45 -0400 Subject: [PATCH 313/855] add otsea project (tvl, staking, offers) --- projects/otsea/config.js | 17 +++++++++++ projects/otsea/index.js | 62 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 projects/otsea/config.js create mode 100644 projects/otsea/index.js diff --git a/projects/otsea/config.js b/projects/otsea/config.js new file mode 100644 index 000000000000..548651194732 --- /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 000000000000..b034d166540e --- /dev/null +++ b/projects/otsea/index.js @@ -0,0 +1,62 @@ + +const { GraphQLClient, gql } = require("graphql-request"); +const { staking } = require("../helper/staking"); +const config = require("./config"); + +const OTSEA_TOKEN = "0x5dA151B95657e788076D04d56234Bd93e409CB09"; +const OTSEA_TREASURY = "0xF2c8e860ca12Cde3F3195423eCf54427A4f30916"; + +// OTSEA market volume by network +function getMarketVolume(endpoint) { + return async (api) => { + let graphQLClient = new GraphQLClient(endpoint); + let query = gql` + query Globals { + globals { + totalOrders + totalVolume + } + } + `; + const results = await graphQLClient.request(query) + + const { globals } = results || { + globals: [{ totalOrders: 0, totalVolume: 0 }], + } + + api.addCGToken('ethereum', parseFloat(globals[0].totalVolume || 0) / 1e18) + } +} + +// TVL of OTSEA +async function otsea_tvl(api) { + const collateralBalance = await api.call({ + abi: 'erc20:totalSupply', + target: OTSEA_TOKEN, + params: [], + }); + + api.add(OTSEA_TOKEN, collateralBalance) +} + +// Global export +module.exports = { + methodology: "We uses otsea's subgraphs to fetch tvl and offers data.", +}; + +// Network exports +config.chains.forEach(async chainInfo => { + const { name: chain, graphql: endpoint } = chainInfo + + if (chain == 'ethereum') { + module.exports[chain] = { + tvl: otsea_tvl, + staking: staking(OTSEA_TREASURY, OTSEA_TOKEN), + offers: getMarketVolume(endpoint), + } + } else { + module.exports[chain] = { + offers: getMarketVolume(endpoint), + } + } +}) \ No newline at end of file From c05d54ff17e01e0ccd7b63d7dfed1b5bd4928d81 Mon Sep 17 00:00:00 2001 From: Seiji Date: Thu, 13 Jun 2024 03:33:31 -0400 Subject: [PATCH 314/855] replace tvl calculation with make volume --- projects/otsea/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/projects/otsea/index.js b/projects/otsea/index.js index b034d166540e..1cd9e04a1209 100644 --- a/projects/otsea/index.js +++ b/projects/otsea/index.js @@ -50,13 +50,12 @@ config.chains.forEach(async chainInfo => { if (chain == 'ethereum') { module.exports[chain] = { - tvl: otsea_tvl, + tvl: getMarketVolume(endpoint), staking: staking(OTSEA_TREASURY, OTSEA_TOKEN), - offers: getMarketVolume(endpoint), } } else { module.exports[chain] = { - offers: getMarketVolume(endpoint), + tvl: getMarketVolume(endpoint), } } }) \ No newline at end of file From 7b307e64e6f027e1634e77555c1c22014e20a6bd Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Thu, 13 Jun 2024 09:25:27 +0100 Subject: [PATCH 315/855] remove duplicated entry (#10634) --- projects/bunicorn/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/bunicorn/index.js b/projects/bunicorn/index.js index 1460356ccd6a..a8f5a1178530 100644 --- a/projects/bunicorn/index.js +++ b/projects/bunicorn/index.js @@ -10,7 +10,7 @@ async function staking(api) { } module.exports = { bsc: { - tvl: v1Tvl('0x48ab312150E1802D57639859d7C3107aE751FE35', 8973039), + // tvl: v1Tvl('0x48ab312150E1802D57639859d7C3107aE751FE35', 8973039), tvl: sdk.util.sumChainTvls([v1Tvl('0x48ab312150E1802D57639859d7C3107aE751FE35', 8973039), uniTvlExport('bsc', '0x86873f85bc12ce40321340392c0ff39c3bdb8d68', { abis: { allPairsLength: 'uint256:allPoolsLength', From 23bf1b0364c47bb44f6cebe39a58b9103e1f1fac Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 13 Jun 2024 17:55:49 +0200 Subject: [PATCH 316/855] minor fix --- projects/helper/coreAssets.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 6251af69fb5b..59139d4120df 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1805,5 +1805,12 @@ }, "lukso": { "WLYX": "0x2db41674f2b882889e5e1bd09a3f3613952bc472" + }, + "defichain_evm": { + "DFI": "0x49febbf9626b2d39aba11c01d83ef59b3d56d2a4", + "USDT": "0xff0000000000000000000000000000000000000d", + "USDC": "0xff00000000000000000000000000000000000003", + "ETH": "0xff00000000000000000000000000000000000001", + "DUSD": "0xff0000000000000000000000000000000000000f" } } From 44a396e4584b114b4ba6b8ac3d6963c08ecc3408 Mon Sep 17 00:00:00 2001 From: pavelGotbit <156020554+pavelGotbit@users.noreply.github.com> Date: Thu, 13 Jun 2024 19:02:17 +0300 Subject: [PATCH 317/855] added kicks (#10622) * added kicks * minor fix * revert change --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/kicks/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/kicks/index.js diff --git a/projects/kicks/index.js b/projects/kicks/index.js new file mode 100644 index 000000000000..b3ab5e8180ab --- /dev/null +++ b/projects/kicks/index.js @@ -0,0 +1,14 @@ + +const STAKING = "0x7f435dC15CD9d686C48B6beD2cB8d32D895cfb93" +const TOKEN = "0xfEB4e9B932eF708c498Cc997ABe51D0EE39300cf" + +module.exports = { + methodology: "TVL counted from the KICKS contracts", + bsc: { + tvl: () => ({}), + staking: async (api) => { + const bal = await api.call({ abi: 'uint256:totalSupply', target: STAKING }) + api.add(TOKEN, bal) + }, + }, +} \ No newline at end of file From 893c7a9be5711c50461a32916af4eb3a6bf9369c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 13 Jun 2024 18:03:55 +0200 Subject: [PATCH 318/855] lint fixes --- projects/bunicorn/index.js | 3 +-- projects/soulswap/index.js | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/projects/bunicorn/index.js b/projects/bunicorn/index.js index a8f5a1178530..df97a7b11fdf 100644 --- a/projects/bunicorn/index.js +++ b/projects/bunicorn/index.js @@ -4,13 +4,12 @@ const { uniTvlExport } = require('../helper/unknownTokens') const BUNI_CONTRACT_ADDRESS = "0x0e7beec376099429b85639eb3abe7cf22694ed49"; const MASTERCHEF_CONTRACT_ADDRESS = "0xA12c974fE40ea825E66615bA0Dc4Fd19be4D7d24"; - async function staking(api) { return api.sumTokens({ owner: MASTERCHEF_CONTRACT_ADDRESS, tokens: [BUNI_CONTRACT_ADDRESS] }); } + module.exports = { bsc: { - // tvl: v1Tvl('0x48ab312150E1802D57639859d7C3107aE751FE35', 8973039), tvl: sdk.util.sumChainTvls([v1Tvl('0x48ab312150E1802D57639859d7C3107aE751FE35', 8973039), uniTvlExport('bsc', '0x86873f85bc12ce40321340392c0ff39c3bdb8d68', { abis: { allPairsLength: 'uint256:allPoolsLength', diff --git a/projects/soulswap/index.js b/projects/soulswap/index.js index 4c13ede8c9e9..a314e56167bc 100644 --- a/projects/soulswap/index.js +++ b/projects/soulswap/index.js @@ -27,6 +27,5 @@ module.exports = { tvl: getUniTVL({ factory: factory_avax, useDefaultCoreAssets: true, abis, }), borrowed: underworldLending('avax', true) }, - misrepresentedTokens: true, methodology: "Counts liquidity on the exchange, staked soul, and underworld assets.", } From 49ed40ca5ba11ca92f5efd3d5a42744d89a991f1 Mon Sep 17 00:00:00 2001 From: hbeltik <134815749+hbeltik@users.noreply.github.com> Date: Thu, 13 Jun 2024 12:20:20 -0400 Subject: [PATCH 319/855] 3jane/defillama tvl (#10626) * init tvl calc * clean up * fix filename * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/3jane/index.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 projects/3jane/index.js diff --git a/projects/3jane/index.js b/projects/3jane/index.js new file mode 100644 index 000000000000..8fdb9233fd6b --- /dev/null +++ b/projects/3jane/index.js @@ -0,0 +1,27 @@ +const abi = { + vaultParams: "function vaultParams() view returns (bool isPut, uint8 decimals, address asset, address underlying, uint56 minimumSupply, uint104 cap)" +} + +const config = { + ethereum: { + vaults: [ + "0xAcD147A5bbCB7166c5BB13A9354ad7a59b99fB4d", // weETH call vault + ] + } +} + +module.exports = { + methodology: "Sums the totalBalance of all 3Jane Theta Vaults", +}; + +Object.keys(config).forEach(chain => { + const { vaults } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const balances = await api.multiCall({ abi: "uint256:totalBalance", calls: vaults }) + const data = await api.multiCall({ abi: abi.vaultParams, calls: vaults }) + const tokens = data.map(d => d.asset) + api.add(tokens, balances) + } + } +}) From 2cd3d81449d51b253dc39ec05bbc6cf5ee9a22b8 Mon Sep 17 00:00:00 2001 From: Jake Date: Thu, 13 Jun 2024 09:22:20 -0700 Subject: [PATCH 320/855] feat: add USD+ and other chains to Dinari (#10627) --- projects/dinari/index.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/projects/dinari/index.js b/projects/dinari/index.js index 88adad9c2e5b..97ec8bf1693d 100644 --- a/projects/dinari/index.js +++ b/projects/dinari/index.js @@ -2,9 +2,16 @@ const config = { arbitrum: { factory: "0xB4Ca72eA4d072C779254269FD56093D3ADf603b8", getTokensAbi: "function getDShares() external view returns (address[] memory, address[] memory)", - processor: "0xFA922457873F750244D93679df0d810881E4131D", - latestPriceAbi: "function latestFillPrice(address assetToken, address paymentToken) view returns (tuple(uint256 price, uint64 blocktime))", 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)" } } @@ -19,8 +26,16 @@ async function getTokens(api, chain) { Object.keys(config).forEach( chain => { module.exports[chain] = { tvl: async (api) => { + // get dShare tokens const tokens = await getTokens(api, chain) - const bals = await api.multiCall({ abi: 'erc20:totalSupply', calls: tokens}) + const bals = await api.multiCall({ chain: chain, abi: 'erc20:totalSupply', calls: tokens}) + // add USD+ + const usdplus = config[chain].usdplus + if (usdplus) { + const usdplusBal = await api.call({chain: chain, target: usdplus, abi: 'erc20:totalSupply'}) + tokens.push(usdplus) + bals.push(usdplusBal) + } api.add(tokens, bals) } } From 4b5a315bdc60a0d8201978e42d7263c5c892f0dd Mon Sep 17 00:00:00 2001 From: lainhathoang Date: Thu, 13 Jun 2024 23:41:31 +0700 Subject: [PATCH 321/855] feat: create the DefiLlama Adapter for the Capy Finance project (#10630) * feat: create the DefiLlama Adapter for the Capy Finance project * fix: fix some issues * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/bunicorn/index.js | 7 +++++-- projects/capy-finance/index.js | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 projects/capy-finance/index.js diff --git a/projects/bunicorn/index.js b/projects/bunicorn/index.js index df97a7b11fdf..7ab2ca1e5483 100644 --- a/projects/bunicorn/index.js +++ b/projects/bunicorn/index.js @@ -1,11 +1,14 @@ const sdk = require("@defillama/sdk"); const { v1Tvl } = require("../helper/balancer"); -const { uniTvlExport } = require('../helper/unknownTokens') +const { uniTvlExport } = require("../helper/unknownTokens"); const BUNI_CONTRACT_ADDRESS = "0x0e7beec376099429b85639eb3abe7cf22694ed49"; const MASTERCHEF_CONTRACT_ADDRESS = "0xA12c974fE40ea825E66615bA0Dc4Fd19be4D7d24"; async function staking(api) { - return api.sumTokens({ owner: MASTERCHEF_CONTRACT_ADDRESS, tokens: [BUNI_CONTRACT_ADDRESS] }); + return api.sumTokens({ + owner: MASTERCHEF_CONTRACT_ADDRESS, + tokens: [BUNI_CONTRACT_ADDRESS], + }); } module.exports = { diff --git a/projects/capy-finance/index.js b/projects/capy-finance/index.js new file mode 100644 index 000000000000..9dedd33d17c1 --- /dev/null +++ b/projects/capy-finance/index.js @@ -0,0 +1,17 @@ +const CAPY_STAKING_CONTRACT = '0x67D171A673FfDBd5BBce01dE1489f9E57F3d911b'; +const CAPY_RESTAKING_CONTRACT = '0x12178d2B86031dD293274A0E25c8908521F3d27C'; + +async function tvl(api) { + const contracts = [CAPY_STAKING_CONTRACT, CAPY_RESTAKING_CONTRACT] + const tokens = await api.multiCall({ abi: 'address[]:getSupportedTokens', calls: contracts }) + const ownerTokens = contracts.map((contract, i) => [tokens[i], contract]) + return api.sumTokens({ ownerTokens }) +} + +module.exports = { + methodology: 'The TVL of the Capy Finance project in USD.', + start: 1000235, + bsquared: { + tvl, + }, +} \ No newline at end of file From 6d7d0ca3cbcd24b02d8ae7ae8aeb7513044fd60f Mon Sep 17 00:00:00 2001 From: Shayne Brady Date: Fri, 14 Jun 2024 02:41:58 +1000 Subject: [PATCH 322/855] update amped to use latest contracts (#10629) --- projects/amped/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/projects/amped/index.js b/projects/amped/index.js index 31b346899d0a..04f69f4f2234 100644 --- a/projects/amped/index.js +++ b/projects/amped/index.js @@ -1,14 +1,14 @@ const {staking} = require('../helper/staking') const { gmxExports } = require('../helper/gmx') -//Cronos -const phoenixVaultAddress = '0x976156BE19D35ac616c67737258EEc973202E6D6'; -const phoenixStakingAddress = '0x48f206bED002fae4EcB522Dfe36e5A10F15e9f47'; -const phoenixAlpAddress = '0x6c6647B3E6AfA27B8Fb9BEDe728A3603eB6c0fC7'; +const phoenixVaultAddress = '0xa6b88069EDC7a0C2F062226743C8985FF72bB2Eb'; +const phoenixStakingAddress = '0x3c9586567a429BA0467Bc63FD38ea71bB6B912E0'; +const phoenixAmpAddress = '0xca7F14F14d975bEFfEe190Cd3cD232a3a988Ab9C'; module.exports = { + start: 1717674114, lightlink_phoenix: { - staking: staking(phoenixStakingAddress, phoenixAlpAddress), + staking: staking(phoenixStakingAddress, phoenixAmpAddress), tvl: gmxExports({ vault: phoenixVaultAddress, }) }, }; From 1228d8e38e7f381ad6b23bb2314eab4a3f3884f1 Mon Sep 17 00:00:00 2001 From: Seiji Date: Thu, 13 Jun 2024 12:57:13 -0400 Subject: [PATCH 323/855] update TVL calculation as locked assets on open orders --- projects/otsea/index.js | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/projects/otsea/index.js b/projects/otsea/index.js index 1cd9e04a1209..bc6cef85b39f 100644 --- a/projects/otsea/index.js +++ b/projects/otsea/index.js @@ -1,35 +1,42 @@ 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_TREASURY = "0xF2c8e860ca12Cde3F3195423eCf54427A4f30916"; +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 Globals { - globals { - totalOrders - totalVolume + query openSellOrders { + orders (where: { type: 1, state: 0 }) { + fulfilledOutput + totalOutput } } `; const results = await graphQLClient.request(query) - const { globals } = results || { - globals: [{ totalOrders: 0, totalVolume: 0 }], + const { orders } = results || { + orders: [{ totalOutput: 0 }], } - - api.addCGToken('ethereum', parseFloat(globals[0].totalVolume || 0) / 1e18) + 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) } } -// TVL of OTSEA -async function otsea_tvl(api) { +// Total Volume of OTSEA +async function otsea_total_volume(api) { const collateralBalance = await api.call({ abi: 'erc20:totalSupply', target: OTSEA_TOKEN, @@ -41,7 +48,7 @@ async function otsea_tvl(api) { // Global export module.exports = { - methodology: "We uses otsea's subgraphs to fetch tvl and offers data.", + methodology: "We aggregated the assets locked on OTSea market", }; // Network exports @@ -51,7 +58,7 @@ config.chains.forEach(async chainInfo => { if (chain == 'ethereum') { module.exports[chain] = { tvl: getMarketVolume(endpoint), - staking: staking(OTSEA_TREASURY, OTSEA_TOKEN), + staking: staking(OTSEA_STAKING_CONTRACT, OTSEA_TOKEN), } } else { module.exports[chain] = { From c2446cc25342134403b5ce7df2b05d662ca1f8b5 Mon Sep 17 00:00:00 2001 From: jan-magpie <155635960+jan-magpie@users.noreply.github.com> Date: Thu, 13 Jun 2024 22:30:14 +0530 Subject: [PATCH 324/855] Create magpie.js (#10631) * Create magpie.js * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/treasury/magpie.js | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 projects/treasury/magpie.js diff --git a/projects/treasury/magpie.js b/projects/treasury/magpie.js new file mode 100644 index 000000000000..5f296e72c6a4 --- /dev/null +++ b/projects/treasury/magpie.js @@ -0,0 +1,41 @@ +const { treasuryExports } = require("../helper/treasury"); +const { mergeExports } = require('../helper/utils'); + +const magpieTreasury = "0x6dc8ccf1b731e97834002e6ff45e4953bf9602de"; +const vlpnp_staking = "0xc61D3c70CfC9dEDaA090FDD0760Eb9291253fEFF"; +const vlrdp_staking = "0x07973730596E7dbA60E586CDC3dD48d2886Df9dd"; +const pnp_arb = "0x2Ac2B254Bc18cD4999f64773a966E4f4869c34Ee" +const rdp_arb = "0x54bdbf3ce36f451ec61493236b8e6213ac87c0f6" +const ckp_bsc = "0x2B5D9ADea07B590b638FFc165792b2C610EdA649" +const vlckp_staking = "0x232594e7F0096ba7DDAbcD8689cB0D994694eb26" +const mgp = "0xD06716E1Ff2E492Cc5034c2E81805562dd3b45fa"; + +//counting staked tokens in each chain +const stakedExports = { + arbitrum: { + tvl: async (api) => { + let bal_vlpnp = await api.multiCall({ abi: 'function getUserTotalLocked(address) view returns(uint256 _lockAmount)', calls: [magpieTreasury], target: vlpnp_staking, }) + api.add(pnp_arb, bal_vlpnp); + let bal_vlrdp = await api.multiCall({ abi: 'function getUserTotalLocked(address) view returns(uint256 _lockAmount)', calls: [magpieTreasury], target: vlrdp_staking, }) + api.add(rdp_arb, bal_vlrdp); + return api.getBalances(); + }, + }, + bsc: { + tvl: async (api) => { + let bal_vlckp = await api.multiCall({ abi: 'function getUserTotalLocked(address) view returns(uint256 _lockAmount)', calls: [magpieTreasury], target: vlckp_staking, }) + api.add(ckp_bsc, bal_vlckp); + return api.getBalances(); + }, + }, +} + +const treasuryExportsObj = treasuryExports({ + ethereum: { owners: [magpieTreasury], }, + bsc: { + owners: [magpieTreasury], + ownTokens: [mgp] + }, +}) + +module.exports = mergeExports([treasuryExportsObj, stakedExports]) From b4dc5b45389b03fc5ce67d7f54f2cfa79f5829ff Mon Sep 17 00:00:00 2001 From: Jay Welsh Date: Thu, 13 Jun 2024 19:01:57 +0200 Subject: [PATCH 325/855] feat(silo): adds support for optimism deployment (#10632) --- projects/silo/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/projects/silo/index.js b/projects/silo/index.js index a78f3fb92593..d2d47ae58f98 100644 --- a/projects/silo/index.js +++ b/projects/silo/index.js @@ -30,6 +30,14 @@ const config = { } ] }, + optimism: { + factories: [ + { + START_BLOCK: 120480601, + SILO_FACTORY: '0x6B14c4450a29Dd9562c20259eBFF67a577b540b9', // Silo Optimism (Original) + } + ] + }, } const XAI = '0xd7c9f0e536dc865ae858b0c0453fe76d13c3beac' @@ -83,6 +91,7 @@ module.exports = { methodology: `We calculate TVL by interacting with Silo Factory smart contracts on Ethereum and Arbitrum. For Ethereum, it queries Silo(Original)(0x4D919CEcfD4793c0D47866C8d0a02a0950737589), (Convex Factory)(0x6d4A256695586F61b77B09bc3D28333A91114d5a), and (LLAMA Edition)(0x2c0fA05281730EFd3ef71172d8992500B36b56eA). On Arbitrum, we query the Silo Arbitrum factory(0x4166487056A922D784b073d4d928a516B074b719) to obtain the addresses of Silos, retrieve the assets of each Silo, and then calculates the sum of the deposited tokens, borrowed amount are exported separately`, ethereum: { tvl, borrowed, }, arbitrum: { tvl, borrowed, }, + optimism: { tvl, borrowed, }, hallmarks: [ [1692968400, "Launch CRV market"] ] From 102433e7a75b01b31626ba185d4fff06b5acee81 Mon Sep 17 00:00:00 2001 From: slasher125 <74533329+slasher125@users.noreply.github.com> Date: Thu, 13 Jun 2024 21:20:55 +0400 Subject: [PATCH 326/855] graphql-migration (#10635) * ic * revert package lock change * bump version --------- Co-authored-by: 0xngmi <0xngmi@protonmail.com> --- liquidations/aave-v2/index.ts | 5 +- liquidations/benqi/index.ts | 3 +- liquidations/compound/index.ts | 3 +- liquidations/euler/index.ts | 3 +- liquidations/mimo-protocol/index.ts | 7 +-- liquidations/trader-joe-lend/index.ts | 3 +- liquidations/venus/index.ts | 3 +- package-lock.json | 6 +-- projects/aktionariat/index.js | 5 +- projects/altr-lend/index.js | 3 +- projects/contango-v2/index.js | 11 ++-- projects/defiplaza.js | 3 +- projects/enzyme/index.js | 5 +- projects/ethalend/index.js | 3 +- projects/factor-leverage-vault/index.js | 3 +- projects/factor/index.js | 3 +- projects/horizon/collateral.js | 3 +- projects/keep.js | 5 +- projects/mmo/helper/helper.js | 2 +- projects/olympus/index.js | 3 +- projects/orbit/index.js | 3 +- projects/origami/index.js | 5 +- projects/ottopia/index.js | 3 +- projects/pacman/index.js | 3 +- projects/platypus-finance/index.js | 3 +- projects/podsfinance/constants.js | 7 +-- projects/pooltogether/v3.js | 13 ++--- projects/prime-protocol/index.js | 3 +- projects/quickswap/index.js | 3 +- projects/ren/index.js | 10 ++-- projects/rift-finance/networks.js | 5 +- projects/rubicon/index.js | 5 +- projects/sablier-v2/index.js | 9 ++-- projects/sentiment/index.js | 3 +- projects/soulswap/underworld-lending.js | 4 +- projects/steer/index.js | 15 +++--- projects/sudoswap/index.js | 3 +- projects/superfluid.js | 16 +++--- projects/sushiswap-bentobox/helper.js | 64 +++++++++++------------ projects/sushiswap-furo/furo.js | 22 ++++---- projects/sushiswap-kashi/kashi-lending.js | 11 ++-- projects/sushiswap-trident/trident.js | 11 ++-- projects/sushiswap/api.js | 3 +- projects/swaap-earn/index.js | 3 +- projects/swaap/index.js | 3 +- projects/synthetix/api.js | 3 +- projects/synthetix/apiCache.js | 3 +- projects/timeswap/index.js | 3 +- projects/unbound/index.js | 5 +- projects/unifarm/helper.js | 7 +-- projects/vela-exchange/index.js | 5 +- projects/venus-isolated-pools/index.js | 5 +- projects/zksynth/index.js | 3 +- 53 files changed, 196 insertions(+), 150 deletions(-) diff --git a/liquidations/aave-v2/index.ts b/liquidations/aave-v2/index.ts index c546df97ec3b..cc80860cb015 100644 --- a/liquidations/aave-v2/index.ts +++ b/liquidations/aave-v2/index.ts @@ -1,3 +1,4 @@ +import * as sdk from "@defillama/sdk"; import { gql, request } from "graphql-request"; import { Liq } from "../utils/types"; import { getPagedGql } from "../utils/gql"; @@ -75,14 +76,14 @@ const rc: { [chain in Chains]: AaveAdapterResource } = { name: "aave", chain: Chains.ethereum, usdcAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - subgraphUrl: "https://api.thegraph.com/subgraphs/name/aave/protocol-v2", + subgraphUrl: sdk.graph.modifyEndpoint('8wR23o1zkS4gpLqLNU4kG3JHYVucqGyopL5utGxP2q1N'), explorerBaseUrl: "https://etherscan.io/address/", }, // [Chains.polygon]: { // name: "aave", // chain: Chains.polygon, // usdcAddress: "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", - // subgraphUrl: "https://api.thegraph.com/subgraphs/name/aave/aave-v2-matic", + // subgraphUrl: sdk.graph.modifyEndpoint('H1Et77RZh3XEf27vkAmJyzgCME2RSFLtDS2f4PPW6CGp'), // explorerBaseUrl: "https://polygonscan.com/address/", // }, }; diff --git a/liquidations/benqi/index.ts b/liquidations/benqi/index.ts index 4b3e2b70b4b7..ec14a98cc0f0 100644 --- a/liquidations/benqi/index.ts +++ b/liquidations/benqi/index.ts @@ -1,3 +1,4 @@ +import * as sdk from "@defillama/sdk"; import { gql } from "graphql-request"; import { getPagedGql } from "../utils/gql"; import BigNumber from "bignumber.js"; @@ -12,7 +13,7 @@ import { totalCollateralValueInUsd, } from "../utils/compound-helpers"; -const subgraphUrl = "https://api.thegraph.com/subgraphs/name/yhayun/benqi"; +const subgraphUrl = sdk.graph.modifyEndpoint('HcTvZi3fwucvRJvVmtFzNDTnomvMBk64xCLNQQg6GPAV'); const accountsQuery = gql` query accounts($lastId: ID, $pageSize: Int) { diff --git a/liquidations/compound/index.ts b/liquidations/compound/index.ts index d87100ba7bc4..e646fd6a796e 100644 --- a/liquidations/compound/index.ts +++ b/liquidations/compound/index.ts @@ -1,3 +1,4 @@ +import * as sdk from "@defillama/sdk"; import { gql } from "graphql-request"; import { getPagedGql } from "../utils/gql"; import BigNumber from "bignumber.js"; @@ -12,7 +13,7 @@ import { totalCollateralValueInUsd, } from "../utils/compound-helpers"; -const subgraphUrl = "https://api.thegraph.com/subgraphs/name/graphprotocol/compound-v2"; +const subgraphUrl = sdk.graph.modifyEndpoint('AAva7YSZBLar4MaxQ3MqdJDFXkkHEaCDeibKTnraex1x'); const accountsQuery = gql` query accounts($lastId: ID, $pageSize: Int) { diff --git a/liquidations/euler/index.ts b/liquidations/euler/index.ts index 5ef58aa3ad47..d0cac4c0d7c6 100644 --- a/liquidations/euler/index.ts +++ b/liquidations/euler/index.ts @@ -1,9 +1,10 @@ +import * as sdk from "@defillama/sdk"; import { gql } from "graphql-request"; import { getPagedGql } from "../utils/gql"; import BigNumber from "bignumber.js"; import { Liq } from "../utils/types"; -const subgraphUrl = "https://api.thegraph.com/subgraphs/name/euler-xyz/euler-mainnet"; +const subgraphUrl = sdk.graph.modifyEndpoint('EQBXhrF4ppZy9cBYnhPdrMCRaVas6seNpqviih5VRGmU'); const accountsQuery = gql` query accounts($lastId: ID, $pageSize: Int) { diff --git a/liquidations/mimo-protocol/index.ts b/liquidations/mimo-protocol/index.ts index 9d0bc72c7968..30945758a381 100644 --- a/liquidations/mimo-protocol/index.ts +++ b/liquidations/mimo-protocol/index.ts @@ -1,3 +1,4 @@ +import * as sdk from "@defillama/sdk"; import axios from "axios"; import { gql } from "graphql-request"; import BigNumber from "bignumber.js"; @@ -49,16 +50,16 @@ const getSubgraphUrl = (chain: Chain) => { switch (chain) { case Chain.ethereum: { - subgraphUrl = "https://api.thegraph.com/subgraphs/name/m19/titan"; + subgraphUrl = sdk.graph.modifyEndpoint('FV3Dw1zMs97LpVPegWZKJv4bsbsZdrob2EqLCPxdcoDS'); break; } case Chain.polygon: { - subgraphUrl = "https://api.thegraph.com/subgraphs/name/m19/titanpolygon"; + subgraphUrl = sdk.graph.modifyEndpoint('EfFLqiwngmmtE5su2t1EsFoEttoj8KWervocfab1ofYT'); break; } // case Chain.fantom: { // subgraphUrl = - // "https://api.thegraph.com/subgraphs/name/rayxpub/titanfantom"; + // sdk.graph.modifyEndpoint('DkSQLWkkiNfeNG43NJnHsW9hfih8hDt4SHFTNMQgPHJH'); // break; // } } diff --git a/liquidations/trader-joe-lend/index.ts b/liquidations/trader-joe-lend/index.ts index d922f5c99993..2e9475097970 100644 --- a/liquidations/trader-joe-lend/index.ts +++ b/liquidations/trader-joe-lend/index.ts @@ -1,9 +1,10 @@ +import * as sdk from "@defillama/sdk"; import { gql } from "graphql-request"; import { getPagedGql } from "../utils/gql"; import BigNumber from "bignumber.js"; import { Liq } from "../utils/types"; -const subgraphUrl = "https://api.thegraph.com/subgraphs/name/traderjoe-xyz/lending"; +const subgraphUrl = sdk.graph.modifyEndpoint('JB5EdQqbddMjawMLYe3C5ifmhN9WKYvLdgAKoUy1CyYy'); const accountsQuery = gql` query accounts($lastId: ID, $pageSize: Int) { diff --git a/liquidations/venus/index.ts b/liquidations/venus/index.ts index b654f3312c95..703a3c635ce5 100644 --- a/liquidations/venus/index.ts +++ b/liquidations/venus/index.ts @@ -1,3 +1,4 @@ +import * as sdk from "@defillama/sdk"; import { gql } from "graphql-request"; import { getPagedGql } from "../utils/gql"; import BigNumber from "bignumber.js"; @@ -15,7 +16,7 @@ import { } from "../utils/compound-helpers"; const sdk = require("@defillama/sdk"); -const subgraphUrl = "https://api.thegraph.com/subgraphs/name/venusprotocol/venus-subgraph"; +const subgraphUrl = sdk.graph.modifyEndpoint('7h65Zf3pXXPmf8g8yZjjj2bqYiypVxems5d8riLK1DyR'); const accountsQuery = gql` query accounts($lastId: ID, $pageSize: Int) { diff --git a/package-lock.json b/package-lock.json index 911a406bb5b3..bce92f99678d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -886,9 +886,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "5.0.67", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.67.tgz", - "integrity": "sha512-gOJACkDuPyNicL2zs0J93LkbDOkcviSaNQAvRH/wQkeXcdo7tHwN5YH59sFFE6Ge6gsCgcI0KnyuO6E0yjmo8g==", + "version": "5.0.69", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.69.tgz", + "integrity": "sha512-IYdT4P5vG9xt14tM9RuT1+uBUyD8oL6fdTWC3iwOlwATjWKA1kwOhucCXNFE8sc2KKugwTUfQuGp8Q3fHDxAfw==", "dependencies": { "@aws-sdk/client-s3": "^3.400.0", "@elastic/elasticsearch": "^8.13.1", diff --git a/projects/aktionariat/index.js b/projects/aktionariat/index.js index 206de03205a1..aa124060512c 100644 --- a/projects/aktionariat/index.js +++ b/projects/aktionariat/index.js @@ -1,8 +1,9 @@ +const sdk = require("@defillama/sdk"); const { cachedGraphQuery } = require('../helper/cache') const graphs = { - ethereum: "https://api.thegraph.com/subgraphs/name/aktionariat/brokerbot", - optimism: "https://api.thegraph.com/subgraphs/name/aktionariat/brokerbot-optimism", + ethereum: sdk.graph.modifyEndpoint('2ZoJCp4S7YP7gbYN2ndsYNjPeZBV1PMti7BBoPRRscNq'), + optimism: sdk.graph.modifyEndpoint('3QfEXbPfP23o3AUzcmjTfRtUUd4bfrFj3cJ4jET57CTX'), } function tvlPaged(chain) { diff --git a/projects/altr-lend/index.js b/projects/altr-lend/index.js index 7da6e46a0bad..6ae0ea96e5dc 100644 --- a/projects/altr-lend/index.js +++ b/projects/altr-lend/index.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk"); // const LendingContract = "0xdc93413cbe690a1643d285c9f075b271372c9b36" const { graphQuery } = require('../helper/http') const ADDRESSES = require('../helper/coreAssets.json') @@ -9,7 +10,7 @@ async function borrowed(api) { } }` - const { loans } = await graphQuery("https://api.thegraph.com/subgraphs/name/lucidao-developer/altr-lend", query); + const { loans } = await graphQuery(sdk.graph.modifyEndpoint('AVmBsxjouEH6wvG2HCGPCNNt9eDeX2esaRZ7L7jJaTnD'), query); api.add(ADDRESSES.polygon.USDT, loans.map(i => i.amount)); return api.getBalances() } diff --git a/projects/contango-v2/index.js b/projects/contango-v2/index.js index 8cd411efc68a..cf64a0e03be6 100644 --- a/projects/contango-v2/index.js +++ b/projects/contango-v2/index.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk"); const { blockQuery } = require("../helper/http"); const { cachedGraphQuery } = require("../helper/cache"); @@ -8,27 +9,27 @@ const config = { arbitrum: { contango: CONTANGO_PROXY, contango_lens: CONTANGO_LENS_PROXY, - grapUrl: "https://api.thegraph.com/subgraphs/name/contango-xyz/v2-arbitrum", + grapUrl: sdk.graph.modifyEndpoint('BmHqxUxxLuMoDYgbbXU6YR8VHUTGPBf9ghD7XH6RYyTQ'), }, optimism: { contango: CONTANGO_PROXY, contango_lens: CONTANGO_LENS_PROXY, - grapUrl: "https://api.thegraph.com/subgraphs/name/contango-xyz/v2-optimism", + grapUrl: sdk.graph.modifyEndpoint('PT2TcgYqhQmx713U3KVkdbdh7dJevgoDvmMwhDR29d5'), }, ethereum: { contango: CONTANGO_PROXY, contango_lens: CONTANGO_LENS_PROXY, - grapUrl: "https://api.thegraph.com/subgraphs/name/contango-xyz/v2-mainnet", + grapUrl: sdk.graph.modifyEndpoint('FSn2gMoBKcDXEHPvshaXLPC1EJN7YsfCP78swEkXcntY'), }, polygon: { contango: CONTANGO_PROXY, contango_lens: CONTANGO_LENS_PROXY, - grapUrl: "https://api.thegraph.com/subgraphs/name/contango-xyz/v2-polygon", + grapUrl: sdk.graph.modifyEndpoint('5t3rhrAYt79iyjm929hgwyiaPLk9uGxQRMiKEasGgeSP'), }, xdai: { contango: CONTANGO_PROXY, contango_lens: CONTANGO_LENS_PROXY, - grapUrl: "https://api.thegraph.com/subgraphs/name/contango-xyz/v2-gnosis", + grapUrl: sdk.graph.modifyEndpoint('9h1rHUKJK9CGqztdaBptbj4Q9e2zL9jABuu9LpRQ1XkC'), }, base: { contango: CONTANGO_PROXY, diff --git a/projects/defiplaza.js b/projects/defiplaza.js index d915d241e951..ad7b2b6948b9 100644 --- a/projects/defiplaza.js +++ b/projects/defiplaza.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk"); const { cachedGraphQuery } = require('./helper/cache'); const { sumTokens, queryAddresses } = require('./helper/chain/radixdlt'); @@ -5,7 +6,7 @@ const { getConfig } = require('./helper/cache'); const { get } = require('./helper/http'); const sdk = require('@defillama/sdk'); -const graphUrl = 'https://api.thegraph.com/subgraphs/name/omegasyndicate/defiplaza'; +const graphUrl = sdk.graph.modifyEndpoint('4z9FBF12CrfoQJhAkWicqzY2fKYN9QRmuzSsizVXhjKa'); module.exports = { ethereum: { diff --git a/projects/enzyme/index.js b/projects/enzyme/index.js index cb3128d075fd..121fe8240fdb 100644 --- a/projects/enzyme/index.js +++ b/projects/enzyme/index.js @@ -1,9 +1,10 @@ +const sdk = require("@defillama/sdk"); const { cachedGraphQuery } = require('../helper/cache') const { sumTokens2 } = require('../helper/unwrapLPs') const config = { - polygon: { endpoint: 'https://api.thegraph.com/subgraphs/name/enzymefinance/enzyme-core-polygon' }, - ethereum: { endpoint: 'https://api.thegraph.com/subgraphs/name/enzymefinance/enzyme-core' }, + polygon: { endpoint: sdk.graph.modifyEndpoint('GCAHDyqvZBLMwqdb9U7AqWAN4t4TSwR3aXMHDoUUFuRV') }, + ethereum: { endpoint: sdk.graph.modifyEndpoint('9DLBBLep5UyU16kUQRvxBCMqko4q9XzuE4XsMMpARhKK') }, } const query = `query get_accounts($lastId: String!) { vaults( diff --git a/projects/ethalend/index.js b/projects/ethalend/index.js index 79d7fe5394f7..6fbff372750e 100644 --- a/projects/ethalend/index.js +++ b/projects/ethalend/index.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk"); const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') const abi = require('./abi.json') @@ -49,7 +50,7 @@ async function avaxTvl(_, _block, cb) { async function tvl(chain, block, chainId) { const balances = {} if (chain === 'polygon') { - const globalData = (await request("https://api.thegraph.com/subgraphs/name/ethalend/etha-v1", globalDataQuery, { block: block - 100 })).globalDatas + const globalData = (await request(sdk.graph.modifyEndpoint('3fJ6wwsbCeMUrsohMRsmzgzrWwRMWnEac8neYkYQuJaz'), globalDataQuery, { block: block - 100 })).globalDatas await Promise.all(globalData.filter(v => v.type === "lending").map(async v => { if (v.address === "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee") { v.address = ADDRESSES.polygon.WMATIC_2 diff --git a/projects/factor-leverage-vault/index.js b/projects/factor-leverage-vault/index.js index 33853aebb3a4..88dfcb90d41c 100644 --- a/projects/factor-leverage-vault/index.js +++ b/projects/factor-leverage-vault/index.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk"); const { blockQuery } = require('../helper/http') const queryBlock = `query data($block: Int){ @@ -11,7 +12,7 @@ const queryBlock = `query data($block: Int){ }` const SUBGRAPH_URL = - "https://api.thegraph.com/subgraphs/name/dimasriat/factor-leverage-vault"; + sdk.graph.modifyEndpoint('BZhGLLFicmKB9N9oMgDEAP8HmhVxTTjjxQA3ctGewAFc'); async function tvl(api) { const { leverageVaultPairStates } = await blockQuery(SUBGRAPH_URL, queryBlock, { api }) diff --git a/projects/factor/index.js b/projects/factor/index.js index 03023d259dbc..7e161dfc9374 100644 --- a/projects/factor/index.js +++ b/projects/factor/index.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk"); const { staking } = require("../helper/staking"); const { sumTokens2 } = require('../helper/unwrapLPs'); const { cachedGraphQuery } = require('../helper/cache'); @@ -6,7 +7,7 @@ const FCTR = "0x6dD963C510c2D2f09d5eDdB48Ede45FeD063Eb36" const veFCTR = "0xA032082B08B2EF5A6C3Ea80DaEac58300F68FB73" async function tvl(api) { - const endpoint = 'https://api.thegraph.com/subgraphs/name/yanuar-ar/factor-arbitrum' + const endpoint = sdk.graph.modifyEndpoint('2ZavYD1JPYUy8HMheuYcyKCswHR5djpEq2xuWs7PzPRe') const res = await cachedGraphQuery('factor-v1', endpoint, `{vaultGeneses { id }}`) const indices = res.vaultGeneses.map(v => v.id) const uBalances = await api.multiCall({ abi: 'uint256[]:underlyingAssetsBalance', calls: indices }) diff --git a/projects/horizon/collateral.js b/projects/horizon/collateral.js index 55544343ac6a..a346db5e07d3 100644 --- a/projects/horizon/collateral.js +++ b/projects/horizon/collateral.js @@ -1,7 +1,8 @@ +const sdk = require("@defillama/sdk"); const { request, gql } = require("graphql-request"); const { getBlock } = require('../helper/http'); -const graph_endpoint = 'https://api.thegraph.com/subgraphs/name/rout-horizon/bsc15-issuance' +const graph_endpoint = sdk.graph.modifyEndpoint('3URCfxZm32CHDYikF3eu93YCVpDKQyofm42FUh7KkRY9') const graphQuery = gql` query get_tvl($block: Int) { snxholders(orderBy:collateral,orderDirection:desc,block: { number: $block },first:1000,skip:0, where: {initialDebtOwnership_gt: 0, debtEntryAtIndex_gt: 0}) { diff --git a/projects/keep.js b/projects/keep.js index 83c6c879fe06..00479af2c8b5 100644 --- a/projects/keep.js +++ b/projects/keep.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk"); const { GraphQLClient, } = require('graphql-request') const utils = require('./helper/utils'); const sdk = require('@defillama/sdk') @@ -13,7 +14,7 @@ async function tvl() { } } `; - var endpoint = 'https://api.thegraph.com/subgraphs/name/suntzu93/tbtc'; + var endpoint = sdk.graph.modifyEndpoint('8vQM7kTwPoW37U5FWgZLRpcoMyYKExMcHr5JGgnvzxk5'); var graphQLClient = new GraphQLClient(endpoint) const results2 = await graphQLClient.request(q2) var ethStaked = parseFloat(results2.totalBondedECDSAKeeps[0].totalBonded) + parseFloat(results2.totalBondedECDSAKeeps[0].totalAvailable); @@ -39,7 +40,7 @@ async function staking() { } `; - var endpoint = 'https://api.thegraph.com/subgraphs/name/suntzu93/keepnetwork'; + var endpoint = sdk.graph.modifyEndpoint('Pg2cbxfPGJtqRBwMutR69oapbodKmcXuQRsxPRaK57S'); var graphQLClient = new GraphQLClient(endpoint) const results = await graphQLClient.request(q1) const keepPoolStaked = await utils.returnBalance('0x85Eee30c52B0b379b046Fb0F85F4f3Dc3009aFEC', '0xCf916681a6F08fa22e9EF3e665F2966Bf3089Ff1') diff --git a/projects/mmo/helper/helper.js b/projects/mmo/helper/helper.js index f92dee6d7d1b..2c7c59ff279a 100644 --- a/projects/mmo/helper/helper.js +++ b/projects/mmo/helper/helper.js @@ -14,7 +14,7 @@ const MtrollerABI = { async function fetch(query) { var endpoint = - "https://api.thegraph.com/subgraphs/name/ohan8/mmo-finance-active-loans"; + sdk.graph.modifyEndpoint('DUQF7Lhwu1dzz2GwyNi3eRvjZeUnMNCDFjQRA8BYpoRJ'); var graphQLClient = new GraphQLClient(endpoint); const results = await graphQLClient.request(query) diff --git a/projects/olympus/index.js b/projects/olympus/index.js index d7b4f374a626..6dc387b3ce95 100644 --- a/projects/olympus/index.js +++ b/projects/olympus/index.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk"); const ADDRESSES = require('../helper/coreAssets.json') const { blockQuery } = require("../helper/http"); const { getEnv } = require("../helper/env"); @@ -94,7 +95,7 @@ const subgraphUrls = { arbitrum: "2XQDRQ9AXhp5us6PsNyRM5BxKWeXhy3BNQLynA6YmmjA", fantom: - "https://api.thegraph.com/subgraphs/name/olympusdao/protocol-metrics-fantom", + sdk.graph.modifyEndpoint('3qSJTWdWJETFzht814HVV9rVafwRLQp3k9mZhCF39bYd'), polygon: "JCVMW1dbqectgaSLRuKSen6FKe9RPMJRQhNYZa4iTgFb", }; diff --git a/projects/orbit/index.js b/projects/orbit/index.js index 50bb44ba6842..a94248dcc8da 100644 --- a/projects/orbit/index.js +++ b/projects/orbit/index.js @@ -1,9 +1,10 @@ +const sdk = require("@defillama/sdk"); const { toUSDTBalances } = require("../helper/balances"); const { request, gql } = require("graphql-request"); async function tvlFromGraph() { const graphUrl = - "https://api.thegraph.com/subgraphs/name/riccardogalbusera/orbit-subgraph"; + sdk.graph.modifyEndpoint('BRUJ3Y4Fpq4VuvoCAi4p9qv1SxZ6ghVtMK1Rg8igfxmi'); const graphQuery = gql` query { positionManagerFactories(first: 1) { diff --git a/projects/origami/index.js b/projects/origami/index.js index c92c4889f5b3..22e1c67a613d 100644 --- a/projects/origami/index.js +++ b/projects/origami/index.js @@ -1,8 +1,9 @@ +const sdk = require("@defillama/sdk"); const { cachedGraphQuery } = require('../helper/cache') const GRAPH_URLS = { - ethereum: "https://api.thegraph.com/subgraphs/name/templedao/origami-mainnet", // ethereum - arbitrum: "https://api.thegraph.com/subgraphs/name/templedao/origami-arb", // arbitrum + ethereum: sdk.graph.modifyEndpoint('GGN8RoYQBiw2Ui6wUeaKcHsBBSrQzQoryYi2feoTKwPX'), // ethereum + arbitrum: sdk.graph.modifyEndpoint('AHT1ffJhw7NWdeH3XYbWzMmy5USbB22K3ecVDu8azGuF'), // arbitrum } module.exports = { diff --git a/projects/ottopia/index.js b/projects/ottopia/index.js index 003956ae96a6..0a07f498cdac 100644 --- a/projects/ottopia/index.js +++ b/projects/ottopia/index.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk"); const { GraphQLClient, gql } = require("graphql-request"); const { staking } = require("../helper/staking"); @@ -5,7 +6,7 @@ const CLAM = "0xC250e9987A032ACAC293d838726C511E6E1C029d"; const PearlBank = "0x845EB7730a8D37e8D190Fb8bb9c582038331B48a"; async function tvl({timestamp}, block, chainBlocks) { - let endpoint = "https://api.thegraph.com/subgraphs/name/otterclam/otterclam"; + let endpoint = sdk.graph.modifyEndpoint('CejrrsnSQAxHJBpkgiBrLHQZ7h2MkK9QArM8bJvN9GuQ'); let graphQLClient = new GraphQLClient(endpoint); let query = gql` query tvl($start: BigInt!, $end: BigInt!) { diff --git a/projects/pacman/index.js b/projects/pacman/index.js index 6d2c762d5393..cf82ad1db316 100644 --- a/projects/pacman/index.js +++ b/projects/pacman/index.js @@ -1,6 +1,7 @@ +const sdk = require("@defillama/sdk"); const { graphQuery } = require('../helper/http') -const subgraphUrl = "https://api.thegraph.com/subgraphs/name/pacmanfinance/pacman-arbitrum"; +const subgraphUrl = sdk.graph.modifyEndpoint('9xteTELUdzjii1yLASJm6CxSpYuS1bmE6DGWMMhgkq2k'); const vaultsQuery = ` query { diff --git a/projects/platypus-finance/index.js b/projects/platypus-finance/index.js index de5523078740..cf16de413e2c 100644 --- a/projects/platypus-finance/index.js +++ b/projects/platypus-finance/index.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk"); const { staking } = require("../helper/staking"); const { sumTokens2 } = require("../helper/unwrapLPs"); const { cachedGraphQuery } = require('../helper/cache') @@ -13,7 +14,7 @@ const query = `{ async function tvl(api) { if (api.timestamp > +new Date("2023-02-17") / 1e3) blacklistedTokens.push("0xdaCDe03d7Ab4D81fEDdc3a20fAA89aBAc9072CE2") // USP was hacked - const { pools } = await cachedGraphQuery("platypus-finance", "https://api.thegraph.com/subgraphs/name/platypus-finance/platypus-dashboard", query) + const { pools } = await cachedGraphQuery("platypus-finance", sdk.graph.modifyEndpoint('Bu5QPRWGnZB6NxU4S7kAKQZJpY4pHmAq3TV69V1W2Qqw'), query) console.log(pools) const tokensAndOwners = pools.map(i => i.assetsList.map(v => [v.token.id, v.id])).flat() return sumTokens2({ api, tokensAndOwners, blacklistedTokens }); diff --git a/projects/podsfinance/constants.js b/projects/podsfinance/constants.js index f9a95a182177..70cd0e2e3a3c 100644 --- a/projects/podsfinance/constants.js +++ b/projects/podsfinance/constants.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk"); const ADDRESSES = require('../helper/coreAssets.json') module.exports = { ADDRESS_ZERO: ADDRESSES.null, @@ -7,16 +8,16 @@ module.exports = { NETWORK_POLYGON: { id: 137, name: 'polygon', - subgraph: 'https://api.thegraph.com/subgraphs/name/pods-finance/pods-matic' + subgraph: sdk.graph.modifyEndpoint('5yQETkt77T9htftwDSW4WJpoGkPH9KBQzQLzPnuyZ8ti') }, NETWORK_MAINNET: { id: 1, name: 'ethereum', - subgraph: 'https://api.thegraph.com/subgraphs/name/pods-finance/pods' + subgraph: sdk.graph.modifyEndpoint('9qiAuWa5ryYeTj1gLy9BGiiVkfgkXnsN25wkYQSfyaws') }, NETWORK_ARBITRUM: { id: 42161, name: 'arbitrum', - subgraph: 'https://api.thegraph.com/subgraphs/name/pods-finance/pods-arbitrum' + subgraph: sdk.graph.modifyEndpoint('5Qz4mWABKaCfr9uGnteAAwmWmBAyQtRDYgB3ydU556HX') } } diff --git a/projects/pooltogether/v3.js b/projects/pooltogether/v3.js index 9d55942b04e7..2d8964857dcc 100644 --- a/projects/pooltogether/v3.js +++ b/projects/pooltogether/v3.js @@ -1,15 +1,16 @@ +const sdk = require("@defillama/sdk"); const { cachedGraphQuery } = require('../helper/cache') const abi = require('./abi.json') const GRAPH_URLS = { ethereum: [ - 'https://api.thegraph.com/subgraphs/name/pooltogether/pooltogether-v3_1_0', - 'https://api.thegraph.com/subgraphs/name/pooltogether/pooltogether-v3_3_2', - 'https://api.thegraph.com/subgraphs/name/pooltogether/pooltogether-v3_3_8', - 'https://api.thegraph.com/subgraphs/name/pooltogether/pooltogether-v3_4_3' + sdk.graph.modifyEndpoint('DpnLpjCKyyQ8TZnD2V6VNyx4JR7bGrCfGaLbrrsn5r7s'), + sdk.graph.modifyEndpoint('6SXRM2pyUiLKgNvXU6fiSF1E3dDDFGGAFiMurbZhZew8'), + sdk.graph.modifyEndpoint('6fBV3gC2fjdPsKvnmhi2SNzp74RYZj3tS1AiWFGHapyX'), + sdk.graph.modifyEndpoint('C12o8EA9X9EKjjDoxKGUiM9YniNT4RVCiV6jGuYWwwZX') ], - celo: ['https://api.thegraph.com/subgraphs/name/pooltogether/celo-v3_4_5'], - bsc: ['https://api.thegraph.com/subgraphs/name/pooltogether/bsc-v3_4_3'] + celo: [sdk.graph.modifyEndpoint('7RqWfG27PACLZEvSMGtcK87qnV1DJCQfYjNdqwHDQdTe')], + bsc: [sdk.graph.modifyEndpoint('9Qmsc7YBLy2sdbEAcGv8vkpaqdGm3YMYoqiWLCid64MN')] } const GRAPH_QUERY = ` query GET_POOLS { diff --git a/projects/prime-protocol/index.js b/projects/prime-protocol/index.js index 850504ce073a..a2d45b103b33 100644 --- a/projects/prime-protocol/index.js +++ b/projects/prime-protocol/index.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk"); const sdk = require('@defillama/sdk'); const { sumTokens2, } = require('../helper/unwrapLPs'); const { cachedGraphQuery } = require('../helper/cache'); @@ -17,7 +18,7 @@ const PRIME_SATELLITE_NETWORKS = { // filecoin: 314 }; -const primeSubgraphUrl = 'https://api.thegraph.com/subgraphs/name/prime-protocol/liquidity-incentives'; +const primeSubgraphUrl = sdk.graph.modifyEndpoint('6LrvPGTZeMZfEQh4p9DvDBBv4G8cjhLs4v3mdiUycERp'); const primeMarketsQuery = `{ markets { address chainId } diff --git a/projects/quickswap/index.js b/projects/quickswap/index.js index e3f0619628f7..fd961c2af723 100644 --- a/projects/quickswap/index.js +++ b/projects/quickswap/index.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk"); const ADDRESSES = require('../helper/coreAssets.json') const { getChainTvl } = require('../helper/getUniSubgraphTvl'); const { staking } = require('../helper/staking'); @@ -8,7 +9,7 @@ module.exports = { polygon:{ staking: staking("0x958d208Cdf087843e9AD98d23823d32E17d723A1", ADDRESSES.polygon.QUICK), tvl: getChainTvl({ - polygon: 'https://api.thegraph.com/subgraphs/name/sameepsi/quickswap06' + polygon: sdk.graph.modifyEndpoint('FUWdkXWpi8JyhAnhKL5pZcVshpxuaUQG8JHMDqNCxjPd') })('polygon') }, hallmarks:[ diff --git a/projects/ren/index.js b/projects/ren/index.js index 659535bdb408..e52debcd52bb 100644 --- a/projects/ren/index.js +++ b/projects/ren/index.js @@ -3,15 +3,15 @@ const { request, gql } = require("graphql-request"); const sdk = require("@defillama/sdk"); const { getTokenSupply } = require('../helper/solana') -const ethGraphUrl = "https://api.thegraph.com/subgraphs/name/renproject/renvm"; +const ethGraphUrl = sdk.graph.modifyEndpoint('AJaQdD8DUunuwHCbAsZk5h62AfyNG1etRtK9EcDH7gwH'); const bscGraphUrl = - "https://api.thegraph.com/subgraphs/name/renproject/renvm-binance-smart-chain"; + sdk.graph.modifyEndpoint('6UCMxzH5LPvZrLhcpSVrSDhoKRYJchvHM7vnTUo2bBp2'); const avalancheGraphUrl = - "https://api.thegraph.com/subgraphs/name/renproject/renvm-avalanche"; + sdk.graph.modifyEndpoint('GBRcEpUZTHMyjmtkPsHMYmHuPtcLFqnU5SPvpaLdfmau'); const fantomGraphUrl = - "https://api.thegraph.com/subgraphs/name/renproject/renvm-fantom"; + sdk.graph.modifyEndpoint('2TV9sKK7fLvfsbnUox6irt3XbiHAzw1fvbh9j8vnBXmH'); const polygonGraphUrl = - "https://api.thegraph.com/subgraphs/name/renproject/renvm-polygon"; + sdk.graph.modifyEndpoint('GQCGcDW16JfawMXegTemUte8PPyJQVvtF6kACvMYwX8V'); const graphQuery = gql` { assets { diff --git a/projects/rift-finance/networks.js b/projects/rift-finance/networks.js index c86af1ab9f9c..4b2c0cbee465 100644 --- a/projects/rift-finance/networks.js +++ b/projects/rift-finance/networks.js @@ -1,14 +1,15 @@ +const sdk = require("@defillama/sdk"); module.exports = { aurora: { coreAddress: "0x40A01A4064b690cA33FA52d315ec02015eF5287E", startBlock: 58983267, graphUrl: - "https://api.thegraph.com/subgraphs/name/recursive-research/rift-subgraph-aurora", + sdk.graph.modifyEndpoint('GkqMC7XyPQFceCjT7rdqc62nzfF5WsVCn6HA9q17VBW'), }, ethereum: { coreAddress: "0x5D7e616B2c0bf268494A482e315a60814F97dBC8", startBlock: 14845882, graphUrl: - "https://api.thegraph.com/subgraphs/name/recursive-research/rift-subgraph", + sdk.graph.modifyEndpoint('44q7UpeVu33BTDwHd1iHJnEYXwcF9NM6HRd5oSVdLFDQ'), }, }; diff --git a/projects/rubicon/index.js b/projects/rubicon/index.js index 1a4c4844056a..88f57564a402 100644 --- a/projects/rubicon/index.js +++ b/projects/rubicon/index.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk"); const { cachedGraphQuery } = require('../helper/cache') const { sumTokens2 } = require('../helper/unwrapLPs') @@ -17,7 +18,7 @@ module.exports = { const config = { optimism: { - endpoint: 'https://api.thegraph.com/subgraphs/name/denverbaumgartner/rubiconmetricsoptimism', + endpoint: sdk.graph.modifyEndpoint('AUcAkUd4sJutFD3hYQfvB6uvXrEdYP26qiZwZ5qyrgTw'), owners: [ RUBICON_MARKET_OPTIMISM, // Rubicon Market "0xB0bE5d911E3BD4Ee2A8706cF1fAc8d767A550497", // bathETH @@ -30,7 +31,7 @@ const config = { ] }, arbitrum: { - endpoint: 'https://api.thegraph.com/subgraphs/name/jossduff/rubiconmetricsarbitrum', + endpoint: sdk.graph.modifyEndpoint('B4cTJXyWHMLkxAcpLGK7dJfArJdrbyWukCoCLPDT1f7n'), owners: [RUBICON_MARKET_ARBITRUM,] } } diff --git a/projects/sablier-v2/index.js b/projects/sablier-v2/index.js index 547f0c150418..63ee4894707c 100644 --- a/projects/sablier-v2/index.js +++ b/projects/sablier-v2/index.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk"); const { isWhitelistedToken } = require('../helper/streamingHelper') const { cachedGraphQuery } = require('../helper/cache') @@ -33,11 +34,11 @@ const config = { ethereum: { endpoints: ['5EgaXheiBXZBCkepyGUYAu8pN31Dkbh7bpGtnLPqaT5m'], }, arbitrum: { endpoints: ['AR77w8PwmkAG7c9DJSsfW6yTrC5UdvdQ1Hz5ZTCuaUWz'], }, bsc: { endpoints: ['BVyi15zcH5eUg5PPKfRDDesezMezh6cAkn8LPvh7MVAF'], }, - xdai: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-gnosis'], }, - optimism: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-optimism'], }, + xdai: { endpoints: [sdk.graph.modifyEndpoint('EXhNLbhCbsewJPx4jx5tutNXpxwdgng2kmX1J7w1bFyu')], }, + optimism: { endpoints: [sdk.graph.modifyEndpoint('6e6Dvs1yDpsWDDREZRqxGi54SVdvTNzUdKpKJxniKVrp')], }, polygon: { endpoints: ['J8XJaFtxcz7xowzVJ5LwZhi35N5Lbtwfrt4sea6G1ysJ'], }, - avax: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-avalanche'], }, - base: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-base'], }, + avax: { endpoints: [sdk.graph.modifyEndpoint('FdVwZuMV43yCb1nPmjnLQwmzS58wvKuLMPzcZ4UWgWAc')], }, + base: { endpoints: [sdk.graph.modifyEndpoint('HS6B8Wi9ZY7D9bjHEuJwDqHa5eCMX5d6H59YyGVnQ5QP')], }, blast: { endpoints: ['https://api.studio.thegraph.com/query/57079/sablier-v2-blast/version/latest'], }, } diff --git a/projects/sentiment/index.js b/projects/sentiment/index.js index e4ab49ad0add..7e6184be993f 100644 --- a/projects/sentiment/index.js +++ b/projects/sentiment/index.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk"); const ADDRESSES = require('../helper/coreAssets.json') const { cachedGraphQuery } = require('../helper/cache') @@ -8,7 +9,7 @@ async function tvl(api) { api.addTokens(assets, totalAssets) // const userAccounts = await api.call({ target: "0x17b07cfbab33c0024040e7c299f8048f4a49679b", abi: "address[]:getAllAccounts", }) - const data = await cachedGraphQuery('sentiment', 'https://api.thegraph.com/subgraphs/name/r0ohafza/sentiment', query, { fetchById: true, }) + const data = await cachedGraphQuery('sentiment', sdk.graph.modifyEndpoint('H4hxkyy4kLmFsZZCatedvHpWT1ZvqKcfv2FFYXLxDm9W'), query, { fetchById: true, }) const userAccounts = data.map(i => i.id) const [equity, borrows] = await Promise.all([ api.multiCall({ target: "0xc0ac97A0eA320Aa1E32e9DEd16fb580Ef3C078Da", calls: userAccounts, abi: "function getBalance(address account) view returns (uint256)", permitFailure: true, }), diff --git a/projects/soulswap/underworld-lending.js b/projects/soulswap/underworld-lending.js index eead9b86937c..b1c9f3f95500 100644 --- a/projects/soulswap/underworld-lending.js +++ b/projects/soulswap/underworld-lending.js @@ -4,8 +4,8 @@ const { BigNumber } = require('bignumber.js'); // https://thegraph.com/hosted-service/subgraph/soulswapfantom/coffinbox const graphUrls = { - 'fantom': 'https://api.thegraph.com/subgraphs/name/soulswapfinance/fantom-coffinbox', - 'avax': 'https://api.thegraph.com/subgraphs/name/soulswapfinance/coffinbox-avalanche', + 'fantom': sdk.graph.modifyEndpoint('FhS8cRWsTPZwXfmn7b8YGvKii2h2ghr2v7ah5T8oiDmo'), + 'avax': sdk.graph.modifyEndpoint('6WonmxWbw3MSVXVR5P4VhC8jWBEG5RkipWzxhAA67hoP'), } const coffinboxQuery = gql` diff --git a/projects/steer/index.js b/projects/steer/index.js index 39ef515ba7fa..615bdc660aba 100644 --- a/projects/steer/index.js +++ b/projects/steer/index.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk"); const { cachedGraphQuery } = require('../helper/cache') const { stakings } = require("../helper/staking"); @@ -5,25 +6,25 @@ const { stakings } = require("../helper/staking"); const supportedChains = [ { name: 'Polygon', - subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/steerprotocol/steer-protocol-polygon', + subgraphEndpoint: sdk.graph.modifyEndpoint('uQxLz6EarmJcr2ymRRmTnrRPi8cCqas4XcPQb71HBvw'), chainId: 137, identifier: 'polygon' }, { name: 'Arbitrum', - subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/steerprotocol/steer-protocol-arbitrum', + subgraphEndpoint: sdk.graph.modifyEndpoint('HVC4Br5yprs3iK6wF8YVJXy4QZWBNXTCFp8LPe3UpcD4'), chainId: 42161, identifier: 'arbitrum' }, { name: 'Optimism', - subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/steerprotocol/steer-protocol-optimism', + subgraphEndpoint: sdk.graph.modifyEndpoint('GgW1EwNARL3dyo3acQ3VhraQQ66MHT7QnYuGcQc5geDG'), chainId: 10, identifier: 'optimism' }, { name: 'Binance', - subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/steerprotocol/steer-protocol-bsc', + subgraphEndpoint: sdk.graph.modifyEndpoint('GLDP56fPGDz3MtmhtfTkz5CxWiqiNLACVrsJ9RqQeL4U'), chainId: 56, identifier: 'bsc' }, @@ -35,7 +36,7 @@ const supportedChains = [ }, { name: 'Avalanche', - subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/steerprotocol/steer-protocol-avalanche', + subgraphEndpoint: sdk.graph.modifyEndpoint('GZotTj3rQJ8ZqVyodtK8TcnKcUxMgeF7mCJHGPYbu8dA'), chainId: 43114, identifier: 'avax' }, @@ -101,7 +102,7 @@ const supportedChains = [ }, { name: 'Fantom', - subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/rakeshbhatt10/steer-protocol-fantom-test', + subgraphEndpoint: sdk.graph.modifyEndpoint('8k6x2Uho5PEqjxHx5SeSE334MEaxSZqMZhH6p5XYvqjM'), chainId: 250, identifier: 'fantom' }, @@ -143,7 +144,7 @@ const supportedChains = [ }, // { // name: 'Celo', - // subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/rakeshbhatt10/steer-test-celo', + // subgraphEndpoint: sdk.graph.modifyEndpoint('DDwt4z55qLHPNmasiQXFH3nRjgCBrBhsiz3uEqKRJoa'), // chainId: 42220, // identifier: 'celo' // }, diff --git a/projects/sudoswap/index.js b/projects/sudoswap/index.js index 59c1aa00f3e5..c51821cee7fc 100644 --- a/projects/sudoswap/index.js +++ b/projects/sudoswap/index.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk"); const { graphFetchById, } = require('../helper/cache') const { ART_BLOCKS, sumArtBlocks } = require('../helper/nft') const sdk = require('@defillama/sdk') @@ -34,7 +35,7 @@ module.exports = { ethereum: { tvl: async (api) => { const data = await graphFetchById({ - endpoint: 'https://api.thegraph.com/subgraphs/name/zeframlou/sudoswap', + endpoint: sdk.graph.modifyEndpoint('5ZEPsiros7UhV5noPBHHkzy1rfSBFRP2d2ghHZHHCugd'), query, api, options: { diff --git a/projects/superfluid.js b/projects/superfluid.js index 1e3099bdeafa..95f64ca96e55 100644 --- a/projects/superfluid.js +++ b/projects/superfluid.js @@ -6,8 +6,8 @@ const { transformBalances } = require('./helper/portedTokens') // Superfluid Supertokens can be retrieved using GraphQl API - cannot use block number to retrieve historical data at the moment though // TheGraph URL before being deprecated, before 2021-12-23 -// const polygonGraphUrl = 'https://api.thegraph.com/subgraphs/name/superfluid-finance/superfluid-matic' -// const xdaiGraphUrl = 'https://api.thegraph.com/subgraphs/name/superfluid-finance/superfluid-xdai' +// const polygonGraphUrl = sdk.graph.modifyEndpoint('BoiJR4mfVpVthWjTcansrCUFCjKY9MfDxgTfzkf4YpAN') +// const xdaiGraphUrl = sdk.graph.modifyEndpoint('A3LhWnFQR13mxQPFGUZML9vyBrLLKhLJBhfFsrdShxBU') const supertokensQuery = ` query get_supertokens($block: Int) { @@ -99,12 +99,12 @@ async function retrieveSupertokensBalances(chain, block, isVesting, ts, graphUrl } const config = { - avax: { graph: 'https://api.thegraph.com/subgraphs/name/superfluid-finance/protocol-v1-avalanche-c', }, - polygon: { graph: 'https://api.thegraph.com/subgraphs/name/superfluid-finance/protocol-v1-matic', }, - xdai: { graph: 'https://api.thegraph.com/subgraphs/name/superfluid-finance/protocol-v1-xdai', }, - optimism: { graph: 'https://api.thegraph.com/subgraphs/name/superfluid-finance/protocol-v1-optimism-mainnet', }, - arbitrum: { graph: 'https://api.thegraph.com/subgraphs/name/superfluid-finance/protocol-v1-arbitrum-one', }, - bsc: { graph: 'https://api.thegraph.com/subgraphs/name/superfluid-finance/protocol-v1-bsc-mainnet', }, + avax: { graph: sdk.graph.modifyEndpoint('CtYR3ng4ED64HVEzDo49eKQgEf78RERiC8mDUtwLxda'), }, + polygon: { graph: sdk.graph.modifyEndpoint('7d9iBvDoM43SZiZhRR2pnpW8z3ujSEy9nC6RuqnufRU9'), }, + xdai: { graph: sdk.graph.modifyEndpoint('DE6fybqxjXLNvqGpd4QLAD92kAZNEmha1ZfKvS2qM376'), }, + optimism: { graph: sdk.graph.modifyEndpoint('S48f1C3KhNB2YbEMDxYHPzZ3FYt27fQZdruKfSTeEdZ'), }, + arbitrum: { graph: sdk.graph.modifyEndpoint('ES5GNHtiaqP6jFydhUyD9R4RackYrbGr6LEL1ZDauktd'), }, + bsc: { graph: sdk.graph.modifyEndpoint('FzYUiDH968QKbjURULGE5Pwh1ZRvcBNjDcut5YSiMYnj'), }, } module.exports = { diff --git a/projects/sushiswap-bentobox/helper.js b/projects/sushiswap-bentobox/helper.js index 36c37f5e9041..eba23cee887c 100644 --- a/projects/sushiswap-bentobox/helper.js +++ b/projects/sushiswap-bentobox/helper.js @@ -24,23 +24,23 @@ const toAmountAbi = const bentoSubgraphs = { ethereum: - "https://api.thegraph.com/subgraphs/name/sushiswap/bentobox-ethereum", - polygon: "https://api.thegraph.com/subgraphs/name/sushiswap/bentobox-polygon", - fantom: "https://api.thegraph.com/subgraphs/name/sushiswap/bentobox-fantom", - bsc: "https://api.thegraph.com/subgraphs/name/sushiswap/bentobox-bsc", - avax: "https://api.thegraph.com/subgraphs/name/sushiswap/bentobox-avalanche", + sdk.graph.modifyEndpoint('8HYeoDopVqqvb5RJEV2TtSzFsouYPz8cownnG3mbhiGy'), + polygon: sdk.graph.modifyEndpoint('6kJg5kFoQY8B8Ge2hqswHMqZDcmsR1TLUUz7AKov69fy'), + fantom: sdk.graph.modifyEndpoint('2KqXx6dGw7T4mZeGKyzQ9m9iyuCMjPR8PntLB9Gn9AEK'), + bsc: sdk.graph.modifyEndpoint('BggyE3r5snDsjx19jgZcbiBH7cbtrkpjvyGLFHMdXekd'), + avax: sdk.graph.modifyEndpoint('EhYaJodF1WQjKgxx1ZC63goeCwp5swD4AQRdaKXBm2xk'), arbitrum: - "https://api.thegraph.com/subgraphs/name/sushiswap/bentobox-arbitrum", + sdk.graph.modifyEndpoint('JZFyMKR4jnsFQ58q7dT6nbXenTzNgE176zTejc6Gf8Z'), optimism: - "https://api.thegraph.com/subgraphs/name/sushiswap/bentobox-optimism", - xdai: "https://api.thegraph.com/subgraphs/name/sushiswap/bentobox-gnosis", - harmony: "https://api.thegraph.com/subgraphs/name/sushiswap/bentobox-harmony", + sdk.graph.modifyEndpoint('8b4Hy4Kn7jCNAf9JFrqHb24LsqmapG4HrAsCrwdJf9Nu'), + xdai: sdk.graph.modifyEndpoint('9jn9kA6SKCNxXQSqb93zZPLdLaru4FeZBwLNWAK4nfZ2'), + harmony: sdk.graph.modifyEndpoint('Bioj7N3Rf2n7iBq9PVoaMie3WiuzPze9NMi7aSye7LFc'), moonbeam: - "https://api.thegraph.com/subgraphs/name/sushiswap/bentobox-moonbeam", + sdk.graph.modifyEndpoint('7wA5gqWNP4E1dPWBsTYvz5eQSDbtYDFgyU5BGdHr2UKp'), moonriver: - "https://api.thegraph.com/subgraphs/name/sushiswap/bentobox-moonriver", + sdk.graph.modifyEndpoint('73XEV6UQKpPSJn68WZBAYTwALcZtFJkFYn58ZoZUb7tn'), //metis: "", - celo: "https://api.thegraph.com/subgraphs/name/sushiswap/bentobox-celo", + celo: sdk.graph.modifyEndpoint('5DwkvjxPGVFFaWEMM68g1yztDdhCgJEYAxS6FuhkajzR'), //kava: "", }; @@ -60,23 +60,23 @@ const bentoQuery = gql` const furoSubgraphs = { ethereum: - "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-ethereum", + sdk.graph.modifyEndpoint('D8vYJpKN5SEHUkUWKSuorsL6FRt7hAQMnywnC4e93ygf'), polygon: - "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-polygon", - fantom: "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-fantom", - bsc: "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-bsc", - avax: "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-avalanche", + sdk.graph.modifyEndpoint('4KsDNsyJjKX6bjwVNJQmJ7Dm3wovYXSX37UR39rNaMX4'), + fantom: sdk.graph.modifyEndpoint('E98zSR5UZBGBgQe2SSLZ5R6yj5GPqKDJcQJNDHTeV3cS'), + bsc: sdk.graph.modifyEndpoint('2wBYezghRA3hEJLQB4njUZGDNxCdU3u2gsLP5yVvBqKk'), + avax: sdk.graph.modifyEndpoint('8LVoX3JPEVAak8T8GoEfdJudMoP2bsGwd9tszJxo3Rnx'), arbitrum: - "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-arbitrum", + sdk.graph.modifyEndpoint('8eHhPeKDr646JH5KUBBcabAJzkWmLfu6pqBtpXQHa37F'), optimism: - "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-optimism", - xdai: "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-gnosis", + sdk.graph.modifyEndpoint('8KnsmppMf9k6Qvyixxwmny7dYugTV7XT4htHTfyq3d69'), + xdai: sdk.graph.modifyEndpoint('5ToxB5xubMh9osdEDeX98JBAyzUVwkReGXAT1CzQhZCB'), harmony: - "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-harmony", + sdk.graph.modifyEndpoint('9D9C3ppoDE1zuZk5adznngKomLYS8NnC9zxniSS8vzgH'), moonbeam: - "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-moonbeam", + sdk.graph.modifyEndpoint('HJxpcsmaPV3L6PsqGFBHLczeMnL7bEgmL1D65edGx8pf'), moonriver: - "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-moonriver", + sdk.graph.modifyEndpoint('9ZqdKjfu7o9dX1RThXHDV9EqMn5CTvgpsPKKbpANg8yC'), }; const furoQuery = gql` @@ -97,11 +97,11 @@ const furoQuery = gql` `; const kashiSubgraphs = { - ethereum: "https://api.thegraph.com/subgraphs/name/sushi-labs/kashi-ethereum", - polygon: "https://api.thegraph.com/subgraphs/name/sushi-labs/kashi-polygon", - arbitrum: "https://api.thegraph.com/subgraphs/name/sushi-labs/kashi-arbitrum", - bsc: "https://api.thegraph.com/subgraphs/name/sushi-labs/kashi-bsc", - avax: "https://api.thegraph.com/subgraphs/name/sushiswap/kashi-avalanche", + ethereum: sdk.graph.modifyEndpoint('6Kf5cPeXUMVzfGCtzBnSxDU849w2YM2o9afn1uiPpy2m'), + polygon: sdk.graph.modifyEndpoint('5F3eB4Cm5mxorArsyrbs2a1TDxctmk3znpDZ4LEzqrBJ'), + arbitrum: sdk.graph.modifyEndpoint('G3rbmaF7w2ZLQjZgGoi12BzPeL9z4MTW662iVyjYmtiX'), + bsc: sdk.graph.modifyEndpoint('D1TGHRKx2Q54ce2goyt9hbtKNuT94FDBsuPwtGg5EzRw'), + avax: sdk.graph.modifyEndpoint('BHeJByyVoNuVtqufK3Nk7YYmFkBs43boYpKv8z6hQ5Q1'), }; const kashiQuery = gql` @@ -124,15 +124,15 @@ const kashiQuery = gql` const tridentSubgraphs = { polygon: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-polygon", - optimism: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-optimism", + optimism: sdk.graph.modifyEndpoint('FEgRuH9zeTRMZgpVv5YavoFEcisoK6KHk3zgQRRBqt51'), kava: "https://pvt.graph.kava.io/subgraphs/name/sushi-v2/trident-kava", metis: "https://andromeda.thegraph.metis.io/subgraphs/name/sushi-v2/trident-metis", bittorrent: "https://subgraphs.sushi.com/subgraphs/name/sushi-v2/trident-bttc", - arbitrum: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-arbitrum", - bsc: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-bsc", - avax: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-avalanche", + arbitrum: sdk.graph.modifyEndpoint('4x8H6ZoGfJykyZqAe2Kx2g5afsp17S9pn8GroRkpezhx'), + bsc: sdk.graph.modifyEndpoint('9TQaBw1sU3wi2kdevuygKhfhjP3STnwBe1jUnKxmNhmn'), + avax: sdk.graph.modifyEndpoint('NNTV3MgqSGtHMBGdMVLXzzDbKDKmsY87k3PsQ2knmC1'), }; const tridentQuery = gql` diff --git a/projects/sushiswap-furo/furo.js b/projects/sushiswap-furo/furo.js index cfecc8d7bd27..a299c787c64b 100644 --- a/projects/sushiswap-furo/furo.js +++ b/projects/sushiswap-furo/furo.js @@ -5,23 +5,23 @@ const { isWhitelistedToken } = require('../helper/streamingHelper') const graphUrls = { ethereum: - "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-ethereum", + sdk.graph.modifyEndpoint('D8vYJpKN5SEHUkUWKSuorsL6FRt7hAQMnywnC4e93ygf'), polygon: - "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-polygon", - fantom: "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-fantom", - bsc: "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-bsc", - avax: "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-avalanche", + sdk.graph.modifyEndpoint('4KsDNsyJjKX6bjwVNJQmJ7Dm3wovYXSX37UR39rNaMX4'), + fantom: sdk.graph.modifyEndpoint('E98zSR5UZBGBgQe2SSLZ5R6yj5GPqKDJcQJNDHTeV3cS'), + bsc: sdk.graph.modifyEndpoint('2wBYezghRA3hEJLQB4njUZGDNxCdU3u2gsLP5yVvBqKk'), + avax: sdk.graph.modifyEndpoint('8LVoX3JPEVAak8T8GoEfdJudMoP2bsGwd9tszJxo3Rnx'), arbitrum: - "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-arbitrum", + sdk.graph.modifyEndpoint('8eHhPeKDr646JH5KUBBcabAJzkWmLfu6pqBtpXQHa37F'), optimism: - "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-optimism", - xdai: "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-gnosis", + sdk.graph.modifyEndpoint('8KnsmppMf9k6Qvyixxwmny7dYugTV7XT4htHTfyq3d69'), + xdai: sdk.graph.modifyEndpoint('5ToxB5xubMh9osdEDeX98JBAyzUVwkReGXAT1CzQhZCB'), harmony: - "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-harmony", + sdk.graph.modifyEndpoint('9D9C3ppoDE1zuZk5adznngKomLYS8NnC9zxniSS8vzgH'), moonbeam: - "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-moonbeam", + sdk.graph.modifyEndpoint('HJxpcsmaPV3L6PsqGFBHLczeMnL7bEgmL1D65edGx8pf'), moonriver: - "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-moonriver", + sdk.graph.modifyEndpoint('9ZqdKjfu7o9dX1RThXHDV9EqMn5CTvgpsPKKbpANg8yC'), }; const bentoboxes = { diff --git a/projects/sushiswap-kashi/kashi-lending.js b/projects/sushiswap-kashi/kashi-lending.js index 2b1498f35af0..5fce7a573002 100644 --- a/projects/sushiswap-kashi/kashi-lending.js +++ b/projects/sushiswap-kashi/kashi-lending.js @@ -1,12 +1,13 @@ +const sdk = require("@defillama/sdk"); const ADDRESSES = require('../helper/coreAssets.json') const { blockQuery } = require("../helper/http"); const graphUrls = { - ethereum: "https://api.thegraph.com/subgraphs/name/sushi-labs/kashi-ethereum", - polygon: "https://api.thegraph.com/subgraphs/name/sushi-labs/kashi-polygon", - arbitrum: "https://api.thegraph.com/subgraphs/name/sushi-labs/kashi-arbitrum", - bsc: "https://api.thegraph.com/subgraphs/name/sushi-labs/kashi-bsc", - avax: "https://api.thegraph.com/subgraphs/name/sushiswap/kashi-avalanche", + ethereum: sdk.graph.modifyEndpoint('6Kf5cPeXUMVzfGCtzBnSxDU849w2YM2o9afn1uiPpy2m'), + polygon: sdk.graph.modifyEndpoint('5F3eB4Cm5mxorArsyrbs2a1TDxctmk3znpDZ4LEzqrBJ'), + arbitrum: sdk.graph.modifyEndpoint('G3rbmaF7w2ZLQjZgGoi12BzPeL9z4MTW662iVyjYmtiX'), + bsc: sdk.graph.modifyEndpoint('D1TGHRKx2Q54ce2goyt9hbtKNuT94FDBsuPwtGg5EzRw'), + avax: sdk.graph.modifyEndpoint('BHeJByyVoNuVtqufK3Nk7YYmFkBs43boYpKv8z6hQ5Q1'), }; const bentoboxes = { diff --git a/projects/sushiswap-trident/trident.js b/projects/sushiswap-trident/trident.js index ce68092fa4f5..d30085dd2b7d 100644 --- a/projects/sushiswap-trident/trident.js +++ b/projects/sushiswap-trident/trident.js @@ -1,18 +1,19 @@ +const sdk = require("@defillama/sdk"); const { blockQuery } = require('../helper/http') const graphUrls = { polygon: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-polygon", polygonOldRouter: - "https://api.thegraph.com/subgraphs/name/sushi-0m/trident-polygon", - optimism: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-optimism", + sdk.graph.modifyEndpoint('5LBvcUQthQDZTMe6cyJ7DbeokFkYeVpYYBZruHPUjMG5'), + optimism: sdk.graph.modifyEndpoint('FEgRuH9zeTRMZgpVv5YavoFEcisoK6KHk3zgQRRBqt51'), kava: "https://pvt.graph.kava.io/subgraphs/name/sushi-v2/trident-kava", metis: "https://andromeda.thegraph.metis.io/subgraphs/name/sushi-v2/trident-metis", bittorrent: "https://subgraphs.sushi.com/subgraphs/name/sushi-v2/trident-bttc", - arbitrum: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-arbitrum", - bsc: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-bsc", - avax: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-avalanche", + arbitrum: sdk.graph.modifyEndpoint('4x8H6ZoGfJykyZqAe2Kx2g5afsp17S9pn8GroRkpezhx'), + bsc: sdk.graph.modifyEndpoint('9TQaBw1sU3wi2kdevuygKhfhjP3STnwBe1jUnKxmNhmn'), + avax: sdk.graph.modifyEndpoint('NNTV3MgqSGtHMBGdMVLXzzDbKDKmsY87k3PsQ2knmC1'), }; const tridentQueryWithBlock = ` diff --git a/projects/sushiswap/api.js b/projects/sushiswap/api.js index 2c3e0c53af6b..4f9445c4842b 100644 --- a/projects/sushiswap/api.js +++ b/projects/sushiswap/api.js @@ -1,8 +1,9 @@ +const sdk = require("@defillama/sdk"); const { toUSDTBalances } = require('../helper/balances'); const { blockQuery } = require('../helper/http') const { getUniTVL } = require("../helper/unknownTokens") -const graphUrl = 'https://api.thegraph.com/subgraphs/name/zippoxer/sushiswap-subgraph-fork' +const graphUrl = sdk.graph.modifyEndpoint('8TXwDMLemg6p4eicVuixKk7Mw9aNxpod1PQQFdSvFj6H') const graphQuery = ` query get_tvl($block: Int) { uniswapFactory( diff --git a/projects/swaap-earn/index.js b/projects/swaap-earn/index.js index 1cff804f379b..175ecf3a11c9 100644 --- a/projects/swaap-earn/index.js +++ b/projects/swaap-earn/index.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk"); const { cachedGraphQuery } = require('../helper/cache') const query = `query FundsTVL{ funds { id } }` @@ -6,7 +7,7 @@ module.exports = { } const config = { - arbitrum: { endpoint: 'https://api.thegraph.com/subgraphs/name/borelien/swaap-earn-arbitrum-test', }, + arbitrum: { endpoint: sdk.graph.modifyEndpoint('DHZvo3KRhryqHH9zj9sK8n9sjXvg3ddmDoVdLZcZQMJg'), }, } Object.keys(config).forEach(chain => { diff --git a/projects/swaap/index.js b/projects/swaap/index.js index 83cb7a77a245..6415219340e3 100644 --- a/projects/swaap/index.js +++ b/projects/swaap/index.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk"); const { sumTokens2 } = require('../helper/unwrapLPs') const { cachedGraphQuery } = require('../helper/cache') @@ -6,7 +7,7 @@ const configV1 = { startBlock: 29520285, blockDelay: 30, theGraph: { - endpoint: 'https://api.thegraph.com/subgraphs/name/swaap-labs/swaapv1', + endpoint: sdk.graph.modifyEndpoint('A1ibaGVUkqdLeBG7VeeSB8jm9QNmS8phSz8iooXR8puv'), query: `pools: pools(orderBy: liquidity, orderDirection: desc) { id tokens { diff --git a/projects/synthetix/api.js b/projects/synthetix/api.js index 1850690eed1c..4912de250c4f 100644 --- a/projects/synthetix/api.js +++ b/projects/synthetix/api.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk"); const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const BigNumber = require('bignumber.js'); @@ -27,7 +28,7 @@ const synthetixs = { } const snxGraphEndpoints = { ethereum: 'https://api.thegraph.com/subgraphs/name/0xngmi/snx-lite-ethereum', - optimism: 'https://api.thegraph.com/subgraphs/name/0xngmi/snx-lite-optimism-regenesis' + optimism: sdk.graph.modifyEndpoint('5NQi9n4ztd8M6EEDFKA6gwcCnbLdmzZRymiDbPkbjEWN') } const ethStaking = "0xc1aae9d18bbe386b102435a8632c8063d31e747c" const weth = ADDRESSES.ethereum.WETH diff --git a/projects/synthetix/apiCache.js b/projects/synthetix/apiCache.js index 735e61a8fd12..c9a52f1ef5af 100644 --- a/projects/synthetix/apiCache.js +++ b/projects/synthetix/apiCache.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk"); const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const BigNumber = require('bignumber.js'); @@ -30,7 +31,7 @@ const synthetixs = { } const snxGraphEndpoints = { ethereum: 'https://api.thegraph.com/subgraphs/name/0xngmi/snx-lite-ethereum', - optimism: 'https://api.thegraph.com/subgraphs/name/0xngmi/snx-lite-optimism-regenesis' + optimism: sdk.graph.modifyEndpoint('5NQi9n4ztd8M6EEDFKA6gwcCnbLdmzZRymiDbPkbjEWN') } const ethStaking = "0xc1aae9d18bbe386b102435a8632c8063d31e747c" const weth = ADDRESSES.ethereum.WETH diff --git a/projects/timeswap/index.js b/projects/timeswap/index.js index 19acc60107bd..45b9d2f993bb 100644 --- a/projects/timeswap/index.js +++ b/projects/timeswap/index.js @@ -1,9 +1,10 @@ +const sdk = require("@defillama/sdk"); const { sumTokens2 } = require('../helper/unwrapLPs') const { cachedGraphQuery } = require('../helper/cache') const GRAPH_URLS = { polygon: - "https://api.thegraph.com/subgraphs/name/timeswap-labs/timeswap-defi-llama", + sdk.graph.modifyEndpoint('CjoTTVotweY5YZYjGbskVMZvJi8oD6urLnP1N7rWVFun'), }; function chainTvl(chain) { diff --git a/projects/unbound/index.js b/projects/unbound/index.js index be951d9483e3..fa320ce92aa8 100644 --- a/projects/unbound/index.js +++ b/projects/unbound/index.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk"); const { GraphQLClient, gql } = require('graphql-request') const { staking } = require("../helper/staking"); @@ -10,7 +11,7 @@ const UNB_POLY = '0xD81F558b71A5323e433729009D55159955F8A7f9' async function ethTvl() { - var endpoint = 'https://api.thegraph.com/subgraphs/name/unbound-finance/unbound' + var endpoint = sdk.graph.modifyEndpoint('8hYGnnqzaQ98ikvhi9uZ5GRmYjd7C2ykopeNpbA3DXUh') var graphQLClient = new GraphQLClient(endpoint) var query = gql` @@ -40,7 +41,7 @@ async function ethTvl() { } async function polyTvl() { - var endpoint = 'https://api.thegraph.com/subgraphs/name/unbound-finance/unbound-polygon' + var endpoint = sdk.graph.modifyEndpoint('EtpUNR2s35iZNRGfQ5vqCSayGf72THHd1duUtkxKreGU') var graphQLClient = new GraphQLClient(endpoint) var query = gql` diff --git a/projects/unifarm/helper.js b/projects/unifarm/helper.js index c15e19c096c3..7cc92129724c 100644 --- a/projects/unifarm/helper.js +++ b/projects/unifarm/helper.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk"); const { cachedGraphQuery } = require('../helper/cache') const { graphQuery, } = require('../helper/http') const { sleep, log } = require('../helper/utils') @@ -78,9 +79,9 @@ query MyQuery { `; const v2EndPoints = { - ethereum: "https://api.thegraph.com/subgraphs/name/themohitmadan/unifarm-eth", - polygon: "https://api.thegraph.com/subgraphs/name/themohitmadan/unifarm-polygon", - bsc: "https://api.thegraph.com/subgraphs/name/themohitmadan/unifarm-bsc", + ethereum: sdk.graph.modifyEndpoint('Cquw1hbmvNrSvUjaqoRhu9nWv7AX1Mz2gEb9sapYdMA5'), + polygon: sdk.graph.modifyEndpoint('Ami8CcwigwYViJsUrwqK8DWwDPtFVAKbeYfii6ANahax'), + bsc: sdk.graph.modifyEndpoint('EsA5LyABgi7ibZJGNr5PQsQ2L8QDPZxNdDvd5qPs5CJj'), } const getV1Calls = async (chain) => { diff --git a/projects/vela-exchange/index.js b/projects/vela-exchange/index.js index 89124b093991..e7652239c761 100644 --- a/projects/vela-exchange/index.js +++ b/projects/vela-exchange/index.js @@ -1,11 +1,12 @@ +const sdk = require("@defillama/sdk"); const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require("../helper/staking") const { graphQuery } = require('../helper/http') const VELA = '0x088cd8f5eF3652623c22D48b1605DCfE860Cd704' -const arbitrumEndpoint = "https://api.thegraph.com/subgraphs/name/velaexchange/vela-exchange-official" -const baseEndpoint = "https://api.thegraph.com/subgraphs/name/velaexchange/vela-exchange-official-base" +const arbitrumEndpoint = sdk.graph.modifyEndpoint('6H9PEiNPZgwXfpbijjesZh96LFBzUvkHmEutMoYQ9fvp') +const baseEndpoint = sdk.graph.modifyEndpoint('2qsbZ4X5TJM7NupC2eRJv167kBDFCDBd37KnK7PQtdga') async function staking_arbitrum_(api) { const query = ` diff --git a/projects/venus-isolated-pools/index.js b/projects/venus-isolated-pools/index.js index d3fb595a04cc..3d8b21c4d7b1 100644 --- a/projects/venus-isolated-pools/index.js +++ b/projects/venus-isolated-pools/index.js @@ -1,13 +1,14 @@ +const sdk = require("@defillama/sdk"); const { cachedGraphQuery } = require('../helper/cache') const sdk = require('@defillama/sdk') const { compoundExports2 } = require('../helper/compound') const config = { bsc: { - endpoint: 'https://api.thegraph.com/subgraphs/name/venusprotocol/venus-isolated-pools', + endpoint: sdk.graph.modifyEndpoint('H2a3D64RV4NNxyJqx9jVFQRBpQRzD6zNZjLDotgdCrTC'), corePools: ['0xfd36e2c2a6789db23113685031d7f16329158384'], }, ethereum: { - endpoint: 'https://api.thegraph.com/subgraphs/name/venusprotocol/venus-isolated-pools-ethereum', + endpoint: sdk.graph.modifyEndpoint('Htf6Hh1qgkvxQxqbcv4Jp5AatsaiY5dNLVcySkpCaxQ8'), corePools: ['0x67aA3eCc5831a65A5Ba7be76BED3B5dc7DB60796'], } } diff --git a/projects/zksynth/index.js b/projects/zksynth/index.js index cb3cfa072475..e9098e0d099f 100644 --- a/projects/zksynth/index.js +++ b/projects/zksynth/index.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk"); const { cachedGraphQuery } = require('../helper/cache') const { sumTokens2 } = require('../helper/unwrapLPs') @@ -11,7 +12,7 @@ const query = `{ }` async function tvl(api) { - const { pools } = await cachedGraphQuery('zksynth', 'https://api.thegraph.com/subgraphs/name/prasad-kumkar/zksynth-mainnet', query) + const { pools } = await cachedGraphQuery('zksynth', sdk.graph.modifyEndpoint('CWgPgHm4zz4pijQaEsi2oniuzvdwqasBczTgBRMgg1EL'), query) const tokensAndOwners = pools.map(i => i.collaterals).flat().map(i => [i.token.id, i.pool.id]) return sumTokens2({ api, tokensAndOwners }) } From cabaa026498dd85079f3de6b896d8d63236b77dc Mon Sep 17 00:00:00 2001 From: Dmitry Mpower Date: Thu, 13 Jun 2024 20:22:04 +0300 Subject: [PATCH 327/855] feat: Update tvl tokens (#10636) --- projects/daolama/tvl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/daolama/tvl.js b/projects/daolama/tvl.js index 2a016f9e84cd..e431da19e93f 100644 --- a/projects/daolama/tvl.js +++ b/projects/daolama/tvl.js @@ -3,5 +3,5 @@ const { POOL_ADDRESS } = require("./constants"); const { sumTokensExport } = require("../helper/chain/ton"); module.exports = { - tvl: sumTokensExport({ owner: POOL_ADDRESS, tokens: [ADDRESSES.null]}), + tvl: sumTokensExport({ owner: POOL_ADDRESS, tokens: [ADDRESSES.ton.TON, ADDRESSES.ton.USDT]}), } From c12eb5415159a92d3070d5d1639bf767434edaaa Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 13 Jun 2024 23:14:53 +0530 Subject: [PATCH 328/855] Fyde (#10642) * update Fyde TVL to include yieldModule * update methodlology * minor fix --------- Co-authored-by: Timo Neumann --- projects/fyde/index.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/projects/fyde/index.js b/projects/fyde/index.js index 2ed9adbc38ad..d9d8bec6e968 100644 --- a/projects/fyde/index.js +++ b/projects/fyde/index.js @@ -1,12 +1,12 @@ const ADDRESSES = require('../helper/coreAssets.json') const FYDE_CONTRACT = "0x87Cc45fFF5c0933bb6aF6bAe7Fc013b7eC7df2Ee"; const RESTAKING_AGGREGATOR = "0x3f69F62e25441Cf72E362508f4d6711d53B05341"; +const ORACLE = "0x05198327206123E89c24ABd9A482316449bD2aEe" const WETH = ADDRESSES.ethereum.WETH; async function tvl(api) { const tokens = await api.fetchList({ lengthAbi: 'getAssetsListLength', itemAbi: 'assetsList', target: FYDE_CONTRACT }) const bals = await api.multiCall({ abi: 'function totalAssetAccounting(address) view returns (uint256)', calls: tokens, target: FYDE_CONTRACT }) - api.addTokens(tokens, bals) // add restaking aggregator TVL const amountStakedETH = await api.call({ @@ -16,10 +16,27 @@ async function tvl(api) { }); api.add(WETH, amountStakedETH) + + // add tokens deployed to yield module. Check which token from tokens is a yield-token, map to the underlying and + // add balances to TVL + const response = await api.multiCall({ + target: ORACLE, + calls: tokens, + abi: 'function yieldTokenToToken(address) external view returns (address)', + }) + const decimals = await api.multiCall({ abi: 'uint8:decimals', calls: tokens}) + + for (let i = 0; i < tokens.length; i++) { + if (response[i] !== '0x0000000000000000000000000000000000000000') { + const balance = bals[i] / 10 ** (decimals[i] - 18) + api.add(response[i], balance) + } else + api.add(tokens[i], bals[i]) + } } module.exports = { - methodology: 'Read out balances from internal accounting for each asset in Fyde. Add ETH staked in LRT Aggregator.', + methodology: 'Read out balances from internal accounting for each asset in Fyde in the YieldModule. Add ETH staked in LRT Aggregator.', ethereum: { tvl } From 4eb7d68e9ccf3e8b00f03f9c7c515babbaec4622 Mon Sep 17 00:00:00 2001 From: Aymen <146243083+aymentrosh@users.noreply.github.com> Date: Thu, 13 Jun 2024 18:45:21 +0100 Subject: [PATCH 329/855] added bsc to karak (#10641) --- projects/karak/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/karak/index.js b/projects/karak/index.js index 345fd55a23b7..8e1fc4e132e4 100644 --- a/projects/karak/index.js +++ b/projects/karak/index.js @@ -4,7 +4,8 @@ const config = { ethereum: { factory: '0x54e44dbb92dba848ace27f44c0cb4268981ef1cc', }, arbitrum: { factory: '0x399f22ae52a18382a67542b3de9bed52b7b9a4ad', }, karak: { factory: '0xB308474350D75447cA8731B7Ce87c9ee9DA03B1C', }, - mantle: { factory: '0x4a2b015CcB8658998692Db9eD4522B8e846962eD' }, + mantle: { factory: '0x4a2b015CcB8658998692Db9eD4522B8e846962eD', }, + bsc: { factory: '0x4a2b015CcB8658998692Db9eD4522B8e846962eD', }, } Object.keys(config).forEach(chain => { From c76dcc1924bf88c744c816957e4af0ab4d1f281a Mon Sep 17 00:00:00 2001 From: jovanjellylabs <107772201+jovanjellylabs@users.noreply.github.com> Date: Thu, 13 Jun 2024 20:33:02 +0200 Subject: [PATCH 330/855] jellyverse listing (#10639) --- projects/jellyverse/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/jellyverse/index.js diff --git a/projects/jellyverse/index.js b/projects/jellyverse/index.js new file mode 100644 index 000000000000..63501defdd79 --- /dev/null +++ b/projects/jellyverse/index.js @@ -0,0 +1,12 @@ +const { onChainTvl } = require('../helper/balancer') + +const config = { + vault: "0xFB43069f6d0473B85686a85F4Ce4Fc1FD8F00875", + startingBlock: 81_247_457, +}; + +module.exports = { + sei: { + tvl: onChainTvl(config.vault, config.startingBlock), + } +} From 9437d9cab4ada0eb645999c6e4ecfc8071bbdc11 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 13 Jun 2024 20:13:57 +0100 Subject: [PATCH 331/855] fix syntax --- projects/keep.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/keep.js b/projects/keep.js index 00479af2c8b5..90c4457adf23 100644 --- a/projects/keep.js +++ b/projects/keep.js @@ -1,7 +1,6 @@ const sdk = require("@defillama/sdk"); const { GraphQLClient, } = require('graphql-request') const utils = require('./helper/utils'); -const sdk = require('@defillama/sdk') async function tvl() { var q2 = `{ From 247148c5a73e3bd084aff60e927f97a4f7cf1a74 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 13 Jun 2024 20:19:35 +0100 Subject: [PATCH 332/855] fix syntax --- projects/defiplaza.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/defiplaza.js b/projects/defiplaza.js index ad7b2b6948b9..3da8a98f9a62 100644 --- a/projects/defiplaza.js +++ b/projects/defiplaza.js @@ -4,7 +4,6 @@ const { cachedGraphQuery } = require('./helper/cache'); const { sumTokens, queryAddresses } = require('./helper/chain/radixdlt'); const { getConfig } = require('./helper/cache'); const { get } = require('./helper/http'); -const sdk = require('@defillama/sdk'); const graphUrl = sdk.graph.modifyEndpoint('4z9FBF12CrfoQJhAkWicqzY2fKYN9QRmuzSsizVXhjKa'); From 94807839a38ec44ebfcb0b5c11e22bc4432df64b Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Thu, 13 Jun 2024 20:29:30 +0100 Subject: [PATCH 333/855] fix duplicated sdk --- projects/ethalend/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/ethalend/index.js b/projects/ethalend/index.js index 6fbff372750e..ce4b17865af2 100644 --- a/projects/ethalend/index.js +++ b/projects/ethalend/index.js @@ -1,6 +1,5 @@ const sdk = require("@defillama/sdk"); const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require('@defillama/sdk') const abi = require('./abi.json') const { unwrapUniswapLPs } = require('../helper/unwrapLPs') const { staking } = require('../helper/staking') From 275c4bd4c1690a0be4e8b89fba0ebbb95a6b7fe7 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 13 Jun 2024 20:42:28 +0100 Subject: [PATCH 334/855] fix syntax --- projects/ethalend/index.js | 1 - projects/prime-protocol/index.js | 1 - projects/synthetix/api.js | 1 - projects/synthetix/apiCache.js | 1 - 4 files changed, 4 deletions(-) diff --git a/projects/ethalend/index.js b/projects/ethalend/index.js index ce4b17865af2..d38667239d43 100644 --- a/projects/ethalend/index.js +++ b/projects/ethalend/index.js @@ -1,4 +1,3 @@ -const sdk = require("@defillama/sdk"); const ADDRESSES = require('../helper/coreAssets.json') const abi = require('./abi.json') const { unwrapUniswapLPs } = require('../helper/unwrapLPs') diff --git a/projects/prime-protocol/index.js b/projects/prime-protocol/index.js index a2d45b103b33..07379c2fdd3d 100644 --- a/projects/prime-protocol/index.js +++ b/projects/prime-protocol/index.js @@ -1,5 +1,4 @@ const sdk = require("@defillama/sdk"); -const sdk = require('@defillama/sdk'); const { sumTokens2, } = require('../helper/unwrapLPs'); const { cachedGraphQuery } = require('../helper/cache'); diff --git a/projects/synthetix/api.js b/projects/synthetix/api.js index 4912de250c4f..ec2936a08732 100644 --- a/projects/synthetix/api.js +++ b/projects/synthetix/api.js @@ -1,6 +1,5 @@ const sdk = require("@defillama/sdk"); const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require('@defillama/sdk'); const BigNumber = require('bignumber.js'); const abi = require('./abi.json'); const { getBlock } = require('../helper/http'); diff --git a/projects/synthetix/apiCache.js b/projects/synthetix/apiCache.js index c9a52f1ef5af..50c94547c186 100644 --- a/projects/synthetix/apiCache.js +++ b/projects/synthetix/apiCache.js @@ -1,6 +1,5 @@ const sdk = require("@defillama/sdk"); const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require('@defillama/sdk'); const BigNumber = require('bignumber.js'); const abi = require('./abi.json'); const { getBlock } = require('../helper/http'); From fa2dbc5ddf80b70d8b18e03a862eecab2185c7a2 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 13 Jun 2024 20:49:06 +0100 Subject: [PATCH 335/855] fix syntax --- projects/sudoswap/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/sudoswap/index.js b/projects/sudoswap/index.js index c51821cee7fc..a2e2ddd95c63 100644 --- a/projects/sudoswap/index.js +++ b/projects/sudoswap/index.js @@ -1,7 +1,6 @@ const sdk = require("@defillama/sdk"); const { graphFetchById, } = require('../helper/cache') const { ART_BLOCKS, sumArtBlocks } = require('../helper/nft') -const sdk = require('@defillama/sdk') const query = ` query get_pairs($lastId: String, $block: Int) { From df411578267f0589ea78d8e5fa34fd3484bc6528 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 13 Jun 2024 21:54:09 +0200 Subject: [PATCH 336/855] use token labels --- projects/MantraProtocol/index.js | 3 +- projects/agentfi/ca.js | 7 +- projects/agentfi/strategies/dex-balancer.js | 5 +- projects/airpuff/index.js | 8 +- projects/amphor/index.js | 3 +- projects/bean/index.js | 5 +- projects/bitparty/index.js | 3 +- projects/blackwing/index.js | 2 +- projects/bunnyswap/index.js | 3 +- projects/cakepie/index.js | 3 +- projects/chi-protocol/index.js | 5 +- projects/defusion/index.js | 3 +- projects/divvy-bet/index.js | 3 +- projects/ethosx/index.js | 5 +- projects/free-protocol/index.js | 17 +- projects/fusefi/index.js | 3 +- projects/fyde/index.js | 2 +- projects/helio-money/index.js | 8 +- projects/helper/tokenMapping.js | 38 ++-- projects/hinkal/hinkalUtils.js | 3 +- projects/hinkal/registryTokens.js | 193 +++++++++--------- .../registryTokensWithUnderlyingAddresses.js | 109 +++++----- projects/instadapp-lite/index.js | 9 +- projects/jellyverse/index.js | 17 +- projects/kalax/index.js | 5 +- projects/kiloex/index.js | 2 +- projects/lynx/index.js | 5 +- projects/meson/index.js | 6 +- projects/metavault-v3/index.js | 3 +- projects/mitosis/index.js | 5 +- projects/particle-trade-duo/index.js | 2 +- projects/rehold-v2/index.js | 12 +- projects/rize/index.js | 6 +- projects/swell-l2-farm/index.js | 6 +- projects/tlx/index.js | 3 +- projects/treasury/golem.js | 3 +- projects/treasury/ribbon.js | 2 +- projects/treasury/safe.js | 2 +- projects/unirouter/index.js | 2 +- projects/unlockd-v2/index.js | 3 +- projects/voltage-stableswap/index.js | 2 +- projects/wise-lending-v2/index.js | 3 +- projects/zeno/index.js | 7 +- projects/zkLink/index.js | 2 +- 44 files changed, 286 insertions(+), 252 deletions(-) diff --git a/projects/MantraProtocol/index.js b/projects/MantraProtocol/index.js index 22ba79f21588..20836e698432 100644 --- a/projects/MantraProtocol/index.js +++ b/projects/MantraProtocol/index.js @@ -1,6 +1,7 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') -const NATIVE_TOKEN_INTERNAL_ADDRESS = '0x0000000000000000000000000000000000000000' +const NATIVE_TOKEN_INTERNAL_ADDRESS = ADDRESSES.null const MANTRA_CONTRACT_PER_CHAIN = { shibarium: '0xf27B9704a15fFe47818fD48660D952235e9C39aF', diff --git a/projects/agentfi/ca.js b/projects/agentfi/ca.js index 3ae558dce6f7..4017cfec77b7 100644 --- a/projects/agentfi/ca.js +++ b/projects/agentfi/ca.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const tokenAddress = { - USDB: "0x4300000000000000000000000000000000000003", - WETH: "0x4300000000000000000000000000000000000004", - ETH: "0x0000000000000000000000000000000000000000" + USDB: ADDRESSES.blast.USDB, + WETH: ADDRESSES.blast.WETH, + ETH: ADDRESSES.null }; const collection = { diff --git a/projects/agentfi/strategies/dex-balancer.js b/projects/agentfi/strategies/dex-balancer.js index dd23b450d349..ecbbd4cca0a7 100644 --- a/projects/agentfi/strategies/dex-balancer.js +++ b/projects/agentfi/strategies/dex-balancer.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../../helper/coreAssets.json') const { balanceFetcher, uniV2Lp, tokenAddress } = require('../ca') const BigNumber = require("bignumber.js"); @@ -5,9 +6,9 @@ const BigNumber = require("bignumber.js"); // underlying token mapping const RingTokenMappings = { // fwUSDB -> USDB - "0x866f2C06B83Df2ed7Ca9C2D044940E7CD55a06d6": tokenAddress.USDB, + [ADDRESSES.blast.fwUSDB]: tokenAddress.USDB, // fwWETH -> WETH - "0x66714DB8F3397c767d0A602458B5b4E3C0FE7dd1": tokenAddress.WETH, + [ADDRESSES.blast.fwWETH]: tokenAddress.WETH, }; async function getTvlForDexBalancer(agentAddresses, api) { diff --git a/projects/airpuff/index.js b/projects/airpuff/index.js index d5313c3863bf..66bec24fafec 100644 --- a/projects/airpuff/index.js +++ b/projects/airpuff/index.js @@ -22,22 +22,22 @@ module.exports = { tvl: async (api) => { const KUSDC = { vault: "0x4c18E80b801AA24066D8B1C6E65ee245497Cb741", - token: "0xa415021bC5c4C3b5B989116DC35Ae95D9C962c8D", + token: ADDRESSES.karak.USDC, }; const KWETH = { vault: "0x9a9631F7BEcE5C6E0aBA1f73f0e5796c534dc4db", - token: "0x4200000000000000000000000000000000000006", + token: ADDRESSES.optimism.WETH_1, }; const wethLending = { vault: "0xd6034F9147CF7528e857403Dea93bc45743295eb", - token: "0x4200000000000000000000000000000000000006", + token: ADDRESSES.optimism.WETH_1, }; const usdcLending = { vault: "0x475820E4bCE0E3d233Ad7f6A8c9DD1f66974c5d6", - token: "0xa415021bC5c4C3b5B989116DC35Ae95D9C962c8D", + token: ADDRESSES.karak.USDC, }; const KarakUSDCBal = await api.call({ target: KUSDC.vault, abi: contractAbis.getTotalSupply }); diff --git a/projects/amphor/index.js b/projects/amphor/index.js index 891a5b603bce..1d34398948e3 100644 --- a/projects/amphor/index.js +++ b/projects/amphor/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumERC4626VaultsExport } = require('../helper/erc4626'); const { sumTokensExport } = require('../helper/unwrapLPs'); const sdk = require('@defillama/sdk'); @@ -18,7 +19,7 @@ const config = { const claimableSilo = '0x06eCFaAde8fcb8C1bC58CB05104604282f8a8144'; const pendingSilo = '0x361a027e660844f336d5fa07E4cb38c40d5880d9'; -const WETH = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'; +const WETH = ADDRESSES.ethereum.WETH; const tvl = sdk.util.sumChainTvls([ sumERC4626VaultsExport({ diff --git a/projects/bean/index.js b/projects/bean/index.js index 09207c321992..c19f8559c800 100644 --- a/projects/bean/index.js +++ b/projects/bean/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const BEANSTALK = "0xc1e088fc1323b20bcbee9bd1b9fc9546db5624c5"; const BEAN_ERC20_V1 = "0xdc59ac4fefa32293a95889dc396682858d52e5db"; @@ -12,9 +13,9 @@ const BEAN3CRV_V2 = "0xc9c32cd16bf7efb85ff14e0c8603cc90f6f2ee49"; const BEANETH_V2 = "0xbea0e11282e2bb5893bece110cf199501e872bad"; // Underlying non-bean tokens -const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; +const WETH = ADDRESSES.ethereum.WETH; const CRV3 = "0x6c3f90f043a72fa612cbac8115ee7e52bde6e490"; -const LUSD = "0x5f98805a4e8be255a32880fdec7f6728c6568ba0"; +const LUSD = ADDRESSES.ethereum.LUSD; /// REFERENCE BLOCKS TIMESTAMPS // Whitelist BEANETH_V1 12974075 1628288832 diff --git a/projects/bitparty/index.js b/projects/bitparty/index.js index e6927521d13c..c5a0a6e70a87 100644 --- a/projects/bitparty/index.js +++ b/projects/bitparty/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs') module.exports = { @@ -6,7 +7,7 @@ module.exports = { owners: ['0xb002b938d63fe8762f2a0eff9e49a8e20a0078e8',], tokens: [ nullAddress, - '0xef63d4e178b3180beec9b0e143e0f37f4c93f4c2', + ADDRESSES.btr.ETH, '0xfe9f969faf8ad72a83b761138bf25de87eff9dd2', '0x9827431e8b77e87c9894bd50b055d6be56be0030', '0xfF204e2681A6fA0e2C3FaDe68a1B28fb90E4Fc5F', diff --git a/projects/blackwing/index.js b/projects/blackwing/index.js index f1c0f529b97f..f2fc33008e18 100644 --- a/projects/blackwing/index.js +++ b/projects/blackwing/index.js @@ -27,7 +27,7 @@ const ETHEREUM_MAINNET_PT_SUSDE_25JUL2024 = "0xd810362556296c834e30c9a61d8e21a5c const ETHEREUM_MAINNET_PT_WEETH_26DEC2024 = "0x6ee2b5e19ecba773a352e5b21415dc419a700d1d"; const ETHEREUM_MAINNET_PT_WEETH_27JUN2024 = "0xc69ad9bab1dee23f4605a82b3354f8e40d1e5966"; -const ETHEREUM_MAINNET_SHIB_ADDRESS = "0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE"; +const ETHEREUM_MAINNET_SHIB_ADDRESS = ADDRESSES.ethereum.INU; const ETHEREUM_MAINNET_PEPE_ADDRESS = "0x6982508145454Ce325dDbE47a25d4ec3d2311933"; const ETHEREUM_MAINNET_EGETH_ADDRESS = "0x18f313Fc6Afc9b5FD6f0908c1b3D476E3feA1DD9"; const ETHEREUM_MAINNET_PUFETH_ADDRESS = "0xD9A442856C234a39a81a089C06451EBAa4306a72"; diff --git a/projects/bunnyswap/index.js b/projects/bunnyswap/index.js index f86a7b0de5dc..340bcc684249 100644 --- a/projects/bunnyswap/index.js +++ b/projects/bunnyswap/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require("../helper/unwrapLPs") module.exports={ base: { tvl: sumTokensExport({ tokens:[ - "0x4200000000000000000000000000000000000006", + ADDRESSES.optimism.WETH_1, "0x0bD4887f7D41B35CD75DFF9FfeE2856106f86670" ], owners:[ diff --git a/projects/cakepie/index.js b/projects/cakepie/index.js index 566838e4eed8..720231d56c6b 100644 --- a/projects/cakepie/index.js +++ b/projects/cakepie/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const CakepieReaderAbi = require("./abis/CakepieReader.json"); const MasterCakepieAbi = require("./abis/MasterCakepie.json"); const config = require("./config") @@ -12,7 +13,7 @@ async function tvl(api) { token = token.toLowerCase() switch (token) { case '0x581fa684d0ec11ccb46b1d92f1f24c8a3f95c0ca': return CakeAddress // mcake -> cake - case '0x7dc91cbd6cb5a3e6a95eed713aa6bf1d987146c8': return '0x2170ed0880ac9a755fd29b2688956bd959f933f8' // mwbeth -> eth + case '0x7dc91cbd6cb5a3e6a95eed713aa6bf1d987146c8': return ADDRESSES.bsc.ETH // mwbeth -> eth default: return token } } diff --git a/projects/chi-protocol/index.js b/projects/chi-protocol/index.js index a2914a14e118..117d14ce928b 100644 --- a/projects/chi-protocol/index.js +++ b/projects/chi-protocol/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs'); const { pool2s } = require("../helper/pool2"); @@ -6,8 +7,8 @@ const USC_STAKING = '0x60aBb55c8488698153dB0AF2af362EdB25A505e3'; const CHI_STAKING = '0xaB1dCa1C0f948c268652eedC676966002Ae241c6'; const CHI_LOCKING = '0xE3dD17ff009bAC84e32130fcA5f01C908e956603'; const CHI_VESTING = '0x426DBAa2B33cE1B833C13b72503F5128AFef79fC'; -const STETH = '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84'; -const WETH = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' +const STETH = ADDRESSES.ethereum.STETH; +const WETH = ADDRESSES.ethereum.WETH const USC = '0x38547D918b9645F2D94336B6b61AEB08053E142c'; const CHI = '0x3b21418081528845a6DF4e970bD2185545b712ba'; diff --git a/projects/defusion/index.js b/projects/defusion/index.js index 90c12c6ed196..ecd1cb2f0716 100644 --- a/projects/defusion/index.js +++ b/projects/defusion/index.js @@ -1,6 +1,7 @@ +const ADDRESSES = require('../helper/coreAssets.json') async function tvl(api) { const supply = await api.call({ abi: 'erc20:totalSupply', target: '0xCdde1f5D971A369eB952192F9a5C367f33a0A891'}) - api.add('0xC054751BdBD24Ae713BA3Dc9Bd9434aBe2abc1ce', supply) + api.add(ADDRESSES.tomochain.TOMO, supply) } module.exports.tomochain = { diff --git a/projects/divvy-bet/index.js b/projects/divvy-bet/index.js index fe8a3d9d62c5..3f56141cc471 100644 --- a/projects/divvy-bet/index.js +++ b/projects/divvy-bet/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { Program } = require("@project-serum/anchor"); const { PublicKey } = require("@solana/web3.js"); const { getProvider, sumTokens2 } = require("../helper/solana"); @@ -10,7 +11,7 @@ async function tvl() { )[0]; } - const NATIVE_MINT = "So11111111111111111111111111111111111111112"; + const NATIVE_MINT = ADDRESSES.solana.SOL; const DIVVY_ADMIN = "AHf1MX99d31ebLfAydVPe2vVdgzZGuUaW972znWPNzZY"; const programId = new PublicKey("dvyFwAPniptQNb1ey4eM12L8iLHrzdiDsPPDndd6xAR"); diff --git a/projects/ethosx/index.js b/projects/ethosx/index.js index 98a71c0a118c..b6969293c407 100644 --- a/projects/ethosx/index.js +++ b/projects/ethosx/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require("../helper/unwrapLPs"); const ETH_PUT_CONTROLLER_ADDRESS = "0x55E008E3b0Aa6808Ca8B8Ba1DC319EC132554aCd"; const ETH_CALL_CONTROLLER_ADDRESS = @@ -5,8 +6,8 @@ const ETH_CALL_CONTROLLER_ADDRESS = const BTC_PUT_CONTROLLER_ADDRESS = "0x3273C69432b2B0D808499F4Cc56113Be6c7A673F"; const BTC_CALL_CONTROLLER_ADDRESS = "0x18AadF2a220D3FEb958Ed161263185f0805D11a1"; -const USDC_ARB_ADDRESS = "0xaf88d065e77c8cC2239327C5EDb3A432268e5831"; -const USDC_BSC_ADDRESS = "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"; +const USDC_ARB_ADDRESS = ADDRESSES.arbitrum.USDC_CIRCLE; +const USDC_BSC_ADDRESS = ADDRESSES.bsc.USDC; module.exports = { methodology: "TVL counts the USDC held in the controller contracts.", diff --git a/projects/free-protocol/index.js b/projects/free-protocol/index.js index 9c4a21af38f4..7ce2b8688dd4 100644 --- a/projects/free-protocol/index.js +++ b/projects/free-protocol/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs'); module.exports = { @@ -10,7 +11,7 @@ module.exports = { '0xE12382e046DB998DE89aF19Ca799CbB757106781', ], tokens: [ - '0xB880fd278198bd590252621d4CD071b1842E9Bcd', + ADDRESSES.merlin.WBTC_1, '0xC5BD913eE3BEFD4721C609177F29a8770ACD7242', '0x41D9036454BE47d3745A823C4aaCD0e29cFB0f71', ], @@ -26,9 +27,9 @@ module.exports = { '0xeea3A032f381AB1E415e82Fe08ebeb20F513c42c', ], tokens: [ - '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', + ADDRESSES.ethereum.USDC, '0x7122985656e38bdc0302db86685bb972b145bd3c', - '0xdac17f958d2ee523a2206206994597c13d831ec7', + ADDRESSES.ethereum.USDT, '0x7122985656e38BDC0302Db86685bb972b145bD3C', ] }) @@ -40,8 +41,8 @@ module.exports = { '0xBA43F3C8733b0515B5C23DFF46F47Af6EB46F85C', ], tokens: [ - '0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9', - '0xaf88d065e77c8cc2239327c5edb3a432268e5831', + ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.USDC_CIRCLE, ] }) }, @@ -63,9 +64,9 @@ module.exports = { '0x0A80028d73Faaee6e57484E3335BeFda0de7f455', ], tokens: [ - '0xc5f0f7b66764F6ec8C8Dff7BA683102295E16409', - '0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c', - '0xc5f0f7b66764F6ec8C8Dff7BA683102295E16409', + ADDRESSES.ethereum.FDUSD, + ADDRESSES.bsc.BTCB, + ADDRESSES.ethereum.FDUSD, '0x4aae823a6a0b376De6A78e74eCC5b079d38cBCf7', ] }) diff --git a/projects/fusefi/index.js b/projects/fusefi/index.js index e80a3e353fcf..f66c14ab691a 100644 --- a/projects/fusefi/index.js +++ b/projects/fusefi/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const swap = require("./swap"); const { stakings } = require("../helper/staking"); -const VOLT_TOKEN = "0x34Ef2Cc892a88415e9f02b91BfA9c91fC0bE6bD4".toLowerCase(); +const VOLT_TOKEN = ADDRESSES.fuse.VOLT.toLowerCase(); const VOLT_BAR = "0x97a6e78c9208c21afaDa67e7E61d7ad27688eFd1".toLowerCase(); const VOLT_VOTE_ESCROW = "0xB0a05314Bd77808269e2E1E3D280Bff57Ba85672".toLowerCase() diff --git a/projects/fyde/index.js b/projects/fyde/index.js index d9d8bec6e968..c099c960cd7a 100644 --- a/projects/fyde/index.js +++ b/projects/fyde/index.js @@ -27,7 +27,7 @@ async function tvl(api) { const decimals = await api.multiCall({ abi: 'uint8:decimals', calls: tokens}) for (let i = 0; i < tokens.length; i++) { - if (response[i] !== '0x0000000000000000000000000000000000000000') { + if (response[i] !== ADDRESSES.null) { const balance = bals[i] / 10 ** (decimals[i] - 18) api.add(response[i], balance) } else diff --git a/projects/helio-money/index.js b/projects/helio-money/index.js index 14518e17f3ca..29f1e90b6627 100644 --- a/projects/helio-money/index.js +++ b/projects/helio-money/index.js @@ -42,22 +42,22 @@ module.exports = { // BTCB [ - "0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c", + ADDRESSES.bsc.BTCB, "0xad9eAAe95617c39019aCC42301a1dCa4ea5b6f65", ], // ezETH [ - "0x2416092f143378750bb29b79ed961ab195cceea5", + ADDRESSES.blast.ezETH, "0xd7E33948e2a43e7C1ec2F19937bf5bf8BbF9BaE8", ], // weETH [ - "0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A", + ADDRESSES.blast.weETH, "0x2367f2Da6fd39De6944218CC9EC706BCdc9a6918", ], // STONE [ - "0x80137510979822322193fc997d400d5a6c747bf7", + ADDRESSES.scroll.STONE, "0x876cd9a380Ee7712129b52f8293F6f06056c3104", ], ], diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 172986f2aacf..893d6d8097b0 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -46,15 +46,15 @@ const fixBalancesTokens = { "SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.token-alex::alex": { coingeckoId: "alexgo", decimals: 8 }, }, stellar: { - "CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA": { coingeckoId: "stellar", decimals: 7}, - "CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75": { coingeckoId: "usd-coin", decimals: 7}, + [ADDRESSES.stellar.XLM]: { coingeckoId: "stellar", decimals: 7}, + [ADDRESSES.stellar.USDC]: { coingeckoId: "usd-coin", decimals: 7}, }, defichain_evm: { - '0x49febbf9626b2d39aba11c01d83ef59b3d56d2a4': { coingeckoId: "defichain", decimals: 18 }, - '0xff0000000000000000000000000000000000000d': { coingeckoId: "usd-coin", decimals: 18 }, - '0xff00000000000000000000000000000000000003': { coingeckoId: "tether", decimals: 18 }, - '0xff00000000000000000000000000000000000001': { coingeckoId: "ethereum", decimals: 18 }, - '0xff0000000000000000000000000000000000000f': { coingeckoId: "decentralized-usd", decimals: 18 }, + [ADDRESSES.defichain_evm.DFI]: { coingeckoId: "defichain", decimals: 18 }, + [ADDRESSES.defichain_evm.USDT]: { coingeckoId: "usd-coin", decimals: 18 }, + [ADDRESSES.defichain_evm.USDC]: { coingeckoId: "tether", decimals: 18 }, + [ADDRESSES.defichain_evm.ETH]: { coingeckoId: "ethereum", decimals: 18 }, + [ADDRESSES.defichain_evm.DUSD]: { coingeckoId: "decentralized-usd", decimals: 18 }, '0x66F3Cf265D2D146A0348F6fC67E3Da0835e0968E': { coingeckoId: "javsphere", decimals: 18 }, }, ace: { @@ -91,13 +91,13 @@ const fixBalancesTokens = { KBTC: { coingeckoId: "kintsugi-btc", decimals: 8 }, }, ham: { - '0x4200000000000000000000000000000000000006': { coingeckoId: 'ethereum', decimals: 18 }, + [ADDRESSES.optimism.WETH_1]: { coingeckoId: 'ethereum', decimals: 18 }, }, blast: { '0xf7bc58b8d8f97adc129cfc4c9f45ce3c0e1d2692': { coingeckoId: "wrapped-bitcoin", decimals: 8 }, '0x9e0d7d79735e1c63333128149c7b616a0dc0bbdb': { coingeckoId: "weth", decimals: 18 }, //pirex eth '0xde55b113a27cc0c5893caa6ee1c020b6b46650c0': { coingeckoId: "deus-finance-2", decimals: 18 }, // deus - '0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34': { coingeckoId: "ethena-usde", decimals: 18 }, + [ADDRESSES.arbitrum.USDe]: { coingeckoId: "ethena-usde", decimals: 18 }, }, solana: { 'AZsHEMXd36Bj1EMNXhowJajpUXzrKcK57wW4ZGXVa7yR': { coingeckoId: "guacamole", decimals: 5 }, @@ -111,7 +111,7 @@ const fixBalancesTokens = { '0x85D431A3a56FDf2d2970635fF627f386b4ae49CC': { coingeckoId: "merlin-s-seal-btc", decimals: 18 }, }, btr: { - '0x0000000000000000000000000000000000000000': { coingeckoId: 'bitcoin', decimals: 18 }, + [ADDRESSES.null]: { coingeckoId: 'bitcoin', decimals: 18 }, '0xff204e2681a6fa0e2c3fade68a1b28fb90e4fc5f': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, '0xfe9f969faf8ad72a83b761138bf25de87eff9dd2': { coingeckoId: 'tether', decimals: 6 }, '0x9827431e8b77e87c9894bd50b055d6be56be0030': { coingeckoId: 'usd-coin', decimals: 6 }, @@ -123,10 +123,10 @@ const fixBalancesTokens = { //REMOVE '0xA984b70f7B41EE736B487D5F3D9C1e1026476Ea3': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, }, cyeth: { - '0x4200000000000000000000000000000000000006': { coingeckoId: 'ethereum', decimals: 18 }, + [ADDRESSES.optimism.WETH_1]: { coingeckoId: 'ethereum', decimals: 18 }, }, bouncebit: { - '0x0000000000000000000000000000000000000000': { coingeckoId: 'bouncebit', decimals: 18 }, + [ADDRESSES.null]: { coingeckoId: 'bouncebit', decimals: 18 }, '0xf4c20e5004c6fdcdda920bdd491ba8c98a9c5863': { coingeckoId: 'bouncebit', decimals: 18 }, '0x77776b40c3d75cb07ce54dea4b2fd1d07f865222': { coingeckoId: 'tether', decimals: 18 }, '0xF5e11df1ebCf78b6b6D26E04FF19cD786a1e81dC': { coingeckoId: 'bitcoin', decimals: 18 }, @@ -138,19 +138,19 @@ const fixBalancesTokens = { '0x2967e7bb9daa5711ac332caf874bd47ef99b3820': { coingeckoId: 'wrapped-stbtc', decimals: 18 }, }, real: { - '0x0000000000000000000000000000000000000000': { coingeckoId: 'bitcoin', decimals: 18 }, + [ADDRESSES.null]: { coingeckoId: 'bitcoin', decimals: 18 }, '0x90c6e93849e06ec7478ba24522329d14a5954df4': { coingeckoId: 'ethereum', decimals: 18 }, '0x75d0cbf342060b14c2fc756fd6e717dfeb5b1b70': { coingeckoId: 'dai', decimals: 18 }, '0x83fedbc0b85c6e29b589aa6bdefb1cc581935ecd': { coingeckoId: 'mountain-protocol-usdm', decimals: 18 }, }, taiko: { - '0xA51894664A773981C6C112C43ce576f315d5b1B6': { coingeckoId: 'ethereum', decimals: 18 }, - '0x07d83526730c7438048d55a4fc0b850e2aab6f0b': { coingeckoId: 'usd-coin', decimals: 6 }, + [ADDRESSES.taiko.WETH]: { coingeckoId: 'ethereum', decimals: 18 }, + [ADDRESSES.taiko.USDC]: { coingeckoId: 'usd-coin', decimals: 6 }, }, sei: { '0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1': { coingeckoId: 'usd-coin', decimals: 6 }, '0xb75d0b03c06a926e488e2659df1a861f860bd3d1': { coingeckoId: 'tether', decimals: 6 }, - '0x0000000000000000000000000000000000000000': { coingeckoId: 'sei-network', decimals: 18 }, + [ADDRESSES.null]: { coingeckoId: 'sei-network', decimals: 18 }, '0xe30fedd158a2e3b13e9badaeabafc5516e95e8c7': { coingeckoId: 'sei-network', decimals: 18 }, }, core: { @@ -158,11 +158,11 @@ const fixBalancesTokens = { '0x5B1Fb849f1F76217246B8AAAC053b5C7b15b7dc3': { coingeckoId: 'solv-btc', decimals: 18 }, }, lukso: { - '0x2db41674f2b882889e5e1bd09a3f3613952bc472': { coingeckoId: 'lukso-token-2', decimals: 18 }, + [ADDRESSES.lukso.WLYX]: { coingeckoId: 'lukso-token-2', decimals: 18 }, }, planq: { - "0xecEEEfCEE421D8062EF8d6b4D814efe4dc898265": { coingeckoId: 'usd-coin', decimals: 6 }, - "0x75E20C5d4aade76143b8b74d1C5E2865347f9d3B": { coingeckoId: 'usd-coin', decimals: 18 }, + [ADDRESSES.functionx.USDT]: { coingeckoId: 'usd-coin', decimals: 6 }, + [ADDRESSES.planq.USDC_1]: { coingeckoId: 'usd-coin', decimals: 18 }, }, zeta: { "0x1e4bF3CaBD7707089138dD5a545B077413FA83Fc": { coingeckoId: 'pufeth', decimals: 18 }, diff --git a/projects/hinkal/hinkalUtils.js b/projects/hinkal/hinkalUtils.js index fd8768e9800f..d1eb07baeabe 100644 --- a/projects/hinkal/hinkalUtils.js +++ b/projects/hinkal/hinkalUtils.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const ownerByChain = require("./owners.js"); -const nullAddress = "0x0000000000000000000000000000000000000000"; +const nullAddress = ADDRESSES.null; const nativeVolatileChains = ["blast"]; diff --git a/projects/hinkal/registryTokens.js b/projects/hinkal/registryTokens.js index 36eff5d81ac8..97c239cdddd6 100644 --- a/projects/hinkal/registryTokens.js +++ b/projects/hinkal/registryTokens.js @@ -1,23 +1,24 @@ +const ADDRESSES = require('../helper/coreAssets.json') const ETHEREUM_REGISTRY_TOKENS = [ - "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - "0xdAC17F958D2ee523a2206206994597C13D831ec7", - "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", - "0x6B175474E89094C44Da98b954EedeAC495271d0F", + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.DAI, "0x8E870D67F660D95d5be530380D0eC0bd388289E1", - "0x83F20F44975D03b1b09e64809B757c47f942BEeA", + ADDRESSES.ethereum.SDAI, "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490", "0xc4AD29ba4B3c580e6D59105FFf484999997675Ff", - "0x853d955aCEf822Db058eb8505911ED77F175b99e", + ADDRESSES.ethereum.FRAX, "0xFC2838a17D8e8B1D5456E0a351B0708a09211147", "0x3175Df0976dFA876431C2E9eE6Bc45b65d3473CC", "0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd", "0xf43211935C781D5ca1a41d2041F397B8A7366C7A", "0xd632f22692FaC7611d2AA1C0D552930D43CAEd3B", - "0xD533a949740bb3306d119CC777fa900bA034cd52", + ADDRESSES.ethereum.CRV, "0x99D8a9C45b2ecA8864373A26D1459e3Dff1e17F3", "0x5a6A4D54456819380173272A5E8E9B9904BdF41B", - "0x57Ab1ec28D129707052df4dF418D58a2D46d5f51", + ADDRESSES.ethereum.sUSD, "0xC25a3A3b969415c80451098fa907EC722572917F", "0xb2C35aC676F4A002669e195CF4dc50DDeDF6F0fA", "0x5e74C9036fb86BD7eCdcb084a0673EFc32eA31cb", @@ -26,18 +27,18 @@ const ETHEREUM_REGISTRY_TOKENS = [ "0x99f5aCc8EC2Da2BC0771c32814EFF52b712de1E5", "0xfE18be6b3Bd88A2D2A7f928d00292E7a9963CfC6", "0x051d7e5609917Bd9b73f04BAc0DED8Dd46a74301", - "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0", + ADDRESSES.ethereum.LUSD, "0x5E8422345238F34275888049021821E8E08CAa1f", - "0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B", + ADDRESSES.ethereum.CVX, "0x865377367054516e17014CcdED1e7d814EDC9ce4", "0x3A283D9c08E8b55966afb64C515f5143cf907611", "0x06325440D014e39736583c165C2963BA99fAf14E", "0x4d9f9D15101EEC665F77210cB999639f760F831E", - "0xae78736Cd615f374D3085123A210448E74Fc6393", + ADDRESSES.ethereum.RETH, "0x6c38cE8984a890F5e46e6dF6117C26b3F1EcfC9C", - "0x62B9c7356A2Dc64a1969e19C23e4f579F9810Aa7", + ADDRESSES.ethereum.cvxCRV, "0x971add32Ea87f10bD192671630be3BE8A11b8623", - "0x0000000000085d4780B73119b644AE5ecd22b376", + ADDRESSES.ethereum.TUSD, "0xEcd5e75AFb02eFa118AF914515D6521aaBd189F1", "0xb40b6608B2743E691C9B54DdBDEe7bf03cd79f1c", "0x68934F60758243eafAf4D2cFeD27BF8010bede3a", @@ -45,7 +46,7 @@ const ETHEREUM_REGISTRY_TOKENS = [ "0xdf55670e27bE5cDE7228dD0A6849181891c9ebA1", "0x9D0464996170c6B9e75eED71c68B99dDEDf279e8", "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0", - "0xFEEf77d3f69374f66429C91d732A244f074bdf74", + ADDRESSES.ethereum.cvxFXS, "0xBC6DA0FE9aD5f3b0d58160288917AA56653660E9", "0xB30dA2376F63De30b42dC055C93fa474F31330A5", "0x828b154032950C8ff7CF8085D841723Db2696056", @@ -54,11 +55,11 @@ const ETHEREUM_REGISTRY_TOKENS = [ "0x1cEB5cB57C4D4E2b2433641b95Dd330A33185A44", "0x4647B6D835f3B393C7A955df51EEfcf0db961606", "0x0100546F2cD4C9D97f798fFC9755E47865FF7Ee6", - "0x5A98FcBEA516Cf06857215779Fd812CA3beF1B32", + ADDRESSES.ethereum.LIDO, "0xb79565c01b7Ae53618d9B847b9443aAf4f9011e7", - "0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e", + ADDRESSES.ethereum.YFI, "0x29059568bB40344487d62f7450E78b8E6C74e0e5", - "0xBe9895146f7AF43049ca1c1AE358B0541Ea49704", + ADDRESSES.ethereum.cbETH, "0x5b6C539b224014A09B3388e51CaAA8e354c959C8", "0xd7C9F0e536dC865Ae858b0C0453Fe76D13c3bEAc", "0x326290A1B0004eeE78fa6ED4F1d8f4b2523ab669", @@ -72,7 +73,7 @@ const ETHEREUM_REGISTRY_TOKENS = [ "0x856c4Efb76C1D1AE02e20CEB03A2A6a08b0b8dC3", "0x94B17476A93b3262d87B9a326965D1E91f9c13E7", "0xF95AAa7EBB1620e46221B73588502960Ef63dBa0", - "0x18084fbA666a33d37592fA2633fD49a74DD93a88", + ADDRESSES.ethereum.tBTC, "0xa2E3356610840701BDf5611a53974510Ae27E2e1", "0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643", "0x39AA39c021dfbaE8faC545936693aC917d5E7563", @@ -87,7 +88,7 @@ const ETHEREUM_REGISTRY_TOKENS = [ "0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D", "0x49849C98ae39Fff122806C06791Fa73784FB3675", "0xA0d69E286B938e21CBf7E51D71F6A4c8918f482F", - "0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E", + ADDRESSES.ethereum.CRVUSD, "0x3835a58CA93Cdb5f912519ad366826aC9a752510", "0x892D701d94a43bDBCB5eA28891DaCA2Fa22A690b", "0x5Ca135cB8527d76e932f34B5145575F9d8cbE08E", @@ -149,10 +150,10 @@ const ETHEREUM_REGISTRY_TOKENS = [ "0xE08FF1427b199241506FcdCC23fcc24Dd98a4FA9", "0xC21545c26661ae74b3259B55aE007ACC4Bf5d4e3", "0x9ee91F9f426fA633d227f7a9b000E28b9dfd8599", - "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0", - "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84", - "0x35fA164735182de50811E8e2E824cFb9B6118ac2", - "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0", + ADDRESSES.ethereum.MATIC, + ADDRESSES.ethereum.STETH, + ADDRESSES.ethereum.EETH, + ADDRESSES.ethereum.WSTETH, "0xa0Cd8B83B63381895C1854A605315fa7eF50e026", "0x25aE9BE521898d33c7DF6Ae8c6669Fe038Bb3550", "0x9434722bf29750B44649eb1b1A10a335d40edFc1", @@ -168,7 +169,7 @@ const ETHEREUM_REGISTRY_TOKENS = [ "0xc794c6a95f30d0ebf7b3bbe85e8a0a95c9e411c1", "0xaeda92e6a3b1028edc139a4ae56ec881f3064d4f", "0xacdf0dba4b9839b96221a8487e9ca660a48212be", - "0x514910771af9ca656af840dff83e8264ecf986ca", + ADDRESSES.ethereum.LINK, "0xa663b02cf0a4b149d2ad41910cb81e23e1c41c32", "0x04c154b66cb340f3ae24111cc767e0184ed00cc6", "0xf8fde8a259a3698902c88bdb1e13ff28cd7f6f09", @@ -241,35 +242,35 @@ const ETHEREUM_REGISTRY_TOKENS = [ "0xf57e7e7c23978c3caec3c3548e3d615c346e79ff", "0xc944e90c64b2c07662a292be6244bdf05cda44a7", "0xe28b3b32b6c345a34ff64674606124dd5aceca30", - "0x4c9edd5852cd905f086c759e8383e09bff1e68b3", + ADDRESSES.ethereum.USDe, "0xaea46a60368a7bd060eec7df8cba43b7ef41ad85", "0x4a220e6096b25eadb88358cb44068a3248254675", "0x62d0a8458ed7719fdaf978fe5929c6d342b0bfce", "0x57e114b691db790c35207b2e685d4a43181e6061", - "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9", - "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", + ADDRESSES.ethereum.AAVE, + ADDRESSES.ethereum.UNI, "0xEEda34A377dD0ca676b9511EE1324974fA8d980D", "0x0d86883faf4ffd7aeb116390af37746f45b6f378", ]; const ARBITRUM_REGISTRY_TOKENS = [ - "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", - "0xaf88d065e77c8cc2239327c5edb3a432268e5831", - "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9", - "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", - "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f", - "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", - "0xFEa7a6a0B346362BF88A9e4A88416B77a57D6c2A", + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.USDC_CIRCLE, + ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.WETH, + ADDRESSES.arbitrum.WBTC, + ADDRESSES.optimism.DAI, + ADDRESSES.arbitrum.MIM, "0x7f90122BF0700F9E7e1F688fe926940E8839F353", "0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F", "0x11cDb42B0EB46D95f990BeDD4695A6e3fA034978", "0x64343594Ab9b56e99087BfA6F2335Db24c2d1F17", "0x641441c631e2F909700d2f41FD87F0aA6A6b4EDb", - "0xEB466342C4d449BC9f53A865D5Cb90586f405215", + ADDRESSES.kava.axlUSDC, "0xC9B8a3FDECB9D5b218d02555a8Baf332E5B740d5", - "0x5979D7b546E38E414F7E9822514be443A4800529", + ADDRESSES.arbitrum.WSTETH, "0x8616E8EA83f048ab9A5eC513c9412Dd2993bcE3F", - "0xDBf31dF14B66535aF65AaC99C32e9eA844e14501", + ADDRESSES.fantom.renBTC, "0x93FC1235119c554576D8AB23583371fc25B803ee", "0xaE6aab43C4f3E0cea4Ab83752C278f8dEbabA689", "0xb1781BF9C582A71269c6098E4155Ea8b15B35305", @@ -318,7 +319,7 @@ const ARBITRUM_REGISTRY_TOKENS = [ "0xe20F93279fF3538b1ad70D11bA160755625e3400", "0x4a2f6ae7f3e5d715689530873ec35593dc28951b", "0xb67c014fa700e69681a673876eb8bafaa36bff71", - "0xfc5a1a6eb076a2c7ad06ed22c90d7e710e35ad0a", + ADDRESSES.arbitrum.GMX, "0x3c6ef5ed8ad5df0d5e3d05c6e607c60f987fb735", "0x9cb911cbb270cae0d132689ce11c2c52ab2dedbc", "0x9791d590788598535278552eecd4b211bfc790cb", @@ -340,7 +341,7 @@ const ARBITRUM_REGISTRY_TOKENS = [ "0xce3b19d820cb8b9ae370e423b0a329c4314335fe", "0x539bdE0d7Dbd336b79148AA742883198BBF60342", "0x99c409e5f62e4bd2ac142f17cafb6810b8f0baae", - "0x912CE59144191C1204E64559FE8253a0e49E6548", + ADDRESSES.arbitrum.ARB, "0xC3691c157D1B3A431B841230a7B11d5a373097e1", "0x7Bdc233E5369Ac023b9894645902C9032A72D9Ee", "0xCC26A5246C6A04a85E997d6581C1b4f14363841a", @@ -351,7 +352,7 @@ const ARBITRUM_REGISTRY_TOKENS = [ "0x886867993080DC3bBFC39CDfc343A0e083bB34E0", "0xB72ea6F99EfA5BD6Fb400BaA4eFddC3cfB075215", "0x660108601EED17aF2832A1c0F1D7dE74F560C5ed", - "0xf97f4df75117a78c1a5a0dbb814af92458539fb4", + ADDRESSES.arbitrum.LINK, "0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0", "0x9623063377ad1b27544c965ccd7342f7ea7e88c7", "0xb0ffa8000886e57f86dd5264b9582b2ad87b2b91", @@ -364,25 +365,25 @@ const ARBITRUM_REGISTRY_TOKENS = [ "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE", "0x35751007a407ca6FEFfE80b3cB397736D2cf4dbe", "0x4186BFC76E2E237523CBC30FD220FE055156b41F", - "0x2416092f143378750bb29b79eD961ab195CcEea5", + ADDRESSES.blast.ezETH, ]; const OPTIMISM_REGISTRY_TOKENS = [ - "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85", - "0x7F5c764cBc14f9669B88837ca1490cCa17c31607", - "0x94b008aa00579c1307b0ef2c499ad98a8ce58e58", - "0x4200000000000000000000000000000000000006", - "0x68f180fcce6836688e9084f035309e29bf0a2095", - "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1", - "0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9", + ADDRESSES.optimism.USDC_CIRCLE, + ADDRESSES.optimism.USDC, + ADDRESSES.optimism.USDT, + ADDRESSES.optimism.WETH_1, + ADDRESSES.optimism.WBTC, + ADDRESSES.optimism.DAI, + ADDRESSES.optimism.sUSD, "0x061b87122Ed14b9526A813209C8a59a633257bAb", - "0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb", + ADDRESSES.optimism.WSTETH, "0xEfDE221f306152971D8e9f181bFe998447975810", "0x298B9B95708152ff6968aafd889c6586e9169f1D", "0x9F2fE3500B1a7E285FDc337acacE94c480e00130", "0x1337BedC9D22ecbe766dF105c9623922A27963EC", "0x0994206dfe8de6ec6920ff4d779b0d950605fb53", - "0xE405de8F52ba7559f9df3C368500B6E6ae6Cee49", + ADDRESSES.optimism.sETH, "0x7Bc5728BC2b59B45a58d9A576E2Ffc5f0505B35E", "0xB153FB3d196A8eB25522705560ac152eeEc57901", "0x810D1AaA4Cd8F21c23bB648F2dfb9DC232A01F09", @@ -505,11 +506,11 @@ const OPTIMISM_REGISTRY_TOKENS = [ "0x970D50d09F3a656b43E11B0D45241a84e3a6e011", "0x1DB2466d9F5e10D7090E7152B68d62703a2245F0", "0xc40F949F8a4e094D1b49a23ea9241D289B7b2819", - "0xCB8FA9a76b8e203D8C3797bF438d8FB81Ea3326A", - "0xdFA46478F9e5EA86d57387849598dbFB2e964b02", + ADDRESSES.optimism.alUSD, + ADDRESSES.moonbeam.MAI, "0x3c8B650257cFb5f272f799F5e2b4e65093a11a05", - "0x4200000000000000000000000000000000000042", - "0x2e3d870790dc77a83dd1d18184acc7439a53f475", + ADDRESSES.optimism.OP, + ADDRESSES.optimism.FRAX, "0xfdb794692724153d1488ccdbe0c56c252596735f", "0x1e925De1c68ef83bD98eE3E130eF14a50309C01B", "0xC03b43d492d904406db2d7D57e67C7e8234bA752", @@ -520,7 +521,7 @@ const OPTIMISM_REGISTRY_TOKENS = [ "0x8aE125E8653821E851F12A49F7765db9a9ce7384", "0x217D47011b23BB961eB6D93cA9945B7501a5BB11", "0x9485aca5bbBE1667AD97c7fE7C4531a624C8b1ED", - "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb", + ADDRESSES.base.DAI, "0x79af5dd14e855823fa3e9ecacdf001d99647d043", "0x9560e827aF36c94D2Ac33a39bCE1Fe78631088Db", "0x4e720dd3ac5cfe1e1fbde4935f386bb1c66f4642", @@ -548,24 +549,24 @@ const OPTIMISM_REGISTRY_TOKENS = [ ]; const POLYGON_REGISTRY_TOKENS = [ - "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", - "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359", - "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", - "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619", - "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6", - "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", + ADDRESSES.polygon.USDC, + ADDRESSES.polygon.USDC_CIRCLE, + ADDRESSES.polygon.USDT, + ADDRESSES.polygon.WETH_1, + ADDRESSES.polygon.WBTC, + ADDRESSES.polygon.DAI, "0xE7a24EF0C5e95Ffb0f6684b813A78F2a3AD7D171", "0x87ff96aba480f1813aF5c780387d8De7cf7D8261", "0x2088C47Fc0c78356c622F79dBa4CbE1cCfA84A91", "0xdAb529f40E671A1D4bF91361c21bf9f0C9712ab7", - "0xDBf31dF14B66535aF65AaC99C32e9eA844e14501", + ADDRESSES.fantom.renBTC, "0xD6DF932A45C0f255f85145f286eA0b292B21C90B", "0xa3FC7E0021970f5AF674aD837a8dc09e2F12F37B", "0x7D645CBbCAdE2A130bF1bf0528b8541d32D3f8Cf", "0x2e1AD108fF1D8C782fcBbB89AAd783aC49586756", "0x20D3922b4a1A8560E1aC99FBA4faDe0c849e2142", "0x4e3Decbb3645551B8A19f0eA1678079FCB33fB4c", - "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + ADDRESSES.polygon.WMATIC_2, "0xf8a57c1d3b9629b77b6726a042ca48990A84Fb49", "0x45c32fA6DF82ead1e2EF74d17b76547EDdFaFF89", "0xA691D34Abf93C0A77998e53B564bEcfaf46Dae27", @@ -658,7 +659,7 @@ const POLYGON_REGISTRY_TOKENS = [ "0x67FEe70c32097c53B5aeAaCdbee7544eaE2194f8", "0xbe4e30b74b558e41f5837dc86562df44af57a013", "0x0fC4f2DB534Bf7525710DBf64B7081e1a3A6428f", - "0xfa68fb4628dff1028cfec22b4162fccd0d45efb6", + ADDRESSES.polygon.MATICX, "0x40c03Cd0B5D1571608D09e6279B4C63660e431F1", "0x2ee50c34392e7e7a1d17b0a42328a8d1ad6894e3", "0x1205f31718499dbf1fca446663b532ef87481fe1", @@ -709,19 +710,19 @@ const POLYGON_REGISTRY_TOKENS = [ "0x1a13F4Ca1d028320A707D99520AbFefca3998b7F", "0x60D55F02A771d515e077c9C2403a1ef324885CeC", "0x27F8D03b3a2196956ED754baDc28D73be8830A6e", - "0x03b54A6e9a984069379fae1a4fC4dBAE93B3bCCD", + ADDRESSES.polygon.WSTETH, ]; const AVALANCHE_REGISTRY_TOKENS = [ - "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", - "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", - "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664", - "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7", - "0xc7198437980c041c805A1EDcbA50c1Ce5db95118", - "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70", - "0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB", - "0x50b7545627a5162F82A992c33b87aDc75187B218", - "0x152b9d0FdC40C096757F570A51E494bd4b943E50", + ADDRESSES.avax.WAVAX, + ADDRESSES.avax.USDC, + ADDRESSES.avax.USDC_e, + ADDRESSES.avax.USDt, + ADDRESSES.avax.USDT_e, + ADDRESSES.avax.DAI, + ADDRESSES.avax.WETH_e, + ADDRESSES.avax.WBTC_e, + ADDRESSES.avax.BTC_b, "0x111111111111ed1D73f860F57b2798b683f2d325", "0x130966628846BFd36ff31a822705796e8cb8C18D", "0x40b393cecf8F7D7Fc79b83e8fA40e850511817f6", @@ -759,7 +760,7 @@ const AVALANCHE_REGISTRY_TOKENS = [ "0x3D81A269E05e6057e4dF9E2D76E254E65a65Eb66", "0x454E67025631C065d3cFAD6d71E6892f74487a15", "0x282B11E65f0B49363D4505F91c7A44fBEe6bCc0b", - "0x6e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd", + ADDRESSES.avax.JOE, "0x3C2131A02659343d68c211aAa686750bE37d88c4", "0x813aB5B3FDc59B143C42284665864b24B794C324", "0xd6070ae98b8069de6b494332d1a1a81b6179d960", @@ -784,12 +785,12 @@ const AVALANCHE_REGISTRY_TOKENS = [ ]; const BNB_REGISTRY_TOKENS = [ - "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", - "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", - "0x55d398326f99059fF775485246999027B3197955", - "0x2170Ed0880ac9A755fd29B2688956BD959F933F8", - "0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c", - "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", + ADDRESSES.bsc.WBNB, + ADDRESSES.bsc.USDC, + ADDRESSES.bsc.USDT, + ADDRESSES.bsc.ETH, + ADDRESSES.bsc.BTCB, + ADDRESSES.bsc.BUSD, "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3", "0x31e77776b924Cd5f0E624771C9B3d2bD6B9c919E", "0x577d005912C49B1679B4c21E334FdB650E92C077", @@ -818,7 +819,7 @@ const BNB_REGISTRY_TOKENS = [ "0xD411121C948Cff739857513E1ADF25ED448623f8", "0x90C97F71E18723b0Cf0dfa30ee176Ab653E89F40", "0x3F56e0c36d275367b8C502090EDF38289b3dEa0d", - "0x51bd63F240fB13870550423D208452cA87c44444", + ADDRESSES.bsc.beltBTC, "0xbCFcE18C5c33463316f93A067b1f50d75b00dc09", "0x10bf6e7B28b1cfFb1c047D7F815953931e5Ee947", "0x56ec6031dC969CfA035F6D65e65D8595d5660fB4", @@ -826,11 +827,11 @@ const BNB_REGISTRY_TOKENS = [ "0x77c9a64C88Ad5e5467B53E20E66AD2F8800BBf3d", "0x2ecBD508c00Bbc8aA0cdc9100bf3956fCabE7677", "0xC34Ae91312A3c3F9420691922040a5DEe1698E52", - "0xa8Bb71facdd46445644C277F9499Dd22f6F0A30C", + ADDRESSES.bsc.beltBNB, "0xeDe45f9dC994a66F1aD1ac68974Abb28086f909d", "0x6321B57b6fdc14924be480c54e93294617E672aB", "0xc1fcf50ccaCd1583BD9d3b41657056878C94e592", - "0x9cb73F20164e399958261c289Eb5F9846f4D1404", + ADDRESSES.bsc.Belt4, "0xb26642B6690E4c4c9A6dAd6115ac149c700C7dfE", "0x0eD7e52944161450477ee417DE9Cd3a859b14fD0", "0x33D0F945F77660F4A9e56949500265313f6D08fb", @@ -840,7 +841,7 @@ const BNB_REGISTRY_TOKENS = [ "0x0383E88A19E5c387FeBafbF51E5bA642d2ad8bE0", "0x9aA83081AA06AF7208Dcc7A4cB72C94d057D2cda", "0xf2064C230b285AA6Cf45c6267DA86a8E3505D0AA", - "0xAA20E8Cb61299df2357561C2AC2e1172bC68bc25", + ADDRESSES.bsc.beltETH, "0x960eE6caC56912D94cE5c83D7Fb0CD873b5c5099", "0xD3C480EC7a47596fF8D63396227d1F7dC728A7f0", "0xe0Af98A11DB57c7282c1f6066d116E13F02BF0E9", @@ -890,19 +891,19 @@ const BNB_REGISTRY_TOKENS = [ "0x9B00a09492a626678E5A3009982191586C444Df9", "0x00901a076785e0906d1028c7d6372d247bec7d61", "0xa9251ca9DE909CB71783723713B21E4233fbf1B1", - "0x2416092f143378750bb29b79eD961ab195CcEea5", + ADDRESSES.blast.ezETH, ]; const BASE_REGISTRY_TOKENS = [ - "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", - "0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA", + ADDRESSES.base.USDC, + ADDRESSES.base.USDbC, "0x4621b7A9c75199271F773Ebd9A499dbd165c3191", "0x8Ee73c484A26e0A5df2Ee2a4960B789967dd0415", "0x417Ac0e078398C154EdFadD9Ef675d30Be60Af93", - "0xEB466342C4d449BC9f53A865D5Cb90586f405215", - "0x4200000000000000000000000000000000000006", + ADDRESSES.kava.axlUSDC, + ADDRESSES.optimism.WETH_1, "0x236aa50979D5f3De3Bd1Eeb40E81137F22ab794b", - "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb", + ADDRESSES.base.DAI, "0xd07379a755A8f11B57610154861D694b2A0f615a", "0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22", "0xB6fe221Fe9EeF5aBa221c348bA20A1Bf5e73624c", @@ -949,14 +950,14 @@ const BASE_REGISTRY_TOKENS = [ "0xD4a0e0b9149BCee3C920d2E00b5dE09138fd8bb7", "0x99CBC45ea5bb7eF3a5BC08FB1B7E56bB2442Ef0D", "0x4e65fE4DbA92790696d040ac24Aa414708F5c0AB", - "0x2416092f143378750bb29b79eD961ab195CcEea5", + ADDRESSES.blast.ezETH, "0x1Bc71130A0e39942a7658878169764Bbd8A45993", "0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452", ]; const BLAST_REGISTRY_TOKENS = [ - "0x4300000000000000000000000000000000000004", - "0x4300000000000000000000000000000000000003", + ADDRESSES.blast.WETH, + ADDRESSES.blast.USDB, "0xF7bc58b8D8f97ADC129cfC4c9f45Ce3C0E1D2692", "0x9D020B1697035d9d54f115194c9e04a1e4Eb9aF7", "0x96F6b70f8786646E0FF55813621eF4c03823139C", @@ -970,7 +971,7 @@ const BLAST_REGISTRY_TOKENS = [ "0x76da31d7c9cbeae102aff34d3398bc450c8374c1", "0x47c337bd5b9344a6f3d6f58c474d9d8cd419d8ca", "0x216a5a1135a9dab49fa9ad865e0f22fe22b5630a", - "0x2416092f143378750bb29b79ed961ab195cceea5", + ADDRESSES.blast.ezETH, ]; const registryTokensByChain = { diff --git a/projects/hinkal/registryTokensWithUnderlyingAddresses.js b/projects/hinkal/registryTokensWithUnderlyingAddresses.js index 4185fd3f16ce..02fa16045caa 100644 --- a/projects/hinkal/registryTokensWithUnderlyingAddresses.js +++ b/projects/hinkal/registryTokensWithUnderlyingAddresses.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const ETHEREUM_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = { "0x93ce650b8d3a7a7e44121db82a0429a3884db599": "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490", @@ -66,27 +67,27 @@ const ETHEREUM_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = { "0x3e0A917d4d914e432B82825e6FBEe039b89f4477": "0x029aad400f6092dc735a65be95102efcc2fe64bf", "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8": - "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + ADDRESSES.ethereum.WETH, "0x0B925eD163218f6662a35e0f0371Ac234f9E9371": - "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0", + ADDRESSES.ethereum.WSTETH, "0x5Ee5bf7ae06D1Be5997A1A72006FE6C607eC6DE8": - "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + ADDRESSES.ethereum.WBTC, "0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c": - "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + ADDRESSES.ethereum.USDC, "0x23878914EFE38d27C4D67Ab83ed1b93A74D4086a": - "0xdAC17F958D2ee523a2206206994597C13D831ec7", + ADDRESSES.ethereum.USDT, "0x018008bfb33d285247A21d44E50697654f754e63": - "0x6B175474E89094C44Da98b954EedeAC495271d0F", + ADDRESSES.ethereum.DAI, "0x9ff58f4fFB29fA2266Ab25e75e2A8b3503311656": - "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + ADDRESSES.ethereum.WBTC, "0x030bA81f1c18d280636F32af80b9AAd02Cf0854e": - "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + ADDRESSES.ethereum.WETH, "0xBcca60bB61934080951369a648Fb03DF4F96263C": - "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + ADDRESSES.ethereum.USDC, "0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811": - "0xdAC17F958D2ee523a2206206994597C13D831ec7", + ADDRESSES.ethereum.USDT, "0x028171bCA77440897B824Ca71D1c56caC55b68A3": - "0x6B175474E89094C44Da98b954EedeAC495271d0F", + ADDRESSES.ethereum.DAI, }; const ARBITRUM_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = { @@ -111,17 +112,17 @@ const ARBITRUM_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = { "0x660108601EED17aF2832A1c0F1D7dE74F560C5ed": "0x7c0ac20c3ca8c6257ea099131081d8199bf6b8f6", "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8": - "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", + ADDRESSES.arbitrum.WETH, "0x513c7E3a9c69cA3e22550eF58AC1C0088e918FFf": - "0x5979D7b546E38E414F7E9822514be443A4800529", + ADDRESSES.arbitrum.WSTETH, "0x078f358208685046a11C85e8ad32895DED33A249": - "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f", + ADDRESSES.arbitrum.WBTC, "0x724dc807b04555b71ed48a6896b6F41593b8C637": - "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", + ADDRESSES.arbitrum.USDC_CIRCLE, "0x6ab707Aca953eDAeFBc4fD23bA73294241490620": - "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9", + ADDRESSES.arbitrum.USDT, "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE": - "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", + ADDRESSES.optimism.DAI, }; const OPTIMISM_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = { @@ -140,17 +141,17 @@ const OPTIMISM_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = { "0xbA65D50Cf4e6E739B2735338a964C3354fAF9B19": "0xcea806562b757aeffa9fe9d0a03c909b4a204254", "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8": - "0x4200000000000000000000000000000000000006", + ADDRESSES.optimism.WETH_1, "0xc45A479877e1e9Dfe9FcD4056c699575a1045dAA": - "0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb", + ADDRESSES.optimism.WSTETH, "0x078f358208685046a11C85e8ad32895DED33A249": - "0x68f180fcCe6836688e9084f035309E29Bf0A2095", + ADDRESSES.optimism.WBTC, "0x38d693cE1dF5AaDF7bC62595A37D667aD57922e5": - "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85", + ADDRESSES.optimism.USDC_CIRCLE, "0x6ab707Aca953eDAeFBc4fD23bA73294241490620": - "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58", + ADDRESSES.optimism.USDT, "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE": - "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", + ADDRESSES.optimism.DAI, }; const POLYGON_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = { @@ -171,69 +172,69 @@ const POLYGON_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = { "0x90F06727Ba5016eDcf9D8B5def63a5849EcD132f": "0x9633e0749faa6ec6d992265368b88698d6a93ac0", "0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97": - "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + ADDRESSES.polygon.WMATIC_2, "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8": - "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619", + ADDRESSES.polygon.WETH_1, "0xf59036CAEBeA7dC4b86638DFA2E3C97dA9FcCd40": - "0x03b54A6e9a984069379fae1a4fC4dBAE93B3bCCD", + ADDRESSES.polygon.WSTETH, "0x078f358208685046a11C85e8ad32895DED33A249": - "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6", + ADDRESSES.polygon.WBTC, "0xA4D94019934D8333Ef880ABFFbF2FDd611C762BD": - "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359", + ADDRESSES.polygon.USDC_CIRCLE, "0x6ab707Aca953eDAeFBc4fD23bA73294241490620": - "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", + ADDRESSES.polygon.USDT, "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE": - "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", + ADDRESSES.polygon.DAI, "0x8dF3aad3a84da6b69A4DA8aeC3eA40d9091B2Ac4": - "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + ADDRESSES.polygon.WMATIC_2, "0x28424507fefb6f7f8E9D3860F56504E4e5f5f390": - "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619", + ADDRESSES.polygon.WETH_1, "0x5c2ed810328349100A66B82b78a1791B101C9D61": - "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6", + ADDRESSES.polygon.WBTC, "0x1a13F4Ca1d028320A707D99520AbFefca3998b7F": - "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", + ADDRESSES.polygon.USDC, "0x60D55F02A771d515e077c9C2403a1ef324885CeC": - "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", + ADDRESSES.polygon.USDT, "0x27F8D03b3a2196956ED754baDc28D73be8830A6e": - "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", + ADDRESSES.polygon.DAI, }; const AVALANCHE_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = { "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8": - "0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB", + ADDRESSES.avax.WETH_e, "0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97": - "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", + ADDRESSES.avax.WAVAX, "0x8ffDf2DE812095b1D19CB146E4c004587C0A0692": - "0x152b9d0FdC40C096757F570A51E494bd4b943E50", + ADDRESSES.avax.BTC_b, "0x625E7708f30cA75bfd92586e17077590C60eb4cD": - "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", + ADDRESSES.avax.USDC, "0x6ab707Aca953eDAeFBc4fD23bA73294241490620": - "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7", + ADDRESSES.avax.USDt, "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE": - "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70", + ADDRESSES.avax.DAI, "0x53f7c5869a859F0AeC3D334ee8B4Cf01E3492f21": - "0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB", + ADDRESSES.avax.WETH_e, "0xDFE521292EcE2A4f44242efBcD66Bc594CA9714B": - "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", + ADDRESSES.avax.WAVAX, "0x46A51127C3ce23fb7AB1DE06226147F446e4a857": - "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", + ADDRESSES.avax.USDC, "0x532E6537FEA298397212F09A61e03311686f548e": - "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7", + ADDRESSES.avax.USDt, "0x47AFa96Cdc9fAb46904A55a6ad4bf6660B53c38a": - "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7", + ADDRESSES.avax.USDt, }; const BNB_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = { "0x2E94171493fAbE316b6205f1585779C887771E2F": - "0x2170Ed0880ac9A755fd29B2688956BD959F933F8", + ADDRESSES.bsc.ETH, "0x56a7ddc4e848EbF43845854205ad71D5D5F72d3D": - "0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c", + ADDRESSES.bsc.BTCB, "0x9B00a09492a626678E5A3009982191586C444Df9": - "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", + ADDRESSES.bsc.WBNB, "0x00901a076785e0906d1028c7d6372d247bec7d61": - "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", + ADDRESSES.bsc.USDC, "0xa9251ca9DE909CB71783723713B21E4233fbf1B1": - "0x55d398326f99059fF775485246999027B3197955", + ADDRESSES.bsc.USDT, }; const BASE_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = { @@ -244,11 +245,11 @@ const BASE_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = { "0x3E07F263C1Ce5EC2a3f1cA87af56B80B27674D96": "0x89289DC2192914a9F0674f1E9A17C56456549b8A", "0xD4a0e0b9149BCee3C920d2E00b5dE09138fd8bb7": - "0x4200000000000000000000000000000000000006", + ADDRESSES.optimism.WETH_1, "0x99CBC45ea5bb7eF3a5BC08FB1B7E56bB2442Ef0D": "0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452", "0x4e65fE4DbA92790696d040ac24Aa414708F5c0AB": - "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", + ADDRESSES.base.USDC, }; const BLAST_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = {}; diff --git a/projects/instadapp-lite/index.js b/projects/instadapp-lite/index.js index 0631c8f3ec95..9ed590e89e6f 100644 --- a/projects/instadapp-lite/index.js +++ b/projects/instadapp-lite/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const vaults = [ - { "vault": "0xc383a3833A87009fD9597F8184979AF5eDFad019", "token": "0x0000000000000000000000000000000000000000" }, - { "vault": "0xc8871267e07408b89aA5aEcc58AdCA5E574557F8", "token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" }, - { "vault": "0xEC363faa5c4dd0e51f3D9B5d0101263760E7cdeB", "token": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599" }, - { "vault": "0x40a9d39aa50871Df092538c5999b107f34409061", "token": "0x6B175474E89094C44Da98b954EedeAC495271d0F" } + { "vault": "0xc383a3833A87009fD9597F8184979AF5eDFad019", "token": ADDRESSES.null }, + { "vault": "0xc8871267e07408b89aA5aEcc58AdCA5E574557F8", "token": ADDRESSES.ethereum.USDC }, + { "vault": "0xEC363faa5c4dd0e51f3D9B5d0101263760E7cdeB", "token": ADDRESSES.ethereum.WBTC }, + { "vault": "0x40a9d39aa50871Df092538c5999b107f34409061", "token": ADDRESSES.ethereum.DAI } ] const vaultsV2 = ["0xA0D3707c569ff8C87FA923d3823eC5D81c98Be78"] diff --git a/projects/jellyverse/index.js b/projects/jellyverse/index.js index 63501defdd79..382b6f667755 100644 --- a/projects/jellyverse/index.js +++ b/projects/jellyverse/index.js @@ -1,12 +1,19 @@ const { onChainTvl } = require('../helper/balancer') const config = { - vault: "0xFB43069f6d0473B85686a85F4Ce4Fc1FD8F00875", - startingBlock: 81_247_457, + vault: "0xFB43069f6d0473B85686a85F4Ce4Fc1FD8F00875", + startingBlock: 81_247_457, }; module.exports = { - sei: { - tvl: onChainTvl(config.vault, config.startingBlock), - } + sei: { + tvl: onChainTvl(config.vault, config.startingBlock, { + preLogTokens: [ + '0x3894085Ef7Ff0f0aeDf52E2A2704928d1Ec074F1', + '0xB75D0B03c06A926e488e2659DF1A861F860bD3d1', + '0x5f0E07dFeE5832Faa00c63F2D33A0D79150E8598', + '0x5Cf6826140C1C56Ff49C808A1A75407Cd1DF9423', + ] + }), + } } diff --git a/projects/kalax/index.js b/projects/kalax/index.js index a9a8710ceb7c..2977f9f232fe 100644 --- a/projects/kalax/index.js +++ b/projects/kalax/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require("../helper/unwrapLPs"); const KALAX = "0x2F67F59b3629Bf24962290DB9edE0CD4127e606D"; @@ -9,8 +10,8 @@ async function tvl(api) { pools .filter((i) => i.assets !== KALAX) .forEach((i) => { - if (i.assets === "0x0000000000000000000000000000000000000001") { - i.assets = "0x0000000000000000000000000000000000000000"; + if (i.assets === ADDRESSES.linea.WETH_1) { + i.assets = ADDRESSES.null; } api.add(i.assets, i.tvl); }); diff --git a/projects/kiloex/index.js b/projects/kiloex/index.js index 47ba4bfea13a..e33d310ac219 100644 --- a/projects/kiloex/index.js +++ b/projects/kiloex/index.js @@ -17,6 +17,6 @@ module.exports = { tvl: sumTokensExport({ owners: manta_owners, tokens: [ADDRESSES.manta.USDT, manta_stone_token] }) }, taiko: { - tvl: sumTokensExport({ owners: taiko_owners, tokens: ['0x07d83526730c7438048D55A4fc0b850e2aaB6f0b'] }) + tvl: sumTokensExport({ owners: taiko_owners, tokens: [ADDRESSES.taiko.USDC] }) }, }; diff --git a/projects/lynx/index.js b/projects/lynx/index.js index 1920f7a7d222..783bb6e68e75 100644 --- a/projects/lynx/index.js +++ b/projects/lynx/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require("../helper/unwrapLPs"); const config = { @@ -15,7 +16,7 @@ const config = { tokenAndOwnerPair: [ [ // WFUSE Token - "0x0BE9e53fd7EDaC9F859882AfdDa116645287C629", + ADDRESSES.fuse.WFUSE, // OFTChipAdapter (owner) "0x962FD1B229c8c775bC2E37A8a90dac4f3C0105B7", ], @@ -87,7 +88,7 @@ const config = { ], [ // WMATIC Token - "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", + ADDRESSES.polygon.WMATIC_2, // OFTChipAdapter (owner) "0x028815b56433a4aae10087290d1ed9ef7437068f", ], diff --git a/projects/meson/index.js b/projects/meson/index.js index 240504c5e574..3760dabd8ab1 100644 --- a/projects/meson/index.js +++ b/projects/meson/index.js @@ -20,10 +20,10 @@ const config = { bsquared: { tokens: [ ADDRESSES.bsquared.USDT, - '0x7537C1F80c9E157ED7AFD93a494be3e1f04f1462', + ADDRESSES.bsquared.BSTONE, '0xa793740863F1710A87070a5918820976ff32B758', - '0xC2Fe4f673455Ef92299770a09CDB5E8756A525D5', - '0xD48d3A551757ac47655fCe25BDE1B0B6b1Cb2a5A', + ADDRESSES.bsquared.FDUSD, + ADDRESSES.bsquared.ETH, ADDRESSES.bsquared.USDC, ], id: 'b2', diff --git a/projects/metavault-v3/index.js b/projects/metavault-v3/index.js index fa4ae6eac261..a94dcc1647db 100644 --- a/projects/metavault-v3/index.js +++ b/projects/metavault-v3/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { uniV3Export } = require("../helper/uniswapV3") const factory = "0x9367c561915f9D062aFE3b57B18e30dEC62b8488" // same on all chains module.exports = uniV3Export({ linea: { factory, fromBlock: 652486, }, - scroll: { factory, fromBlock: 77008, blacklistedTokens: ['0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f'] }, + scroll: { factory, fromBlock: 77008, blacklistedTokens: [ADDRESSES.linea.WETH] }, }) \ No newline at end of file diff --git a/projects/mitosis/index.js b/projects/mitosis/index.js index 5da1d01b9dce..3067d24c3866 100644 --- a/projects/mitosis/index.js +++ b/projects/mitosis/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const chains = [ "ethereum", "arbitrum", @@ -12,9 +13,9 @@ const WEETH_ADDRESS = { ethereum: "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee", arbitrum: "0x35751007a407ca6FEFfE80b3cB397736D2cf4dbe", optimism: "0x346e03f8cce9fe01dcb3d0da3e9d00dc2c0e08f0", - mode: "0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A", + mode: ADDRESSES.blast.weETH, manta: "0x77b6F99970f488cFA8bd41892900b6Ce881C2300", - blast: "0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A", + blast: ADDRESSES.blast.weETH, linea: "0x1bf74c010e6320bab11e2e5a532b5ac15e0b8aa6", }; diff --git a/projects/particle-trade-duo/index.js b/projects/particle-trade-duo/index.js index 819a47b4d14b..c674172a3ad2 100644 --- a/projects/particle-trade-duo/index.js +++ b/projects/particle-trade-duo/index.js @@ -56,7 +56,7 @@ Object.keys(config).forEach(chain => { target: usdeVault.fwUSDe, params: usdeVault.vault }); - api.add('0x5d3a1ff2b6bab83b63cd9ad0787074081a52ef34', wrappedUSDeBalance) + api.add(ADDRESSES.arbitrum.USDe, wrappedUSDeBalance) return sumTokens2({ api }) } } diff --git a/projects/rehold-v2/index.js b/projects/rehold-v2/index.js index 48221eac907d..30a1825dd520 100644 --- a/projects/rehold-v2/index.js +++ b/projects/rehold-v2/index.js @@ -10,10 +10,10 @@ module.exports = { bsc: { tvl: sumTokensExport({ owner: VAULT_V2, fetchCoValentTokens: true, tokens: [ - "0x55d398326f99059fF775485246999027B3197955", // BSC-USD - "0x2170Ed0880ac9A755fd29B2688956BD959F933F8", //Bpeg ETH - "0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c", // btcb - "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", // usdc + ADDRESSES.bsc.USDT, // BSC-USD + ADDRESSES.bsc.ETH, //Bpeg ETH + ADDRESSES.bsc.BTCB, // btcb + ADDRESSES.bsc.USDC, // usdc "0x570A5D26f7765Ecb712C0924E4De545B89fD43dF", // sol "0x1Fa4a73a3F0133f0025378af00236f3aBDEE5D63", // near "0x1D2F0da169ceB9fC7B3144628dB156f3F6c60dBE", // xrp @@ -27,13 +27,13 @@ module.exports = { "0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD", // link "0xCC42724C6683B7E57334c4E856f4c9965ED682bD", // matic "0x56b6fB708fC5732DEC1Afc8D8556423A2EDcCbD6", // eos - "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", // busd + ADDRESSES.bsc.BUSD, // busd "0xBf5140A22578168FD562DCcF235E5D43A02ce9B1", // uni "0xD41FDb03Ba84762dD66a0af1a6C8540FF1ba5dfb", // sfp "0xAD29AbB318791D579433D831ed122aFeAf29dcfe", // ftm "0xB0D502E938ed5f4df2E681fE6E419ff29631d62b", // stg "0x7083609fCE4d1d8Dc0C979AAb8c869Ea2C873402", // dot - "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", // wbnb + ADDRESSES.bsc.WBNB, // wbnb "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82", // cake "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3", // dai "0x715D400F88C167884bbCc41C5FeA407ed4D2f8A0", // axs diff --git a/projects/rize/index.js b/projects/rize/index.js index 693688e5ae5a..e5aacc173311 100644 --- a/projects/rize/index.js +++ b/projects/rize/index.js @@ -5,7 +5,7 @@ const suiScallopPools = { usdc: { poolId: "0x4ace6648ddc64e646ba47a957c562c32c9599b3bba8f5ac1aadb2ae23a2f8ca0", rewardPoolId: "0xf4268cc9b9413b9bfe09e8966b8de650494c9e5784bf0930759cfef4904daff8", - type: "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN", + type: ADDRESSES.sui.USDC, stakeType: "0xefe8b36d5b2e43728cc323298626b83177803521d195cfb11e15b910e892fddf::reserve::MarketCoin<0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN>", balanceSheet: '0x2f4df5e1368fbbdaa5c712d28b837b3d41c2d3872979ccededcdfdac55ff8a93', spoolAccount: 'a5a2d2afe12ed353ca32a3d5f7592a7a57945040ee7beacab6d82a5fe5b34734', @@ -14,7 +14,7 @@ const suiScallopPools = { usdt: { poolId: "0xcb328f7ffa7f9342ed85af3fdb2f22919e1a06dfb2f713c04c73543870d7548f", rewardPoolId: "0x2c9f934d67a5baa586ceec2cc24163a2f049a6af3d5ba36b84d8ac40f25c4080", - type: "0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN", + type: ADDRESSES.sui.USDT, stakeType: "0xefe8b36d5b2e43728cc323298626b83177803521d195cfb11e15b910e892fddf::reserve::MarketCoin<0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN>", balanceSheet: '0xfbc056f126dd35adc1f8fe985e2cedc8010e687e8e851e1c5b99fdf63cd1c879', spoolAccount: '775206c05243da6b1a29a45c74bd3d3e7db4b3f8303342cbf34c3d12725eac70', @@ -23,7 +23,7 @@ const suiScallopPools = { weth: { poolId: "0xeec40beccb07c575bebd842eeaabb835f77cd3dab73add433477e57f583a6787", rewardPoolId: "0x957de68a18d87817de8309b30c1ec269a4d87ae513abbeed86b5619cb9ce1077", - type: "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN", + type: ADDRESSES.sui.WETH, stakeType: "0xefe8b36d5b2e43728cc323298626b83177803521d195cfb11e15b910e892fddf::reserve::MarketCoin<0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN>", balanceSheet: '0xc8fcdff48efc265740ae0b74aae3faccae9ec00034039a113f3339798035108c', spoolAccount: '3865596e3ea8860e4d479b91d2b9f5c57adab00d70b13ac6c7eb410fd092d2cc', diff --git a/projects/swell-l2-farm/index.js b/projects/swell-l2-farm/index.js index 815a7d4baa20..858c8e3d4cca 100644 --- a/projects/swell-l2-farm/index.js +++ b/projects/swell-l2-farm/index.js @@ -30,11 +30,11 @@ module.exports = { "0x6ee2b5E19ECBa773a352E5B21415Dc419A700d1d", "0xac440d0eE23FA69632Aa731322C2a480dD1376e4", "0x330c4DD05dB16db6323505262C57CFdE5f0A78Ea", - "0x4c9EDD5852cd905f086C759E8383e09bff1E68B3", - "0x853d955aCEf822Db058eb8505911ED77F175b99e", + ADDRESSES.ethereum.USDe, + ADDRESSES.ethereum.FRAX, "0xA663B02CF0a4b149d2aD41910CB81e23e1c41c32", "0x5E8422345238F34275888049021821E8E08CAa1f", - "0xac3E018457B222d93114458476f3E3416Abbe38F", + ADDRESSES.ethereum.sfrxETH, "0x18f313Fc6Afc9b5FD6f0908c1b3D476E3feA1DD9", "0xf7906F274c174A52d444175729E3fa98f9bde285" ] diff --git a/projects/tlx/index.js b/projects/tlx/index.js index 24f65216b89e..c66b8892914f 100644 --- a/projects/tlx/index.js +++ b/projects/tlx/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const helperAbi = { "leveragedTokenData": "function leveragedTokenData() view returns (tuple(address addr, string symbol, uint256 totalSupply, string targetAsset, uint256 targetLeverage, bool isLong, bool isActive, uint256 rebalanceThreshold, uint256 exchangeRate, bool canRebalance, bool hasPendingLeverageUpdate, uint256 remainingMargin, uint256 leverage, uint256 assetPrice, uint256 userBalance)[])" } @@ -5,7 +6,7 @@ const helperAbi = { const contracts = { tlx: "0xD9cC3D70E730503E7f28c1B407389198c4B75FA2", - sUSD: "0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9", + sUSD: ADDRESSES.optimism.sUSD, locker: "0xc068c3261522c97ff719dc97c98c63a1356fef0f", staker: "0xc30877315f3b621a8f7bcda27819ec29429f3817", leveragedTokenHelper: "0xBdAF7A2C4ee313Be468B9250609ba8496131B1f0", diff --git a/projects/treasury/golem.js b/projects/treasury/golem.js index 9095d252aba1..7dc4a819b217 100644 --- a/projects/treasury/golem.js +++ b/projects/treasury/golem.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress, treasuryExports } = require("../helper/treasury"); const { mergeExports } = require('../helper/utils'); @@ -20,7 +21,7 @@ module.exports = treasuryExports({ async function tvl(api) { if(api.timestamp > 1687828149){ // Staked 100k ETH in validators - api.add("0x0000000000000000000000000000000000000000", 100e3*1e18) + api.add(ADDRESSES.null, 100e3*1e18) } return api.getBalances() } diff --git a/projects/treasury/ribbon.js b/projects/treasury/ribbon.js index 752a9b3d0583..4e6ebcaac808 100644 --- a/projects/treasury/ribbon.js +++ b/projects/treasury/ribbon.js @@ -6,7 +6,7 @@ const treasury = "0xDAEada3d210D2f45874724BeEa03C7d4BBD41674"; const treasury2 = "0x42c1357aaa3243ea30c713cdfed115d09f10a71d" const treasury3 = "0x6adeb4fddb63f08e03d6f5b9f653be8b65341b35" const RBN = "0x6123B0049F904d730dB3C36a31167D9d4121fA6B"; -const AEVO = "0xb528edbef013aff855ac3c50b381f253af13b997" +const AEVO = ADDRESSES.ethereum.AEVO module.exports = treasuryExports({ ethereum: { diff --git a/projects/treasury/safe.js b/projects/treasury/safe.js index 4bede95630f5..47ddb3f1acf2 100644 --- a/projects/treasury/safe.js +++ b/projects/treasury/safe.js @@ -2,7 +2,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress,treasuryExports } = require("../helper/treasury"); const treasury = "0x3EDf6868d7c42863E44072DaEcC16eCA2804Dea1" // -const SAFE = "0x5afe3855358e112b5647b952709e6165e1c1eeee" +const SAFE = ADDRESSES.ethereum.SAFE const safe_foundation_treasury = "0x1d4f25bc16b68c50b78e1040bc430a8097fd6f45" const safe_dao_2 = "0x0b00b3227a5f3df3484f03990a87e02ebad2f888" diff --git a/projects/unirouter/index.js b/projects/unirouter/index.js index dafc73bc3961..62cd1b5c317d 100644 --- a/projects/unirouter/index.js +++ b/projects/unirouter/index.js @@ -3,7 +3,7 @@ const ADDRESSES = require("../helper/coreAssets.json"); async function unirouterLSDTvl(api) { const uBTCBalance = await api.call({ abi: "erc20:totalSupply", - target: "0x796e4D53067FF374B89b2Ac101ce0c1f72ccaAc2", + target: ADDRESSES.bsquared.UBTC, }); return await api.add(ADDRESSES.null, uBTCBalance); } diff --git a/projects/unlockd-v2/index.js b/projects/unlockd-v2/index.js index 7d6cee91da71..c0d566ce1052 100644 --- a/projects/unlockd-v2/index.js +++ b/projects/unlockd-v2/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const methodologies = require("../helper/methodologies.js"); const uTokenAbi = { "totalAvailableSupply": "function totalAvailableSupply(address) view returns (uint256)", @@ -5,7 +6,7 @@ const uTokenAbi = { } const addresses = { UTokenVault: "0x25299e9Ec27c242465587B8A2Aa70bcE02636cDA", - USDC: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" + USDC: ADDRESSES.ethereum.USDC } async function tvl(api) { diff --git a/projects/voltage-stableswap/index.js b/projects/voltage-stableswap/index.js index 1b44e9007d39..8fbb3467cf21 100644 --- a/projects/voltage-stableswap/index.js +++ b/projects/voltage-stableswap/index.js @@ -3,7 +3,7 @@ const { sumTokensExport } = require('../helper/unwrapLPs') const FUSD_ADDRESS = '0xd0ce1b4a349c35e61af02f5971e71ac502441e49' const STABLESWAP_ADDRESS = '0x2a68D7C6Ea986fA06B2665d08b4D08F5e7aF960c'.toLowerCase() -const FUSD_V3_ADDRESS = '0xce86a1cf3cff48139598de6bf9b1df2e0f79f86f' +const FUSD_V3_ADDRESS = ADDRESSES.fuse.FUSD_3 const PEGSWAP_ADDRESS = '0x56ee525bb9056bed23a6055e60b2a2c5c225d1db' const STABLES = [ diff --git a/projects/wise-lending-v2/index.js b/projects/wise-lending-v2/index.js index 8abbfef260d5..bb9c6732625c 100644 --- a/projects/wise-lending-v2/index.js +++ b/projects/wise-lending-v2/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') async function tvl(api) { const { lending: lendingContract, tvlAddresses } = config[api.chain]; @@ -19,7 +20,7 @@ async function borrowed(api) { const aavePools = [ "0x724dc807b04555b71ed48a6896b6F41593b8C637", "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8", - "0x5979D7b546E38E414F7E9822514be443A4800529", + ADDRESSES.arbitrum.WSTETH, "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE", "0x6ab707Aca953eDAeFBc4fD23bA73294241490620", ]; diff --git a/projects/zeno/index.js b/projects/zeno/index.js index 7a0ec0617b7e..541525055a30 100644 --- a/projects/zeno/index.js +++ b/projects/zeno/index.js @@ -1,11 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') async function metisTvl(api) { const vaultStorageAddress = "0xFaEee486F4A53cdBEaBE37216bcf1016eB4E52D6"; // eth, usdt, usdc const zenoUnderlyingTokens = [ - "0x420000000000000000000000000000000000000a", - "0xEA32A96608495e54156Ae48931A7c20f0dcc1a21", - "0xbB06DCA3AE6887fAbF931640f67cab3e3a16F4dC", + ADDRESSES.metis.WETH, + ADDRESSES.metis.m_USDC, + ADDRESSES.metis.m_USDT, ]; return api.sumTokens({ diff --git a/projects/zkLink/index.js b/projects/zkLink/index.js index 5dde9d4146c9..3c3ec06b6055 100644 --- a/projects/zkLink/index.js +++ b/projects/zkLink/index.js @@ -119,7 +119,7 @@ const config = { "0xf5b90fE755Aa2e3CcC69d9548cbeB7b38c661D73", // nova bridge address ], tokens: [ - "0xB880fd278198bd590252621d4CD071b1842E9Bcd", //MBTC + ADDRESSES.merlin.WBTC_1, //MBTC "0x41D9036454BE47d3745A823C4aaCD0e29cFB0f71", //Solv BTC ], From 212ee5354e98e937478409b0103bc2d4ef59f6ae Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 13 Jun 2024 21:22:54 +0100 Subject: [PATCH 337/855] remove duplicate sdk --- projects/venus-isolated-pools/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/venus-isolated-pools/index.js b/projects/venus-isolated-pools/index.js index 3d8b21c4d7b1..4622bd4693b7 100644 --- a/projects/venus-isolated-pools/index.js +++ b/projects/venus-isolated-pools/index.js @@ -1,6 +1,5 @@ const sdk = require("@defillama/sdk"); const { cachedGraphQuery } = require('../helper/cache') -const sdk = require('@defillama/sdk') const { compoundExports2 } = require('../helper/compound') const config = { bsc: { From 5df477c3b5500437804459be2d3d331a0b274537 Mon Sep 17 00:00:00 2001 From: slasher125 Date: Fri, 14 Jun 2024 09:53:27 +0400 Subject: [PATCH 338/855] remove dupe sdk imports in liquidations --- liquidations/mimo-protocol/index.ts | 1 - liquidations/venus/index.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/liquidations/mimo-protocol/index.ts b/liquidations/mimo-protocol/index.ts index 30945758a381..6f72b712cdee 100644 --- a/liquidations/mimo-protocol/index.ts +++ b/liquidations/mimo-protocol/index.ts @@ -1,4 +1,3 @@ -import * as sdk from "@defillama/sdk"; import axios from "axios"; import { gql } from "graphql-request"; import BigNumber from "bignumber.js"; diff --git a/liquidations/venus/index.ts b/liquidations/venus/index.ts index 703a3c635ce5..7d6f154a598a 100644 --- a/liquidations/venus/index.ts +++ b/liquidations/venus/index.ts @@ -1,4 +1,3 @@ -import * as sdk from "@defillama/sdk"; import { gql } from "graphql-request"; import { getPagedGql } from "../utils/gql"; import BigNumber from "bignumber.js"; From 58fcba46ce5c9efb580e71f1f3ca71eafcdf6b97 Mon Sep 17 00:00:00 2001 From: Strategic Reserve Date: Fri, 14 Jun 2024 01:00:13 -0700 Subject: [PATCH 339/855] Add Rootstock and Taiko (#10644) --- projects/visor/config.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/visor/config.js b/projects/visor/config.js index b2832d59d82f..69ab6e93011e 100644 --- a/projects/visor/config.js +++ b/projects/visor/config.js @@ -128,6 +128,13 @@ const HYPE_REGISTRY = { mode: [ ["0x683292172E2175bd08e3927a5e72FC301b161300", 696737], // KIM ], + taiko: [ + ["0xc27ddd78fc49875fe6f844b72bbf31dfbb099881", 57600], // Uniswap + ], + rsk: [ + ["0x683292172E2175bd08e3927a5e72FC301b161300", 6414342], // Uniswap + ["0xC27DDd78FC49875Fe6F844B72bbf31DFBB099881", 6414350], // Sushiswap + ], }; Object.keys(HYPE_REGISTRY).forEach(chain => { From 44879a3fd164d5ef41e94df5888c22b5c9c49e2b Mon Sep 17 00:00:00 2001 From: joltbrian <144665672+briangarden@users.noreply.github.com> Date: Fri, 14 Jun 2024 16:02:01 +0800 Subject: [PATCH 340/855] update the tvl calculation for Joltify rwa adapter (#10628) --- projects/joltify-rwa/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/projects/joltify-rwa/index.js b/projects/joltify-rwa/index.js index 8d3810eb45e3..586e223be863 100644 --- a/projects/joltify-rwa/index.js +++ b/projects/joltify-rwa/index.js @@ -6,8 +6,18 @@ const tvl = async (api) => { queryV1Beta1({ chain, url: `spv/list_pools` }), ]); + const [price_info] = await Promise.all([ + queryV1Beta1({ chain, url: `third_party/pricefeed/v1beta1/prices` }), + ]); + pools.pools_info.forEach(async pool => { + const [market, borrowed_denom] = pool.borrowed_amount.denom.split('-'); + const market_id = `${market}:usd`; + const price = price_info.prices.find(price => price.market_id === market_id)?.price; + api.add(borrowed_denom, pool.borrowed_amount.amount * price); api.add(pool.usable_amount.denom, pool.usable_amount.amount); + api.add(pool.escrow_principal_amount.denom, pool.escrow_principal_amount.amount); + api.add(pool.escrow_principal_amount.denom, pool.escrow_interest_amount); }); } From a730591388a366890169281c936efd65ffcdaa88 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 14 Jun 2024 10:04:23 +0200 Subject: [PATCH 341/855] joltify: exclude borrowed --- projects/joltify-rwa/index.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/projects/joltify-rwa/index.js b/projects/joltify-rwa/index.js index 586e223be863..7529664e7388 100644 --- a/projects/joltify-rwa/index.js +++ b/projects/joltify-rwa/index.js @@ -6,15 +6,7 @@ const tvl = async (api) => { queryV1Beta1({ chain, url: `spv/list_pools` }), ]); - const [price_info] = await Promise.all([ - queryV1Beta1({ chain, url: `third_party/pricefeed/v1beta1/prices` }), - ]); - pools.pools_info.forEach(async pool => { - const [market, borrowed_denom] = pool.borrowed_amount.denom.split('-'); - const market_id = `${market}:usd`; - const price = price_info.prices.find(price => price.market_id === market_id)?.price; - api.add(borrowed_denom, pool.borrowed_amount.amount * price); api.add(pool.usable_amount.denom, pool.usable_amount.amount); api.add(pool.escrow_principal_amount.denom, pool.escrow_principal_amount.amount); api.add(pool.escrow_principal_amount.denom, pool.escrow_interest_amount); From 76aea5552d84080f352d0d088e537670af99ab74 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 14 Jun 2024 10:10:15 +0200 Subject: [PATCH 342/855] fix ethalend --- projects/ethalend/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/ethalend/index.js b/projects/ethalend/index.js index d38667239d43..cf8f95e3d8d8 100644 --- a/projects/ethalend/index.js +++ b/projects/ethalend/index.js @@ -4,6 +4,7 @@ const { unwrapUniswapLPs } = require('../helper/unwrapLPs') const { staking } = require('../helper/staking') const { pool2 } = require('../helper/pool2') const { getConfig } = require('../helper/cache') +const sdk = require('@defillama/sdk') const { gql, request } = require('graphql-request') const { default: BigNumber } = require('bignumber.js') From 945eedafc66735e9f9c2bc2999cd3fdce46f5307 Mon Sep 17 00:00:00 2001 From: Macaron <164980497+Macaromswap@users.noreply.github.com> Date: Fri, 14 Jun 2024 08:33:41 +0000 Subject: [PATCH 343/855] add macaron-xyz-stable --- projects/macaron-xyz-stable/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/macaron-xyz-stable/index.js diff --git a/projects/macaron-xyz-stable/index.js b/projects/macaron-xyz-stable/index.js new file mode 100644 index 000000000000..0624a26f029f --- /dev/null +++ b/projects/macaron-xyz-stable/index.js @@ -0,0 +1,23 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +async function tvl(api) { + const { factory, fromBlock, } = config[api.chain] + const logs = await getLogs({ + api, + target: factory, + topics: ['0x8e74ffd51819fef95a58370a621a4ba82cae11062f357bf636c4cca361812ddf'], + fromBlock, + eventAbi: 'event NewStableSwapPair(address indexed pool, address indexed token0, address indexed token1, uint256 A, uint256 fee, uint256 adminFee)', + onlyArgs: true, + }) + return sumTokens2({ api, ownerTokens: logs.map(({ pool, token0, token1 }) => ([[token0, token1], pool])) }) +} + +const config = { + btr: { factory: '0x584E53b4D07b077fA6cc4302B0b457c04bbCC8Fa', fromBlock: 1736941 }, +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file From 69bcef020c4400721ef509650c26148e83a66b4d Mon Sep 17 00:00:00 2001 From: Nicolas Zozol Date: Fri, 14 Jun 2024 11:44:05 +0200 Subject: [PATCH 344/855] update: swaap and swaap-earn update from thegraph to goldsky --- projects/swaap-earn/index.js | 3 ++- projects/swaap/index.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/swaap-earn/index.js b/projects/swaap-earn/index.js index 175ecf3a11c9..f9be8debc38d 100644 --- a/projects/swaap-earn/index.js +++ b/projects/swaap-earn/index.js @@ -7,7 +7,8 @@ module.exports = { } const config = { - arbitrum: { endpoint: sdk.graph.modifyEndpoint('DHZvo3KRhryqHH9zj9sK8n9sjXvg3ddmDoVdLZcZQMJg'), }, + arbitrum: { endpoint: 'https://api.goldsky.com/api/public/project_clws2t7g7ae9c01xsbnu80a51/subgraphs/swaap-earn-arbitrum/1.0.0/gn', }, + ethereum: { endpoint: 'https://api.goldsky.com/api/public/project_clws2t7g7ae9c01xsbnu80a51/subgraphs/swaap-earn-ethereum/1.0.0/gn', }, } Object.keys(config).forEach(chain => { diff --git a/projects/swaap/index.js b/projects/swaap/index.js index 6415219340e3..0744bbe62cd6 100644 --- a/projects/swaap/index.js +++ b/projects/swaap/index.js @@ -7,7 +7,7 @@ const configV1 = { startBlock: 29520285, blockDelay: 30, theGraph: { - endpoint: sdk.graph.modifyEndpoint('A1ibaGVUkqdLeBG7VeeSB8jm9QNmS8phSz8iooXR8puv'), + endpoint: 'https://api.goldsky.com/api/public/project_clws2t7g7ae9c01xsbnu80a51/subgraphs/swaapv1/1.0.0/gn', query: `pools: pools(orderBy: liquidity, orderDirection: desc) { id tokens { From 2b8636aee2896db2e92cbab786bcb8682c731b64 Mon Sep 17 00:00:00 2001 From: Oleh Kalenyk Date: Fri, 14 Jun 2024 11:46:34 +0300 Subject: [PATCH 345/855] *added steer vaults for kim exchange --- projects/kim-vaults/index.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 projects/kim-vaults/index.js diff --git a/projects/kim-vaults/index.js b/projects/kim-vaults/index.js new file mode 100644 index 000000000000..a81af95c9d30 --- /dev/null +++ b/projects/kim-vaults/index.js @@ -0,0 +1,36 @@ +const STEER_VAULTS = [ + "0x23c17a512d486d6f46db63a8dd5144b352497762", + "0x4236fc0a5c47857777dd1578b7e825c8ccadca88", + "0x4c8d1a52ee90b04ff8ee1257ad12290d89d13e6f", + "0x554310f5d636dfc1122308a10f2b9936681f76de", + "0x5aa27d5d8aff8cd5e683e23812124ace4aa5af7d", + "0x83556d8bba69bdd159f50b2127ccc88bebf73e39", + "0x879f9998c68cdaf28e4808fcc2b4f174c3cc5d97", + "0x8bc0cd048cea0ebff9e81eeb79842c86c501ea3b", + "0x908731366f82668ddd3ae3b2498adf52604e892d", + "0xa212659dd4b71947268ff2037a654ce03730d857", + "0xac8c89516bc4b60621c5326446e33680357bb3d2", + "0xacb9a8676fc6ada472611a62354bf47502969287", + "0xc07df1d13188c081f770944ece48e469b326b2a5", + "0xc40d4d88afc7b03c65391cbfb6f399f464f6ab03", + "0xcf4664fd4d0cabfcbbcbd4b6c2ecb71ac120d0c3" +]; + +async function tvl(api) { + const token0s = await api.multiCall({ abi: 'address:token0', calls: STEER_VAULTS }) + const token1s = await api.multiCall({ abi: 'address:token1', calls: STEER_VAULTS }) + const bals = await api.multiCall({ + abi: 'function getTotalAmounts() view returns (uint256 bal0, uint256 bal1)', + calls: STEER_VAULTS + }) + bals.forEach(({ bal0, bal1 }, i) => { + api.add(token0s[i], bal0) + api.add(token1s[i], bal1) + }) +} + +module.exports = { + mode: { + tvl, + }, +}; From c22d281b78673f7cd0ceb19eba3156c0440d63d4 Mon Sep 17 00:00:00 2001 From: PRDT Finance <87976805+PRDTfinance@users.noreply.github.com> Date: Fri, 14 Jun 2024 12:53:00 +0300 Subject: [PATCH 346/855] Update index.js --- projects/prdt/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/projects/prdt/index.js b/projects/prdt/index.js index 19a9b6564ab9..74c15e966f8d 100644 --- a/projects/prdt/index.js +++ b/projects/prdt/index.js @@ -5,12 +5,14 @@ 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], }, @@ -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, ADDRESSES.polygon.ETH], }, }; From bea2f684c9a23aac0483aa706edc1d1f46be2318 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Fri, 14 Jun 2024 10:57:19 +0100 Subject: [PATCH 347/855] dynamic query batching --- test.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/test.js b/test.js index c77936d29d57..df47f6948bd0 100644 --- a/test.js +++ b/test.js @@ -354,10 +354,10 @@ async function computeTVL(balances, timestamp) { let tokenData = [] readKeys.forEach(i => unknownTokens[i] = true) + const queries = buildPricesGetQueries(readKeys) const { errors } = await PromisePool.withConcurrency(5) - .for(sliceIntoChunks(readKeys, 100)) - .process(async (keys) => { - tokenData.push((await axios.get(`https://coins.llama.fi/prices/current/${keys.join(',')}`)).data.coins) + .for(queries).process(async (query) => { + tokenData.push((await axios.get(query)).data.coins) }) if (errors && errors.length) @@ -423,7 +423,22 @@ setTimeout(() => { process.exit(1); }, 10 * 60 * 1000) // 10 minutes +function buildPricesGetQueries(readKeys) { + const burl = 'https://coins.llama.fi/prices/current/' + const queries = [] + let query = burl + for (key of readKeys) { + if (query.length + key.length > 2000) { + queries.push(query.slice(0, -1)) + query = burl + } + query += `${key},` + } + + queries.push(query.slice(0, -1)) + return queries +} async function initCache() { let currentCache = await sdk.cache.readCache(INTERNAL_CACHE_FILE) From bc9f96c624b48b2fe91f0f97f405b663552bc64c Mon Sep 17 00:00:00 2001 From: kexley <87971154+kexleyBeefy@users.noreply.github.com> Date: Fri, 14 Jun 2024 11:50:00 +0100 Subject: [PATCH 348/855] Fix Beefy from Lite to zkSync Era --- projects/beefy/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/beefy/index.js b/projects/beefy/index.js index 2422c214110a..45d85b14ce1e 100644 --- a/projects/beefy/index.js +++ b/projects/beefy/index.js @@ -41,7 +41,7 @@ const chains = { polygon: 137, fantom: 250, fraxtal: 252, - zksync: 324, + era: 324, metis: 1088, polygon_zkevm: 1101, moonbeam: 1284, From 169741bff1208b46499c7bfac0402d89e7ec0220 Mon Sep 17 00:00:00 2001 From: slasher125 Date: Fri, 14 Jun 2024 15:44:32 +0400 Subject: [PATCH 349/855] kyber fix --- projects/kyber/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/kyber/index.js b/projects/kyber/index.js index 6b7254639eda..069bb63b2092 100644 --- a/projects/kyber/index.js +++ b/projects/kyber/index.js @@ -1,3 +1,4 @@ +const sdk = require("@defillama/sdk") const { cachedGraphQuery } = require("../helper/cache"); const { sumTokens2 } = require('../helper/unwrapLPs') @@ -45,6 +46,12 @@ async function fetchPools(chain) { case "cronos": url = 'https://cronos-graph.kyberengineering.io/subgraphs/name/kybernetwork/kyberswap-elastic-cronos'; break; case "base": url = 'https://base-graph.kyberengineering.io/subgraphs/name/kybernetwork/kyberswap-elastic-base'; break; case "scroll": url = 'https://scroll-graph.kyberengineering.io/subgraphs/name/kybernetwork/kyberswap-elastic-scroll'; break; + case "mainnet": url = sdk.graph.modifyEndpoint('4U9PxDR4asVvfXyoVy18fhuj6NHnQhLzZkjZ5Bmuc5xk'); break; + case "arbitrum-one" : url = sdk.graph.modifyEndpoint('C36tj8jSpEHxcNbjM3z7ayUZHVjrk4HRqnpGMFuRgXs6'); break; + case "avalanche": url = sdk.graph.modifyEndpoint('9oMJfc7CL8uDqqQ3T3NFBnFCz9JMwq2YhH9AqojECFWp'); break; + case "bsc": url = sdk.graph.modifyEndpoint('FDEDgycFnTbPZ7PfrnWEZ4iR7T5De6BR69zx1i8gKQRa'); break; + case "fantom": url = sdk.graph.modifyEndpoint('9aj6YZFVL647wFBQXnNKM72eiowP4fyzynQKwLrn5axL'); break; + case "optimism": url = sdk.graph.modifyEndpoint('3Kpd8i7U94pTz3Mgdb8hyvT5o26fpwT7SUHAbTa6JzfZ'); break; default: url = `https://api.thegraph.com/subgraphs/name/kybernetwork/kyberswap-elastic-${chain}`; } let toa = []; From c9093d35f4e5ab6c6500afa7fa67097e76ad5f44 Mon Sep 17 00:00:00 2001 From: FantaHolic <96290246+0xfantaholic@users.noreply.github.com> Date: Sat, 15 Jun 2024 00:00:29 +0300 Subject: [PATCH 350/855] added zklink (#10653) * added zklink * update test.js --- projects/wagmi-com/index.js | 1 + test.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/wagmi-com/index.js b/projects/wagmi-com/index.js index 8fc560dd6975..24f8afe3e998 100644 --- a/projects/wagmi-com/index.js +++ b/projects/wagmi-com/index.js @@ -7,6 +7,7 @@ module.exports = uniV3Export({ kava: { factory: '0x0e0Ce4D450c705F8a0B6Dd9d5123e3df2787D16B', fromBlock: 6037137, }, ethereum: { factory: '0xB9a14EE1cd3417f3AcC988F61650895151abde24', fromBlock: 18240112, }, metis: { factory: '0x8112E18a34b63964388a3B2984037d6a2EFE5B8A', fromBlock: 9740222, }, + zklink: { factory: '0x6175b648473F1d4c1549aAC3c2d007e7720585e6', fromBlock: 1339353, }, }) module.exports.kava = { tvl: uniV3GraphExport({ name: 'wagmi-kava', graphURL: 'https://kava.graph.wagmi.com/subgraphs/name/v3', minTVLUSD: 0 }) } diff --git a/test.js b/test.js index 87c765265641..81060fd6bd8f 100644 --- a/test.js +++ b/test.js @@ -428,7 +428,7 @@ function buildPricesGetQueries(readKeys) { const queries = [] let query = burl - for (key of readKeys) { + for (const key of readKeys) { if (query.length + key.length > 2000) { queries.push(query.slice(0, -1)) query = burl From d0fe2cf43a47e9c4d96b93873a7b89435d47e6d8 Mon Sep 17 00:00:00 2001 From: leeamijo <154820412+leeamijo@users.noreply.github.com> Date: Sat, 15 Jun 2024 17:23:39 +0800 Subject: [PATCH 351/855] feat: Pell Network add bsquared chain (#10657) --- projects/pell/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/pell/index.js b/projects/pell/index.js index 5a8ae0be27e4..9d6365a47cbf 100644 --- a/projects/pell/index.js +++ b/projects/pell/index.js @@ -1,12 +1,12 @@ const { sumTokens2 } = require('../helper/unwrapLPs') const { getConfig } = require('../helper/cache') -const chains = ['merlin', 'bouncebit', 'btr', 'bsc',] +const chains = ['merlin', 'bouncebit', 'btr', 'bsc', 'bsquared'] chains.forEach(chain => { module.exports[chain] = { tvl: async function (api) { - const { result } = await getConfig(`pell/${api.chain}`, `https://api.pell.network/v1/stakeList?chainId=${api.chainId}`) + const { result } = await getConfig(`pell/${api.chain}`, `https://api.pell.network/v1/stakeList?chainId=${api.chain === 'bsquared' ? 223 : api.chainId}`) const vaults = result.map(f => f.strategyAddress) const tokens = await api.multiCall({ abi: 'address:underlyingToken', calls: vaults }) return sumTokens2({ api, tokensAndOwners2: [tokens, vaults], }) From 716168a3274aa8e35ba99ab8aa09b254cc45a113 Mon Sep 17 00:00:00 2001 From: Ulysse Ramage Date: Sat, 15 Jun 2024 13:47:36 +0200 Subject: [PATCH 352/855] fix: add event topics for Spectra Finance (#10658) * fix: add event topics * fix: add cache extra key --- projects/spectra/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/projects/spectra/index.js b/projects/spectra/index.js index 87ea77c9e6a9..a0dfa4546ae7 100644 --- a/projects/spectra/index.js +++ b/projects/spectra/index.js @@ -7,6 +7,11 @@ module.exports = { methodology: `All deposited underlying in Spectra Principal Tokens and all underlying supplied as liquidity in Spectra Markets`, }; +const curvePoolDeployedTopic = + "0x3c7b686d948efcba31c9cfd1aeae78faac70fe0c1ed90d151d49c75e85027a91"; +const ptDeployedTopic = + "0xcf50c3e7162cc35f5befd4f0379ddd760d499ca96330c9ae8faa4059919caaee"; + Object.keys(config).forEach((chain) => { const { factory, fromBlock } = config[chain]; module.exports[chain] = { @@ -89,10 +94,12 @@ Object.keys(config).forEach((chain) => { const logs = await getLogs({ api, target: factory, + topic: curvePoolDeployedTopic, eventAbi: "event CurvePoolDeployed(address indexed poolAddress, address indexed ibt, address indexed pt)", onlyArgs: true, fromBlock: fromBlock, + extraKey: "markets", }); return logs.map((i) => [i.poolAddress, i.ibt]); } @@ -101,10 +108,12 @@ Object.keys(config).forEach((chain) => { const logs = await getLogs({ api, target: factory, + topic: ptDeployedTopic, eventAbi: "event PTDeployed(address indexed pt, address indexed poolCreator)", onlyArgs: true, fromBlock: fromBlock, + extraKey: "pts", }); return logs.map((i) => i.pt); } From d5a4578e16b4a83352bcb6aa6e36959c16b4c05a Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Sat, 15 Jun 2024 18:15:15 +0100 Subject: [PATCH 353/855] add fenix finance v2 --- projects/fenix-v2/index.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 projects/fenix-v2/index.js diff --git a/projects/fenix-v2/index.js b/projects/fenix-v2/index.js new file mode 100644 index 000000000000..b068b85c558c --- /dev/null +++ b/projects/fenix-v2/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('blast', '0xa19c51d91891d3df7c13ed22a2f89d328a82950f') \ No newline at end of file From 74b9e8c15357c3ca338ee6f1e7cf8168e94447d4 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Sat, 15 Jun 2024 18:35:38 +0100 Subject: [PATCH 354/855] hasStablePools=true --- projects/fenix-v2/index.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/projects/fenix-v2/index.js b/projects/fenix-v2/index.js index b068b85c558c..25e428c98eb9 100644 --- a/projects/fenix-v2/index.js +++ b/projects/fenix-v2/index.js @@ -1,3 +1,12 @@ -const { uniTvlExport } = require('../helper/unknownTokens') +const { getUniTVL } = require('../helper/unknownTokens') -module.exports = uniTvlExport('blast', '0xa19c51d91891d3df7c13ed22a2f89d328a82950f') \ No newline at end of file +module.exports = { + misrepresentedTokens: true, + blast: { + tvl: getUniTVL({ + factory: '0xa19c51d91891d3df7c13ed22a2f89d328a82950f', + useDefaultCoreAssets: true, + hasStablePools: true + }) + }, +}; \ No newline at end of file From cc9ed873b4b60a4d012ed35d436c7885e312a9f4 Mon Sep 17 00:00:00 2001 From: hamur dev <122794657+tpktpj@users.noreply.github.com> Date: Sat, 15 Jun 2024 14:37:07 -0400 Subject: [PATCH 355/855] Add scroll mkt (#10661) Co-authored-by: jsmjsm --- projects/avalon-finance/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/avalon-finance/index.js b/projects/avalon-finance/index.js index 0b804e332194..e266be25e823 100644 --- a/projects/avalon-finance/index.js +++ b/projects/avalon-finance/index.js @@ -8,7 +8,8 @@ const mainMarket = { btr: aaveExports('', '0x6aB5d5E96aC59f66baB57450275cc16961219796', undefined, ['0x5F314b36412765f3E1016632fD1Ad528929536CA'], {v3: true}), arbitrum: aaveExports('', '0xa2ddc06baDc817C612111137c0cf6Bd43634EE1a', undefined, ['0xEc579d2cE07401258710199Ff12a5bb56e086a6F'],{v3: true}), bsc: aaveExports('', '0x5395201A4DD625a0d69b99D917282f75928416c1', undefined, ['0x672b19DdA450120C505214D149Ee7F7B6DEd8C39'],{v3: true}), - core: aaveExports('', '0x410d2D3Dc79ec66A2Cfc3A4a0AD4af3a38D38bd0', undefined, ['0x802CB61844325dc9A161bC3A498E3BE1B7b6FE00'],{v3: true}), + core: aaveExports('', '0x410d2D3Dc79ec66A2Cfc3A4a0AD4af3a38D38bd0', undefined, ['0x802CB61844325dc9A161bC3A498E3BE1B7b6FE00'], { v3: true }), + scroll: aaveExports('', '0xFBb77A68ee35e7902F1ABE0Bd34B263023e90c70', undefined, ['0x18cbe70602Ee17f79D56971F685E9EaF49DA53F2'], { v3: true }) } const innovativeMarket = { From efa22db7b67ff54c8513323eedd065189510d573 Mon Sep 17 00:00:00 2001 From: D <105202131+dmitrykarpushkin@users.noreply.github.com> Date: Sun, 16 Jun 2024 01:11:30 +0400 Subject: [PATCH 356/855] banx idl link update (#10659) --- projects/banx/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/banx/index.js b/projects/banx/index.js index 2f87f287ba19..8bc4c0a7fac0 100644 --- a/projects/banx/index.js +++ b/projects/banx/index.js @@ -13,7 +13,7 @@ async function getData() { async function getAllData() { const programId = '4tdmkuY6EStxbS6Y8s5ueznL3VPMSugrvQuDeAHGZhSt' const provider = getProvider() - const idl = await getConfig('banx-idl', 'https://raw.githubusercontent.com/frakt-solana/banx-public-sdk/master/src/fbond-protocol/idl/bonds.json') + const idl = await getConfig('banx-idl', 'https://api.banx.gg/idl') const program = new Program(idl, programId, provider) const bondOfferOffset = 32 + 8; From 5e39ab7d8d97ef4747a9bd4db3133b101d033083 Mon Sep 17 00:00:00 2001 From: fextr <34183870+fextr@users.noreply.github.com> Date: Sat, 15 Jun 2024 14:18:47 -0700 Subject: [PATCH 357/855] add staking TVL to zunami (#10660) * add staking TVL to zunami * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/zunami/abi.json | 3 --- projects/zunami/index.js | 25 ++++++++++++++++++++----- 2 files changed, 20 insertions(+), 8 deletions(-) delete mode 100644 projects/zunami/abi.json diff --git a/projects/zunami/abi.json b/projects/zunami/abi.json deleted file mode 100644 index fcec271d50ab..000000000000 --- a/projects/zunami/abi.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "totalHoldings": "uint256:totalHoldings" -} \ No newline at end of file diff --git a/projects/zunami/index.js b/projects/zunami/index.js index 4c2293a0efcc..5505e9b36b38 100644 --- a/projects/zunami/index.js +++ b/projects/zunami/index.js @@ -1,22 +1,37 @@ const ADDRESSES = require('../helper/coreAssets.json') -const abi = require("./abi.json"); +const poolAbi = { + "totalHoldings": "uint256:totalHoldings" +} +const stakingAbi = { + "totalSupply": "uint256:totalSupply" +} const zunUSD = "0x8C0D76C9B18779665475F3E212D9Ca1Ed6A1A0e6"; const zunUSDAps = "0x28e487bbF6b64867C29e61DccbCD17aB64082889"; + const zunETH = "0xc2e660C62F72c2ad35AcE6DB78a616215E2F2222"; const zunETHAps = "0x5Ab3aa11a40eB34f1d2733f08596532871bd28e2"; +const zunStaking = "0x45af4F12B46682B3958B297bAcebde2cE2E795c3"; + +const ZUN = "0x6b5204B0Be36771253Cc38e88012E02B752f0f36"; + async function ethTvl(api) { - api.add(ADDRESSES.ethereum.DAI, await api.call({ abi: abi.totalHoldings, target: zunUSD, })) - api.add(ADDRESSES.ethereum.DAI, await api.call({ abi: abi.totalHoldings, target: zunUSDAps, })) - api.add(ADDRESSES.ethereum.WETH, await api.call({ abi: abi.totalHoldings, target: zunETH, })) - api.add(ADDRESSES.ethereum.WETH, await api.call({ abi: abi.totalHoldings, target: zunETHAps, })) + api.add(ADDRESSES.ethereum.DAI, await api.call({ abi: poolAbi.totalHoldings, target: zunUSD, })) + api.add(ADDRESSES.ethereum.DAI, await api.call({ abi: poolAbi.totalHoldings, target: zunUSDAps, })) + api.add(ADDRESSES.ethereum.WETH, await api.call({ abi: poolAbi.totalHoldings, target: zunETH, })) + api.add(ADDRESSES.ethereum.WETH, await api.call({ abi: poolAbi.totalHoldings, target: zunETHAps, })) +} + +async function staking(api) { + api.add(ZUN, await api.call({ abi: stakingAbi.totalSupply, target: zunStaking, })) } module.exports = { misrepresentedTokens: true, ethereum: { tvl: ethTvl, + staking, }, hallmarks: [ [Math.floor(new Date('2023-08-13')/1e3), 'Project was hacked for $2M'], From 3c41003f1f6e686982861f6a761ebaf03d68d1ff Mon Sep 17 00:00:00 2001 From: mutuarilabs Date: Sun, 16 Jun 2024 01:20:50 +0400 Subject: [PATCH 358/855] Add Mutuari project (#10652) * Add files via upload Added mutuari project * code refactor * add borrowed --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/tokenMapping.js | 5 +++++ projects/mutuari/index.js | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 projects/mutuari/index.js diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 893d6d8097b0..333373831edd 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -36,6 +36,11 @@ const ibcMappings = { } const fixBalancesTokens = { + ftn: { + '0x0000000000000000000000000000000000000000': { coingeckoId: 'fasttoken', decimals: 18 }, + '0x4084ab20f8ffca76c19aaf854fb5fe9de6217fbb': { coingeckoId: 'fasttoken', decimals: 18 }, + '0x498d1cf9ad2d66144c98057a5880ee16e801e2f7': { coingeckoId: 'fasttoken', decimals: 18 }, + }, q: { [ADDRESSES.q.ELK]: { coingeckoId: "elk-finance", decimals: 18 }, [ADDRESSES.q.WETH]: { coingeckoId: "ethereum", decimals: 18 }, diff --git a/projects/mutuari/index.js b/projects/mutuari/index.js new file mode 100644 index 000000000000..e7240c73e38d --- /dev/null +++ b/projects/mutuari/index.js @@ -0,0 +1,17 @@ +const { sumTokens2 } = require("../helper/unwrapLPs") + +async function tvl(api) { + const pool = await api.call({ target: '0x831fc32221924f8a6d47251327ef67ebcc5cd6dc', abi: "address:mutuariPool" }) + const tokens = await api.call({ target: pool, abi: "address[]:getReserves" }) + return sumTokens2({ api, owner: pool, tokens,}) +} +async function borrowed(api) { + const [_, borrowed] = await api.call({ target: '0x831fc32221924f8a6d47251327ef67ebcc5cd6dc', abi: "function getGeneralInfo() view returns (uint256 totalSupplied, uint256 totalBorrowed)" }) + api.addGasToken(borrowed) + return sumTokens2({ api }) +} + +module.exports = { + methodology: "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted.", + ftn: { tvl, borrowed }, +} From 435dbf7b5f625ee8e9d398edae82ff35bf8d4eda Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sun, 16 Jun 2024 00:23:38 +0100 Subject: [PATCH 359/855] add new vault --- projects/etherfi-liquid/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/etherfi-liquid/index.js b/projects/etherfi-liquid/index.js index 1498bdcc48fb..d485b235f8e1 100644 --- a/projects/etherfi-liquid/index.js +++ b/projects/etherfi-liquid/index.js @@ -22,7 +22,11 @@ async function tvl(api) { throw new Error('Data is outdated') } console.log(updatedTimestamp, api.timestamp) - api.add(ADDRESSES.ethereum.EETH, balETH - wethBal); + const balETH2 = await api.call({ + abi: "uint256:totalSupply", + target: '0x917ceE801a67f933F2e6b33fC0cD1ED2d5909D88', + }); + api.add(ADDRESSES.ethereum.EETH, BigInt(balETH) - BigInt(wethBal) + BigInt(balETH2)); api.add(ADDRESSES.ethereum.WETH, wethBal) const balUSD = await api.call({ abi: "uint256:totalSupply", From 57caab2f5f2d62a2225615ea643739d53b030c74 Mon Sep 17 00:00:00 2001 From: 0x_danr Date: Sun, 16 Jun 2024 06:43:59 -0400 Subject: [PATCH 360/855] GammaSwap: Tracking Ethereum TVL and DeltaSwap TVL from Base (#10664) * add TVL from Base network * tracking ethereum mainnet pool data --- projects/gammaswap-deltaswap/index.js | 3 +++ projects/gammaswap-v2/index.js | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/projects/gammaswap-deltaswap/index.js b/projects/gammaswap-deltaswap/index.js index 0a868830344e..75b5d201a3c5 100644 --- a/projects/gammaswap-deltaswap/index.js +++ b/projects/gammaswap-deltaswap/index.js @@ -3,4 +3,7 @@ module.exports = { arbitrum: { tvl: getUniTVL({ factory: "0xcb85e1222f715a81b8edaeb73b28182fa37cffa8", }), }, + base: { + tvl: getUniTVL({ factory: "0x9a9a171c69cc811dc6b59bb2f9990e34a22fc971", }), + }, }; diff --git a/projects/gammaswap-v2/index.js b/projects/gammaswap-v2/index.js index 4e50e9c1cbb3..f9db4491fc36 100644 --- a/projects/gammaswap-v2/index.js +++ b/projects/gammaswap-v2/index.js @@ -12,6 +12,12 @@ const config = { factories: [ { factory: '0xfd513630f697a9c1731f196185fb9eba6eaac20b', fromBlock: 12475877 }, ], + deltaswapFactory: '0x9a9a171c69cc811dc6b59bb2f9990e34a22fc971' + }, + ethereum: { + factories: [ + { factory: '0xfd513630f697a9c1731f196185fb9eba6eaac20b', fromBlock: 19961383 }, + ], }, } From 3525e34905be57dbfcdd8f2590b435f8a56513aa Mon Sep 17 00:00:00 2001 From: Nghia Hoang Date: Sun, 16 Jun 2024 17:58:24 +0700 Subject: [PATCH 361/855] Add IHF project adapter (#10663) * Add IHF project adapter * Update index.js * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/infinity-hedge-fund/index.js | 7 +++++++ test.js | 1 + 2 files changed, 8 insertions(+) create mode 100644 projects/infinity-hedge-fund/index.js diff --git a/projects/infinity-hedge-fund/index.js b/projects/infinity-hedge-fund/index.js new file mode 100644 index 000000000000..f354c5563af8 --- /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/test.js b/test.js index 81060fd6bd8f..5846caef1098 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 From e314a074550100de03f807de76517ab8c9d14d5c Mon Sep 17 00:00:00 2001 From: sofa-org <161308389+sofa-org@users.noreply.github.com> Date: Sun, 16 Jun 2024 19:11:22 +0800 Subject: [PATCH 362/855] Add SOFA.org (#10662) * Add SOFA.org Add SOFA.org (Ethereum/Arbitrum) * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/sofa-org/index.js | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 projects/sofa-org/index.js diff --git a/projects/sofa-org/index.js b/projects/sofa-org/index.js new file mode 100644 index 000000000000..380b0d6d94be --- /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 From 50ff3a0bd2f0bd44382ae1006a23692c1f773cac Mon Sep 17 00:00:00 2001 From: Seiji Date: Sun, 16 Jun 2024 21:09:16 -0400 Subject: [PATCH 363/855] exports "misrepresentedTokens: true" --- projects/otsea/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/otsea/index.js b/projects/otsea/index.js index bc6cef85b39f..ee83ffc1f37a 100644 --- a/projects/otsea/index.js +++ b/projects/otsea/index.js @@ -49,6 +49,7 @@ async function otsea_total_volume(api) { // Global export module.exports = { methodology: "We aggregated the assets locked on OTSea market", + misrepresentedTokens: true, }; // Network exports From 97119154a22eefa2e616d40eba750886d800db7a Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 17 Jun 2024 03:06:34 +0100 Subject: [PATCH 364/855] add sanko --- projects/helper/chains.json | 5 +++-- projects/sudoswap-v2/index.js | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 5fe8d95cb351..a7b7e4cc596f 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -322,5 +322,6 @@ "zksync", "zora", "zyx", - "joltify" -] \ No newline at end of file + "joltify", + "sanko" +] diff --git a/projects/sudoswap-v2/index.js b/projects/sudoswap-v2/index.js index c7946391ca8d..d5aca64cb948 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 +}) From a99283dcf18387c1e78790741adc78095218d100 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Mon, 17 Jun 2024 05:18:37 +0100 Subject: [PATCH 365/855] add sanko --- projects/helper/env.js | 1 + projects/helper/tokenMapping.js | 3 +++ 2 files changed, 4 insertions(+) diff --git a/projects/helper/env.js b/projects/helper/env.js index 91c86eb67f3f..72dcf6f3e441 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -26,6 +26,7 @@ const DEFAULTS = { LUKSO_RPC: 'https://rpc.lukso.sigmacore.io', HAM_RPC: 'https://rpc.ham.fun', HAM_RPC_MULTICALL: '0xB7c3Ea932649fBD594C881aDCb3F19415e2EA2d5', + SANKO_RPC_MULTICALL: '0xB32d192e07727A0F6f48e721791aa4e02cd292e1', } const ENV_KEYS = [ diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 333373831edd..a993f9950fd1 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -171,6 +171,9 @@ const fixBalancesTokens = { }, zeta: { "0x1e4bF3CaBD7707089138dD5a545B077413FA83Fc": { coingeckoId: 'pufeth', decimals: 18 }, + }, + sanko: { + "0x0000000000000000000000000000000000000000": { coingeckoId: 'wrapped-dmt', decimals: 18 }, } } From b9b1ad302250d757f2789ace894bc1fc6165a1a3 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Mon, 17 Jun 2024 05:48:19 +0100 Subject: [PATCH 366/855] add reETH vaults --- projects/lyra-v2/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/lyra-v2/index.js b/projects/lyra-v2/index.js index 667113cf9a6b..8f70fff2e344 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 ] }) }, From 71189d121d60269447e6309859c826176954c7d8 Mon Sep 17 00:00:00 2001 From: 0xulti <125024743+tivelprotocol@users.noreply.github.com> Date: Mon, 17 Jun 2024 14:24:19 +0700 Subject: [PATCH 367/855] tivel finance v1 (#10656) * tivel finance v1 * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/tivel-finance/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/tivel-finance/index.js diff --git a/projects/tivel-finance/index.js b/projects/tivel-finance/index.js new file mode 100644 index 000000000000..8cff75dd4c53 --- /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 From 2e72c021be53541ba92b0718fb88a55b5030b9e0 Mon Sep 17 00:00:00 2001 From: NetWeaveFi Date: Mon, 17 Jun 2024 15:28:14 +0800 Subject: [PATCH 368/855] Add files via upload (#10666) * Add files via upload * split adapter --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/netweave-lending/index.js | 7 +++++++ projects/netweave-vault/index.js | 12 ++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 projects/netweave-lending/index.js create mode 100644 projects/netweave-vault/index.js diff --git a/projects/netweave-lending/index.js b/projects/netweave-lending/index.js new file mode 100644 index 000000000000..a58faf317db0 --- /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 000000000000..359cd5b11927 --- /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, +}) From 6bff07dee06fb562df46208d6c4cd333acd1c5ad Mon Sep 17 00:00:00 2001 From: Aleksei Lushnikov Date: Mon, 17 Jun 2024 09:16:49 +0100 Subject: [PATCH 369/855] symbiosis adds cronos chain (#10668) --- projects/symbiosis-finance/config.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/projects/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js index 52682d590f67..6b13f1fb72de 100644 --- a/projects/symbiosis-finance/config.js +++ b/projects/symbiosis-finance/config.js @@ -27,6 +27,9 @@ const TOKENS = { }, zklink: { pufETH: "0x1B49eCf1A8323Db4abf48b2F5EFaA33F7DdAB3FC" + }, + cronos: { + USDC: "0xc21223249ca28397b4b6541dffaecc539bff0c59" } } @@ -380,5 +383,14 @@ module.exports = { '0x8a7F930003BedD63A1ebD99C5917FD6aE7E3dedf', // portal v2 ] }, + { + name: 'cronos', + tokens: [ + TOKENS.cronos.USDC, + ], + holders: [ + '0xE75C7E85FE6ADd07077467064aD15847E6ba9877', // portal v2 + ] + }, ] } \ No newline at end of file From f5102f6f19aa9d41a35a3ecf7db90146f46d6b48 Mon Sep 17 00:00:00 2001 From: Max Zhou Date: Mon, 17 Jun 2024 16:19:02 +0800 Subject: [PATCH 370/855] Update AgentFi TVL (#10667) * fix agent fi address not matching issue * add pac finance strategy to looper --- projects/agentfi/index.js | 2 +- projects/agentfi/strategies/dex-balancer.js | 4 ++-- projects/agentfi/utils.js | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/projects/agentfi/index.js b/projects/agentfi/index.js index 3b0f57a84c1f..bee8f2652448 100644 --- a/projects/agentfi/index.js +++ b/projects/agentfi/index.js @@ -23,7 +23,7 @@ async function tvl(api) { await getTvlForDexBalancer(dexBalancerAgents.map(i => i.agentAddress), api) - await getTvlForLooperWithOrbit(looperAgentsAddresses, api) + await getTvlForLooperWithOrbit(looperAgentsAddresses, api) await sumTokens2({ tokensAndOwners: [ ...thrusterv2, diff --git a/projects/agentfi/strategies/dex-balancer.js b/projects/agentfi/strategies/dex-balancer.js index ecbbd4cca0a7..db3b650f4b9a 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 b96518f17f7b..3c82f037847a 100644 --- a/projects/agentfi/utils.js +++ b/projects/agentfi/utils.js @@ -62,7 +62,8 @@ async function getAllAgent(api) { const DexBalancerModules = ["0x7e8280f5Ee5137f89d09FA61B356fa322a93415a", "0x35a4B9B95bc1D93Bf8e3CA9c030fc15726b83E6F", "0x067299A9C3F7E8d4A9d9dD06E2C1Fe3240144389"] const MultioliooorModule = ["0x54D588243976F7fA4eaf68d77122Da4e6C811167"] const ConcentratedLiquidityModule = ["0x10C02a975a748Db5B749Dc420154dD945e2e8657", "0x41D68d86545D6b931c1232f1E0aBB5844Ada4967", "0xa11D4dcD5a9ad75c609E1786cf1FD88b53C83A5E"] - const Looper = ["0x6A9D21A09A76808C444a89fE5fCc0a5f38dc0523", "0xe5fe6f280CEadc5c4DDE69eF2DF6234dd7Bd82E2"] + const pacLooperModule = '0x5E38765FF50D9b8932441Cd668c1fDA365D358b5' + const Looper = ["0x6A9D21A09A76808C444a89fE5fCc0a5f38dc0523", "0xe5fe6f280CEadc5c4DDE69eF2DF6234dd7Bd82E2", pacLooperModule] if (modules.some(i => DexBalancerModules.includes(i))) { return { ...i, From c0dd6314d1c21dc869a2465714d4d29fb42850f0 Mon Sep 17 00:00:00 2001 From: yash-trufin <113037107+yash-trufin@users.noreply.github.com> Date: Mon, 17 Jun 2024 17:14:25 +0530 Subject: [PATCH 371/855] feat: Add TruFin's TruStake APTOS vault TVL calculation (#10669) * feat: Add TruFin's TruStake APTOS vault TVL calculation * merge adapters --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/trufin-trustake/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/projects/trufin-trustake/index.js b/projects/trufin-trustake/index.js index b07074161403..c9a9b38a220f 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 } } From 6ddd0a921615b61c3aaca07ec2f2220354ac6532 Mon Sep 17 00:00:00 2001 From: beruf Date: Mon, 17 Jun 2024 17:39:17 +0200 Subject: [PATCH 372/855] update: add polygon for aktionariat (#10670) --- projects/aktionariat/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/aktionariat/index.js b/projects/aktionariat/index.js index aa124060512c..44ba41bf2c3f 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] = { From a775b4a980f4467474237e31a32348e2924ea175 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Mon, 17 Jun 2024 17:51:07 +0100 Subject: [PATCH 373/855] add methodology --- projects/summer-fi/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/summer-fi/index.js b/projects/summer-fi/index.js index adcaec100584..4ac4457ea7e3 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 }, }; From 5d5ae8300c94817431c991bdcd42341308fd8a58 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Mon, 17 Jun 2024 20:16:26 +0100 Subject: [PATCH 374/855] add sanko --- projects/camelot-v2/index.js | 6 +++++- projects/camelot/index.js | 3 +++ projects/helper/tokenMapping.js | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/projects/camelot-v2/index.js b/projects/camelot-v2/index.js index 736a4682aab0..42ef6e7d26af 100644 --- a/projects/camelot-v2/index.js +++ b/projects/camelot-v2/index.js @@ -10,4 +10,8 @@ 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} +}) + +module.exports = mergeExports([export1, export2, export3]); \ No newline at end of file diff --git a/projects/camelot/index.js b/projects/camelot/index.js index 060254dd4579..3bad8b35b056 100644 --- a/projects/camelot/index.js +++ b/projects/camelot/index.js @@ -6,4 +6,7 @@ module.exports = { arbitrum: { tvl: getUniTVL({ factory: '0x6EcCab422D763aC031210895C81787E87B43A652', useDefaultCoreAssets: true,}), }, + sanko: { + tvl: getUniTVL({factory: '0x7d8c6B58BA2d40FC6E34C25f9A488067Fe0D2dB4', useDefaultCoreAssets: true}) + } }; \ No newline at end of file diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index a993f9950fd1..65ec8c7d41da 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -174,6 +174,10 @@ const fixBalancesTokens = { }, sanko: { "0x0000000000000000000000000000000000000000": { 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 } } From 4477ba407164ff8c1a8f5b49c15028af3b921e8f Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Mon, 17 Jun 2024 21:33:49 +0100 Subject: [PATCH 375/855] add xai --- projects/camelot-v2/index.js | 7 ++++++- projects/camelot/index.js | 3 +++ projects/helper/tokenMapping.js | 5 +++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/projects/camelot-v2/index.js b/projects/camelot-v2/index.js index 42ef6e7d26af..d69c3a02f581 100644 --- a/projects/camelot-v2/index.js +++ b/projects/camelot-v2/index.js @@ -14,4 +14,9 @@ const export3 = uniV3Export({ sanko: { factory: '0xcF8d0723e69c6215523253a190eB9Bc3f68E0FFa', fromBlock: 51, isAlgebra: true} }) -module.exports = mergeExports([export1, export2, export3]); \ No newline at end of file +const export4 = uniV3Export({ + xai: { factory: '0xD8676fBdfa5b56BB2298D452c9768f51e80e34AE', fromBlock: 2398999, isAlgebra: true} +}) + + +module.exports = mergeExports([export1, export2, export3, export4]); \ No newline at end of file diff --git a/projects/camelot/index.js b/projects/camelot/index.js index 3bad8b35b056..e3f4a0a1d3d1 100644 --- a/projects/camelot/index.js +++ b/projects/camelot/index.js @@ -8,5 +8,8 @@ module.exports = { }, sanko: { tvl: getUniTVL({factory: '0x7d8c6B58BA2d40FC6E34C25f9A488067Fe0D2dB4', useDefaultCoreAssets: true}) + }, + xai: { + tvl: getUniTVL({factory: '0x18E621B64d7808c3C47bccbbD7485d23F257D26f', useDefaultCoreAssets: true}) } }; \ No newline at end of file diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 65ec8c7d41da..809c2d928331 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -178,6 +178,11 @@ const fixBalancesTokens = { "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 } } } From 362426070c2ffbc55a59b7b3d143be9f456831f1 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Mon, 17 Jun 2024 22:17:08 +0100 Subject: [PATCH 376/855] add rari chain --- projects/camelot-v2/index.js | 6 +++++- projects/camelot/index.js | 3 +++ projects/helper/chains.json | 1 + projects/helper/tokenMapping.js | 5 +++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/projects/camelot-v2/index.js b/projects/camelot-v2/index.js index d69c3a02f581..6fea9e552a2a 100644 --- a/projects/camelot-v2/index.js +++ b/projects/camelot-v2/index.js @@ -18,5 +18,9 @@ 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]); \ No newline at end of file +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 e3f4a0a1d3d1..87e43be12c33 100644 --- a/projects/camelot/index.js +++ b/projects/camelot/index.js @@ -11,5 +11,8 @@ module.exports = { }, xai: { tvl: getUniTVL({factory: '0x18E621B64d7808c3C47bccbbD7485d23F257D26f', useDefaultCoreAssets: true}) + }, + rari: { + tvl: getUniTVL({factory: '0x7d8c6B58BA2d40FC6E34C25f9A488067Fe0D2dB4', useDefaultCoreAssets: true}) } }; \ No newline at end of file diff --git a/projects/helper/chains.json b/projects/helper/chains.json index a7b7e4cc596f..e9a923076b61 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -242,6 +242,7 @@ "quasar", "quicksilver", "radixdlt", + "rari", "real", "reef", "regen", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 809c2d928331..a2d52ff5d7cc 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -183,6 +183,11 @@ const fixBalancesTokens = { "0x3fb787101dc6be47cfe18aeee15404dcc842e6af": { coingeckoId: 'xai-blockchain', decimals: 18 }, "0xbee82cfdaff4a6aa4e4793cb81eb1c2e79ac463c": { coingeckoId: 'weth', decimals: 18 }, "0x1e3769bd5fb2e9e9e7d4ed8667c947661f9a82e3": { coingeckoId: 'usd-coin', decimals: 6 } + }, + rari: { + "0x0000000000000000000000000000000000000000": { coingeckoId: 'weth', decimals: 18 }, + "0xf037540e51d71b2d2b1120e8432ba49f29edfbd0": { coingeckoId: 'weth', decimals: 18 }, + "0xfbda5f676cb37624f28265a144a48b0d6e87d3b6": { coingeckoId: 'usd-coin', decimals: 6 }, } } From f2117022d29e98f60074a86c65239ac935af9b4b Mon Sep 17 00:00:00 2001 From: PRDT Finance <87976805+PRDTfinance@users.noreply.github.com> Date: Tue, 18 Jun 2024 14:59:22 +0300 Subject: [PATCH 377/855] Update index.js --- projects/prdt/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/prdt/index.js b/projects/prdt/index.js index 74c15e966f8d..1fc4559df715 100644 --- a/projects/prdt/index.js +++ b/projects/prdt/index.js @@ -24,7 +24,7 @@ const config = { predictionPRO: "0x599974D3f2948b50545Fb5aa77C9e0bddc230ADE", predictionPROV2: "0x22dB94d719659d7861612E0f43EE28C9FF9909C7", predictionclassicV3: "0x00199E444155f6a06d74CF36315419d39b874f5c", - predictionPROV3: "0x49eFb44831aD88A9cFFB183d48C0c60bF4028da8" + predictionPROV3: "0x49eFb44831aD88A9cFFB183d48C0c60bF4028da8", }), tokens: [ADDRESSES.null, ADDRESSES.bsc.USDT, ADDRESSES.bsc.USDC, ADDRESSES.bsc.ETH], }, From 18b1a896748b2eccef462ed15a186b4624130efb Mon Sep 17 00:00:00 2001 From: Hongchao Liu Date: Tue, 18 Jun 2024 14:59:58 +0200 Subject: [PATCH 378/855] Track wbtc and usdc (#10680) --- projects/ayin/index.js | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/projects/ayin/index.js b/projects/ayin/index.js index dc66dfeb53a6..33c05f232073 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 } } From 27a6c55af4cb863599829625981c709c1d7f0950 Mon Sep 17 00:00:00 2001 From: Max Zhou Date: Tue, 18 Jun 2024 21:01:12 +0800 Subject: [PATCH 379/855] add new looper module address and add bladeswap to tvl (#10679) --- projects/agentfi/index.js | 3 ++ projects/agentfi/strategies/bladeswap.js | 56 ++++++++++++++++++++++++ projects/agentfi/utils.js | 12 ++++- 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 projects/agentfi/strategies/bladeswap.js diff --git a/projects/agentfi/index.js b/projects/agentfi/index.js index bee8f2652448..7f9e0ce4fbca 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) @@ -24,6 +26,7 @@ async function tvl(api) { await getTvlForDexBalancer(dexBalancerAgents.map(i => i.agentAddress), 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 000000000000..704752bafa2d --- /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/utils.js b/projects/agentfi/utils.js index 3c82f037847a..d9e24955e39e 100644 --- a/projects/agentfi/utils.js +++ b/projects/agentfi/utils.js @@ -62,8 +62,13 @@ async function getAllAgent(api) { const DexBalancerModules = ["0x7e8280f5Ee5137f89d09FA61B356fa322a93415a", "0x35a4B9B95bc1D93Bf8e3CA9c030fc15726b83E6F", "0x067299A9C3F7E8d4A9d9dD06E2C1Fe3240144389"] const MultioliooorModule = ["0x54D588243976F7fA4eaf68d77122Da4e6C811167"] const ConcentratedLiquidityModule = ["0x10C02a975a748Db5B749Dc420154dD945e2e8657", "0x41D68d86545D6b931c1232f1E0aBB5844Ada4967", "0xa11D4dcD5a9ad75c609E1786cf1FD88b53C83A5E"] + const BladeSwapConcentratedLiquidityModule = [ + "0x5dBC01F3F1310E36454C43cA1d2c84F44b8094F2", + "0xa28299bfbf44450CbA73a1eAdcE461AF62181a02", + "0xD18eD95286316a359291b21d02e8d46C59986302", + ] const pacLooperModule = '0x5E38765FF50D9b8932441Cd668c1fDA365D358b5' - const Looper = ["0x6A9D21A09A76808C444a89fE5fCc0a5f38dc0523", "0xe5fe6f280CEadc5c4DDE69eF2DF6234dd7Bd82E2", pacLooperModule] + const Looper = ["0x6A9D21A09A76808C444a89fE5fCc0a5f38dc0523", "0xe5fe6f280CEadc5c4DDE69eF2DF6234dd7Bd82E2", "0x8220512520db5D3295EA41308601FD0974405975", pacLooperModule] if (modules.some(i => DexBalancerModules.includes(i))) { return { ...i, @@ -79,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, From 1f5e8e6f67eafe7bbdca9ca56e698ebc98ce400e Mon Sep 17 00:00:00 2001 From: Georgi Popov Date: Tue, 18 Jun 2024 16:01:45 +0300 Subject: [PATCH 380/855] Return finance - added new contract on Avax (#10678) * Added project return-finance project * code refactor * Minor changes * Added new contract address --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/return-finance/index.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/projects/return-finance/index.js b/projects/return-finance/index.js index 73c4b6961b51..8a173a7ca469 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 => { From 4121479f8740747960ced950c9092403347b6194 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 18 Jun 2024 18:35:07 +0530 Subject: [PATCH 381/855] Notional (#10683) * fix: update urls * fix: add decentralized urls * minor fix --------- Co-authored-by: Jeff Wu --- projects/notional-v3/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/notional-v3/index.js b/projects/notional-v3/index.js index cbf2b9ba94b7..77ec4f3eb2e6 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 } }` From c7417abd09fe450faa7d3bdad6092ce5e8cbaa06 Mon Sep 17 00:00:00 2001 From: jack-lvsjack <106633601+jack-lvsjack@users.noreply.github.com> Date: Tue, 18 Jun 2024 21:19:51 +0800 Subject: [PATCH 382/855] add Pu239 (#10677) --- projects/pu239/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/pu239/index.js diff --git a/projects/pu239/index.js b/projects/pu239/index.js new file mode 100644 index 000000000000..7a849903a1c0 --- /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 } + ), +}; From 2442c4ce46c0ecc94e2787f3626ec282505e9956 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 18 Jun 2024 19:06:31 +0530 Subject: [PATCH 383/855] Lovelyswap (#10685) * Added Lovely Swap TVL * code refactor * minor fix --------- Co-authored-by: Andrii Hrynchuk --- projects/lovelyswap-v2/index.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 projects/lovelyswap-v2/index.js diff --git a/projects/lovelyswap-v2/index.js b/projects/lovelyswap-v2/index.js new file mode 100644 index 000000000000..ed77cf98482d --- /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', +}) From 6586217b50f1567b26ab69074a8079c0f22527d1 Mon Sep 17 00:00:00 2001 From: PRDT Finance <87976805+PRDTfinance@users.noreply.github.com> Date: Tue, 18 Jun 2024 18:31:52 +0300 Subject: [PATCH 384/855] Update index.js --- projects/prdt/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/prdt/index.js b/projects/prdt/index.js index 1fc4559df715..75b82cab3b2f 100644 --- a/projects/prdt/index.js +++ b/projects/prdt/index.js @@ -37,7 +37,7 @@ const config = { predictionclassicv3: "0x9f9564BE7b566dfE4B091a83a591752102aF3F33", predictionPROV3: "0x0b9c8c0a04354f41b985c10daf7db30bc66998f5", }), - tokens: [ADDRESSES.null, ADDRESSES.polygon.USDT, ADDRESSES.polygon.USDC, ADDRESSES.polygon.ETH], + tokens: [ADDRESSES.null, ADDRESSES.polygon.USDT, ADDRESSES.polygon.USDC, ADDRESSES.polygon.WETH], }, }; From ef33e49d0f280ea823b819659312688ca1d14849 Mon Sep 17 00:00:00 2001 From: zhouJF <58616306+jfzhou5@users.noreply.github.com> Date: Wed, 19 Jun 2024 01:33:52 +0800 Subject: [PATCH 385/855] Fix: pac-finance tvl data (#10687) * Fix: pac-finance tvl data * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/pac-finance/index.js | 47 ++++++++++++++++++++++++++++++++--- projects/time-fun/index.js | 7 ++++++ 2 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 projects/time-fun/index.js diff --git a/projects/pac-finance/index.js b/projects/pac-finance/index.js index 231eb54e08d0..d07df91722eb 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/time-fun/index.js b/projects/time-fun/index.js new file mode 100644 index 000000000000..89e0c994ee38 --- /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 From 5cd88fb40f373524c4ba6677c0411185b3db3f9c Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 19 Jun 2024 03:19:50 +0100 Subject: [PATCH 386/855] add sushiswap skale --- projects/sushiswap-v3/index.js | 1 + projects/sushiswap/api.js | 1 + 2 files changed, 2 insertions(+) diff --git a/projects/sushiswap-v3/index.js b/projects/sushiswap-v3/index.js index 3cbc37b1b412..f09968b39813 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 4f9445c4842b..851bbc15ffd1 100644 --- a/projects/sushiswap/api.js +++ b/projects/sushiswap/api.js @@ -97,6 +97,7 @@ module.exports = { blast: { tvl: getUniTVL({ factory: '0x42Fa929fc636e657AC568C0b5Cf38E203b67aC2b', useDefaultCoreAssets: true, }) }, core: { tvl: tvl2 }, rsk: { tvl: tvl2 }, + europa: { tvl: getUniTVL({ factory: '0x1aaF6eB4F85F8775400C1B10E6BbbD98b2FF8483', useDefaultCoreAssets: true, }) }, } module.exports.polygon.tvl = getChainTVL('polygon') From a109a584960cda61f387d89b7c1c41e0bb1ffee6 Mon Sep 17 00:00:00 2001 From: Jeremy Crane Date: Tue, 18 Jun 2024 23:14:42 -0600 Subject: [PATCH 387/855] [Alta Finance] Update index.js (#10688) --- projects/alta-finance/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/alta-finance/index.js b/projects/alta-finance/index.js index 8a7a0128c008..ed7d6ec0e92d 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 => { From 67269695018498a1bee06ed76435af655fbf07c4 Mon Sep 17 00:00:00 2001 From: Robert Chu Date: Tue, 18 Jun 2024 22:15:31 -0700 Subject: [PATCH 388/855] Update mainnet subgraph query url (#10689) --- projects/term-finance/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/term-finance/index.js b/projects/term-finance/index.js index cd2787efaccc..d3a6af84763d 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", }; From ed8beeab6a9126f31e62e717dede33ced49ce79b Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 19 Jun 2024 07:19:33 +0200 Subject: [PATCH 389/855] track blastoff staking --- projects/blastoff/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/blastoff/index.js b/projects/blastoff/index.js index 82fc8af05e58..3a253451e7e2 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", }; From c94f4ee71ebe40339a98b5aada9a354f42904207 Mon Sep 17 00:00:00 2001 From: Andrii Rozinko <31214139+AndrewAR2@users.noreply.github.com> Date: Wed, 19 Jun 2024 08:24:17 +0300 Subject: [PATCH 390/855] Add AirDAO Hera pool (#10684) * Add AirDAO/FirepotSwap * Revert "Add AirDAO/FirepotSwap" This reverts commit 67a59c7baad03ee0ba6a289c224a73c661be8f46. * Add AirDAO/FirepotSwap chain/project * Sync * Added AirDAO Hera pool --- projects/airdao-hera-pool/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 projects/airdao-hera-pool/index.js diff --git a/projects/airdao-hera-pool/index.js b/projects/airdao-hera-pool/index.js new file mode 100644 index 000000000000..384f749e993b --- /dev/null +++ b/projects/airdao-hera-pool/index.js @@ -0,0 +1,22 @@ +const sdk = require('@defillama/sdk'); + +const POOL_ADDRESS = '0x0E051C8C1cd519d918DB9b631Af303aeC85266BF'; + +async function tvl(api) { + const balances = {}; + + const totalStake = await api.call({abi: 'uint256:totalStake', target: POOL_ADDRESS}) + + sdk.util.sumSingleBalance(balances, 'amber', totalStake / 10**18) + + return balances; +} + +module.exports = { + methodology: `TVL counts deposits made to Hera pool on AirDAO.`, + misrepresentedTokens: true, + timetravel: false, + airdao: { + tvl + } +} From 85c35d3b3c6d2387e368346bf60891ccf8da3b54 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 19 Jun 2024 07:25:30 +0200 Subject: [PATCH 391/855] minor fix --- projects/airdao-hera-pool/index.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/projects/airdao-hera-pool/index.js b/projects/airdao-hera-pool/index.js index 384f749e993b..d14949b826d0 100644 --- a/projects/airdao-hera-pool/index.js +++ b/projects/airdao-hera-pool/index.js @@ -1,21 +1,10 @@ -const sdk = require('@defillama/sdk'); - -const POOL_ADDRESS = '0x0E051C8C1cd519d918DB9b631Af303aeC85266BF'; - async function tvl(api) { - const balances = {}; - - const totalStake = await api.call({abi: 'uint256:totalStake', target: POOL_ADDRESS}) - - sdk.util.sumSingleBalance(balances, 'amber', totalStake / 10**18) - - return balances; + 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.`, - misrepresentedTokens: true, - timetravel: false, airdao: { tvl } From f57d908513508c1d8588748b57526391a0dceb16 Mon Sep 17 00:00:00 2001 From: slasher125 Date: Wed, 19 Jun 2024 10:46:48 +0400 Subject: [PATCH 392/855] more graph upgrades --- projects/alpha-homora/v2.js | 16 ++++++++-------- projects/ambient-finance/index.js | 3 ++- projects/sushiswap-bentobox/helper.js | 2 +- projects/sushiswap-trident/trident.js | 2 +- projects/synthetix/api.js | 2 +- projects/synthetix/apiCache.js | 2 +- 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/projects/alpha-homora/v2.js b/projects/alpha-homora/v2.js index d7aa9b98141b..ab58294362b8 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/ambient-finance/index.js b/projects/ambient-finance/index.js index 4ac8955c98f2..4739b3da09ce 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/sushiswap-bentobox/helper.js b/projects/sushiswap-bentobox/helper.js index eba23cee887c..425a6f8a3c99 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 d30085dd2b7d..4e7b29cb88fe 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/synthetix/api.js b/projects/synthetix/api.js index ec2936a08732..1e5cc6072de6 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 50c94547c186..92809152547b 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" From 1a7fbf869fb3822e48b1f8dea83a281fde89326e Mon Sep 17 00:00:00 2001 From: penpad-dev <168410560+penpad-dev@users.noreply.github.com> Date: Wed, 19 Jun 2024 16:48:17 +0800 Subject: [PATCH 393/855] add new assets (#10692) --- projects/penpad/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/projects/penpad/index.js b/projects/penpad/index.js index 0ef51da7aa34..4a835dafc80c 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 ], }), }, From cabfd7ed33f88b905015d5fa3aadf8537d3dc127 Mon Sep 17 00:00:00 2001 From: PRDT Finance <87976805+PRDTfinance@users.noreply.github.com> Date: Wed, 19 Jun 2024 11:49:09 +0300 Subject: [PATCH 394/855] Update index.js (#10691) --- projects/prdt/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/prdt/index.js b/projects/prdt/index.js index 75b82cab3b2f..e7100be91e91 100644 --- a/projects/prdt/index.js +++ b/projects/prdt/index.js @@ -14,7 +14,7 @@ const config = { 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({ @@ -37,7 +37,7 @@ const config = { predictionclassicv3: "0x9f9564BE7b566dfE4B091a83a591752102aF3F33", predictionPROV3: "0x0b9c8c0a04354f41b985c10daf7db30bc66998f5", }), - tokens: [ADDRESSES.null, ADDRESSES.polygon.USDT, ADDRESSES.polygon.USDC, ADDRESSES.polygon.WETH], + tokens: [ADDRESSES.null, ADDRESSES.polygon.USDT, ADDRESSES.polygon.USDC_CIRCLE, ADDRESSES.polygon.WETH], }, }; From ef998f425c03edc01d760dc24456ead0a4908f16 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Wed, 19 Jun 2024 10:37:23 +0100 Subject: [PATCH 395/855] bridges --- projects/sanko-bridge/index.js | 15 +++++++++++++++ projects/xai-bridge/index.js | 15 +++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 projects/sanko-bridge/index.js create mode 100644 projects/xai-bridge/index.js diff --git a/projects/sanko-bridge/index.js b/projects/sanko-bridge/index.js new file mode 100644 index 000000000000..69fd836d2549 --- /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/xai-bridge/index.js b/projects/xai-bridge/index.js new file mode 100644 index 000000000000..ab93d3ca0b52 --- /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, + }), + }, +}; From 2aa8408a562f551e88be358860fdd9951fd8aeb7 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 19 Jun 2024 15:26:31 +0530 Subject: [PATCH 396/855] Dusa (#10695) * init * init * massa integration API * finishing helper for massa * chore: Remove unused code and fetch tokens info in massa.js * fix fetch pair information * chore: Update dependencies and improve TVL calculation in massa integration API * final commit for first PR * update package-lock to original state * cleaning code for first PR * revert changes of package.json for PR * code refactor --------- Co-authored-by: Nils Co-authored-by: plouis01 Co-authored-by: aya --- projects/dusa/index.js | 33 ++++++++++ projects/helper/chain/massa.js | 106 ++++++++++++++++++++++++++++++++ projects/helper/chains.json | 1 + projects/helper/portedTokens.js | 1 + projects/helper/tokenMapping.js | 8 ++- 5 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 projects/dusa/index.js create mode 100644 projects/helper/chain/massa.js diff --git a/projects/dusa/index.js b/projects/dusa/index.js new file mode 100644 index 000000000000..8729b65d4708 --- /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/helper/chain/massa.js b/projects/helper/chain/massa.js new file mode 100644 index 000000000000..fb514c5ff285 --- /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/chains.json b/projects/helper/chains.json index e9a923076b61..bded24bc801b 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -175,6 +175,7 @@ "lukso", "lung", "manta", + "massa", "manta_atlantic", "mantle", "map", diff --git a/projects/helper/portedTokens.js b/projects/helper/portedTokens.js index 10b8ee84c3fb..d45aca7a97d5 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/tokenMapping.js b/projects/helper/tokenMapping.js index a2d52ff5d7cc..f3f717be94fd 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 @@ -66,6 +66,12 @@ 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 From 5744ef24d064443062072cf64817257cc6d4e7a3 Mon Sep 17 00:00:00 2001 From: Sushant Mishra <162546266+sushantCat@users.noreply.github.com> Date: Wed, 19 Jun 2024 15:32:26 +0530 Subject: [PATCH 397/855] Add garden tvl (#10693) * Add garden tvl * sumTokensExport instead of cexExports * Add SEED token to Staking --------- Co-authored-by: Sushants-Git --- projects/garden/index.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 projects/garden/index.js diff --git a/projects/garden/index.js b/projects/garden/index.js new file mode 100644 index 000000000000..a60cc7a748d3 --- /dev/null +++ b/projects/garden/index.js @@ -0,0 +1,27 @@ +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] }), + ]), + }, + arbitrum: { + tvl: sumTokensExport({ + owners: [WBTC_LIQUIDITY_ADDRESS], + tokens: [ADDRESSES.arbitrum.WBTC], + }), + staking: sumTokensExport({ + owners: [STAKING_CONTRACT_ADDRESS], + tokens: [SEED_TOKEN_ADDRESS], + }), + }, +}; From cf84c8a1ab8bdb57f366bd5116d7a33ed5b37257 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Wed, 19 Jun 2024 12:26:34 +0100 Subject: [PATCH 398/855] jax protocol taiko (#10696) * jax protocol taiko * fix jax --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/tokenMapping.js | 1 + projects/jax-protocol/index.js | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 projects/jax-protocol/index.js diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index f3f717be94fd..dac1a8d4a5e9 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -155,6 +155,7 @@ 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 }, }, diff --git a/projects/jax-protocol/index.js b/projects/jax-protocol/index.js new file mode 100644 index 000000000000..e7bf371af2aa --- /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 From a2ba5e7a714156c24534f4f15aa2f07f93da3daf Mon Sep 17 00:00:00 2001 From: fextr Date: Wed, 19 Jun 2024 16:41:06 +0400 Subject: [PATCH 399/855] add Resolv TVL adapter --- projects/resolv/index.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 projects/resolv/index.js diff --git a/projects/resolv/index.js b/projects/resolv/index.js new file mode 100644 index 000000000000..8981ca61a10f --- /dev/null +++ b/projects/resolv/index.js @@ -0,0 +1,34 @@ +const USR = "0x66a1E37c9b0eAddca17d3662D6c05F4DECf3e110"; +const RLP = "0x4956b52aE2fF65D74CA2d61207523288e4528f96"; +const RLPPriceStorage = "0x31319866778a5223633bd745780BB6d59406371E"; +const stUSR = "0x6c8984bc7DBBeDAf4F6b2FD766f16eBB7d10AAb4"; + +const erc20 = { + "totalSupply": "uint256:totalSupply" +}; +const rlpPriceStorage = { + "lastPrice": "uint256:lastPrice" +}; + +async function ethTvl(api) { + api.add(USR, await api.call({ abi: erc20.totalSupply, target: USR })); + + const rlpSupply = await api.call({ abi: erc20.totalSupply, target: RLP }); + const rlpPrice = await api.call({ + abi: rlpPriceStorage.lastPrice, + target: RLPPriceStorage + } + ) / 1e18; + api.add(RLP, rlpSupply * rlpPrice); +} + +async function staking(api) { + api.add(USR, await api.call({ abi: erc20.totalSupply, target: stUSR })); +} + +module.exports = { + ethereum: { + tvl: ethTvl, + staking + } +}; \ No newline at end of file From a5fcdf487f011c66050160580bb59e76b3ea6a74 Mon Sep 17 00:00:00 2001 From: Ivan <3238603+ivivanov@users.noreply.github.com> Date: Wed, 19 Jun 2024 17:39:01 +0300 Subject: [PATCH 400/855] Nolus refactoring (#10697) * Add native USDC pool in Nolus protocol * remove hardcoded denoms, refactoring --- projects/nolus/index.js | 148 ++++++++++++++++------------------------ 1 file changed, 58 insertions(+), 90 deletions(-) diff --git a/projects/nolus/index.js b/projects/nolus/index.js index 2be45251c9f2..b1983f2736a5 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 }, + ]) } } } From 9106856d1b0fbdec9aced2cd5dd394f2c00eea57 Mon Sep 17 00:00:00 2001 From: SWFT Blockchain Date: Wed, 19 Jun 2024 22:45:12 +0800 Subject: [PATCH 401/855] Create index.js (#10681) * Create index.js * Update index.js * Update index.js * Update index.js * code refactor * Update index.js * Update index.js * Update index.js * Update sui.js * Update sumTokens.js * rename folder --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/bridgers-ai/index.js | 183 ++++++++++++++++++++++++++++++++++ projects/helper/chain/sui.js | 22 ++-- projects/helper/sumTokens.js | 1 + 3 files changed, 200 insertions(+), 6 deletions(-) create mode 100644 projects/bridgers-ai/index.js diff --git a/projects/bridgers-ai/index.js b/projects/bridgers-ai/index.js new file mode 100644 index 000000000000..4c41996b9aa1 --- /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/helper/chain/sui.js b/projects/helper/chain/sui.js index e688c0d2d833..01b174963586 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/sumTokens.js b/projects/helper/sumTokens.js index c973223ba47a..c376231260eb 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"), From 5642110e0d64415871a71bddab404941101639a4 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 19 Jun 2024 16:47:23 +0200 Subject: [PATCH 402/855] update package version --- package-lock.json | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index bce92f99678d..b2a77fb27696 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": { From c48a24965c18aeaade94f9092d824fc37fd4ecf7 Mon Sep 17 00:00:00 2001 From: Sushant Mishra <162546266+sushantCat@users.noreply.github.com> Date: Wed, 19 Jun 2024 20:57:08 +0530 Subject: [PATCH 403/855] Update garden tvl (#10698) * Add garden tvl * sumTokensExport instead of cexExports * Add SEED token to Staking * Update garden tvl with eth --------- Co-authored-by: Sushants-Git --- projects/garden/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/projects/garden/index.js b/projects/garden/index.js index a60cc7a748d3..a5244db1cc39 100644 --- a/projects/garden/index.js +++ b/projects/garden/index.js @@ -14,6 +14,12 @@ module.exports = { sumTokensExport({ owners: [BTC_LIQUIDITY_ADDRESS] }), ]), }, + ethereum: { + tvl: sumTokensExport({ + owners: [WBTC_LIQUIDITY_ADDRESS], + tokens: [ADDRESSES.ethereum.WBTC], + }), + }, arbitrum: { tvl: sumTokensExport({ owners: [WBTC_LIQUIDITY_ADDRESS], From e8d5fda2f4ddee15fff482cf8c0966f63577eed8 Mon Sep 17 00:00:00 2001 From: retraca <61762107+retraca@users.noreply.github.com> Date: Wed, 19 Jun 2024 19:41:21 +0100 Subject: [PATCH 404/855] scoreplay (#10665) * scoreplay * fix * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/scoreplay/index.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 projects/scoreplay/index.js diff --git a/projects/scoreplay/index.js b/projects/scoreplay/index.js new file mode 100644 index 000000000000..1ddddeb1a61b --- /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 From 20fec2e7062c76de5125c0503d31267d681fe8a1 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 20 Jun 2024 00:20:33 +0530 Subject: [PATCH 405/855] Add LoopFi Prelaunch (#10700) * feat: LoopFi prelaunch adapter * minor fix --------- Co-authored-by: 0xd4n1el <0xd4n1el@gmail.com> --- projects/helper/tokenMapping.js | 6 +++--- projects/loopfi/index.js | 26 ++++++++++++++++++++++++++ projects/symbiosis-finance/config.js | 2 +- 3 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 projects/loopfi/index.js diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index dac1a8d4a5e9..0f68f49a045c 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -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 }, }, @@ -180,7 +180,7 @@ const fixBalancesTokens = { "0x1e4bF3CaBD7707089138dD5a545B077413FA83Fc": { coingeckoId: 'pufeth', decimals: 18 }, }, sanko: { - "0x0000000000000000000000000000000000000000": { coingeckoId: 'wrapped-dmt', decimals: 18 }, + [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 }, @@ -192,7 +192,7 @@ const fixBalancesTokens = { "0x1e3769bd5fb2e9e9e7d4ed8667c947661f9a82e3": { coingeckoId: 'usd-coin', decimals: 6 } }, rari: { - "0x0000000000000000000000000000000000000000": { coingeckoId: 'weth', decimals: 18 }, + [ADDRESSES.null]: { coingeckoId: 'weth', decimals: 18 }, "0xf037540e51d71b2d2b1120e8432ba49f29edfbd0": { coingeckoId: 'weth', decimals: 18 }, "0xfbda5f676cb37624f28265a144a48b0d6e87d3b6": { coingeckoId: 'usd-coin', decimals: 6 }, } diff --git a/projects/loopfi/index.js b/projects/loopfi/index.js new file mode 100644 index 000000000000..1cc6ccdb44f9 --- /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/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js index 6b13f1fb72de..ac562fb1afaf 100644 --- a/projects/symbiosis-finance/config.js +++ b/projects/symbiosis-finance/config.js @@ -29,7 +29,7 @@ const TOKENS = { pufETH: "0x1B49eCf1A8323Db4abf48b2F5EFaA33F7DdAB3FC" }, cronos: { - USDC: "0xc21223249ca28397b4b6541dffaecc539bff0c59" + USDC: ADDRESSES.cronos.USDC } } From c315caf0583b615d5a2f402d59dddbc7955d30ee Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 19 Jun 2024 23:16:28 +0200 Subject: [PATCH 406/855] splice: track blast --- projects/splice-fi/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/splice-fi/index.js b/projects/splice-fi/index.js index 19c5c84c352c..9848b6456fc9 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) => { From ccab0082f481aa44b683b85ec8c4d7425d3c7ada Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 19 Jun 2024 22:32:20 +0100 Subject: [PATCH 407/855] temp fix --- projects/bridgers-ai/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/bridgers-ai/index.js b/projects/bridgers-ai/index.js index 4c41996b9aa1..69af52189ae6 100644 --- a/projects/bridgers-ai/index.js +++ b/projects/bridgers-ai/index.js @@ -69,14 +69,14 @@ const tokensConf = { // SWFTC: "0xe64e30276c2f826febd3784958d6da7b55dfbad3", DOGE: "0xba2ae424d960c26247dd6c32edc70b295c744c43", }, - heco: { + /*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, From 92d81ccf997e69380d6058eeb7d0b30c8411676d Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 20 Jun 2024 04:19:24 +0100 Subject: [PATCH 408/855] add traderjoe lb 2.2 --- projects/traderjoe-lb-v2-2/index.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 projects/traderjoe-lb-v2-2/index.js diff --git a/projects/traderjoe-lb-v2-2/index.js b/projects/traderjoe-lb-v2-2/index.js new file mode 100644 index 000000000000..e2028cfd4944 --- /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 From 1c0de7004bcf7c4a97d4e977367abe2f4a042566 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Thu, 20 Jun 2024 10:02:59 +0100 Subject: [PATCH 409/855] add haskey exchange (CEX) (#10711) --- projects/hashkey-exchange/index.js | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 projects/hashkey-exchange/index.js diff --git a/projects/hashkey-exchange/index.js b/projects/hashkey-exchange/index.js new file mode 100644 index 000000000000..2786278e13d7 --- /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); From eb623182ccb68d2e796af9835089ea4a3e389ab1 Mon Sep 17 00:00:00 2001 From: Arpit Date: Thu, 20 Jun 2024 20:39:11 +0530 Subject: [PATCH 410/855] add filecoin chain to tvl (#10701) --- projects/SecuredFinance/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/SecuredFinance/index.js b/projects/SecuredFinance/index.js index 927411c5dd15..d8b7edaf73e7 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 => { From d4efb3f89019725af0254b699aab3722e7fc2134 Mon Sep 17 00:00:00 2001 From: Winson Cheng <83229800+0xKMG@users.noreply.github.com> Date: Thu, 20 Jun 2024 23:10:27 +0800 Subject: [PATCH 411/855] add new vaults on Mantle (#10704) --- projects/airpuff/index.js | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/projects/airpuff/index.js b/projects/airpuff/index.js index 66bec24fafec..f2189acf5734 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 }); From 9af952aeb4d2ddd5875ae28acf9753a8ec7dc1cb Mon Sep 17 00:00:00 2001 From: shafu Date: Thu, 20 Jun 2024 18:23:47 +0300 Subject: [PATCH 412/855] tBTC vault (#10706) --- projects/dyad/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/dyad/index.js b/projects/dyad/index.js index c7e27744d3f8..95297e64b14b 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 +} From 8f3ef680cd462d637f31ba73bf4a94aa0a5daa09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Kruszelnicki?= <65346518+pawell24@users.noreply.github.com> Date: Thu, 20 Jun 2024 17:36:10 +0200 Subject: [PATCH 413/855] Add zkFinance (#10717) --- projects/zkfinance/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/zkfinance/index.js diff --git a/projects/zkfinance/index.js b/projects/zkfinance/index.js new file mode 100644 index 000000000000..1ba6e29c4e40 --- /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, + }), +}; From ab271dda5868177701882f29b6376709121d985a Mon Sep 17 00:00:00 2001 From: Nicolas Zozol Date: Thu, 20 Jun 2024 17:44:52 +0200 Subject: [PATCH 414/855] update: adding some chains (#10709) --- projects/swaap-v2/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/swaap-v2/index.js b/projects/swaap-v2/index.js index 0b4ad43ee08c..85b4c305395d 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,}, } /** From 8b14c151f8da27734c785cb66b0cccd2f3275c58 Mon Sep 17 00:00:00 2001 From: imfeng Date: Thu, 20 Jun 2024 23:58:48 +0800 Subject: [PATCH 415/855] add Term Structure TVL (#10712) * add Term Structure TVL * Update Term Structure TVL * refactor Term Structure adapter * update Term Structure handle Eth token address * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/term-structure/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/term-structure/index.js diff --git a/projects/term-structure/index.js b/projects/term-structure/index.js new file mode 100644 index 000000000000..8724f8b9e458 --- /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 }) + }, + }, +}; From 97a07578a91b92d261e3eeb4f0a9c59586868d27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vuka=C5=A1in=20Manojlovi=C4=87?= Date: Thu, 20 Jun 2024 18:16:40 +0200 Subject: [PATCH 416/855] Add NSTR to Nostra Money Market (#10719) --- projects/helper/coreAssets.json | 3 ++- projects/nostra/index.js | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 59139d4120df..e76a73ac7c5d 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", diff --git a/projects/nostra/index.js b/projects/nostra/index.js index b16b13d9d7da..f30b87d7a468 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) { From 4115e97f2baef4f368195470c0344b517f2ba0b0 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 20 Jun 2024 22:39:04 +0530 Subject: [PATCH 417/855] Allstake (#10720) * Allstake * refactor: rename vars * refactor: reduce idl size * refactor: update imports * remove unused code --------- Co-authored-by: roblint <171213773+roblint@users.noreply.github.com> --- projects/allstake/idls/strategy_manager.json | 82 ++++++++++++++++++++ projects/allstake/index.js | 56 +++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 projects/allstake/idls/strategy_manager.json create mode 100644 projects/allstake/index.js diff --git a/projects/allstake/idls/strategy_manager.json b/projects/allstake/idls/strategy_manager.json new file mode 100644 index 000000000000..c5434515951f --- /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 000000000000..a685108ede54 --- /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', +} From 2049af532a0604907dfd88633d2968b2900be0ba Mon Sep 17 00:00:00 2001 From: Brandon Date: Thu, 20 Jun 2024 11:58:16 -0700 Subject: [PATCH 418/855] Update: add rootstock (#10721) * Add telos and xlayer * Add rootstock * change id to rsk --- projects/steer/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/steer/index.js b/projects/steer/index.js index 615bdc660aba..753bca2cb0b1 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'), From 03bf1eb7834ae220153f564db49980c95975e761 Mon Sep 17 00:00:00 2001 From: Dan Hsu Date: Fri, 21 Jun 2024 03:26:25 +0800 Subject: [PATCH 419/855] Add new staking LP to TVL (#10714) * feature: update stapearl psm id * feature: add lst lp to tvl * feature: modified the function of getStakingLPAmount * feature: add navi sLP * feature: change id and remove console.log --- projects/bucket-protocol/index.js | 42 +++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/projects/bucket-protocol/index.js b/projects/bucket-protocol/index.js index 3e1f1899d54b..6c1a1587d5e9 100644 --- a/projects/bucket-protocol/index.js +++ b/projects/bucket-protocol/index.js @@ -50,6 +50,23 @@ 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"; + +async function getStakingLPAmount(id) { + const stakingLPObject = await sui.getObject(id); + return stakingLPObject.fields.output_volume; +} + async function tvl(api) { const protocolFields = await sui.getDynamicFieldObjects({ parent: MAINNET_PROTOCOL_ID, @@ -184,6 +201,31 @@ 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 + ); } module.exports = { From de27ea967dd32960ddc31da85f29d3f16ef21cad Mon Sep 17 00:00:00 2001 From: Chase Brown <54334583+chasebrownn@users.noreply.github.com> Date: Thu, 20 Jun 2024 14:29:31 -0500 Subject: [PATCH 420/855] New TVL Adapter for Tangible-ustb protocol (#10643) * small revision made to arcana adapter. RWA adapter started, just needs RWA price from CG * progress to Tangible RWA and re.al protocol adapters * final updates to tangible-rwa adapter * removed real-rwa * removed baskets tvl. Only USTB for now * protocol rename * code refactor * remove unused file * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/arcana/index.js | 6 ++---- projects/tangible-ustb/index.js | 8 ++++++++ 2 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 projects/tangible-ustb/index.js diff --git a/projects/arcana/index.js b/projects/arcana/index.js index cdcf40739fe8..e5705c741f91 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/tangible-ustb/index.js b/projects/tangible-ustb/index.js new file mode 100644 index 000000000000..b04203fbda1b --- /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 From 951f93ce9dcdb8ba3165180fe9607fb184682305 Mon Sep 17 00:00:00 2001 From: Tigris of Gaul <81036209+tigris-of-gaul@users.noreply.github.com> Date: Fri, 21 Jun 2024 07:54:17 +0000 Subject: [PATCH 421/855] Add Tarot factory for Scroll (#10723) --- projects/tarot/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/tarot/index.js b/projects/tarot/index.js index 541ce31315f4..c802d74fbcb7 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) From fef4c911f5f483496d2e4d67500375188d485438 Mon Sep 17 00:00:00 2001 From: Winson Cheng <83229800+0xKMG@users.noreply.github.com> Date: Fri, 21 Jun 2024 15:55:30 +0800 Subject: [PATCH 422/855] Add new pool vlp pool for Vaultka (#10724) * add new vaults on Mantle * add new VLP pool for vaultka * remove log --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/vaultka/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/projects/vaultka/index.js b/projects/vaultka/index.js index 4d85a4af3c5b..b6eb22698c78 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); From aa1590011b4e1c59e96bc52397339bb0d3dfe68d Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 21 Jun 2024 01:25:25 -0700 Subject: [PATCH 423/855] Add Solayer | Solana restaking (#10729) * add solayer adapter * refactor: Update solayer index.js for TVL calculation and methodology --------- Co-authored-by: somer --- projects/solayer/index.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 projects/solayer/index.js diff --git a/projects/solayer/index.js b/projects/solayer/index.js new file mode 100644 index 000000000000..9657dd695238 --- /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 }, +}; From 05a7f3f1ffcb6862ca1662c74027e6952af8a252 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Fri, 21 Jun 2024 10:31:43 +0100 Subject: [PATCH 424/855] add icecream v3 (#10731) --- projects/icecreamswap-v3/index.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 projects/icecreamswap-v3/index.js diff --git a/projects/icecreamswap-v3/index.js b/projects/icecreamswap-v3/index.js new file mode 100644 index 000000000000..426c5aea73a3 --- /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 From 7b4eee56fa6b8161cfd45cd5fc0e6ae472953381 Mon Sep 17 00:00:00 2001 From: FantaHolic <96290246+0xfantaholic@users.noreply.github.com> Date: Fri, 21 Jun 2024 12:54:00 +0300 Subject: [PATCH 425/855] added iota (#10728) --- projects/wagmi-com/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/wagmi-com/index.js b/projects/wagmi-com/index.js index 24f8afe3e998..5840df0b8489 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 }) } From 6874d2f986bea0badbd0fe266f18f4134e6520a3 Mon Sep 17 00:00:00 2001 From: santino <83203265+santinoYoung@users.noreply.github.com> Date: Fri, 21 Jun 2024 17:54:18 +0800 Subject: [PATCH 426/855] update Desyn chain (#10727) * add desyn protocol * update lpposition token * Update index.js add resolveLP * Update index.js remove resolveLP * add tvl * Update index.js update sumTokensExport * code refactor * update desyn chain --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/desyn/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/desyn/index.js b/projects/desyn/index.js index a7d43249a7fb..8afa05133286 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 => { From 9efaaae854997fb2d4d2bf91803c3b4c61d94b04 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 21 Jun 2024 17:48:19 +0100 Subject: [PATCH 427/855] update methodology --- projects/helio-money/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/helio-money/index.js b/projects/helio-money/index.js index 29f1e90b6627..a780961f1417 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"] From ec3a77acfbce83993ee96a60cad8db19612670fb Mon Sep 17 00:00:00 2001 From: maximiliano carrasco <56497105+abstract829@users.noreply.github.com> Date: Sun, 23 Jun 2024 15:02:01 -0400 Subject: [PATCH 428/855] Soroswap TVL Adapter (#10735) --- projects/soroswap/index.js | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 projects/soroswap/index.js diff --git a/projects/soroswap/index.js b/projects/soroswap/index.js new file mode 100644 index 000000000000..14a806760c7c --- /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 }, +}; From 4ba12327dc734f432ba72d2ffcec23dc06a3a3c8 Mon Sep 17 00:00:00 2001 From: taidogprotocol Date: Sun, 23 Jun 2024 15:07:26 -0400 Subject: [PATCH 429/855] Add taidog (#10734) --- projects/taidog/index.js | 95 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 projects/taidog/index.js diff --git a/projects/taidog/index.js b/projects/taidog/index.js new file mode 100644 index 000000000000..8e56a5ad2de3 --- /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, + }, +}; From 4f4dc3f662d6c7a68d15bc3c638cecfe7a77b7b2 Mon Sep 17 00:00:00 2001 From: Dan Hsu Date: Mon, 24 Jun 2024 03:08:45 +0800 Subject: [PATCH 430/855] Add new collaterals to tvl (#10743) * feature: update stapearl psm id * feature: add lst lp to tvl * feature: modified the function of getStakingLPAmount * feature: add navi sLP * feature: change id and remove console.log * feature: add scallop sLP --- projects/bucket-protocol/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/projects/bucket-protocol/index.js b/projects/bucket-protocol/index.js index 6c1a1587d5e9..040f879c685a 100644 --- a/projects/bucket-protocol/index.js +++ b/projects/bucket-protocol/index.js @@ -62,11 +62,22 @@ const haSUI_sLP_ID = 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, @@ -226,6 +237,12 @@ async function tvl(api) { "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 = { From c23491179754c0bb2128859494052927100d45e7 Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Mon, 24 Jun 2024 03:15:58 +0800 Subject: [PATCH 431/855] Update concentrator arUSD (#10742) * Add arUSD * Add Concentrator arUSD * Update arUSD --------- Co-authored-by: Andrew --- projects/concentrator/abis/AladdinRUSD.json | 3 + projects/concentrator/index.js | 276 +++++++++++++------- 2 files changed, 185 insertions(+), 94 deletions(-) create mode 100644 projects/concentrator/abis/AladdinRUSD.json diff --git a/projects/concentrator/abis/AladdinRUSD.json b/projects/concentrator/abis/AladdinRUSD.json new file mode 100644 index 000000000000..cdfb2cd32cf4 --- /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 47e722850ca7..10500adb5595 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, + }, +}; From f34572d32c76b4a5570cc6db3c95376aee2eff4f Mon Sep 17 00:00:00 2001 From: 0xbitu Date: Mon, 24 Jun 2024 14:38:55 +0800 Subject: [PATCH 432/855] feat: add BITU --- projects/bitu-protocol/index.js | 11 ------- projects/bitu/index.js | 55 +++++++++++++++++++++++++++++++++ projects/helper/coreAssets.json | 3 +- 3 files changed, 56 insertions(+), 13 deletions(-) delete mode 100644 projects/bitu-protocol/index.js create mode 100644 projects/bitu/index.js diff --git a/projects/bitu-protocol/index.js b/projects/bitu-protocol/index.js deleted file mode 100644 index d3d29d110a7b..000000000000 --- a/projects/bitu-protocol/index.js +++ /dev/null @@ -1,11 +0,0 @@ -const ADDRESSES = require("../helper/coreAssets.json"); -const BITU = ADDRESSES.bsc.BITU; - -module.exports = { - bsc: { - tvl: async (api) => { - const supply = await api.call({ abi: "erc20:totalSupply", target: BITU }); - api.add(BITU, supply); - }, - }, -}; diff --git a/projects/bitu/index.js b/projects/bitu/index.js new file mode 100644 index 000000000000..1e7f88e794fb --- /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/helper/coreAssets.json b/projects/helper/coreAssets.json index 31a8dd620d8b..eee6a5af45c6 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -125,8 +125,7 @@ "IVN": "0x6a46d878401f46b4c7f665f065e0667580e031ec", "ankrBNB": "0xe85afccdafbe7f2b096f268e31cce3da8da2990a", "aBNBb": "0xbb1aa6e59e5163d8722a122cd66eba614b59df0d", - "TUSD": "0x40af3827f39d0eacbf4a168f8d4ee67c121d11c9", - "BITU": "0x654A32542A84bEA7D2c2C1A1Ed1AAAf26888E6bD" + "TUSD": "0x40af3827f39d0eacbf4a168f8d4ee67c121d11c9" }, "polygon": { "WMATIC": "0xfd28c7cea3c50a060cb4c0059e453c6d4dd9829d", From e5a987cb6b022d32221a0af883c6680c36954d14 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 24 Jun 2024 11:52:58 +0200 Subject: [PATCH 433/855] track stablejack --- projects/stablejack/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/stablejack/index.js diff --git a/projects/stablejack/index.js b/projects/stablejack/index.js new file mode 100644 index 000000000000..e44943b7302f --- /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 From 9a7d962c4d7ec61b752956d2c2dc1012e75a6549 Mon Sep 17 00:00:00 2001 From: D <105202131+dmitrykarpushkin@users.noreply.github.com> Date: Mon, 24 Jun 2024 14:34:13 +0400 Subject: [PATCH 434/855] bond offers migration (#10737) --- projects/banx/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/banx/index.js b/projects/banx/index.js index 8bc4c0a7fac0..02c5ddea41c8 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]), ]) From fb99d796075c379625f59bafbe5119a3e96131d1 Mon Sep 17 00:00:00 2001 From: Cohiba Nan <132758148+Cohiban@users.noreply.github.com> Date: Mon, 24 Jun 2024 18:44:40 +0800 Subject: [PATCH 435/855] Add AILayer Chain (#10739) * Add AILayer Chain * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/ainnswap/index.js | 10 ++++++++++ projects/helper/chains.json | 1 + projects/helper/coreAssets.json | 3 +++ projects/helper/env.js | 1 + projects/helper/tokenMapping.js | 7 ++++++- 5 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 projects/ainnswap/index.js diff --git a/projects/ainnswap/index.js b/projects/ainnswap/index.js new file mode 100644 index 000000000000..4efe43244eba --- /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/helper/chains.json b/projects/helper/chains.json index bded24bc801b..3a0e109318ec 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -2,6 +2,7 @@ "acala", "ace", "aelf", + "ailayer", "airdao", "alephium", "algorand", diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index e76a73ac7c5d..ef1af7fa2e98 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1813,5 +1813,8 @@ "USDC": "0xff00000000000000000000000000000000000003", "ETH": "0xff00000000000000000000000000000000000001", "DUSD": "0xff0000000000000000000000000000000000000f" + }, + "ailayer": { + "ABTC": "0x1470a4831F76954686BfB4dE8180F7469EA8dE6F" } } diff --git a/projects/helper/env.js b/projects/helper/env.js index 72dcf6f3e441..9ee5524f86bd 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -27,6 +27,7 @@ const DEFAULTS = { HAM_RPC: 'https://rpc.ham.fun', HAM_RPC_MULTICALL: '0xB7c3Ea932649fBD594C881aDCb3F19415e2EA2d5', SANKO_RPC_MULTICALL: '0xB32d192e07727A0F6f48e721791aa4e02cd292e1', + AILAYER_RPC: "https://mainnet-rpc.ailayer.xyz", } const ENV_KEYS = [ diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 0f68f49a045c..76e5370d8168 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -195,7 +195,12 @@ const fixBalancesTokens = { [ADDRESSES.null]: { coingeckoId: 'weth', 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 }, + }, } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) From 5cf4e8bf8d6cf7cc0aebb4e2f1dfc219206ce66c Mon Sep 17 00:00:00 2001 From: Nyke Finance <167595945+Jabr0nie@users.noreply.github.com> Date: Mon, 24 Jun 2024 06:08:23 -0500 Subject: [PATCH 436/855] Nyke Finance (#10745) * Create index.js * Update pull_request_template.md * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/nyke/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 projects/nyke/index.js diff --git a/projects/nyke/index.js b/projects/nyke/index.js new file mode 100644 index 000000000000..567110759524 --- /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', + }) +}; From 07259250f8ee540201d9eab068a6b5c39a64bb3b Mon Sep 17 00:00:00 2001 From: MishaShWoof Date: Mon, 24 Jun 2024 14:09:55 +0300 Subject: [PATCH 437/855] feat: add optimism-usdt and arbitrum-weth markets (#10748) --- projects/compound-v3/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/compound-v3/index.js b/projects/compound-v3/index.js index 7932a5dde46f..7735d0402bad 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 + ], } }) From 9e449e1f073386a9715db1bae4d15ec84060dde7 Mon Sep 17 00:00:00 2001 From: Carl Wiles <131632522+CarlWiles@users.noreply.github.com> Date: Mon, 24 Jun 2024 19:10:20 +0800 Subject: [PATCH 438/855] feat: support rho markets tvl and borrowed query (#10740) * feat: support rho markets tvl and borrowed query * minor fix --------- Co-authored-by: Carl Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/tokenMapping.js | 1 + projects/rho-markets/index.js | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 projects/rho-markets/index.js diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 76e5370d8168..1373b2dbf824 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -78,6 +78,7 @@ const fixBalancesTokens = { }, scroll: { [ADDRESSES.mode.STONE]: { coingeckoId: "ethereum:0x7122985656e38bdc0302db86685bb972b145bd3c", decimals: 0 }, + '0x3ba89d490ab1c0c9cc2313385b30710e838370a4': { coingeckoId: "solv-btc", decimals: 18 }, }, tezos: { "KT1PnUZCp3u2KzWr93pn4DD7HAJnm3rWVrgn": { coingeckoId: "tezos", decimals: 6 }, diff --git a/projects/rho-markets/index.js b/projects/rho-markets/index.js new file mode 100644 index 000000000000..79ea4983559f --- /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 From 01a8c35dbf952c19313d2060fccada75fe63cf59 Mon Sep 17 00:00:00 2001 From: GausPeerzade <116433573+GausPeerzade@users.noreply.github.com> Date: Mon, 24 Jun 2024 17:21:19 +0530 Subject: [PATCH 439/855] New Degen Chain Vaults of Rivera (#10750) * Added Arbitrum vaults * Added new chains * New Degen Vaults Rivera * New degen vault of Rivera --- projects/rivera_money/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/rivera_money/index.js b/projects/rivera_money/index.js index 4ee8512d0a3f..2ae40f26054f 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: [ From 63fa44c4059736a3fae81706f21fac71b189c16a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 24 Jun 2024 17:21:30 +0530 Subject: [PATCH 440/855] Update xlink owner and disable EOAs (#10749) * feat: xlink owner update * disable EOAs --------- Co-authored-by: fiftyeightandeight --- projects/xlink/index.js | 50 +++++++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/projects/xlink/index.js b/projects/xlink/index.js index 8a9d91ab9af5..ad6c513dc300 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 => { From fc193fddd05c0b66a0550110666b4254c67d15d8 Mon Sep 17 00:00:00 2001 From: George Bibilashvili Date: Mon, 24 Jun 2024 17:49:51 +0400 Subject: [PATCH 441/855] feat: add fantom assets to lynx project (#10752) --- projects/lynx/index.js | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/projects/lynx/index.js b/projects/lynx/index.js index 783bb6e68e75..38ecda6e9e89 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: [ [ From 3234ec349fd1c43de806dd355c010cdad8b27071 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 24 Jun 2024 19:20:23 +0530 Subject: [PATCH 442/855] Add unwrapping functionality for Arcadia (#10751) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ✨ add wrapped & staked aerodrome on arcadia (#5) * ✨ add wrapped and staked aerodrome positions * 🎨 undo formatting & push test again * code refactor --------- Co-authored-by: Jasper <104004836+j-vp@users.noreply.github.com> Co-authored-by: j-vp --- projects/arcadia-finance-v2/index.js | 64 ++++++++++++++++++++++++---- projects/helper/unwrapLPs.js | 1 - 2 files changed, 55 insertions(+), 10 deletions(-) diff --git a/projects/arcadia-finance-v2/index.js b/projects/arcadia-finance-v2/index.js index 9cbaf0aebfc4..52ab1570d3b0 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/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index b6eef6184f8f..3be5849ca689 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) From ee5cdaf2e87afeab6d56a4750bc7dedd71d267d2 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 24 Jun 2024 23:36:36 +0100 Subject: [PATCH 443/855] add some chains to sushiswap --- projects/sushiswap/api.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/sushiswap/api.js b/projects/sushiswap/api.js index 851bbc15ffd1..4e4e3a3819e0 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: { @@ -98,6 +98,12 @@ module.exports = { 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') From fbe1acb7f339160ebc6bcb41504bc256a95e37ff Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 24 Jun 2024 23:37:11 +0100 Subject: [PATCH 444/855] display chain on subgraph errors --- projects/helper/cex.js | 1 + projects/helper/http.js | 1 + 2 files changed, 2 insertions(+) diff --git a/projects/helper/cex.js b/projects/helper/cex.js index 81bd5add7d93..2d945389ef24 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/http.js b/projects/helper/http.js index 327b3436e7ad..e682d45ac452 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) From 122f6b989bfc7a04eb4662b08d4cd0e898c29da0 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 24 Jun 2024 23:39:20 +0100 Subject: [PATCH 445/855] + subgraph errors --- utils/handleError.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/handleError.js b/utils/handleError.js index 254c51a97edb..049f9b2cd972 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 From 11360eb78edea60ea36b3387d6bd5726db3a6e47 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 25 Jun 2024 05:33:19 +0100 Subject: [PATCH 446/855] update --- projects/sushiswap/api.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/sushiswap/api.js b/projects/sushiswap/api.js index 4e4e3a3819e0..3cc89fa2a6c1 100644 --- a/projects/sushiswap/api.js +++ b/projects/sushiswap/api.js @@ -107,6 +107,7 @@ module.exports = { } module.exports.polygon.tvl = getChainTVL('polygon') +module.exports.boba_avax.tvl = () => ({}) // module.exports.bsc.tvl = getChainTVL('bsc') // module.exports.fantom.tvl = getChainTVL('fantom') // module.exports.harmony.tvl = getChainTVL('harmony') From cbfa5a28464438defd1331142282f025d33d7ee7 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Tue, 25 Jun 2024 05:38:03 +0100 Subject: [PATCH 447/855] fix --- projects/sushiswap/api.js | 1 - projects/sushiswap/index.js | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/projects/sushiswap/api.js b/projects/sushiswap/api.js index 3cc89fa2a6c1..4e4e3a3819e0 100644 --- a/projects/sushiswap/api.js +++ b/projects/sushiswap/api.js @@ -107,7 +107,6 @@ module.exports = { } module.exports.polygon.tvl = getChainTVL('polygon') -module.exports.boba_avax.tvl = () => ({}) // module.exports.bsc.tvl = getChainTVL('bsc') // module.exports.fantom.tvl = getChainTVL('fantom') // module.exports.harmony.tvl = getChainTVL('harmony') diff --git a/projects/sushiswap/index.js b/projects/sushiswap/index.js index 4a4ea92d3f2a..3739a6b4870a 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 From 740d1aa22171ad64ca6fa63f4e10a27b9cf082d5 Mon Sep 17 00:00:00 2001 From: vspaxo <110825143+vspaxo@users.noreply.github.com> Date: Tue, 25 Jun 2024 14:59:16 +0530 Subject: [PATCH 448/855] add boba network to wefi (#10756) Co-authored-by: Vinay Sagar --- projects/paxo-finance/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/paxo-finance/index.js b/projects/paxo-finance/index.js index f9dd2cd90e1a..099a49b8c152 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.`, } From b619ca4622f3f697ed542a93cc906461e26a3a6e Mon Sep 17 00:00:00 2001 From: Shoebill Finance <118880028+ShoebillFinance@users.noreply.github.com> Date: Tue, 25 Jun 2024 18:30:14 +0900 Subject: [PATCH 449/855] update zklink-eth, fuse-fuse market @ShoebillFinance (#10753) * add bob-stable market * update kroma chain * update zklink-eth, fuse-fuse market --- projects/shoebillFinance-v2/index.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/projects/shoebillFinance-v2/index.js b/projects/shoebillFinance-v2/index.js index a411d75fabf8..720f27cd0e8f 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", + }), + }, ]); From 6fc96f7fff29e5d09aaee027d23e9b5ca866c160 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 25 Jun 2024 18:41:14 +0530 Subject: [PATCH 450/855] Add Chiliz Governance Staking TVL (#10762) * Add Chiliz Staking * renamed chiliz-staking to chiliz-governance-staking * minor fix --------- Co-authored-by: Giorgi Abuladze Co-authored-by: Giorgi Abuladze --- projects/chiliz-governance-staking/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 projects/chiliz-governance-staking/index.js diff --git a/projects/chiliz-governance-staking/index.js b/projects/chiliz-governance-staking/index.js new file mode 100644 index 000000000000..02b95529187e --- /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 From 376d42cbc28cf246b7fcd11e809d9bbe526d5e58 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 25 Jun 2024 18:41:41 +0530 Subject: [PATCH 451/855] Add Fraxtal chain support and fix minor issues (#10761) * symbiosis adds Fraxtal chain * minor fix --------- Co-authored-by: allush --- projects/helper/coreAssets.json | 3 +++ projects/helper/tokenMapping.js | 3 +++ projects/symbiosis-finance/config.js | 12 ++++++++++++ 3 files changed, 18 insertions(+) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index ef1af7fa2e98..bf4568f0c55c 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1816,5 +1816,8 @@ }, "ailayer": { "ABTC": "0x1470a4831F76954686BfB4dE8180F7469EA8dE6F" + }, + "fraxtal": { + "WETH": "0xA8a59D73388D0c4344a7b0Ba287ddb654227c38a" } } diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 1373b2dbf824..2e66a779a81d 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -202,6 +202,9 @@ const fixBalancesTokens = { '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/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js index ac562fb1afaf..89c49ce315b9 100644 --- a/projects/symbiosis-finance/config.js +++ b/projects/symbiosis-finance/config.js @@ -30,6 +30,9 @@ const TOKENS = { }, cronos: { USDC: ADDRESSES.cronos.USDC + }, + fraxtal: { + WETH: ADDRESSES.fraxtal.WETH } } @@ -392,5 +395,14 @@ module.exports = { '0xE75C7E85FE6ADd07077467064aD15847E6ba9877', // portal v2 ] }, + { + name: 'fraxtal', + tokens: [ + TOKENS.fraxtal.WETH, + ], + holders: [ + '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 + ] + }, ] } \ No newline at end of file From e9f57ff4746ae4407639f975c4e89a5dfca923be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Stankiewicz?= Date: Tue, 25 Jun 2024 15:12:57 +0200 Subject: [PATCH 452/855] Add truefi alocs (#10759) * Add truefi alocs on arbitrum * Add alocs on mainnet --- projects/truefi/abi.json | 4 +++- projects/truefi/index.js | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/projects/truefi/abi.json b/projects/truefi/abi.json index c291f46fb20b..ad9087e274e5 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 2a4291a38391..87aef85eb869 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 From 8c636f590e065c4556bf5d7d4a7dabbf63c00706 Mon Sep 17 00:00:00 2001 From: GausPeerzade <116433573+GausPeerzade@users.noreply.github.com> Date: Tue, 25 Jun 2024 18:43:51 +0530 Subject: [PATCH 453/855] Corex Vaults of Rivera (#10758) * Added Arbitrum vaults * Added new chains * New Degen Vaults Rivera * New degen vault of Rivera * Corex vaults for Rivera --- projects/rivera_money/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/rivera_money/index.js b/projects/rivera_money/index.js index 2ae40f26054f..bd45d7734ee9 100644 --- a/projects/rivera_money/index.js +++ b/projects/rivera_money/index.js @@ -50,6 +50,11 @@ const config = { polygon: [ "0x67e07BFfce318ADbA7b08618CBf4B8E271499197" ], + + core: [ + "0xBC91a7a0eE37085af193C61747ecE693979Ec0C1", + "0x018BeE125A17D456E6dacE22A66E8B9aF3c69449", + ], } module.exports = { From 87da2e2cf61ce7ec96e31de8caf1445537a2f762 Mon Sep 17 00:00:00 2001 From: zhwindy Date: Tue, 25 Jun 2024 21:15:00 +0800 Subject: [PATCH 454/855] add MintSwap (#10757) * add MintSwap * replace core to mint * fix fromBlock * add token contract * add env multicall * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/chains.json | 1 + projects/helper/coreAssets.json | 6 ++++++ projects/helper/env.js | 1 + projects/helper/tokenMapping.js | 10 +++++++++- projects/mintswap-finance-v3/index.js | 7 +++++++ 5 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 projects/mintswap-finance-v3/index.js diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 3a0e109318ec..5f083946a7bd 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -189,6 +189,7 @@ "migaloo", "milkomeda", "milkomeda_a1", + "mint", "mixin", "mode", "moonbeam", diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index bf4568f0c55c..dba22a0ba978 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1817,6 +1817,12 @@ "ailayer": { "ABTC": "0x1470a4831F76954686BfB4dE8180F7469EA8dE6F" }, + "mint": { + "WETH": "0x4200000000000000000000000000000000000006", + "USDC": "0xb62F35B9546A908d11c5803ecBBA735AbC3E3eaE", + "USDT": "0x05D032ac25d322df992303dCa074EE7392C117b9", + "WBTC": "0x03C7054BCB39f7b2e5B2c7AcB37583e32D70Cfa3" + }, "fraxtal": { "WETH": "0xA8a59D73388D0c4344a7b0Ba287ddb654227c38a" } diff --git a/projects/helper/env.js b/projects/helper/env.js index 9ee5524f86bd..7c4eaa096166 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -28,6 +28,7 @@ const DEFAULTS = { HAM_RPC_MULTICALL: '0xB7c3Ea932649fBD594C881aDCb3F19415e2EA2d5', SANKO_RPC_MULTICALL: '0xB32d192e07727A0F6f48e721791aa4e02cd292e1', AILAYER_RPC: "https://mainnet-rpc.ailayer.xyz", + MINT_RPC_MULTICALL: "0xf8ac4BEB2F75d2cFFb588c63251347fdD629B92c", } const ENV_KEYS = [ diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 2e66a779a81d..a8a7a6bc512e 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -192,8 +192,16 @@ const fixBalancesTokens = { "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: 'weth', decimals: 18 }, + [ADDRESSES.null]: { coingeckoId: 'ethereum', decimals: 18 }, "0xf037540e51d71b2d2b1120e8432ba49f29edfbd0": { coingeckoId: 'weth', decimals: 18 }, "0xfbda5f676cb37624f28265a144a48b0d6e87d3b6": { coingeckoId: 'usd-coin', decimals: 6 }, }, diff --git a/projects/mintswap-finance-v3/index.js b/projects/mintswap-finance-v3/index.js new file mode 100644 index 000000000000..4c1f4bd9b79a --- /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 From 4a15bc2ad96c16874b428b645e918ff29da939cf Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 25 Jun 2024 19:40:52 +0530 Subject: [PATCH 455/855] update xy finance (#10763) * feat: add ox chain config * feat: update xy token config * fix xy --------- Co-authored-by: ryanC --- projects/helper/chains.json | 3 ++- projects/helper/env.js | 2 ++ projects/xy-finance/index.js | 51 +++++++++++++++++++++++++++++++++--- 3 files changed, 52 insertions(+), 4 deletions(-) diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 5f083946a7bd..aa686a761145 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -327,5 +327,6 @@ "zora", "zyx", "joltify", - "sanko" + "sanko", + "ox_chain" ] diff --git a/projects/helper/env.js b/projects/helper/env.js index 7c4eaa096166..b11f97487205 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -28,6 +28,8 @@ const DEFAULTS = { 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", MINT_RPC_MULTICALL: "0xf8ac4BEB2F75d2cFFb588c63251347fdD629B92c", } diff --git a/projects/xy-finance/index.js b/projects/xy-finance/index.js index 07f7100730f7..307d67cbecb6 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" + // } } } From d6c5b67e66bc157219ac358e167834f27d83323e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 25 Jun 2024 17:17:35 +0200 Subject: [PATCH 456/855] track thusd --- projects/thUSD/index.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 projects/thUSD/index.js diff --git a/projects/thUSD/index.js b/projects/thUSD/index.js new file mode 100644 index 000000000000..ae50a6d0bbd4 --- /dev/null +++ b/projects/thUSD/index.js @@ -0,0 +1,7 @@ +const { getLiquityTvl } = require("../helper/liquity") + +module.exports = { + ethereum: { + tvl: getLiquityTvl('0xf5e4ffeb7d2183b61753aa4074d72e51873c1d0a', { nonNativeCollateralToken: true, abis: { collateralToken: 'address:collateralAddress' } }) + } +} From 1c59a2078bf19b1c7ed3aab66d70c16273730b12 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 25 Jun 2024 16:53:10 +0100 Subject: [PATCH 457/855] delete duplicate file --- projects/fountain.js | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 projects/fountain.js diff --git a/projects/fountain.js b/projects/fountain.js deleted file mode 100644 index 41f47558ed67..000000000000 --- 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 From b301748dda40d6778d333ea3a07c3dc6d8cddc85 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 25 Jun 2024 17:01:22 +0100 Subject: [PATCH 458/855] remove unlisted adapter for dead project --- projects/bitswap/index.js | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 projects/bitswap/index.js diff --git a/projects/bitswap/index.js b/projects/bitswap/index.js deleted file mode 100644 index b3b7004b203d..000000000000 --- 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 From e0c2b64ced2a47f77250377ea7298a68a19ed72b Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 25 Jun 2024 17:06:57 +0100 Subject: [PATCH 459/855] Remove unlisted adapter for dead project --- projects/moonbiz/index.js | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 projects/moonbiz/index.js diff --git a/projects/moonbiz/index.js b/projects/moonbiz/index.js deleted file mode 100644 index e316ff8a8267..000000000000 --- 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, }) From 361d5ebc4e928afe4ce236732061628e3d3dfec9 Mon Sep 17 00:00:00 2001 From: doomsower <12031673+doomsower@users.noreply.github.com> Date: Tue, 25 Jun 2024 14:21:22 -0400 Subject: [PATCH 460/855] fix[gearbox]: workaround for out of gas (#10768) --- projects/gearbox/index.js | 74 ++++++++++++++++++++++++++++++++------- 1 file changed, 61 insertions(+), 13 deletions(-) diff --git a/projects/gearbox/index.js b/projects/gearbox/index.js index b492d66e140e..c524bc3bd53f 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 }); } } } From 3f5e004dd4b949af19fa6582f09f8535dc87d5bf Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 25 Jun 2024 22:57:00 +0200 Subject: [PATCH 461/855] update thusd --- projects/thUSD/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/thUSD/index.js b/projects/thUSD/index.js index ae50a6d0bbd4..368dc65b0c89 100644 --- a/projects/thUSD/index.js +++ b/projects/thUSD/index.js @@ -1,7 +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: getLiquityTvl('0xf5e4ffeb7d2183b61753aa4074d72e51873c1d0a', { nonNativeCollateralToken: true, abis: { collateralToken: 'address:collateralAddress' } }) + tvl: sdk.util.sumChainTvls([tBTCTvl, ethTvl]) } } From 987feb529dbf0f2c0ee295b3da3d77d4ea1e4988 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 26 Jun 2024 10:30:57 +0200 Subject: [PATCH 462/855] fix poseidollar --- projects/poseidollar/index.js | 53 +++++++++++------------------------ 1 file changed, 16 insertions(+), 37 deletions(-) diff --git a/projects/poseidollar/index.js b/projects/poseidollar/index.js index 436c7336b9cf..900db73c0840 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) } } From 0152764c220d52db3a62b363e825025b73e6869c Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Wed, 26 Jun 2024 09:48:03 +0100 Subject: [PATCH 463/855] git push origin apex-omni (#10780) --- projects/apex-omni/index.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 projects/apex-omni/index.js diff --git a/projects/apex-omni/index.js b/projects/apex-omni/index.js new file mode 100644 index 000000000000..74ecad0c41dd --- /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 From d57b95975ad47682b53abe51f57e8381587df6c4 Mon Sep 17 00:00:00 2001 From: Noah Hanover Date: Wed, 26 Jun 2024 03:50:31 -0500 Subject: [PATCH 464/855] Feat: munchables addition (#10767) * bringing back s * added season 2 * feat: added support for BLAST token tracking * Merge branch 'main' into feat/munchables-addition --- projects/helper/coreAssets.json | 5 +++-- projects/munchables-season2/index.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index dba22a0ba978..53f58c056369 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1659,7 +1659,8 @@ "fwUSDB": "0x866f2c06b83df2ed7ca9c2d044940e7cd55a06d6", "WETH": "0x4300000000000000000000000000000000000004", "ezETH": "0x2416092f143378750bb29b79eD961ab195CcEea5", - "weETH": "0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A" + "weETH": "0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A", + "BLAST": "0xb1a5700fA2358173Fe465e6eA4Ff52E36e88E2ad" }, "chz": { "WCHZ": "0x721ef6871f1c4efe730dce047d40d1743b886946" @@ -1826,4 +1827,4 @@ "fraxtal": { "WETH": "0xA8a59D73388D0c4344a7b0Ba287ddb654227c38a" } -} +} \ No newline at end of file diff --git a/projects/munchables-season2/index.js b/projects/munchables-season2/index.js index 8c8a101bdbd9..95d1cc941b1f 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 From a4c05cc7a6289bdc64452ee883890bf0ad285790 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 26 Jun 2024 15:04:16 +0530 Subject: [PATCH 465/855] Dinari: Add kinto (#10781) * feat: dinari kinto tvl * minor fix --------- Co-authored-by: jaketimothy --- projects/dinari/index.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/projects/dinari/index.js b/projects/dinari/index.js index 97ec8bf1693d..829e3dbfcfad 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]; } From 6ce9a1dfd2531b02d48447dcbc9f54dc80fd0337 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Wed, 26 Jun 2024 10:34:33 +0100 Subject: [PATCH 466/855] add more wallet deribit CEX (#10782) --- projects/deribit/index.js | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/projects/deribit/index.js b/projects/deribit/index.js index 0cc893762af3..eb71c2aab713 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", + ] } } From 086aa26835af9a2a2d78059a211e473f0ced731f Mon Sep 17 00:00:00 2001 From: Jake Barber Date: Wed, 26 Jun 2024 04:36:15 -0500 Subject: [PATCH 467/855] Update Interest Protocol TVL, to include OPTIMISM TVL. (#10772) * no pricing * op is correct now * uni position TVL is correct on op * added reseerve to mainnet, updated token lists, everything looks up to date * updated methodology * cleanup * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/ip/index.js | 131 +++++++++++++++++++++++++------------------ 1 file changed, 77 insertions(+), 54 deletions(-) diff --git a/projects/ip/index.js b/projects/ip/index.js index c1721e5ed3bb..f9f78c593fd5 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. ` }; From 62ceb1fda9c5621c904155b777a876e5f749f30f Mon Sep 17 00:00:00 2001 From: Philip Gogolev <46344159+googolev@users.noreply.github.com> Date: Wed, 26 Jun 2024 12:36:42 +0300 Subject: [PATCH 468/855] electrowizy integration (#10764) * electrowizy integration * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/electrowizy/index.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 projects/electrowizy/index.js diff --git a/projects/electrowizy/index.js b/projects/electrowizy/index.js new file mode 100644 index 000000000000..3abb551ff082 --- /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 From 63a602763f5854a4fccf87a2c0fc884124a7c15c Mon Sep 17 00:00:00 2001 From: An-Haijun <34919636+An-Haijun@users.noreply.github.com> Date: Wed, 26 Jun 2024 17:36:55 +0800 Subject: [PATCH 469/855] Update mantle subgraph url (#10773) * Changed to get all vault raise balances * Add judgment * add network * del console log * fix bug * fix bug * Update index.js * update subgraph url * fix bug * revert * Excluding Fof Funds * add other Deposit * add solvbtc Solv Funds del solvbtc * update graphql query * add mirro balance * Eliminate SolvBTC * Remove unusable code * Format * update: mantle 0xgraph url --------- Co-authored-by: buchaoqun Co-authored-by: charq <73696209+buchaoqun@users.noreply.github.com> Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Co-authored-by: qwen-solv --- projects/solv-protocol-funds/index.js | 2 +- projects/solv-protocol-rwa/index.js | 2 +- projects/solvbtc/index.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/solv-protocol-funds/index.js b/projects/solv-protocol-funds/index.js index efdf9aec3aea..c086c8a4c7e5 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 19ea2fc662fa..25d703b28ec7 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 c255fdf3f378..1c35f29559c7 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', } From 9dc53151d97055b6e29fdc06fdb95e0726c21467 Mon Sep 17 00:00:00 2001 From: LpcAries <101619245+LpcAries@users.noreply.github.com> Date: Wed, 26 Jun 2024 17:37:05 +0800 Subject: [PATCH 470/855] add core config (#10774) --- projects/izumi-iziswap/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/izumi-iziswap/index.js b/projects/izumi-iziswap/index.js index 63ce4f8601be..256c2d5b2acf 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 = [ From 15c5af24125a3428bb6762c3b5603d706744403a Mon Sep 17 00:00:00 2001 From: Bitrock Blockchain <138885902+BitrockChain@users.noreply.github.com> Date: Wed, 26 Jun 2024 16:37:31 +0700 Subject: [PATCH 471/855] Add TVL on staking contract of WBROCK and BITROCK | Bitrock chain (#10770) * Add Rockswap - Bitrock Blockchain * Update index.js * minor fix * Add WBROCK and ROCK Staking TVL * Update TVL on staking contract of WBROCK and BITROCK * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/wbrockstaking/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/wbrockstaking/index.js diff --git a/projects/wbrockstaking/index.js b/projects/wbrockstaking/index.js new file mode 100644 index 000000000000..2f72feb04f05 --- /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", +}; + From 80b38c19a6045aeb1b4653d2e6f34a858212cdf2 Mon Sep 17 00:00:00 2001 From: LpcAries <101619245+LpcAries@users.noreply.github.com> Date: Wed, 26 Jun 2024 17:37:50 +0800 Subject: [PATCH 472/855] add woodswap adapter (#10775) --- projects/woodswap/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 projects/woodswap/index.js diff --git a/projects/woodswap/index.js b/projects/woodswap/index.js new file mode 100644 index 000000000000..8fb05ca6ebb1 --- /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 From 88772f035264f9f0058b2af275502366e12ae91d Mon Sep 17 00:00:00 2001 From: BAICE <48044642+libaice@users.noreply.github.com> Date: Wed, 26 Jun 2024 17:38:07 +0800 Subject: [PATCH 473/855] add coredao aBTC market (#10776) --- projects/bitlen/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/bitlen/index.js b/projects/bitlen/index.js index 0dc80f0a0546..418bdaf2062b 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] } } From c70b05e8bcaa694657f1dc3d12fe0bbb5c1b9d17 Mon Sep 17 00:00:00 2001 From: Sujith Somraaj <35634175+sujithsomraaj@users.noreply.github.com> Date: Wed, 26 Jun 2024 15:08:27 +0530 Subject: [PATCH 474/855] fix superform TVL (#10777) * chore: add fantom for superform * chore: blacklist misconfigured vaults --- projects/superform/index.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/projects/superform/index.js b/projects/superform/index.js index 16122439a96f..322f58ef1e54 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) }) From c88944ad7ead5f4d895ae520a4a6001390e7714e Mon Sep 17 00:00:00 2001 From: bit-reserve Date: Wed, 26 Jun 2024 17:41:48 +0800 Subject: [PATCH 475/855] Update contract address (#10778) --- projects/bit-reserve/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/bit-reserve/index.js b/projects/bit-reserve/index.js index 10191c1208df..580a2ea6a9d9 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 +} From 0e71b086873d48a0ee0bbe30739af4d9a0a753aa Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 26 Jun 2024 11:45:03 +0200 Subject: [PATCH 476/855] update teahouse endpoint --- projects/teahouse-v3/index.js | 4 ++-- projects/teahouse/index.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/teahouse-v3/index.js b/projects/teahouse-v3/index.js index 2b1d0d1b8f63..df331983caf0 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 4e54008cf90d..e6cbbf4fa1e8 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) { From 34e41ebca67901c73d30c09fe8bf2fa8c66de1f8 Mon Sep 17 00:00:00 2001 From: tuco-gordian <125207884+tuco-gordian@users.noreply.github.com> Date: Wed, 26 Jun 2024 15:06:46 +0300 Subject: [PATCH 477/855] Treasuries of dexfinance (#10783) * Treasuries of dexfinance * Change ownTokens to tokens --- projects/treasury/dexfinance.js | 84 +++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 projects/treasury/dexfinance.js diff --git a/projects/treasury/dexfinance.js b/projects/treasury/dexfinance.js new file mode 100644 index 000000000000..d336eb63cc5f --- /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 From ec5d603796977573b136addfeb1b8355745b00d7 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 26 Jun 2024 16:52:54 +0100 Subject: [PATCH 478/855] fix timestamp --- projects/fusefi-lending/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/fusefi-lending/index.js b/projects/fusefi-lending/index.js index 79b5685fc121..dacc669eb407 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: [ From 38cd5cd66996a2716f68485402a863c635f39428 Mon Sep 17 00:00:00 2001 From: LeviathanYou <168118002+LeviathanYou@users.noreply.github.com> Date: Thu, 27 Jun 2024 00:20:12 +0800 Subject: [PATCH 479/855] feat: add meson taiko (#10785) --- projects/meson/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/meson/index.js b/projects/meson/index.js index 3760dabd8ab1..6b6fbe6e191d 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: {}, From 608e48d46631fca17d5abd1340ecfa613e171f49 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 26 Jun 2024 18:06:45 +0100 Subject: [PATCH 480/855] add mantle --- projects/vertex/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/projects/vertex/index.js b/projects/vertex/index.js index c50337781593..e82cca2d13ca 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 From 0033833cf50ce66e32ec41fd273a8200f673b91b Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 26 Jun 2024 22:54:28 +0100 Subject: [PATCH 481/855] add synthetix --- projects/synthetix-v3/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/synthetix-v3/index.js b/projects/synthetix-v3/index.js index f756e24a0389..a556bbf52cc6 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] }) } } From 9ffbc3797239a182f8b6ce6791985c0b53221dc9 Mon Sep 17 00:00:00 2001 From: fextr Date: Thu, 27 Jun 2024 08:55:31 +0400 Subject: [PATCH 482/855] remove staking export --- projects/resolv/index.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/projects/resolv/index.js b/projects/resolv/index.js index 8981ca61a10f..0a8c9710cbe9 100644 --- a/projects/resolv/index.js +++ b/projects/resolv/index.js @@ -1,7 +1,6 @@ const USR = "0x66a1E37c9b0eAddca17d3662D6c05F4DECf3e110"; const RLP = "0x4956b52aE2fF65D74CA2d61207523288e4528f96"; const RLPPriceStorage = "0x31319866778a5223633bd745780BB6d59406371E"; -const stUSR = "0x6c8984bc7DBBeDAf4F6b2FD766f16eBB7d10AAb4"; const erc20 = { "totalSupply": "uint256:totalSupply" @@ -22,13 +21,8 @@ async function ethTvl(api) { api.add(RLP, rlpSupply * rlpPrice); } -async function staking(api) { - api.add(USR, await api.call({ abi: erc20.totalSupply, target: stUSR })); -} - module.exports = { ethereum: { - tvl: ethTvl, - staking + tvl: ethTvl } }; \ No newline at end of file From 8977cd5948e9a1600994fec98e6aa6da7477c5ec Mon Sep 17 00:00:00 2001 From: fextr Date: Thu, 27 Jun 2024 12:32:03 +0400 Subject: [PATCH 483/855] use curve oracle for the rlp price --- projects/resolv/index.js | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/projects/resolv/index.js b/projects/resolv/index.js index 0a8c9710cbe9..95ba4c23870c 100644 --- a/projects/resolv/index.js +++ b/projects/resolv/index.js @@ -1,24 +1,13 @@ const USR = "0x66a1E37c9b0eAddca17d3662D6c05F4DECf3e110"; const RLP = "0x4956b52aE2fF65D74CA2d61207523288e4528f96"; -const RLPPriceStorage = "0x31319866778a5223633bd745780BB6d59406371E"; const erc20 = { "totalSupply": "uint256:totalSupply" }; -const rlpPriceStorage = { - "lastPrice": "uint256:lastPrice" -}; async function ethTvl(api) { api.add(USR, await api.call({ abi: erc20.totalSupply, target: USR })); - - const rlpSupply = await api.call({ abi: erc20.totalSupply, target: RLP }); - const rlpPrice = await api.call({ - abi: rlpPriceStorage.lastPrice, - target: RLPPriceStorage - } - ) / 1e18; - api.add(RLP, rlpSupply * rlpPrice); + api.add(RLP, await api.call({ abi: erc20.totalSupply, target: RLP })); } module.exports = { From d7e9a4bec1e4cc1e5618dd056e821c1591a37220 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Thu, 27 Jun 2024 09:38:17 +0100 Subject: [PATCH 484/855] add sei to uni v3 (#10791) --- projects/uniswap/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index c8d11e93080f..efef5c824181 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 }, From 6315a3d9d0556e07d63b48d5296fd1fe1f5f54c7 Mon Sep 17 00:00:00 2001 From: Ivan Dzizenko Date: Thu, 27 Jun 2024 11:48:03 +0300 Subject: [PATCH 485/855] Dorian adapter (#10787) --- projects/dorian/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/dorian/index.js diff --git a/projects/dorian/index.js b/projects/dorian/index.js new file mode 100644 index 000000000000..bea9b6756bbc --- /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; From b2fd2ca0efb2fa37d7071dc32bd2cf3e4a1907e0 Mon Sep 17 00:00:00 2001 From: Jonathan Lodge Date: Thu, 27 Jun 2024 16:48:21 +0800 Subject: [PATCH 486/855] Add Arbitrum to the Credbull DefiLlama output (#10792) --- projects/credbull/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/credbull/index.js b/projects/credbull/index.js index 963e7702c7a7..aeeb7c6c6b40 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 }, }; From f39eb0029d83784b041af7224a9dde86b4686ea3 Mon Sep 17 00:00:00 2001 From: TachySwap <160606624+tachyswap@users.noreply.github.com> Date: Thu, 27 Jun 2024 16:48:40 +0800 Subject: [PATCH 487/855] add tachyswap (#10790) * add tachyswap * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/chains.json | 1 + projects/helper/env.js | 1 + projects/helper/tokenMapping.js | 3 +++ projects/tachyswap/index.js | 12 ++++++++++++ 4 files changed, 17 insertions(+) create mode 100644 projects/tachyswap/index.js diff --git a/projects/helper/chains.json b/projects/helper/chains.json index aa686a761145..65579e65b7e0 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -102,6 +102,7 @@ "equilibrium", "era", "ergo", + "etlk", "ethereum", "ethereumclassic", "ethf", diff --git a/projects/helper/env.js b/projects/helper/env.js index b11f97487205..050cb04949f4 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -30,6 +30,7 @@ const DEFAULTS = { 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", } diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index a8a7a6bc512e..83803f525b06 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -180,6 +180,9 @@ 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 }, diff --git a/projects/tachyswap/index.js b/projects/tachyswap/index.js new file mode 100644 index 000000000000..582afc546df2 --- /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 From 7a9692743679de20d4f9fe5ad3b02d5797b14368 Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov <99496217+armoking32@users.noreply.github.com> Date: Thu, 27 Jun 2024 12:49:06 +0400 Subject: [PATCH 488/855] mellow-lrt new-vaults (ethena + second batch) (#10794) --- projects/mellow-protocol-v2/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/mellow-protocol-v2/index.js b/projects/mellow-protocol-v2/index.js index 44a634f7e1b9..a18cfc7fcec8 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' ], }, } From ab802d0a201eaddccb2a92456a105a07af82c749 Mon Sep 17 00:00:00 2001 From: "Kalax.io" <163113001+Kalaxio@users.noreply.github.com> Date: Thu, 27 Jun 2024 16:55:34 +0800 Subject: [PATCH 489/855] add pools (#10793) * add pools * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/tokenMapping.js | 3 +++ projects/kalax/index.js | 33 +++++++++++---------------------- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 83803f525b06..cdc2b3e7e00d 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -160,6 +160,9 @@ const fixBalancesTokens = { [ADDRESSES.taiko.WETH]: { coingeckoId: 'ethereum', decimals: 18 }, [ADDRESSES.taiko.USDC]: { coingeckoId: 'usd-coin', decimals: 6 }, }, + blast: { + '0x0000000000000000000000000000000000000001': { coingeckoId: 'ethereum', decimals: 18 }, + }, sei: { '0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1': { coingeckoId: 'usd-coin', decimals: 6 }, '0xb75d0b03c06a926e488e2659df1a861f860bd3d1': { coingeckoId: 'tether', decimals: 6 }, diff --git a/projects/kalax/index.js b/projects/kalax/index.js index 2977f9f232fe..971b519abef4 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)[])", -}; +} From 8c937d64e789dccc59045d94a9e2ff286d94950c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 27 Jun 2024 10:58:13 +0200 Subject: [PATCH 490/855] update sakai --- projects/sakai-vault/index.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/projects/sakai-vault/index.js b/projects/sakai-vault/index.js index c41f30ac4663..c42b387a332d 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 From 56215e17301a958a0a389c15b59eab9d4bed8ba5 Mon Sep 17 00:00:00 2001 From: FeiZhen98 <113326725+FeiZhen98@users.noreply.github.com> Date: Thu, 27 Jun 2024 15:59:48 +0700 Subject: [PATCH 491/855] chore: update address blast at perp88 (#10789) --- projects/perp88/index.js | 45 +++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/projects/perp88/index.js b/projects/perp88/index.js index 8a0cba31a27d..58521b33fa05 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, + }, +}; From 5779664ee55287dab967c364ab2448e981c94304 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 27 Jun 2024 15:25:25 +0530 Subject: [PATCH 492/855] Add KayenProtocol and minor fix (#10797) * add: AddKayenProtocol * minor fix --------- Co-authored-by: 0xDanielH --- projects/helper/tokenMapping.js | 4 +--- projects/kayen/index.js | 13 +++++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 projects/kayen/index.js diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index cdc2b3e7e00d..5088dc90f025 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -106,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 @@ -160,9 +161,6 @@ const fixBalancesTokens = { [ADDRESSES.taiko.WETH]: { coingeckoId: 'ethereum', decimals: 18 }, [ADDRESSES.taiko.USDC]: { coingeckoId: 'usd-coin', decimals: 6 }, }, - blast: { - '0x0000000000000000000000000000000000000001': { coingeckoId: 'ethereum', decimals: 18 }, - }, sei: { '0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1': { coingeckoId: 'usd-coin', decimals: 6 }, '0xb75d0b03c06a926e488e2659df1a861f860bd3d1': { coingeckoId: 'tether', decimals: 6 }, diff --git a/projects/kayen/index.js b/projects/kayen/index.js new file mode 100644 index 000000000000..b37cf8f7ccac --- /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 From f93fefa39f6f267129ebd87709e86b6352068d38 Mon Sep 17 00:00:00 2001 From: kexley <87971154+kexleyBeefy@users.noreply.github.com> Date: Thu, 27 Jun 2024 16:19:59 +0100 Subject: [PATCH 493/855] Add Beefy Manta (#10798) --- projects/beefy/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/beefy/index.js b/projects/beefy/index.js index 45d85b14ce1e..57cd2993eef6 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, From cfe7414324e4aecc98ccd4432247908a7b7edc85 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 27 Jun 2024 21:09:11 +0100 Subject: [PATCH 494/855] add vaults --- projects/cian-lst/index.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/projects/cian-lst/index.js b/projects/cian-lst/index.js index 426b6bedf83c..7a981fe59236 100644 --- a/projects/cian-lst/index.js +++ b/projects/cian-lst/index.js @@ -1,23 +1,24 @@ const config = { ethereum: [ - '0xcDd374F491fBF3f4FcF6E9023c99043774005137', - '0xB8c0c50D255B93f5276549cbA7F4bf78751A5D34', - '0x88508306E43FCe43F7f2c1e7D73c88cf6a523f6C', + "0xcDd374F491fBF3f4FcF6E9023c99043774005137", + "0xB8c0c50D255B93f5276549cbA7F4bf78751A5D34", + "0x88508306E43FCe43F7f2c1e7D73c88cf6a523f6C", ], - 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 }); + }, + }; +}); From dd068cc494b51137a8f61d414526f0412828932f Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 27 Jun 2024 21:12:58 +0100 Subject: [PATCH 495/855] add eth --- projects/cian-lst/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/cian-lst/index.js b/projects/cian-lst/index.js index 7a981fe59236..aba79f511887 100644 --- a/projects/cian-lst/index.js +++ b/projects/cian-lst/index.js @@ -3,6 +3,7 @@ const config = { "0xcDd374F491fBF3f4FcF6E9023c99043774005137", "0xB8c0c50D255B93f5276549cbA7F4bf78751A5D34", "0x88508306E43FCe43F7f2c1e7D73c88cf6a523f6C", + "0xD34f59E172cF3915f56C96A3037Ac554A7399D77", ], optimism: ["0x907883da917ca9750ad202ff6395C4C6aB14e60E"], bsc: ["0xEa5f10A0E612316A47123D818E2b597437D19a17"], From cc060623ae48f52a9483bba6f83afe975275215c Mon Sep 17 00:00:00 2001 From: Rodrigo Eduardo Date: Thu, 27 Jun 2024 20:49:53 -0300 Subject: [PATCH 496/855] bitflow: add pairs (#10801) * feat: add aeUSDC-sUSDT pair * add USDA-aeUSDC new pair * bitflow: add 2 new pairs (usda-aeusdc-v-1-4 & xyk-stx-aeusdc) --- projects/bitflow/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/bitflow/index.js b/projects/bitflow/index.js index e593034ac11b..16de10f16416 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 = { From b17649bbadefc3217d1c6efa61b2447e7418778e Mon Sep 17 00:00:00 2001 From: Nour Haridy Date: Fri, 28 Jun 2024 02:51:11 +0300 Subject: [PATCH 497/855] grace: add ethereum chain (#10799) --- projects/grace/index.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/projects/grace/index.js b/projects/grace/index.js index 46ed6066e70e..49c598bd597d 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 From ad98d5d9a7df60183adcfcffc1928217821bfce5 Mon Sep 17 00:00:00 2001 From: 0xKoaj <141654454+0xKoaj@users.noreply.github.com> Date: Thu, 27 Jun 2024 20:51:49 -0300 Subject: [PATCH 498/855] feat: add rsk to meanfinance (#10803) --- projects/meanfinance/index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/projects/meanfinance/index.js b/projects/meanfinance/index.js index 491b89b3e077..ee8962fa60bf 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"], From d394b3f6bb7f457f66c32f1a6f5fe31cf5d39586 Mon Sep 17 00:00:00 2001 From: Hiro <152849689+drummaster98@users.noreply.github.com> Date: Fri, 28 Jun 2024 15:29:43 +0800 Subject: [PATCH 499/855] add taiko core assets(USDC_e and USDT) (#10804) * add taiko core assets(USDC_e and USDT) * add token mapping --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/coreAssets.json | 2 ++ projects/helper/tokenMapping.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 53f58c056369..c8778875c4aa 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1799,6 +1799,8 @@ }, "taiko": { "USDC": "0x07d83526730c7438048D55A4fc0b850e2aaB6f0b", + "USDT": "0x2def195713cf4a606b49d07e520e22c17899a736", + "USDC_e": "0x19e26b0638bf63aa9fa4d14c6baf8d52ebe86c5c", "WETH": "0xA51894664A773981C6C112C43ce576f315d5b1B6" }, "stellar": { diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 5088dc90f025..f7663c5cadce 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -160,6 +160,8 @@ const fixBalancesTokens = { [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 }, From 00fd2c6225ff203ab5b6e5cb77f4436410dc5b00 Mon Sep 17 00:00:00 2001 From: MaryamNaveedFunavry <142418936+MaryamNaveedFunavry@users.noreply.github.com> Date: Fri, 28 Jun 2024 12:53:35 +0500 Subject: [PATCH 500/855] added factory v2 contracts for existing chains + addd new chains (#10805) * added factory v2 contracts for existing chains + addd new chains * updatd fromblock xlayer --- projects/chaingpt/index.js | 118 +++++++++++++++++++++++-------------- 1 file changed, 75 insertions(+), 43 deletions(-) diff --git a/projects/chaingpt/index.js b/projects/chaingpt/index.js index c0df86405036..fab8d065e058 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 }) } From 9279e3befc6f85415a773968996a54ebd65342c8 Mon Sep 17 00:00:00 2001 From: 0xmDreamy <124707942+0xmDreamy@users.noreply.github.com> Date: Fri, 28 Jun 2024 14:49:15 +0200 Subject: [PATCH 501/855] feat(mimswap): Add support for Arbitrum (#10807) --- projects/mimswap/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/mimswap/index.js b/projects/mimswap/index.js index 6121e57d58c6..fd60862869b3 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 }, } From 6fefa69b59e63443fc21bde252222091c64af283 Mon Sep 17 00:00:00 2001 From: liuruibin1 <68451339+liuruibin1@users.noreply.github.com> Date: Fri, 28 Jun 2024 20:57:18 +0800 Subject: [PATCH 502/855] add kayak tvl (#10806) * init: kayak * init: kayak tvl * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/kayak/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/kayak/index.js diff --git a/projects/kayak/index.js b/projects/kayak/index.js new file mode 100644 index 000000000000..9227635cfa69 --- /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 From 503fdc14ed67c2e0aea4ede660696e163fb1f7f2 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 28 Jun 2024 15:33:26 +0200 Subject: [PATCH 503/855] refactor raydium adapter --- projects/raydium.js | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/projects/raydium.js b/projects/raydium.js index b179ff1d78fd..83991bcae709 100644 --- a/projects/raydium.js +++ b/projects/raydium.js @@ -1,6 +1,5 @@ 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 { transformDexBalances } = require("./helper/portedTokens"); @@ -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 From b24890aa09c11a604a4d7a23cabf7ac4148205ec Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 28 Jun 2024 15:47:13 +0200 Subject: [PATCH 504/855] move raydium to sushi server --- projects/raydium/api.js | 6 ++++++ projects/{raydium.js => raydium/index.js} | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 projects/raydium/api.js rename projects/{raydium.js => raydium/index.js} (97%) diff --git a/projects/raydium/api.js b/projects/raydium/api.js new file mode 100644 index 000000000000..22d01f64b5bd --- /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 97% rename from projects/raydium.js rename to projects/raydium/index.js index 83991bcae709..dc6ddd76646c 100644 --- a/projects/raydium.js +++ b/projects/raydium/index.js @@ -1,9 +1,9 @@ -const { getConnection, sumTokens2, decodeAccount, } = require("./helper/solana"); +const { getConnection, sumTokens2, decodeAccount, } = require("../helper/solana"); const { PublicKey, } = require("@solana/web3.js"); -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' From 4a5ae7909385c9bd3e175f9c022b8b0e085a473c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 28 Jun 2024 15:48:00 +0200 Subject: [PATCH 505/855] add option to use different rpc for solana client --- projects/helper/env.js | 1 + projects/helper/solana.js | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/projects/helper/env.js b/projects/helper/env.js index 050cb04949f4..7441f69bc516 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -39,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/solana.js b/projects/helper/solana.js index 6abf0c7c3398..ba993179ed7a 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 } From cd476064811c7f39af2613fbcb8135392a69659b Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 28 Jun 2024 17:34:30 +0200 Subject: [PATCH 506/855] uniswap: track sei --- projects/helper/tokenMapping.js | 1 + projects/uniswap/index.js | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index f7663c5cadce..3e06e6ecf428 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -167,6 +167,7 @@ const fixBalancesTokens = { '0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1': { coingeckoId: 'usd-coin', decimals: 6 }, '0xb75d0b03c06a926e488e2659df1a861f860bd3d1': { coingeckoId: 'tether', decimals: 6 }, [ADDRESSES.null]: { coingeckoId: 'sei-network', decimals: 18 }, + '0x160345fc359604fc6e70e3c5facbde5f7a9342d8': { coingeckoId: 'ethereum', decimals: 18 }, '0xe30fedd158a2e3b13e9badaeabafc5516e95e8c7': { coingeckoId: 'sei-network', decimals: 18 }, }, core: { diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index efef5c824181..f663be83487c 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -1,5 +1,5 @@ const { uniV3Export } = require('../helper/uniswapV3') -const { cachedGraphQuery, configPost } = require('../helper/cache') +const { cachedGraphQuery, configPost, getConfig } = require('../helper/cache') const { sumTokens2 } = require('../helper/unwrapLPs') const graphs = { @@ -98,3 +98,12 @@ chains.forEach(chain => { tvl: v3TvlPaged(chain) } }) + +module.exports.sei.tvl = async (api) => { + const { result } = await getConfig('oku-trade/sei', 'https://omni.icarus.tools/sei/cush/getAllPoolsInOrder') + const pools = result.map(i => i.pool) + const token0s = await api.multiCall({ abi: 'address:token0', calls: pools }) + const token1s = await api.multiCall({ abi: 'address:token1', calls: pools }) + const ownerTokens = pools.map((pool, i) => [[token0s[i], token1s[i]], pool]) + return sumTokens2({ api, ownerTokens }) +} From a753441984017fa490c61ebd0903d092e09592f2 Mon Sep 17 00:00:00 2001 From: 0x_danr Date: Fri, 28 Jun 2024 11:42:17 -0400 Subject: [PATCH 507/855] GammaSwap: Add DeltaSwapFactory to Ethereum & Update Protocol Information (#10810) * add TVL from Base network * tracking ethereum mainnet pool data * adding DeltaSwapFactory to ethereum in gammaswap-deltaswap and gammaswap-v2 projects --- projects/gammaswap-deltaswap/index.js | 3 +++ projects/gammaswap-v2/index.js | 1 + 2 files changed, 4 insertions(+) diff --git a/projects/gammaswap-deltaswap/index.js b/projects/gammaswap-deltaswap/index.js index 75b5d201a3c5..c59fd0ceab4c 100644 --- a/projects/gammaswap-deltaswap/index.js +++ b/projects/gammaswap-deltaswap/index.js @@ -6,4 +6,7 @@ module.exports = { base: { tvl: getUniTVL({ factory: "0x9a9a171c69cc811dc6b59bb2f9990e34a22fc971", }), }, + ethereum: { + tvl: getUniTVL({ factory: "0x5fbe219e88f6c6f214ce6f5b1fcaa0294f31ae1b", }), + }, }; diff --git a/projects/gammaswap-v2/index.js b/projects/gammaswap-v2/index.js index f9db4491fc36..c26d9dd1136a 100644 --- a/projects/gammaswap-v2/index.js +++ b/projects/gammaswap-v2/index.js @@ -18,6 +18,7 @@ const config = { factories: [ { factory: '0xfd513630f697a9c1731f196185fb9eba6eaac20b', fromBlock: 19961383 }, ], + deltaswapFactory: '0x5fbe219e88f6c6f214ce6f5b1fcaa0294f31ae1b' }, } From c5a872cb0806abd4b1606f3a5db43c1b0095055f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 28 Jun 2024 23:21:39 +0200 Subject: [PATCH 508/855] bugfix --- projects/raydium/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/raydium/index.js b/projects/raydium/index.js index dc6ddd76646c..0ea9d93918c5 100644 --- a/projects/raydium/index.js +++ b/projects/raydium/index.js @@ -2,7 +2,7 @@ const { getConnection, sumTokens2, decodeAccount, } = require("../helper/solana" const { PublicKey, } = require("@solana/web3.js"); const { TokenAmountLayout, KeyLayoutv4 } = require("../helper/utils/solana/layouts/raydium-layout"); -const { transformDexBalances } = require("./helper/portedTokens"); +const { transformDexBalances } = require("../helper/portedTokens"); const { sleep } = require("../helper/utils"); const CLMM = 'CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK' From ffcdd182307b6cd23c0e4ece0a4e60eb8682349a Mon Sep 17 00:00:00 2001 From: Daniel Schaffield <56415596+kiwi0401@users.noreply.github.com> Date: Fri, 28 Jun 2024 14:54:29 -0700 Subject: [PATCH 509/855] liquid restaking vaults affine defi (#10812) * liquid restaking vaults * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/affine-defi-liquid/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/affine-defi-liquid/index.js diff --git a/projects/affine-defi-liquid/index.js b/projects/affine-defi-liquid/index.js new file mode 100644 index 000000000000..694da7fc8c76 --- /dev/null +++ b/projects/affine-defi-liquid/index.js @@ -0,0 +1,14 @@ +const { sumERC4626VaultsExport } = require('../helper/erc4626') + +module.exports = { + doublecounted: true, + ethereum: { + tvl: sumERC4626VaultsExport({ + vaults: [ + '0x0D53bc2BA508dFdf47084d511F13Bb2eb3f8317B', + '0x47657094e3AF11c47d5eF4D3598A1536B394EEc4', + ], + isOG4626: true, + }), + }, +} \ No newline at end of file From 4fecd1be9c7e7af0029a70e6b196054d00dddfec Mon Sep 17 00:00:00 2001 From: imimim-username <100382074+imimim-username@users.noreply.github.com> Date: Fri, 28 Jun 2024 18:10:36 -0400 Subject: [PATCH 510/855] Add Alchemix arbitrum contracts (#10811) * Add Alchemix arbitrum contracts * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/alchemix/contracts.json | 14 ++++++++ projects/alchemix/index.js | 56 +++++++++++++++----------------- 2 files changed, 40 insertions(+), 30 deletions(-) diff --git a/projects/alchemix/contracts.json b/projects/alchemix/contracts.json index 320372f36eec..325afbd81160 100644 --- a/projects/alchemix/contracts.json +++ b/projects/alchemix/contracts.json @@ -1,4 +1,18 @@ { + "arbitrum": { + "tokenHolders": { + "alUSDAlchemist": "0xb46eE2E4165F629b4aBCE04B7Eb4237f951AC66F", + "alUSDTransmuterBuffer": "0x00E33722ba54545667E76a18CE9D544130eEAbcC", + "alUSDTransmuter": "0xe7ec71B894583E9C1b07873fA86A7e81f3940eA8", + "alETHAlchemist": "0x654e16a0b161b150F5d1C8a5ba6E7A7B7760703A", + "alETHTransmuterBuffer": "0xECAd08EE07f1AA87f3E080997eBa6d02d28bb9D2", + "alETHTransmuter": "0x1EB7D78d7f6D73e5de67Fa62Fd8b55c54Aa9c0D4" + }, + "underlyingTokens": { + "USDC": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", + "WETH": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1" + } + }, "fantom": { "tokenHolders": { "alUSDAlchemist": "0x76b2E3c5a183970AAAD2A48cF6Ae79E3e16D3A0E", diff --git a/projects/alchemix/index.js b/projects/alchemix/index.js index 53b41fc787d4..b574a7ea7264 100644 --- a/projects/alchemix/index.js +++ b/projects/alchemix/index.js @@ -2,45 +2,41 @@ const { sumTokens2 } = require("../helper/unwrapLPs"); const { staking } = require("../helper/staking.js"); const contracts = require("./contracts"); -function tvl(chain) { - return async (api) => { - const tokens = Object.values(contracts[chain].underlyingTokens).concat(Object.values(contracts[chain].yvTokens)) - await sumTokens2({ tokens, api, owners: Object.values(contracts[chain].tokenHolders) }) - if (api.chain !== 'ethereum') return api.getBalances() +async function tvl(api) { + const chain = api.chain + const tokens = Object.values(contracts[chain].underlyingTokens).concat(Object.values(contracts[chain].yvTokens ?? [])) + await sumTokens2({ tokens, api, owners: Object.values(contracts[chain].tokenHolders) }) + if (api.chain !== 'ethereum') return api.getBalances() - await Promise.all( - Object.values(contracts.cvxLPpools).map(async ({ poolAddress, holder, tokenAddress, alToken }) => { - const lpTokenBalance = await api.call({ target: poolAddress, abi: "erc20:balanceOf", params: holder, }) - const supply = await api.call({ target: tokenAddress, abi: "erc20:totalSupply", }) - // console.log({poolAddress, holder, tokenAddress, alToken, lpTokenBalance, supply, ratio: lpTokenBalance / supply}) - if (+supply === 0) return; - const ratio = lpTokenBalance / supply - const tokenBalances = await api.multiCall({ target: tokenAddress, abi: 'function balances(uint256) view returns (uint256)', calls: [0, 1] }) - const tokens = await api.multiCall({ target: tokenAddress, abi: 'function coins(uint256) view returns (address)', calls: [0, 1] }) - alToken = alToken.toLowerCase() - tokens.forEach((token, i) => { - if (token.toLowerCase() !== alToken) { - if (!isNaN(tokenBalances[i] * ratio))api.add(token, tokenBalances[i] * ratio) - } - }) + await Promise.all( + Object.values(contracts.cvxLPpools).map(async ({ poolAddress, holder, tokenAddress, alToken }) => { + const lpTokenBalance = await api.call({ target: poolAddress, abi: "erc20:balanceOf", params: holder, }) + const supply = await api.call({ target: tokenAddress, abi: "erc20:totalSupply", }) + // console.log({poolAddress, holder, tokenAddress, alToken, lpTokenBalance, supply, ratio: lpTokenBalance / supply}) + if (+supply === 0) return; + const ratio = lpTokenBalance / supply + const tokenBalances = await api.multiCall({ target: tokenAddress, abi: 'function balances(uint256) view returns (uint256)', calls: [0, 1] }) + const tokens = await api.multiCall({ target: tokenAddress, abi: 'function coins(uint256) view returns (address)', calls: [0, 1] }) + alToken = alToken.toLowerCase() + tokens.forEach((token, i) => { + if (token.toLowerCase() !== alToken) { + if (!isNaN(tokenBalances[i] * ratio)) api.add(token, tokenBalances[i] * ratio) + } }) - ); - }; -} + }) + ); +}; module.exports = { doublecounted: true, ethereum: { - tvl: tvl("ethereum"), + tvl, staking: staking( contracts.ethereum.staking.holder, contracts.ethereum.staking.token ), }, - fantom: { - tvl: tvl("fantom"), - }, - optimism: { - tvl: tvl("optimism"), - }, + fantom: { tvl, }, + optimism: { tvl, }, + arbitrum: { tvl }, }; From 4fddccb2ec64cb468e31e2b18d9d3b4774ac3b78 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Fri, 28 Jun 2024 23:35:17 +0100 Subject: [PATCH 511/855] add scoop --- projects/scoop/index.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 projects/scoop/index.js diff --git a/projects/scoop/index.js b/projects/scoop/index.js new file mode 100644 index 000000000000..fe603b90ff47 --- /dev/null +++ b/projects/scoop/index.js @@ -0,0 +1,7 @@ +const { nullAddress, sumTokensExport } = require("../helper/unwrapLPs"); + +module.exports={ + base: { + tvl: sumTokensExport({ tokens: [nullAddress], owner: "0xaeea89678b36c20493e2c069cdcea72e1b34a9ed" }) + } +} \ No newline at end of file From 94c91b98598e0f9daf93c8662af9247265a4c2de Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 29 Jun 2024 04:32:19 +0530 Subject: [PATCH 512/855] Add Dexfinance ETF support and refactor code (#10813) * Dexfinance etf * upd * code refactor --------- Co-authored-by: tuco-gordian --- projects/dexfinance-etf/index.js | 43 ++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 projects/dexfinance-etf/index.js diff --git a/projects/dexfinance-etf/index.js b/projects/dexfinance-etf/index.js new file mode 100644 index 000000000000..62605fd51eec --- /dev/null +++ b/projects/dexfinance-etf/index.js @@ -0,0 +1,43 @@ +const config = { + fantom: '0x9b7e30644a9b37eebaa7158129b03f5a3088659d', + pulse: '0xac297968c97ef5686c79640960d106f65c307a37', + base: '0x714c94b9820d7d73e61510e4c18b91f995a895c1', + optimism: '0xd4f1a99212e5be72426bde45abadef66d7d6edf3', + manta: '0x714c94b9820d7d73e61510e4c18b91f995a895c1', + arbitrum: '0xe31fceaf93667365ce1e9edad3bed4a7dd0fc01a', + avax: '0x6b714e6296b8b977e1d5ecb595197649e10a3db1', + bsc: '0x3ace08b10b5c08a17d1c46277d65c81249e65f44', +} + +const blackListTokens = [ + '0x6386704cd6f7a584ea9d23ccca66af7eba5a727e', + '0xaa2c47a35c1298795b5271490971ec4874c8e53d', + '0x6da9ebd271a0676f39c088a2b5fd849d5080c0af', + '0x4117ec0a779448872d3820f37ba2060ae0b7c34b', +] + +Object.keys(config).forEach(chain => { + const factory= config[chain] + module.exports[chain] = { + tvl: async (api) => { + const profitTokens = await api.fetchList({ lengthAbi: 'profitTokensWhitelistCount', itemAbi: 'profitTokensWhitelist', target: factory}) + const connectors = await api.multiCall({ abi: 'function profitTokenConnector(address) view returns (address)', calls: profitTokens, target: factory}) + let underlyings = await api.multiCall({ abi: 'address:underlying', calls: connectors}) + underlyings = underlyings.filter(address => !blackListTokens.includes(address.toLowerCase())) + const tokenCounts = await api.multiCall({ abi: 'uint256:tokensCount', calls: underlyings}) + const owners = [] + const calls = [] + for(let i = 0; i < underlyings.length; i++){ + for(let j = 0; j < tokenCounts[i]; j++){ + calls.push({ + target: underlyings[i], + params: j + }) + owners.push(underlyings[i]) + } + } + const tokens = await api.multiCall({ abi: 'function tokens(uint256) view returns (address)', calls }) + return api.sumTokens({ tokensAndOwners2: [tokens, owners]}) + } + } +}) \ No newline at end of file From 485887b76b7b98f58f44d72b1034e82412ebd791 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 29 Jun 2024 01:16:23 +0200 Subject: [PATCH 513/855] raydium: minor fix --- projects/raydium/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/projects/raydium/index.js b/projects/raydium/index.js index 0ea9d93918c5..041eb9f5a040 100644 --- a/projects/raydium/index.js +++ b/projects/raydium/index.js @@ -45,12 +45,11 @@ async function ammV4Tvl(api) { 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 vaultIdToAmount = {} for (const item of allPoolVaultAmount) { vaultIdToAmount[item.pubkey.toString()] = TokenAmountLayout.decode(item.account.data).amount.toString() } - console.log(vaultIdToAmount['XMt99QwT4NuzQotsLhp2G4PwdkUfXekFTezmyq1q5AB'], 'account value') + await sleep(20000) const allPoolKeyInfo = await connection.getProgramAccounts(new PublicKey(AmmV4), { filters: [{ dataSize: 752 }], dataSlice: { offset: 336, length: KeyLayoutv4.span } }) From 33918e6ec227a2998f62c02026cc64ef0372d86e Mon Sep 17 00:00:00 2001 From: ezoia-com <53337996+ezoia-com@users.noreply.github.com> Date: Sat, 29 Jun 2024 16:53:19 +0800 Subject: [PATCH 514/855] Add Pendle Sept assets for Arbitrum (#10814) * Add Pendle Sep24 expiries for Arbitrum * Include into calculations, fixed incorrect arbitrum addresses --- projects/thetanuts/index.js | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/projects/thetanuts/index.js b/projects/thetanuts/index.js index 68f8d3a3e39a..62aad31bf8b5 100644 --- a/projects/thetanuts/index.js +++ b/projects/thetanuts/index.js @@ -88,9 +88,9 @@ const arbPutVault = '0xf94ea5B18401821BE07FBfF535B8211B061A7F70' const ethCallVaultArb = '0x1D1CD4abe0F2AF9d79b5e3149BF4A503f97C1EAd' const ethPutVaultArb = '0xA8459eC6DF0D9a61058C43a308dD8A2CEc9d550E' // Assets locked in Aave V2 fork -const aArb = '0x116a7f52556a57F807CEACe228242C3c91D2C7E5' -const aUsdc = '0xBEe683e6e5CE1e7Ea07c6f11DF240AcD92c33632' -const aWeth = '0xBbf03fC0C8441e9cc50cC087f74899C137597b6e' +const aArb_ARB = '0x116a7f52556a57F807CEACe228242C3c91D2C7E5' +const aUsdc_ARB = '0xBEe683e6e5CE1e7Ea07c6f11DF240AcD92c33632' +const aWeth_ARB = '0xBbf03fC0C8441e9cc50cC087f74899C137597b6e' // LongLiquidityVaults - Holds aAssets (not counted) and V3 liquidity NFTs const arbC_LLV = '0x721Bba1556649e9c70E2dF1EAFC04270376025f7' const arbP_LLV = '0x57eD79afD32c616E4631231636F4597188d20C5e' @@ -104,6 +104,14 @@ const aPTrsETH_27JUN24 = '0x121b956D11EaeCFD3f0CdF259D6faFFEbEDD0bC9' const PTweETH_27JUN24 = '0x1c27Ad8a19Ba026ADaBD615F6Bc77158130cfBE4' const aPTweETH_27JUN24 = '0x1B38B4586003E64c6c87F4acaF4f15415C2034EB' +const PTweETH_26SEP24 = '0xb8b0a120F6A68Dd06209619F62429fB1a8e92feC' +const aPTweETH_26SEP24 = '0xF5d0866646DF182Fb9BC7FB27B26B84F96b2239d' +const PTezETH_26SEP24 = '0x2CCFce9bE49465CC6f947b5F6aC9383673733Da9' +const aPTezETH_26SEP24 = '0x3F9ca12e7D4867E45b289484a3F33bbA2A1b8723' +const PTrsETH_26SEP24 = '0x30c98c0139B62290E26aC2a2158AC341Dcaf1333' +const aPTrsETH_26SEP24 = '0x0B6Ef11254edCab4b164daa7e626Dc0d0c2Ad51f' + + // Polygon zkEVM vaults const stMaticCallVault = '0x7bF3c7C23501EA3E09B237D6F8AdcB7Ea3CeF41C' @@ -151,6 +159,7 @@ const wcro = '0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23' // Arbitrum assets const arb = ADDRESSES.arbitrum.ARB const usdc_arb = ADDRESSES.arbitrum.USDC_CIRCLE +const weth_arb = ADDRESSES.arbitrum.WETH const univ3nft_arb = '0xC36442b4a4522E871399CD717aBDD847Ab11FE88' // Polygon zkEVM assets @@ -217,14 +226,19 @@ const config = { tokensAndOwners: [ [arb, arbCallVault,], [usdc_arb, arbPutVault,], - [arb, ethCallVaultArb,], + [weth_arb, ethCallVaultArb,], [usdc_arb, ethPutVaultArb,], - [arb, aArb,], - [usdc_arb, aUsdc,], - + [arb, aArb_ARB,], + [weth_arb, aWeth_ARB,], + [usdc_arb, aUsdc_ARB,], + [PTezETH_27JUN24, aPTezETH_27JUN24,], [PTrsETH_27JUN24, aPTrsETH_27JUN24,], [PTweETH_27JUN24, aPTweETH_27JUN24,], + + [PTezETH_26SEP24, aPTezETH_26SEP24,], + [PTrsETH_26SEP24, aPTrsETH_26SEP24,], + [PTweETH_26SEP24, aPTweETH_26SEP24,], ], LLVOwners: [ [univ3nft_arb, arbC_LLV,], From 40c7649cc88a1c0ca73967be838bfae4aaea647f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 29 Jun 2024 10:53:34 +0200 Subject: [PATCH 515/855] lint fix --- projects/alchemix/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/alchemix/index.js b/projects/alchemix/index.js index b574a7ea7264..2a2e6c492e55 100644 --- a/projects/alchemix/index.js +++ b/projects/alchemix/index.js @@ -24,8 +24,8 @@ async function tvl(api) { } }) }) - ); -}; + ) +} module.exports = { doublecounted: true, @@ -39,4 +39,4 @@ module.exports = { fantom: { tvl, }, optimism: { tvl, }, arbitrum: { tvl }, -}; +} From 2ec77fbffd48703e5b7ded6ac23256231b7e3bfd Mon Sep 17 00:00:00 2001 From: Bitrock Blockchain <138885902+BitrockChain@users.noreply.github.com> Date: Sat, 29 Jun 2024 15:55:11 +0700 Subject: [PATCH 516/855] Add TVL on staking contract of ROCK tokens. (#10815) * Add Rockswap - Bitrock Blockchain * Update index.js * minor fix * Add WBROCK and ROCK Staking TVL * Update TVL on staking contract of WBROCK and BITROCK * minor fix * Add ROCK staking TVL | Bitrock chain * Update index.js * Update index.js --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/rockswap-staking/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/rockswap-staking/index.js diff --git a/projects/rockswap-staking/index.js b/projects/rockswap-staking/index.js new file mode 100644 index 000000000000..64ced9d6d070 --- /dev/null +++ b/projects/rockswap-staking/index.js @@ -0,0 +1,11 @@ +const { staking } = require("../helper/staking"); + +const ROCK = "0x826628622a8B55F4AF6aC2A1DD1273bF837e651a"; +const stakingContract = "0xFDfd4A3CfECD29E00942ee3E01cDa6f92E9270BA"; + +module.exports = { + bitrock: { + tvl: staking(stakingContract, ROCK, "bitrock"), + }, + methodology: "ROCK tokens locked in staking contract", +}; \ No newline at end of file From e714be6984ae66d426b08ae45cf0edd7ee6442a7 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sun, 30 Jun 2024 02:08:33 +0100 Subject: [PATCH 517/855] fix --- projects/inverse-finance-firm/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/inverse-finance-firm/index.js b/projects/inverse-finance-firm/index.js index a5fc0d0f2a31..c4f6b2b70b4d 100644 --- a/projects/inverse-finance-firm/index.js +++ b/projects/inverse-finance-firm/index.js @@ -15,6 +15,7 @@ async function tvl(api) { topics: ['0xc3dfb88ee5301cecf05761fb2728064e5b641524346ae69b9ba80394631bf11f'], fromBlock: firmStart, eventAbi: abi.AddMarket, + skipCache: true }) // unique markets From e8b09fd4a7a69c29beb05f4ea888ad912d7c09c6 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sun, 30 Jun 2024 03:43:49 +0100 Subject: [PATCH 518/855] fix olympus --- projects/olympus/index.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/projects/olympus/index.js b/projects/olympus/index.js index 6dc387b3ce95..1dec65c9657b 100644 --- a/projects/olympus/index.js +++ b/projects/olympus/index.js @@ -89,7 +89,8 @@ function sumBalancesByTokenAddress(arr) { * #2. Call tokenRecords with block num from prev query * #3. Sum values returned ***/ -async function tvl(api, isOwnTokensMode = false) { +function buildTvl(isOwnTokensMode = false){ +return async function tvl(api) { const subgraphUrls = { ethereum: `7jeChfyUTWRyp2JxPGuuzxvGt3fDKMkC9rLjm7sfLcNp`, arbitrum: @@ -160,11 +161,12 @@ const subgraphUrls = { } else if (isOwnTokensMode) return; api.add(token.tokenAddress, token.balance * 10 ** decimals[i]) }) - return sumTokens2({ api, resolveLP: true, }) + return await sumTokens2({ api, resolveLP: true, }) +} } async function ownTokens(api) { - return tvl(api, true); + return buildTvl(true)(api); } module.exports = { @@ -174,19 +176,19 @@ module.exports = { "TVL is the sum of the value of all assets held by the treasury (excluding pTokens). Please visit https://app.olympusdao.finance/#/dashboard for more info.", ethereum: { staking: staking(OlympusStakings, [OHM, OHM_V1]), - tvl, + tvl: buildTvl(false), ownTokens, }, arbitrum: { - tvl, + tvl: buildTvl(false), // pool2, }, polygon: { - tvl, + tvl: buildTvl(false), // pool2, }, fantom: { - tvl, + tvl: buildTvl(false), // pool2, }, }; From 6ccdeb009c3fcdf8df142a9b99aca55571cf8276 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Sun, 30 Jun 2024 03:46:20 +0100 Subject: [PATCH 519/855] add hallmark --- projects/inverse-finance-firm/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/inverse-finance-firm/index.js b/projects/inverse-finance-firm/index.js index c4f6b2b70b4d..0bd36960889d 100644 --- a/projects/inverse-finance-firm/index.js +++ b/projects/inverse-finance-firm/index.js @@ -47,7 +47,8 @@ module.exports = { methodology: "Get collateral balances from users personal escrows", hallmarks: [ [1696204800, "Borrow against INV on FiRM"], - [1707177600, "Launch of sDOLA"], + [1707177600, "Launch of sDOLA"], + [1718236800, "CRV liquidation"] ], start: 1670701200, // Dec 10 2022 ethereum: { tvl } From aaf08ee084e8cfda335f31a7399148c1a603d295 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 1 Jul 2024 09:07:49 +0100 Subject: [PATCH 520/855] use cache --- projects/inverse-finance-firm/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/inverse-finance-firm/index.js b/projects/inverse-finance-firm/index.js index 0bd36960889d..3ea79f394346 100644 --- a/projects/inverse-finance-firm/index.js +++ b/projects/inverse-finance-firm/index.js @@ -15,7 +15,7 @@ async function tvl(api) { topics: ['0xc3dfb88ee5301cecf05761fb2728064e5b641524346ae69b9ba80394631bf11f'], fromBlock: firmStart, eventAbi: abi.AddMarket, - skipCache: true + extraKey: "fix-firm" }) // unique markets From 408ba87f8eb0725c875c95584a2ed863e1ea5c8d Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Mon, 1 Jul 2024 11:50:46 +0100 Subject: [PATCH 521/855] add TON to flipster + ton cex helper tokens (#10825) --- projects/flipster/index.js | 6 ++++++ projects/helper/cex.js | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/projects/flipster/index.js b/projects/flipster/index.js index 51d21361bba0..e980af38f1d5 100644 --- a/projects/flipster/index.js +++ b/projects/flipster/index.js @@ -56,6 +56,12 @@ const config = { '0xfA705a98FA89134F460Bf79457D4fbd3d8E118d9' ] }, + ton: { + owners: [ + 'EQDQpuuVQI6Vzpewyll_xSP_SAlSNjXo9RngD9y99C8MVJri', + 'EQBlnb9GCDGnJ5XEqamHL7Sj5_0wJ4MGja5T6PKlwVAISgrW', + ] + }, } module.exports = cexExports(config) diff --git a/projects/helper/cex.js b/projects/helper/cex.js index 2d945389ef24..7cf9874faadf 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -242,6 +242,13 @@ const defaultTokens = { ADDRESSES.cronos.WBTC, "0xe44fd7fcb2b1581822d0c862b68222998a0c299a" //weth ], + ton: [ + nullAddress, + ADDRESSES.ton.USDT, + ADDRESSES.ton.TON_1, + ADDRESSES.ton.TON_2, + ADDRESSES.ton.TON_3, + ], } function cexExports(config) { From 21a3123c49b079f12f44dc6729eec435540e6901 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Mon, 1 Jul 2024 18:21:15 +0100 Subject: [PATCH 522/855] add hallmarks --- projects/superform/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/superform/index.js b/projects/superform/index.js index 322f58ef1e54..68eb5431dfdd 100644 --- a/projects/superform/index.js +++ b/projects/superform/index.js @@ -25,6 +25,10 @@ async function tvl(api) { module.exports = { methodology: "counts the TVL of each superform across all the supported networks", + hallmarks: [ + [1707350400,"Early Access"], + [1715212800,"Open Launch"] + ] }; superform_chains.forEach(chain => module.exports[chain] = { tvl }) \ No newline at end of file From 92a3f4ecf2d7a2fbad64891e2efa95da23937a39 Mon Sep 17 00:00:00 2001 From: antonb <130487593+antonbosss@users.noreply.github.com> Date: Mon, 1 Jul 2024 20:23:59 +0300 Subject: [PATCH 523/855] Update index.js for Morpheus (#10817) * Update index.js * Update index.js --- projects/MorpheusAI/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/MorpheusAI/index.js b/projects/MorpheusAI/index.js index 5df8e2684265..3b7f5038d331 100644 --- a/projects/MorpheusAI/index.js +++ b/projects/MorpheusAI/index.js @@ -18,5 +18,9 @@ module.exports = { methodology: 'Calculates TVL based on stETH deposits in the project contract.', ethereum: { tvl, + start: 1707378815, // Feb-08-2024 07:33:35 AM UTC in Unix timestamp }, + hallmarks: [ + [1712400000, "MOR token launch"], // May-08-2024 12:00:00 AM UTC in Unix timestamp + ], }; From cfde022c659c05ec9325fb941ce6f661caec7f52 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Mon, 1 Jul 2024 18:29:14 +0100 Subject: [PATCH 524/855] update exports --- projects/MorpheusAI/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/MorpheusAI/index.js b/projects/MorpheusAI/index.js index 3b7f5038d331..916627513046 100644 --- a/projects/MorpheusAI/index.js +++ b/projects/MorpheusAI/index.js @@ -16,9 +16,9 @@ module.exports = { timetravel: true, misrepresentedTokens: false, methodology: 'Calculates TVL based on stETH deposits in the project contract.', + start: 1707378815, // Feb-08-2024 07:33:35 AM UTC in Unix timestamp ethereum: { - tvl, - start: 1707378815, // Feb-08-2024 07:33:35 AM UTC in Unix timestamp + tvl }, hallmarks: [ [1712400000, "MOR token launch"], // May-08-2024 12:00:00 AM UTC in Unix timestamp From 08255f68cdcd80d6d7cfc2f7a04bbe6dfcc281de Mon Sep 17 00:00:00 2001 From: MishaShWoof Date: Mon, 1 Jul 2024 20:30:38 +0300 Subject: [PATCH 525/855] feat: add arbitrm-usdt and polygon-usdt markets (#10820) --- projects/compound-v3/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/compound-v3/index.js b/projects/compound-v3/index.js index 7735d0402bad..834ad6a39382 100644 --- a/projects/compound-v3/index.js +++ b/projects/compound-v3/index.js @@ -12,10 +12,14 @@ module.exports = compoundV3Exports({ '0xA5EDBDD9646f8dFF606d7448e414884C7d905dCA', // USDC.e Market '0x9c4ec768c28520B50860ea7a15bd7213a9fF58bf', // USDC Market '0x6f7D514bbD4aFf3BcD1140B7344b32f063dEe486', // WETH Market + '0x5C58d4479A1E9b2d19EE052143FA73F0ee79A36e', // USDT Market ], }, polygon: { - markets: ['0xF25212E676D1F7F89Cd72fFEe66158f541246445'], // USDC.e Market + markets: [ + '0xF25212E676D1F7F89Cd72fFEe66158f541246445', // USDC.e Market + '0xaeB318360f27748Acb200CE616E389A6C9409a07', // USDT Market + ], }, base: { markets: [ From 8cc00e60a2c45435f8fd3274ea7dbc02bedcfac9 Mon Sep 17 00:00:00 2001 From: Masayoshi <82962873+0xMasayoshi@users.noreply.github.com> Date: Tue, 2 Jul 2024 00:46:59 +0700 Subject: [PATCH 526/855] fix: sushiswap v3 skale europa fromBlock (#10822) --- projects/sushiswap-v3/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/sushiswap-v3/index.js b/projects/sushiswap-v3/index.js index f09968b39813..a8be9648b381 100644 --- a/projects/sushiswap-v3/index.js +++ b/projects/sushiswap-v3/index.js @@ -75,7 +75,7 @@ module.exports = uniV3Export({ zeta: { factory: '0xB45e53277a7e0F1D35f2a77160e91e25507f1763', fromBlock: 1551069, }, islm: { factory, fromBlock: 6541826, }, blast: { factory: '0x7680d4b43f3d1d54d6cfeeb2169463bfa7a6cf0d', fromBlock: 284122, }, - europa: { factory: '0x51d15889b66A2c919dBbD624d53B47a9E8feC4bB', fromBlock: 5124250, }, + europa: { factory: '0x51d15889b66A2c919dBbD624d53B47a9E8feC4bB', fromBlock: 5124251, }, rsk: { factory: '0x46B3fDF7B5cde91Ac049936bF0Bdb12C5D22202E', fromBlock: 6365060, }, //this one }); From 4a5a197d47256f30c29af8fd91ad53620af311a4 Mon Sep 17 00:00:00 2001 From: Elisha Okon Date: Mon, 1 Jul 2024 18:48:24 +0100 Subject: [PATCH 527/855] feat(impermax): add support for Scroll chain integration (#10823) - Integrated Scroll chain into the Impermax protocol adapter - Added Scroll-specific configuration to the existing setup - Implemented logic to handle Scroll chain data aggregation and TVL calculation - Updated blacklist mechanism to include Scroll-specific blacklisted pools This integration enables DeFiLlama to fetch and compute Impermax metrics on the Scroll chain, enhancing multi-chain support. --- projects/impermax/impermaxHelper.js | 1 + projects/impermax/index.js | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/impermax/impermaxHelper.js b/projects/impermax/impermaxHelper.js index 9d06f7d205b2..1517fd2b98c7 100644 --- a/projects/impermax/impermaxHelper.js +++ b/projects/impermax/impermaxHelper.js @@ -104,6 +104,7 @@ function impermaxHelper(exportsObj, config, blacklistedPools) { case 'canto': case 'era': case 'fantom': + case 'scroll': default: impermaxSymbol = 'STKD-UNI-V2' return underlyings.filter((_, i) => uSymbols[i] === impermaxSymbol) diff --git a/projects/impermax/index.js b/projects/impermax/index.js index a0a9335bc994..4282c17f2de8 100644 --- a/projects/impermax/index.js +++ b/projects/impermax/index.js @@ -48,6 +48,11 @@ const config = { '0x9b4ae930255CB8695a9F525dA414F80C4C7a945B', ] }, + scroll: { + factories: [ + '0x02Ff7B4d96EeBF8c9B34Fae0418E591e11da3099', + ] + }, } const blacklistedPools = { @@ -89,8 +94,9 @@ const blacklistedPools = { '0x877a330af63094d88792b9ca28ac36c71673eb1c', // IMX-FTM '0xb97b6ed451480fe6466a558e9c54eaac32e6c696', // OXD-FTM ], + scroll: [], } module.exports = {} -impermaxHelper(module.exports, config, blacklistedPools) +impermaxHelper(module.exports, config, blacklistedPools) \ No newline at end of file From a8510fa25aa8eda34ae741c6492454c85bff584c Mon Sep 17 00:00:00 2001 From: Valdislav Dihtiarenko <66130898+Digtyarenk0@users.noreply.github.com> Date: Mon, 1 Jul 2024 19:51:47 +0200 Subject: [PATCH 528/855] update: add new tokens polygon/arbitrum in primex-finance (#10826) * feat: ethereum contracts * fix: default tokens * Add missed tokens * add new polygon/arbitrum tokens --------- Co-authored-by: Eugene Mormul Co-authored-by: Mar-Alex <32222380+Mar-Alex@users.noreply.github.com> --- projects/primex-finance/index.js | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/projects/primex-finance/index.js b/projects/primex-finance/index.js index 1fb8033cf77f..d2bc988eaba0 100644 --- a/projects/primex-finance/index.js +++ b/projects/primex-finance/index.js @@ -18,7 +18,19 @@ const config = { DAI: ADDRESSES.polygon.DAI, LINK: "0x53E0bca35eC356BD5ddDFebbD1Fc0fD03FaBad39", GNS: "0xE5417Af564e4bFDA1c483642db72007871397896", - EPMX: "0xDc6D1bd104E1efa4A1bf0BBCf6E0BD093614E31A" + EPMX: "0xDc6D1bd104E1efa4A1bf0BBCf6E0BD093614E31A", + OM: "0xc3ec80343d2bae2f8e680fdadde7c17e71e114ea", + SAND: "0xbbba073c31bf03b8acf7c28ef0738decf3695683", + QUICK: "0xb5c064f955d8e7f38fe0460c556a72987494ee17", + UNI: "0xb33eaad8d922b1083446dc23f610c2567fb5180f", + MANA: "0xa1c57f48f0deb89f569dfbe6e2b7f46d33606fd4", + BAL: "0x9a71012b13ca4d3d0cdc72a177df3ef03b0e76a3", + GRT: "0x5fe2b58c013d7601147dcdd68c143a77499f5531", + SNX: "0x50b728d8d964fd00c2d0aad81718b71311fef68a", + GHST: "0x385eeac5cb85a38a9a07a70c73e0a3271cfb54a7", + AVAX: "0x2c89bbc92bd86f8075d1decc58c7f4e0107f286b", + CRV: "0x172370d5cd63279efa6d502dab29171933a610af", + SUSHI: "0x0b3f868e0be5597d5db7feb59e1cadbb0fdda50a" }, aaveTokens: { [ADDRESSES.polygon.WETH_1]: "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8", @@ -49,7 +61,17 @@ const config = { MAGIC: "0x539bdE0d7Dbd336b79148AA742883198BBF60342", JOE: "0x371c7ec6D8039ff7933a2AA28EB827Ffe1F52f07", STG: "0x6694340fc020c5E6B96567843da2df01b2CE1eb6", - EPMX: "0xA533f744B179F2431f5395978e391107DC76e103" + EPMX: "0xA533f744B179F2431f5395978e391107DC76e103", + LDO: "0x13Ad51ed4F1B7e9Dc168d8a00cB3f4dDD85EfA60", + UNI: "0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0", + PEPE: "0x25d887Ce7a35172C62FeBFD67a1856F20FaEbB00", + GRT: "0x9623063377AD1B27544C965cCd7342f7EA7e88C7", + CRV: "0x11cDb42B0EB46D95f990BeDD4695A6e3fA034978", + KNC: "0xe4DDDfe67E7164b0FE14E218d80dC4C08eDC01cB", + XAI: "0x4cb9a7ae498cedcbb5eae9f25736ae7d428c9d66", + FXS: "0x9d2F299715D94d8A7E6F5eaa8E654E8c74a988A7", + TIA: "0xD56734d7f9979dD94FAE3d67C7e928234e71cD4C", + RPL: "0xB766039cc6DB368759C1E56B79AFfE831d0Cc507", }, aaveTokens: { [ADDRESSES.arbitrum.DAI]: "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE", From 3389edde3b9616146768362d9d5cf3b5b0759397 Mon Sep 17 00:00:00 2001 From: brightiron <95196612+brightiron@users.noreply.github.com> Date: Mon, 1 Jul 2024 13:01:34 -0500 Subject: [PATCH 529/855] [Baseline] - Adapter Update for V2 (#10816) * baseline v2 contract * account for locked collateral from borrows * cleanup * exclude YES from tvl --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/baseline/index.js | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/projects/baseline/index.js b/projects/baseline/index.js index 2d901efeb966..3df1244745e3 100644 --- a/projects/baseline/index.js +++ b/projects/baseline/index.js @@ -1,4 +1,6 @@ const BASELINE_CONTRACT = "0x14eB8d9b6e19842B5930030B18c50B0391561f27"; +const BASELINE_CONTRACT_V2 = "0x1a49351bdB4BE48C0009b661765D01ed58E8C2d8"; +const CREDT_CONTRACT = "0x158d9270F7931d0eB48Efd72E62c0E9fFfE0E67b"; async function tvl(api) { //floor, anchor, discovery @@ -9,17 +11,26 @@ async function tvl(api) { //return managed positions from baseline contract const baselinePositionBalances = await api.multiCall({ target: BASELINE_CONTRACT, calls: position.map(i => ({ params: [i], })), abi: abi.getBalancesForPosition, }); //sum the reserve balances - api.addGasToken(baselinePositionBalances.map(i => i.reserves)) + api.addGasToken(baselinePositionBalances.map(i => i.reserves)); + + //baseline V2 Positions + const v2Positions = await api.multiCall({ target: BASELINE_CONTRACT_V2, calls: positions, abi: v2Abi.getPosition }); + //account for collateral now locked in protocol from borrowing activity + const v2CollateralLocked = await api.call({ target: CREDT_CONTRACT, abi: credtAbi.totalCollateralized }); + // api.add(BASELINE_CONTRACT_V2, v2CollateralLocked); // YES considered own token and should not be counted towards tvl + api.addGasToken(v2Positions.map(i => i.reserves)); } async function borrowed(api) { const lentReserves = await api.call({ abi: abi.totalLentReserves, target: BASELINE_CONTRACT, }); + const lentReservesV2 = await api.call({ abi: credtAbi.totalCreditIssues, target: CREDT_CONTRACT }); api.addGasToken(lentReserves) + api.addGasToken(lentReservesV2) } module.exports = { hallmarks: [ - [1714251306,"self-whitehack"] + [1714251306, "self-whitehack"] ], doublecounted: true, blast: { @@ -35,3 +46,12 @@ const abi = { getBalancesForPosition: "function getBalancesForPosition(tuple(uint8,int24,int24)) view returns (uint256 reserves, uint256 bAsset)", }; + +const v2Abi = { + getPosition: "function getPosition(uint8) view returns (tuple(uint128 liquidity, uint160 sqrtPriceL, uint160 sqrtPriceU, uint256 bAssets, uint256 reserves, uint256 capacity))", +} + +const credtAbi = { + totalCreditIssues: "function totalCreditIssued() view returns (uint256)", + totalCollateralized: "function totalCollateralized() view returns (uint256)", +} From 2565b697300136e7df4f440cc1d5ec700eb4dff7 Mon Sep 17 00:00:00 2001 From: Brian Bodollo Date: Tue, 2 Jul 2024 02:03:11 +0800 Subject: [PATCH 530/855] Add stISLM to stride tvl (#10829) * feat: added stISLM to stride tvl * Update chains.json remove duplicate * Update index.js add correct chain short-name --------- Co-authored-by: Real Shaman <85087525+realdealshaman@users.noreply.github.com> --- projects/stride/index.js | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/projects/stride/index.js b/projects/stride/index.js index b96cfe370d5a..ff146d5dab91 100644 --- a/projects/stride/index.js +++ b/projects/stride/index.js @@ -67,7 +67,7 @@ const chains = { denom: "adydx", coinGeckoId: "dydx-chain", }, - + celestia: { chainId: "celestia", denom: "utia", @@ -78,33 +78,38 @@ const chains = { chainId: "dymension_1100-1", denom: "adym", coinGeckoId: "dymension", - } + }, + + islm: { + chainId: "haqq_11235-1", + denom: "aISLM", + coinGeckoId: "islamic-coin", + }, }; // inj uses 1e18 - https://docs.injective.network/learn/basic-concepts/inj_coin#base-denomination function getCoinDenimals(denom) { - return ["aevmos", "inj", "adydx", "adym"].includes(denom) ? 1e18 : 1e6; + return ["aevmos", "inj", "adydx", "adym", "aISLM"].includes(denom) + ? 1e18 + : 1e6; } function makeTvlFn(chain) { return async () => { - // Define the URL for host_zone based on chainId - let hostZoneUrl = `https://stride-fleet.main.stridenet.co/api/Stride-Labs/stride/stakeibc/host_zone/${chain.chainId}`; - if (chain.chainId === 'celestia') { - hostZoneUrl = `https://stride-fleet.main.stridenet.co/api/Stride-Labs/stride/staketia/host_zone`; - } else if (chain.chainId === 'dymension_1100-1') { - hostZoneUrl = `https://stride-fleet.main.stridenet.co/api/Stride-Labs/stride/stakedym/host_zone`; - } + const hostZoneUrl = + chain.chainId === "celestia" + ? "https://stride-fleet.main.stridenet.co/api/Stride-Labs/stride/staketia/host_zone" + : chain.chainId === "dymension_1100-1" + ? "https://stride-fleet.main.stridenet.co/api/Stride-Labs/stride/stakedym/host_zone" + : `https://stride-fleet.main.stridenet.co/api/Stride-Labs/stride/stakeibc/host_zone/${chain.chainId}`; const [{ amount: assetBalances }, { host_zone: hostZone }] = await Promise.all([ await get( `https://stride-fleet.main.stridenet.co/api/cosmos/bank/v1beta1/supply/by_denom?denom=st${chain.denom}` ), - await get( - hostZoneUrl - ), + await get(hostZoneUrl), ]); const assetBalance = assetBalances["amount"]; From 33d9f53a753478fdad4de42502f4f0e4c1619e31 Mon Sep 17 00:00:00 2001 From: Mateusz Date: Mon, 1 Jul 2024 19:16:18 +0100 Subject: [PATCH 531/855] Synoym Finance: fixed missing pools (#10832) Fixed conversion for pool with addresses starting with '0'. --- projects/synonym-finance/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/synonym-finance/index.js b/projects/synonym-finance/index.js index fe10fde97893..a3ed39f2656a 100644 --- a/projects/synonym-finance/index.js +++ b/projects/synonym-finance/index.js @@ -1,3 +1,4 @@ +const bytes32ToAddress = (bytes32Address) => "0x" + bytes32Address.substr(-40); const hub = '0x1e3f1f1cA8C62aABCB3B78D87223E988Dfa3780E' async function tvl(api) { @@ -43,9 +44,9 @@ async function getTokenInfos(api) { case '24': chain = 'optimism'; break; case '30': chain = 'base'; break; case '34': chain = 'scroll'; break; - default: console.log('Unsupported chain ' + chainId[i] + "0x" + BigInt(natives[i]).toString(16)); return; + default: console.log('Unsupported chain ' + chainId[i] + bytes32ToAddress(natives[i])); return; } - tokenMappings.push(chain + ':' + "0x" + BigInt(natives[i]).toString(16)) + tokenMappings.push(chain + ':' + bytes32ToAddress(natives[i])) tokens.push(asset) }) From 2021862b6e6ddf2c808f0c971b77e2cd93e2b338 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 2 Jul 2024 01:55:27 +0100 Subject: [PATCH 532/855] Remove chains with RPC issues to fix adapter --- projects/sushiswap-v3/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/sushiswap-v3/index.js b/projects/sushiswap-v3/index.js index a8be9648b381..155d691e5c7d 100644 --- a/projects/sushiswap-v3/index.js +++ b/projects/sushiswap-v3/index.js @@ -72,10 +72,10 @@ module.exports = uniV3Export({ kava: { factory: '0x1e9B24073183d5c6B7aE5FB4b8f0b1dd83FDC77a', fromBlock: 7251753, }, metis: { factory: '0x145d82bCa93cCa2AE057D1c6f26245d1b9522E6F', fromBlock: 9077930, }, bittorrent: { factory: '0xBBDe1d67297329148Fe1ED5e6B00114842728e65', fromBlock: 29265724, }, - zeta: { factory: '0xB45e53277a7e0F1D35f2a77160e91e25507f1763', fromBlock: 1551069, }, + //zeta: { factory: '0xB45e53277a7e0F1D35f2a77160e91e25507f1763', fromBlock: 1551069, }, islm: { factory, fromBlock: 6541826, }, blast: { factory: '0x7680d4b43f3d1d54d6cfeeb2169463bfa7a6cf0d', fromBlock: 284122, }, - europa: { factory: '0x51d15889b66A2c919dBbD624d53B47a9E8feC4bB', fromBlock: 5124251, }, + //europa: { factory: '0x51d15889b66A2c919dBbD624d53B47a9E8feC4bB', fromBlock: 5124251, }, rsk: { factory: '0x46B3fDF7B5cde91Ac049936bF0Bdb12C5D22202E', fromBlock: 6365060, }, //this one }); From 163ee3933fcd2358f4efcd6774db5ecb130c3cd7 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 2 Jul 2024 02:58:50 +0100 Subject: [PATCH 533/855] fix chain name --- projects/sushiswap/api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/sushiswap/api.js b/projects/sushiswap/api.js index 4e4e3a3819e0..5ab6116ee0e6 100644 --- a/projects/sushiswap/api.js +++ b/projects/sushiswap/api.js @@ -103,7 +103,7 @@ module.exports = { optimism: { tvl: getUniTVL({ factory: '0xFbc12984689e5f15626Bad03Ad60160Fe98B303C', useDefaultCoreAssets: true, }) }, linea: { tvl: getUniTVL({ factory: '0xFbc12984689e5f15626Bad03Ad60160Fe98B303C', useDefaultCoreAssets: true, }) }, thundercore: { tvl: tvl2 }, - //haqq: { tvl: tvl2 }, + islm: { tvl: tvl2 }, } module.exports.polygon.tvl = getChainTVL('polygon') From c18d4aa913f0df0371a8532fb4c4333fe39319f3 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 2 Jul 2024 05:07:26 +0100 Subject: [PATCH 534/855] add ogn staking --- projects/origindollar/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/origindollar/index.js b/projects/origindollar/index.js index 1a2b9416b83b..17a994be45f4 100644 --- a/projects/origindollar/index.js +++ b/projects/origindollar/index.js @@ -1,6 +1,6 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const { staking } = require('../helper/staking') +const { staking, stakings } = require("../helper/staking"); const vault = "0xE75D77B1865Ae93c7eaa3040B038D7aA7BC02F70"; @@ -35,6 +35,9 @@ const ethTvl = async (timestamp, ethBlock) => { module.exports = { ethereum: { tvl: ethTvl, - staking: staking('0x0C4576Ca1c365868E162554AF8e385dc3e7C66D9', '0x9c354503C38481a7A7a51629142963F98eCC12D0') + staking: stakings( + ["0x0C4576Ca1c365868E162554AF8e385dc3e7C66D9", "0x63898b3b6Ef3d39332082178656E9862bee45C57"], + ["0x9c354503C38481a7A7a51629142963F98eCC12D0", "0x8207c1FfC5B6804F6024322CcF34F29c3541Ae26"] + ), }, }; From f66c37375f2936c8236d355816297d765f422820 Mon Sep 17 00:00:00 2001 From: brightiron <95196612+brightiron@users.noreply.github.com> Date: Tue, 2 Jul 2024 01:22:01 -0500 Subject: [PATCH 535/855] [Baseline] Track YES collateral locked in protocol as staking (#10834) * track YES collateral locked in protocol * comment --- projects/baseline/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/projects/baseline/index.js b/projects/baseline/index.js index 3df1244745e3..4023b2adf9d4 100644 --- a/projects/baseline/index.js +++ b/projects/baseline/index.js @@ -16,8 +16,7 @@ async function tvl(api) { //baseline V2 Positions const v2Positions = await api.multiCall({ target: BASELINE_CONTRACT_V2, calls: positions, abi: v2Abi.getPosition }); //account for collateral now locked in protocol from borrowing activity - const v2CollateralLocked = await api.call({ target: CREDT_CONTRACT, abi: credtAbi.totalCollateralized }); - // api.add(BASELINE_CONTRACT_V2, v2CollateralLocked); // YES considered own token and should not be counted towards tvl + api.addGasToken(v2Positions.map(i => i.reserves)); } @@ -28,6 +27,11 @@ async function borrowed(api) { api.addGasToken(lentReservesV2) } +async function staking(api) { + const v2CollateralLocked = await api.call({ target: CREDT_CONTRACT, abi: credtAbi.totalCollateralized }); + api.add(BASELINE_CONTRACT_V2, v2CollateralLocked); // collateral deposited into protocol by EOA in exchange for a loan +} + module.exports = { hallmarks: [ [1714251306, "self-whitehack"] @@ -36,6 +40,7 @@ module.exports = { blast: { tvl, borrowed, + staking, }, }; From 1867936068ed4f0379f5b79915ae0f403c92c684 Mon Sep 17 00:00:00 2001 From: Keno Dressel <765921+kenodressel@users.noreply.github.com> Date: Tue, 2 Jul 2024 08:23:20 +0200 Subject: [PATCH 536/855] feat(chains): adds aeternity blockchain (#10830) --- projects/helper/chains.json | 1 + projects/helper/coreAssets.json | 7 +++++++ projects/helper/env.js | 1 + projects/helper/tokenMapping.js | 8 ++++++++ 4 files changed, 17 insertions(+) diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 65579e65b7e0..71efd4e4638f 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -2,6 +2,7 @@ "acala", "ace", "aelf", + "aeternity", "ailayer", "airdao", "alephium", diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index c8778875c4aa..67dafffb54b2 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1828,5 +1828,12 @@ }, "fraxtal": { "WETH": "0xA8a59D73388D0c4344a7b0Ba287ddb654227c38a" + }, + "aeternity": { + "WAE": "ct_J3zBY8xxjsRr3QojETNw48Eb38fjvEuJKkQ6KzECvubvEcvCa", + "WETH": "ct_WVqAvLQpvZCgBg4faZLXA1YBj43Fxj91D33Z8K7pFsY8YCofv", + "WBTC": "ct_26Q5MYFKE4z4GaYLmhZiZ9AHsSVqVNZiiyzySSHTorWyr4od4K", + "USDT": "ct_2AiMceYFXnUdA6A9Lu2ZQ2tr2TpfbGVfkxLfBnceoWgHTKZYvc", + "USDC": "ct_U1i8dzJTVWdnU2cv59TZQfLFpLfjqf7MQQC5ygSMKphn8Yew2" } } \ No newline at end of file diff --git a/projects/helper/env.js b/projects/helper/env.js index 7441f69bc516..dcffe5e9cc1d 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -32,6 +32,7 @@ const DEFAULTS = { OX_CHAIN_RPC_MULTICALL: "0xcA11bde05977b3631167028862bE2a173976CA11", ETLK_RPC_MULTICALL: "0xcA11bde05977b3631167028862bE2a173976CA11", MINT_RPC_MULTICALL: "0xf8ac4BEB2F75d2cFFb588c63251347fdD629B92c", + AETERNITY_HTTP_ENDPOINT: 'https://mainnet.aeternity.io', } const ENV_KEYS = [ diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 3e06e6ecf428..05bf7cd09fe5 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -220,6 +220,14 @@ const fixBalancesTokens = { fraxtal: { [ADDRESSES.fraxtal.WETH]: { coingeckoId: 'ethereum', decimals: 18 }, }, + aeternity: { + [ADDRESSES.null]:{ coingeckoId: 'aeternity', decimals: 18 }, + [ADDRESSES.aeternity.WAE]:{ coingeckoId: 'aeternity', decimals: 18 }, + [ADDRESSES.aeternity.WETH]:{ coingeckoId: 'ethereum', decimals: 18 }, + [ADDRESSES.aeternity.USDC]:{ coingeckoId: 'usd-coin', decimals: 18 }, + [ADDRESSES.aeternity.USDT]:{ coingeckoId: 'tether', decimals: 18 }, + [ADDRESSES.aeternity.WBTC]:{ coingeckoId: 'wrapped-bitcoin', decimals: 18 }, + } } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) From 0710d66ee3dfb211ad911297fe10e7069ef72b02 Mon Sep 17 00:00:00 2001 From: Cohiba Nan <132758148+Cohiban@users.noreply.github.com> Date: Tue, 2 Jul 2024 14:26:20 +0800 Subject: [PATCH 537/855] Add AILayer core assets (#10835) * Add AILayer core assets * Update tokenMapping.js --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/coreAssets.json | 3 ++- projects/helper/tokenMapping.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 67dafffb54b2..1aacadb38c1b 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1818,7 +1818,8 @@ "DUSD": "0xff0000000000000000000000000000000000000f" }, "ailayer": { - "ABTC": "0x1470a4831F76954686BfB4dE8180F7469EA8dE6F" + "ABTC": "0x1470a4831F76954686BfB4dE8180F7469EA8dE6F", + "bBTC": "0xEAa3C2fa77c306592750C9220a8f52DA8A849Ede" }, "mint": { "WETH": "0x4200000000000000000000000000000000000006", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 05bf7cd09fe5..cfbac6a1e9e8 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -214,6 +214,7 @@ const fixBalancesTokens = { }, ailayer: { [ADDRESSES.ailayer.ABTC]: { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, + '0xEAa3C2fa77c306592750C9220a8f52DA8A849Ede': { coingeckoId: 'bouncebit-btc', decimals: 18 }, '0xc5ed6c946cdc82f4599f0f2f012e1822502e70e3': { coingeckoId: 'artificial-neural-network-ordinals', decimals: 18 }, '0x0a3bb08b3a15a19b4de82f8acfc862606fb69a2d': { coingeckoId: 'izumi-bond-usd', decimals: 18 }, }, From 470cd298a59096ec40c1c9d050154adbac35b734 Mon Sep 17 00:00:00 2001 From: To the moon <58972898+0xtomoon@users.noreply.github.com> Date: Tue, 2 Jul 2024 02:42:14 -0400 Subject: [PATCH 538/855] Feature/add stargate v2 (#10833) * stargate v2: add TVL * remove staking contracts * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/tokenMapping.js | 3 + projects/stargatefinance-v2/index.js | 100 +++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 projects/stargatefinance-v2/index.js diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index cfbac6a1e9e8..254e3a77b7b7 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -88,6 +88,9 @@ const fixBalancesTokens = { iotaevm: { "0x6e47f8d48a01b44DF3fFF35d258A10A3AEdC114c": { coingeckoId: 'iota', decimals: 18 }, }, + aurora: { + '0x368ebb46aca6b8d0787c96b2b20bd3cc3f2c45f7': { coingeckoId: 'usd-coin', decimals: 6 }, + }, acala: { ACA: { coingeckoId: "acala", decimals: 12 }, LDOT: { coingeckoId: "liquid-staking-dot", decimals: 10 }, diff --git a/projects/stargatefinance-v2/index.js b/projects/stargatefinance-v2/index.js new file mode 100644 index 000000000000..a06659ce58e8 --- /dev/null +++ b/projects/stargatefinance-v2/index.js @@ -0,0 +1,100 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +const CONFIG = { + ethereum: { + pools: [ + '0x77b2043768d28E9C9aB44E1aBfC95944bcE57931', + '0xc026395860Db2d07ee33e05fE50ed7bD583189C7', + '0x933597a323Eb81cAe705C5bC29985172fd5A3973', + '0xcDafB1b2dB43f366E48e6F614b8DCCBFeeFEEcD3', + '0x268Ca24DAefF1FaC2ed883c598200CcbB79E931D', + ], + }, + bsc: { + pools: [ + '0x138EB30f73BC423c6455C53df6D89CB01d9eBc63', + ], + }, + avax: { + pools: [ + '0x5634c4a5FEd09819E3c46D86A965Dd9447d86e47', + '0x12dC9256Acc9895B076f6638D628382881e62CeE', + ], + }, + polygon: { + pools: [ + '0x9Aa02D4Fae7F58b8E8f34c66E756cC734DAc7fe4', + '0xd47b03ee6d86Cf251ee7860FB2ACf9f91B9fD4d7', + ], + }, + arbitrum: { + pools: [ + '0xA45B5130f36CDcA45667738e2a258AB09f4A5f7F', + '0xe8CDF27AcD73a434D661C84887215F7598e7d0d3', + '0xcE8CcA271Ebc0533920C83d39F417ED6A0abB7D0', + ], + }, + optimism: { + pools: [ + '0xe8CDF27AcD73a434D661C84887215F7598e7d0d3', + '0xcE8CcA271Ebc0533920C83d39F417ED6A0abB7D0', + '0x19cFCE47eD54a88614648DC3f19A5980097007dD', + ], + }, + metis: { + pools: [ + '0xD9050e7043102a0391F81462a3916326F86331F0', + '0x36ed193dc7160D3858EC250e69D12B03Ca087D08', + '0x4dCBFC0249e8d5032F89D6461218a9D2eFff5125', + ], + }, + linea: { + pools: [ + '0x81F6138153d473E8c5EcebD3DC8Cd4903506B075', + ], + }, + mantle: { + pools: [ + '0x4c1d3Fc3fC3c177c3b633427c2F769276c547463', + '0xAc290Ad4e0c891FDc295ca4F0a6214cf6dC6acDC', + '0xB715B85682B731dB9D5063187C450095c91C57FC', + '0xF7628d84a2BbD9bb9c8E686AC95BB5d55169F3F1', + ], + }, + base: { + pools: [ + '0xdc181Bd607330aeeBEF6ea62e03e5e1Fb4B6F7C7', + '0x27a16dc786820B16E5c9028b75B99F6f604b5d26', + ], + }, + kava: { + pools: [ + '0x41A5b0470D96656Fb3e8f68A218b39AdBca3420b', + ], + }, + scroll: { + pools: [ + '0xC2b638Cb5042c1B3c5d5C969361fB50569840583', + '0x3Fc69CC4A842838bCDC9499178740226062b14E4', + ], + }, + aurora: { + pools: [ + '0x81F6138153d473E8c5EcebD3DC8Cd4903506B075', + ], + }, +} + +const createTvlFunction = (pools) => { + return async (api) => { + const tokens = await api.multiCall({ abi: 'address:token', calls: pools, }) + return sumTokens2({ api, tokensAndOwners2: [tokens, pools] }) + }; +}; + +Object.keys(CONFIG).forEach((chain) => { + const { pools } = CONFIG[chain]; + module.exports[chain] = { + tvl: createTvlFunction(pools), + }; +}); From d19475b93ff0f258b8b608ea1a1a2eaf5f7869b5 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 2 Jul 2024 10:26:20 +0300 Subject: [PATCH 539/855] updae mitosis --- projects/helper/tokenMapping.js | 1 + projects/mitosis/index.js | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 254e3a77b7b7..347cdd92fdf1 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -79,6 +79,7 @@ const fixBalancesTokens = { scroll: { [ADDRESSES.mode.STONE]: { coingeckoId: "ethereum:0x7122985656e38bdc0302db86685bb972b145bd3c", decimals: 0 }, '0x3ba89d490ab1c0c9cc2313385b30710e838370a4': { coingeckoId: "solv-btc", decimals: 18 }, + '0x01f0a31698c4d065659b9bdc21b3610292a1c506': { coingeckoId: "ethereum:0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee", decimals: 0 }, }, tezos: { "KT1PnUZCp3u2KzWr93pn4DD7HAJnm3rWVrgn": { coingeckoId: "tezos", decimals: 6 }, diff --git a/projects/mitosis/index.js b/projects/mitosis/index.js index 3067d24c3866..cbd3fca05f69 100644 --- a/projects/mitosis/index.js +++ b/projects/mitosis/index.js @@ -1,13 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') -const chains = [ - "ethereum", - "arbitrum", - "optimism", - "mode", - "manta", - "blast", - "linea", -]; +const { sumTokens2 } = require('../helper/unwrapLPs') const WEETH_ADDRESS = { ethereum: "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee", @@ -17,17 +9,25 @@ const WEETH_ADDRESS = { manta: "0x77b6F99970f488cFA8bd41892900b6Ce881C2300", blast: ADDRESSES.blast.weETH, linea: "0x1bf74c010e6320bab11e2e5a532b5ac15e0b8aa6", + scroll: "0x01f0a31698c4d065659b9bdc21b3610292a1c506", }; const CAP_ADDRESS = { + scroll: "0x4a6219E25a41FD4165fbd158D89723a7175EA382", ethereum: "0x451d791b6e9a9b8c9237bb55e58a7757342b16f9", blast: "0x096430ef0a653c067df32e93ff77090e084169de", linea: "0xcd32876b9b483eb75e8ca74935e4b51725f33a91", }; -chains.forEach((chain) => { +const vaults = { + scroll: '0xB9Ca61A6D5fA0c443F3c48Ab1fbf0118964308D6' +} + +Object.keys(WEETH_ADDRESS).forEach((chain) => { module.exports[chain] = { tvl: async (api) => { + const vault = vaults[chain]; + if (vault) return sumTokens2({ api, owner: vault, tokens: [WEETH_ADDRESS[chain]] }) const cap = CAP_ADDRESS[chain] ?? "0xb883ee478d3b7fea8a5357a3c3e27e2d2292b1d2"; const tvl = await api.call({ abi: "uint256:load", target: cap }); From 0cd84e25ac376efa793b5a84590dbc0954ee6a5c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 2 Jul 2024 13:07:53 +0300 Subject: [PATCH 540/855] update lyra v2 --- projects/lyra-v2/index.js | 77 +++++++++++++-------------------------- 1 file changed, 26 insertions(+), 51 deletions(-) diff --git a/projects/lyra-v2/index.js b/projects/lyra-v2/index.js index 8f70fff2e344..a743d5f462e8 100644 --- a/projects/lyra-v2/index.js +++ b/projects/lyra-v2/index.js @@ -1,52 +1,27 @@ -const { sumTokensExport } = require('../helper/unwrapLPs') -const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') +const { getConfig } = require('../helper/cache') -module.exports = { - ethereum: { - tvl: sumTokensExport({ tokensAndOwners: [ - [ADDRESSES.ethereum.USDC, '0x6d303cee7959f814042d31e0624fb88ec6fbcc1d'], - [ADDRESSES.ethereum.WETH, '0xD4efe33C66B8CdE33B8896a2126E41e5dB571b7e'], - [ADDRESSES.ethereum.WBTC, '0x3Eec7c855aF33280F1eD38b93059F5aa5862E3ab'], - [ADDRESSES.ethereum.USDT, '0x5e98A25d8d6FF69A8992d6Aa57948dFB77D4ECBa'], - [ADDRESSES.ethereum.SNX, '0x7D7aC8d55A9bD4152b703011f3E61AB3bB0A5592'], - [ADDRESSES.ethereum.WSTETH, '0xeBB5D642aA8ccDeE98373D6aC3ee0602b63824b3'], - ['0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee', '0x8180EcCC825b692ef65FF099a0A387743788bf78'], // weETH - ['0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0', '0x4BB4C3CDc7562f08e9910A0C7D8bB7e108861eB4'], // rswETH - ['0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7','0x35d4D9bc79B0a543934b1769304B90d752691caD'] // rsETH - ], - }) - }, - optimism: { - tvl: sumTokensExport({ tokensAndOwners: [ - [ADDRESSES.optimism.USDC_CIRCLE, '0xDEf0bfBdf7530C75AB3C73f8d2F64d9eaA7aA98e'], - [ADDRESSES.optimism.USDC, '0xBb9CF28Bc1B41c5c7c76Ee1B2722C33eBB8fbD8C'], - [ADDRESSES.optimism.WETH, '0xdD4c717a69763176d8B7A687728e228597eAB86d'], - [ADDRESSES.optimism.WBTC, '0xE5967877065f111a556850d8f05b8DaD88edCEc9'], - [ADDRESSES.optimism.USDT, '0x44343AE5e9319b61c9DaD7876919eFdB03241b02'], - ['0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4', '0x8574CBC539c26Df9ec11bA283218268101ff10e1'], // snx - [ADDRESSES.optimism.WSTETH, '0xAA8f9D05599F1a5d5929c40342c06a5Da063a4dE'] - ] - }) - }, - base: { - tvl: sumTokensExport({ tokensAndOwners: [ - [ADDRESSES.base.USDC, '0x4e798659b9846F1da7B6D6B5d09d581270aB6FEC'], - ['0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452', '0x2805B908a0F9CA58a2b3b7900341b4EBd0B994e9'], //wstETH - [ADDRESSES.base.WETH, '0xBd282333710B9C7e33E8a37d027885A7C079Ae23'], - ] - }) - }, - arbitrum: { - tvl: sumTokensExport({ tokensAndOwners: [ - [ADDRESSES.arbitrum.USDC_CIRCLE, '0x5e027ad442e031424b5a2C0ad6f656662Be32882'], - [ADDRESSES.arbitrum.USDC, '0xFB7B06538d837e4212D72E2A38e6c074F9076E0B'], - [ADDRESSES.arbitrum.WETH, '0x8e9f58E6c206CB9C98aBb9F235E0f02D65dFc922'], - [ADDRESSES.arbitrum.WBTC, '0x3D20c6A2b719129af175E0ff7B1875DEb360896f'], - [ADDRESSES.arbitrum.USDT, '0xb2Cb9aDA6e00118dA8E83a6A53dF1EC6331A60a6'], - [ADDRESSES.arbitrum.WSTETH, '0x8574CBC539c26Df9ec11bA283218268101ff10e1'], - ['0x35751007a407ca6FEFfE80b3cB397736D2cf4dbe', '0x3FBFD80EF7591658d1D7DdEC067F413eFd6f985c'], - ['0x4186BFC76E2E237523CBC30FD220FE055156b41F','0x486936FB1CE805e8C46E71C69256e72f3f550d38'] // rsETH - ] - }) - }, -} \ No newline at end of file +const chains = ['ethereum', 'base', 'arbitrum', 'optimism', 'mode', 'blast'] + +async function getOldToA(api) { + const data = await getConfig('lyra-v2/old-contracts', 'https://raw.githubusercontent.com/0xdomrom/socket-plugs/feat/lyra-base/deployments/superbridge/prod_lyra-old_addresses.json') + const vaults = Object.values(data[api.chainId+'']?? {}).map(i => i.Vault) + const tokens = await api.multiCall({ abi: 'address:token__', calls: vaults}) + return vaults.map((vault, i) => [tokens[i], vault]) +} +async function getToA(api) { + const data = await getConfig('lyra-v2/contracts', 'https://raw.githubusercontent.com/0xdomrom/socket-plugs/feat/lyra-base/deployments/superbridge/prod_lyra_addresses.json') + const vaults = Object.values(data[api.chainId+'']?? {}).map(i => i.Vault) + const tokens = await api.multiCall({ abi: 'address:token', calls: vaults}) + return vaults.map((vault, i) => [tokens[i], vault]) +} + +chains.forEach(chain => { + module.exports[chain] = { + tvl: async (api) => { + const oldToA = await getOldToA(api) + const toa = await getToA(api) + return sumTokens2({ tokensAndOwners: oldToA.concat(toa), api }) + } + } +}) From 8205b03d7efbd414d83645e5cbc84739659f762f Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Tue, 2 Jul 2024 11:08:07 +0100 Subject: [PATCH 541/855] split DeSyn Adapter (#10843) --- projects/desyn-farm/index.js | 28 ++++++++++++++++++++++++++++ projects/desyn/index.js | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 projects/desyn-farm/index.js diff --git a/projects/desyn-farm/index.js b/projects/desyn-farm/index.js new file mode 100644 index 000000000000..5830b13a4529 --- /dev/null +++ b/projects/desyn-farm/index.js @@ -0,0 +1,28 @@ +const { getLogs } = require('../helper/cache/getLogs') + +module.exports = { + doublecounted: true, + methodology: 'TVL: Solv.btc deposite in the vault', +} + +const config = { + merlin: { factory: '0x790b4ee7998A93702f29e56f8b615eF35BE5af43', fromBlock: 11260440}, +} + +Object.keys(config).forEach(chain => { + const {factory, fromBlock, } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const logs = await getLogs({ + api, + target: factory, + eventAbi: 'event LOG_NEW_POOL (address indexed caller, address indexed pool)', + onlyArgs: true, + fromBlock, + }) + const pools = logs.map(i=>i.pool) + const tokens = await api.multiCall({ abi: 'address[]:getCurrentTokens', calls: pools}) + return api.sumTokens({ ownerTokens: tokens.map((tokens, i) => [tokens, pools[i]])}) + } + } +}) \ No newline at end of file diff --git a/projects/desyn/index.js b/projects/desyn/index.js index 8afa05133286..04a9d5381e5d 100644 --- a/projects/desyn/index.js +++ b/projects/desyn/index.js @@ -8,7 +8,7 @@ module.exports = { const config = { ethereum: { factory: '0x01a38B39BEddCD6bFEedBA14057E053cBF529cD2', fromBlock: 17335174}, arbitrum: { factory: '0xdE6b117384452b21F5a643E56952593B88110e78', fromBlock: 175985457}, - merlin: { factory: '0x790b4ee7998A93702f29e56f8b615eF35BE5af43', fromBlock: 11260440}, + //merlin chain is tracked under a new listing for farm } Object.keys(config).forEach(chain => { From ac8189eef9028a88bd43f86f1181ed3f2d3aea78 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 2 Jul 2024 13:13:41 +0300 Subject: [PATCH 542/855] add okb token mapping --- projects/helper/tokenMapping.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 347cdd92fdf1..3aa267832856 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -66,6 +66,9 @@ const fixBalancesTokens = { [nullAddress]: { coingeckoId: "endurance", decimals: 18 }, '0x85119527cf38f6ccf7b1b8f8fad05145358aaa81': { coingeckoId: "endurance", decimals: 18 }, }, + xlayer: { + '0x0000000000000000000000000000000000000000': { coingeckoId: "okb", decimals: 18 }, + }, massa: { 'AS12U4TZfNK7qoLyEERBBRDMu8nm5MKoRzPXDXans4v9wdATZedz9': { coingeckoId: 'wrapped-massa', decimals: 9 }, 'AS1hCJXjndR4c9vekLWsXGnrdigp4AaZ7uYG3UKFzzKnWVsrNLPJ': { coingeckoId: 'massa-bridged-usdc-massa', decimals: 6 }, From 7384ee2e904c29d3f0f6627f1f6ab52388a89ecc Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 2 Jul 2024 13:31:57 +0300 Subject: [PATCH 543/855] minor fix --- projects/camelot-v2/index.js | 22 ++++++---------------- projects/raydium/index.js | 8 ++++++++ 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/projects/camelot-v2/index.js b/projects/camelot-v2/index.js index 6fea9e552a2a..dd0b50fbc1e9 100644 --- a/projects/camelot-v2/index.js +++ b/projects/camelot-v2/index.js @@ -3,24 +3,14 @@ const { uniV3Export } = require('../helper/uniswapV3') const { mergeExports } = require('../helper/utils'); const export1 = uniV3Export({ - arbitrum: { factory: '0xd490f2f6990c0291597fd1247651b4e0dcf684dd', fromBlock: 75633510, isAlgebra: true, }, -}) - -const export2 = uniV3Export({ arbitrum: { factory: '0x1a3c9B1d2F0529D97f2afC5136Cc23e58f1FD35B', fromBlock: 75633510, isAlgebra: true, }, }) -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} +const export2 = uniV3Export({ + xai: { factory: '0xD8676fBdfa5b56BB2298D452c9768f51e80e34AE', fromBlock: 2398999, isAlgebra: true}, + rari: { factory: '0xcF8d0723e69c6215523253a190eB9Bc3f68E0FFa', fromBlock: 340548, isAlgebra: true}, + sanko: { factory: '0xcF8d0723e69c6215523253a190eB9Bc3f68E0FFa', fromBlock: 51, isAlgebra: true}, + arbitrum: { factory: '0xd490f2f6990c0291597fd1247651b4e0dcf684dd', fromBlock: 75633510, isAlgebra: true, }, }) - -module.exports = mergeExports([export1, export2, export3, export4, export5]); \ No newline at end of file +module.exports = mergeExports([export1, export2 ]) \ No newline at end of file diff --git a/projects/raydium/index.js b/projects/raydium/index.js index 041eb9f5a040..816005d17ff4 100644 --- a/projects/raydium/index.js +++ b/projects/raydium/index.js @@ -118,6 +118,8 @@ async function ammV2V3() { } async function combinedTvl(api) { + try { + console.time('raydium: combinedTvl') console.time('raydium: tvlCLMM') @@ -139,8 +141,14 @@ async function combinedTvl(api) { await ammV4Tvl(api) console.timeEnd('raydium: ammV4Tvl') + } catch (e) { + console.error('raydium', e) + throw e + } console.timeEnd('raydium: combinedTvl') + const tvl = await api.getUSDValue() + if (tvl < 1.5e8) throw new Error('TVL is too low :' + tvl/1e6 + 'M') return api.getBalances() } From 9e6bc9ff89ec633b41f6704d4e0ed0b7ae8a99cc Mon Sep 17 00:00:00 2001 From: imimim-username <100382074+imimim-username@users.noreply.github.com> Date: Tue, 2 Jul 2024 07:37:04 -0400 Subject: [PATCH 544/855] Alchemix update (#10846) * Update Alchemix contracts on Mainnet, Op, and Arb * Fixed typo * Removed frxETH-ETH LP --- projects/alchemix/contracts.json | 107 +++++++++++++++++++++++++++++-- 1 file changed, 101 insertions(+), 6 deletions(-) diff --git a/projects/alchemix/contracts.json b/projects/alchemix/contracts.json index 325afbd81160..e5b7eb6cab9d 100644 --- a/projects/alchemix/contracts.json +++ b/projects/alchemix/contracts.json @@ -10,7 +10,31 @@ }, "underlyingTokens": { "USDC": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", - "WETH": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1" + "WETH": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", + "wstETH": "0x5979D7b546E38E414F7E9822514be443A4800529" + }, + "yvTokens": { + "aUSDC": "0x248a431116c6f6FCD5Fe1097d16d0597E24100f5" + }, + "cvxLPpools": { + "crAMM-FRAX-alUSD": { + "poolAddress": "0x43fbf34df6da5fC66E15E023D3b690Fd0dE33cD7", + "holder": "0x7e108711771DfdB10743F016D46d75A9379cA043", + "tokenAddress": "0xfd599DB360Cd9713657C95dF66650A427d213010", + "alToken": "0xCB8FA9a76b8e203D8C3797bF438d8FB81Ea3326A" + }, + "crAMM-GRAI-alUSD": { + "poolAddress": "0x72B6594a0c8D9eE9725ce780f87F9E00615D4b10", + "holder": "0x7e108711771DfdB10743F016D46d75A9379cA043", + "tokenAddress": "0x510a496b2443ba52A3B269Fee5A241a4ED4cCA58", + "alToken": "0xCB8FA9a76b8e203D8C3797bF438d8FB81Ea3326A" + }, + "crAMM-alETH-frxETH": { + "poolAddress": "0xC3f26d2Fa16129a8d4A5A0f94D25F2cdd9005CDb", + "holder": "0x7e108711771DfdB10743F016D46d75A9379cA043", + "tokenAddress": "0xfB4fE921F724f3C7B610a826c827F9F6eCEf6886", + "alToken": "0x17573150d67d820542EFb24210371545a4868B03" + } } }, "fantom": { @@ -40,13 +64,73 @@ "DAI": "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", "USDC": "0x7F5c764cBc14f9669B88837ca1490cCa17c31607", "USDT": "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58", - "WETH": "0x4200000000000000000000000000000000000006" + "WETH": "0x4200000000000000000000000000000000000006", + "wstETH": "0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb" }, "yvTokens": { "aDAI": "0x43A502D7e947c8A2eBBaf7627E104Ddcc253aBc6", "aUSDC": "0x4186Eb285b1efdf372AC5896a08C346c7E373cC4", "aUSDT": "0x2680b58945A31602E4B6122C965c2849Eb76Dd3B", - "aWETH": "0x337B4B933d60F40CB57DD19AE834Af103F049810" + "aWETH": "0x337B4B933d60F40CB57DD19AE834Af103F049810", + "ysUSDC": "0x059Eaa296B18E0d954632c8242dDb4a271175EeD", + "ysDAI": "0x0A86aDbF58424EE2e304b395aF0697E850730eCD", + "ysWETH": "0xE62DDa84e579e6A37296bCFC74c97349D2C59ce3" + }, + "cvxLPpools": { + "aAMM-USDC-alUSD": { + "poolAddress": "0xE8b219c285e4e4ec28ac80Fdc4b9739b18cB8890", + "holder": "0xb29617209961DB995dD30a4AB94BA0034A4284f9", + "tokenAddress": "0x124D69DaeDA338b1b31fFC8e429e39c9A991164e", + "alToken": "0xCB8FA9a76b8e203D8C3797bF438d8FB81Ea3326A" + }, + "sAMM-DOLA-alUSD": { + "poolAddress": "0x13bAeC9C12544066a7918efc3D8b626dBbFE1615", + "holder": "0xb29617209961DB995dD30a4AB94BA0034A4284f9", + "tokenAddress": "0x67C253eB6C2e69F9E1114aEeAD0DB4FA8F417AC3", + "alToken": "0xCB8FA9a76b8e203D8C3797bF438d8FB81Ea3326A" + }, + "sAMM-FRAX-alUSD": { + "poolAddress": "0xA8E0754dd8Ef3700Ac8478Fdb8d4B8473de3817C", + "holder": "0xb29617209961DB995dD30a4AB94BA0034A4284f9", + "tokenAddress": "0xaF03f51DE7a0E62BF061F6Fc3931cF79166B0a29", + "alToken": "0xCB8FA9a76b8e203D8C3797bF438d8FB81Ea3326A" + }, + "sAMM-alUSD-MAI": { + "poolAddress": "0xA688080CA069231C6D5713CD009662Ea54437A02", + "holder": "0xb29617209961DB995dD30a4AB94BA0034A4284f9", + "tokenAddress": "0xfA09479d72E2b3f8B6dF63399772237Ad6658D76", + "alToken": "0xCB8FA9a76b8e203D8C3797bF438d8FB81Ea3326A" + }, + "vAMM-OP-alUSD": { + "poolAddress": "0x6101236Fd0E04427952799323D89B99BE0eab52f", + "holder": "0xb29617209961DB995dD30a4AB94BA0034A4284f9", + "tokenAddress": "0x60BE3FB22DDF30C17604b86eC005F6173B1170Aa", + "alToken": "0xCB8FA9a76b8e203D8C3797bF438d8FB81Ea3326A" + }, + "sAMMM-USDC.e-alUSD": { + "poolAddress": "0x4d7959d17B9710BE87e3657e69d946914221BB88", + "holder": "0xb29617209961DB995dD30a4AB94BA0034A4284f9", + "tokenAddress": "0x4d7959d17B9710BE87e3657e69d946914221BB88", + "alToken": "0xCB8FA9a76b8e203D8C3797bF438d8FB81Ea3326A" + }, + "sAMM-alETH-WETH": { + "poolAddress": "0xc16adBf2d01d6524B79CbB610cE31d5db80eee3C", + "holder": "0xb29617209961DB995dD30a4AB94BA0034A4284f9", + "tokenAddress": "0xa1055762336F92b4B8d2eDC032A0Ce45ead6280a", + "alToken": "0x3E29D3A9316dAB217754d13b28646B76607c5f04" + }, + "sAMM-alETH-frxETH": { + "poolAddress": "0xFc0B9A9C2b63E6ACACa91A77A80bfa83C615e6C5", + "holder": "0xb29617209961DB995dD30a4AB94BA0034A4284f9", + "tokenAddress": "0x1AD06Ca54de04DBe9e2817F4C13eCB406DCbeAf0", + "alToken": "0x3E29D3A9316dAB217754d13b28646B76607c5f04" + }, + "vAMM-alETH-OP": { + "poolAddress": "0xB715D27CCe97e869Cff840072ce1Eab1d982791E", + "holder": "0xb29617209961DB995dD30a4AB94BA0034A4284f9", + "tokenAddress": "0xA5EDb0EF932f7c2f37B8FC75CB01948F6258a4f8", + "alToken": "0x3E29D3A9316dAB217754d13b28646B76607c5f04" + } } }, "ethereum": { @@ -71,13 +155,24 @@ "USDT": "0xdAC17F958D2ee523a2206206994597C13D831ec7", "wstETH": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0", "rETH": "0xae78736Cd615f374D3085123A210448E74Fc6393", - "WETH": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" + "WETH": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "FRAX": "0x853d955aCEf822Db058eb8505911ED77F175b99e", + "sfrxETH": "0xac3E018457B222d93114458476f3E3416Abbe38F" }, "yvTokens": { "yvDAI": "0xda816459f1ab5631232fe5e97a05bbbb94970c95", "yvUSDC": "0xa354f35829ae975e850e23e9615b11da1b3dc4de", "yvUSDT": "0x7da96a3891add058ada2e826306d812c638d87a7", - "yvWETH": "0xa258c4606ca8206d8aa700ce2143d7db854d168c" + "yvWETH": "0xa258c4606ca8206d8aa700ce2143d7db854d168c", + "aDAI": "0xcE4a49d7ed99C7c8746B713EE2f0C9aA631688d8", + "aUSDC": "0xf591D878608e2e5c7D4f1E499330f4AB9BbaE37a", + "aUSDT": "0xBC11De1F20e83F0a6889B8c7A7868E722694E315", + "vaUSDC": "0xa8b607Aa09B6A2E306F93e74c282Fb13f6A80452", + "vaDAI": "0x0538C8bAc84E95A9dF8aC10Aad17DbE81b9E36ee", + "vaFRAX": "0xc14900dFB1Aa54e7674e1eCf9ce02b3b35157ba5", + "aFRAX": "0x318334A6dD21d16A8442aB0b7204E81Aa3FB416E", + "aWETH": "0x61134511187a9a2DF38D10DBe07Ba2e8E5563967", + "vaETH": "0xd1C117319B3595fbc39b471AB1fd485629eb05F2" }, "staking": { "token": "0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF", @@ -87,7 +182,7 @@ "cvxLPpools": { "alUSD+FRAXBP": { "poolAddress": "0x26598e3E511ADFadefD70ab2C3475Ff741741104", - "holder": "0xBE1C919cA137299715e9c929BC7126Af14f76091", + "holder": "0x06378717d86B8cd2DBa58c87383dA1EDA92d3495", "tokenAddress": "0xb30da2376f63de30b42dc055c93fa474f31330a5", "alToken": "0xBC6DA0FE9aD5f3b0d58160288917AA56653660E9" }, From 794178de091edc29b29f24ac1f2bf7a724adcdf9 Mon Sep 17 00:00:00 2001 From: Richard Nguyen Date: Tue, 2 Jul 2024 18:37:27 +0700 Subject: [PATCH 545/855] update Minswap Stable Pool TVL (#10840) --- projects/minswap/index.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/projects/minswap/index.js b/projects/minswap/index.js index bd24af267ed3..9867ef3f774a 100644 --- a/projects/minswap/index.js +++ b/projects/minswap/index.js @@ -1,13 +1,32 @@ -const { getAdaInAddress, sumTokensExport } = require("../helper/chain/cardano"); +const { getAdaInAddress, sumTokensExport, sumTokens2 } = require("../helper/chain/cardano"); const POOL_SCRIPT_HASH = "script1uychk9f04tqngfhx4qlqdlug5ntzen3uzc62kzj7cyesjk0d9me" const ORDER_SCRIPT_HASH = "script15ew2tzjwn364l2pszu7j5h9w63v2crrnl97m074w9elrkxhah0e" async function tvl() { + // DEX V1 const liquidityPoolLocked = await getAdaInAddress(POOL_SCRIPT_HASH) const batchOrderLocked = await getAdaInAddress(ORDER_SCRIPT_HASH) + + // Stable Pools + const stablePoolsLiquidity = await sumTokens2({ + owners: [ + 'addr1wy7kkcpuf39tusnnyga5t2zcul65dwx9yqzg7sep3cjscesx2q5m5', + 'addr1wx8d45xlfrlxd7tctve8xgdtk59j849n00zz2pgyvv47t8sxa6t53', + 'addr1w9520fyp6g3pjwd0ymfy4v2xka54ek6ulv4h8vce54zfyfcm2m0sm', + 'addr1wxxdvtj6y4fut4tmu796qpvy2xujtd836yg69ahat3e6jjcelrf94', + ], + tokens: [ + '8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd61446a65644d6963726f555344', + 'f66d78b4a3cb3d37afa0ec36461e51ecbde00f26c8f0a68f94b6988069555344', + '25c5de5f5b286073c593edfd77b48abc7a48e5a4f3d4cd9d428ff93555534443', + 'c48cbb3d5e57ed56e276bc45f99ab39abe94e6cd7ac39fb402da47ad0014df105553444d' + ], + }) + return { cardano: (liquidityPoolLocked * 2) + batchOrderLocked, + ...stablePoolsLiquidity }; } From 996fa935382a05db81328f9feab7af44e8c211bb Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 2 Jul 2024 14:40:01 +0300 Subject: [PATCH 546/855] temp fix for raydium --- projects/helper/heroku-api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/helper/heroku-api.js b/projects/helper/heroku-api.js index 1cbe02f416ca..57aa8cb64295 100644 --- a/projects/helper/heroku-api.js +++ b/projects/helper/heroku-api.js @@ -1,5 +1,5 @@ const { get } = require('./http') -const endpoint = "https://sushi-analytics.llama.fi" +const endpoint = "https://sushi-analytics.llama.fi/temp" let data async function getData() { From 71b3bb6109a7e17d01a68f0ca9ebd074a18e8721 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Tue, 2 Jul 2024 12:41:01 +0100 Subject: [PATCH 547/855] etherfi (WIP) (#10828) * etherfi (WIP) * missing * Update index.js --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/etherfi-lrt/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/etherfi-lrt/index.js diff --git a/projects/etherfi-lrt/index.js b/projects/etherfi-lrt/index.js new file mode 100644 index 000000000000..1d339ce506dd --- /dev/null +++ b/projects/etherfi-lrt/index.js @@ -0,0 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/sumTokens'); + +const owners = ["0x917ceE801a67f933F2e6b33fC0cD1ED2d5909D88"] + +module.exports = { + methodology: "LRTS on 0x917ceE801a67f933F2e6b33fC0cD1ED2d5909D88", + doublecounted: true, + ethereum: { + tvl: sumTokensExport({ + owners, + tokens: [ADDRESSES.ethereum.WSTETH, ADDRESSES.ethereum.sfrxETH, ADDRESSES.ethereum.cbETH, ADDRESSES.ethereum.EETH, ADDRESSES.ethereum.RETH, ADDRESSES.null, "0xf951E335afb289353dc249e82926178EaC7DEd78", "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee", "0xA35b1B31Ce002FBF2058D22F30f95D405200A15b", "0xa2E3356610840701BDf5611a53974510Ae27E2e1", "0xd5F7838F5C461fefF7FE49ea5ebaF7728bB0ADfa" ] + }), + }} From 2f2d074dafb2c6d26e177be3773d41fe8e10c08a Mon Sep 17 00:00:00 2001 From: neoiss <85328218+neoiss@users.noreply.github.com> Date: Tue, 2 Jul 2024 20:00:04 +0800 Subject: [PATCH 548/855] add token address (#10836) * add token address * update chain name * update mos contract address * update chain name --- projects/butternetwork/index.js | 68 +++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/projects/butternetwork/index.js b/projects/butternetwork/index.js index 047c6b2eba4a..c0e1fe185d24 100644 --- a/projects/butternetwork/index.js +++ b/projects/butternetwork/index.js @@ -140,8 +140,76 @@ const config = { MIM: "0x76DA31D7C9CbEAE102aff34D3398bC450c8374c1", OMNI: "0x9e20461bc2c4c980f62f1B279D71734207a6A356", USDB: ADDRESSES.blast.USDB, + WBTC: "0xF7bc58b8D8f97ADC129cfC4c9f45Ce3C0E1D2692", WETH: ADDRESSES.blast.WETH } + }, + arbitrum: { + mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + tokens: { + USDT: ADDRESSES.arbitrum.USDT, + USDC: ADDRESSES.arbitrum.USDC, + WBTC: ADDRESSES.arbitrum.WBTC, + WETH: ADDRESSES.arbitrum.WETH, + DAI: ADDRESSES.arbitrum.DAI, + } + }, + optimism: { + mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + tokens: { + USDT: ADDRESSES.optimism.USDT, + USDC: ADDRESSES.optimism.USDC, + WBTC: ADDRESSES.optimism.WBTC, + WETH: ADDRESSES.optimism.WETH_1, + DAI: ADDRESSES.optimism.DAI, + } + }, + era: { + mosContract: "0xBEf06a32166C4B819fF04cCfa887733B8bb67eB5", + tokens: { + USDT: ADDRESSES.era.USDT, + USDC: ADDRESSES.era.USDC, + WETH: ADDRESSES.era.WETH + }, + }, + // ainn: { + // mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + // tokens: { + // USDT: "0x0663C09Bd0911181B39D66ec4bfAC9d89c8516BA", + // USDC: "0xfaBc451eA1Fd9707c6Ba1769F570E760101C7f22", + // } + // }, + mantle: { + mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + tokens: { + USDT: ADDRESSES.mantle.USDT, + USDC: ADDRESSES.mantle.USDC, + } + }, + tron: { + mosContract: "TYMpgB8Q9vSoGtkyE3hXsvUrpte3KCDGj6", + tokens: { + USDT: ADDRESSES.tron.USDT, + USDC: ADDRESSES.tron.USDC, + } + }, + scroll: { + mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + tokens: { + USDT: ADDRESSES.scroll.USDT, + USDC: ADDRESSES.scroll.USDC, + WBTC: "0x3C1BCa5a656e69edCD0D4E36BEbb3FcDAcA60Cf1", + WETH: ADDRESSES.scroll.WETH, + DAI: "0xcA77eB3fEFe3725Dc33bccB54eDEFc3D9f764f97", + } + }, + linea: { + mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + tokens: { + USDT: ADDRESSES.linea.USDT, + USDC: ADDRESSES.linea.USDC, + WETH: ADDRESSES.linea.WETH, + } } } From 6c6a96c8db9df63fac206705935daad4b5ec683c Mon Sep 17 00:00:00 2001 From: cattyjoke <157704185+cattyjoke@users.noreply.github.com> Date: Tue, 2 Jul 2024 20:33:52 +0800 Subject: [PATCH 549/855] add infdex (#10842) Co-authored-by: catty --- projects/infdex/index.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 projects/infdex/index.js diff --git a/projects/infdex/index.js b/projects/infdex/index.js new file mode 100644 index 000000000000..731d0c17737d --- /dev/null +++ b/projects/infdex/index.js @@ -0,0 +1,6 @@ +const { uniV3Export } = require('../helper/uniswapV3') +const factory = '0x6701E10b02F4131003510f95419F4EeA59484007' + +module.exports = uniV3Export({ + merlin: { factory, fromBlock: 12099773, } +}) \ No newline at end of file From fbaaa4f8af471ed191b4d4d134e9d6d3132c555f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 2 Jul 2024 15:46:15 +0300 Subject: [PATCH 550/855] refactor wing --- projects/helper/tokenMapping.js | 8 ++++ projects/wing.js | 69 ++++++++++++++++++++++----------- 2 files changed, 55 insertions(+), 22 deletions(-) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 3aa267832856..5fd036cb3a42 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -69,6 +69,14 @@ const fixBalancesTokens = { xlayer: { '0x0000000000000000000000000000000000000000': { coingeckoId: "okb", decimals: 18 }, }, + ontology_evm: { + [nullAddress]: { coingeckoId: "ontology", decimals: 18 }, + '0x219cc8e994ea6b35cdcffb5d44e229325d5ad02a': { coingeckoId: "ontology", decimals: 9 }, + '0x72b0f5612802d473a13716db71a0348bcf631d98': { coingeckoId: "tether", decimals: 6 }, + '0xae834526aa3b70de9b34f81c4bf51bc2c80a5473': { coingeckoId: "usd-coin", decimals: 6 }, + '0xfcad47c29551c7691398776c8fa73287c8fa8ec0': { coingeckoId: "wrapped-bitcoin", decimals: 8 }, + '0xd18f97592a1adf4fa18d041abb7bd89491d3a8be': { coingeckoId: "ethereum", decimals: 18 }, + }, massa: { 'AS12U4TZfNK7qoLyEERBBRDMu8nm5MKoRzPXDXans4v9wdATZedz9': { coingeckoId: 'wrapped-massa', decimals: 9 }, 'AS1hCJXjndR4c9vekLWsXGnrdigp4AaZ7uYG3UKFzzKnWVsrNLPJ': { coingeckoId: 'massa-bridged-usdc-massa', decimals: 6 }, diff --git a/projects/wing.js b/projects/wing.js index 3633cca45979..b68791d482dd 100644 --- a/projects/wing.js +++ b/projects/wing.js @@ -1,28 +1,18 @@ -const { get } = require('./helper/http') - -const nft_url = "https://nftapi.wing.finance/backend/nft-pool/pool-overview" +const { get } = require('./helper/http'); +const { compoundExports2 } = require('./helper/compound'); +const { mergeExports } = require('./helper/utils'); +const { sumTokensExport } = require('./helper/unwrapLPs'); +const ADDRESSES = require('./helper/coreAssets.json') const config = { ontology: { url: 'https://flashapi.wing.finance/api/v1/flashpooldetail', }, - ethereum: { - url: 'https://ethapi.wing.finance/eth/flash-pool/detail', - }, - okexchain: { - url: 'https://ethapi.wing.finance/okexchain/flash-pool/detail', - }, - bsc: { - url: "https://ethapi.wing.finance/bsc/flash-pool/detail", - }, - ontology_evm: { - url: "https://ethapi.wing.finance/ontevm/flash-pool/detail", - }, } -module.exports = { - misrepresentedTokens: true, +const apiExports = { + misrepresentedTokens: true, }; const data = {} @@ -34,15 +24,12 @@ async function getData(chain) { } Object.keys(config).forEach(chain => { - module.exports[chain] = { + apiExports[chain] = { tvl: async () => { const { result } = await getData(chain) if (!result.totalBorrow) result.totalBorrow = result.TotalBorrow if (!result.totalSupply) result.totalSupply = result.TotalSupply - if (chain == "ethereum") { - const result_nft = await get(nft_url) - if (result_nft.nftCollateralTVL !=undefined && !result_nft.nftCollateralTVL) result.totalSupply += result_nft.nftCollateralTVL - } + return { tether: result.totalSupply - result.totalBorrow } @@ -65,3 +52,41 @@ Object.keys(config).forEach(chain => { }, } }) + + +module.exports = mergeExports([ + { // flash pool + ethereum: compoundExports2({ comptroller: '0x2F9fa63066cfA2d727F57ddf1991557bA86F12c9' }), + okexchain: compoundExports2({ comptroller: '0x66e212d287e547c2c93cfe50795543c025ca9ee3' }), + bsc: compoundExports2({ comptroller: '0x49620e9bfd117c7b05b4732980b05b7afee60a69' }), + ontology_evm: compoundExports2({ comptroller: '0x000A4d6b9E553a7f4bc1B8F94bB7Dd37BfF6d79b' }), + }, { // p2p pool + ethereum: { + tvl: sumTokensExport({ + owner: '0x091806040FD70B40bcDA5e01D00eAfad8D10AB56', + tokens: [ + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.WETH, + '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643', + '0x39AA39c021dfbaE8faC545936693aC917d5E7563', + '0xdAC17F958D2ee523a2206206994597C13D831ec7', + '0x70e36f6BF80a52b3B46b3aF8e106CC0ed743E8e4', + '0xc00e94Cb662C3520282E6f5717214004A7f26888', + '0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5', + ] + + }) + }, + }, { // nft pool + ethereum: { + tvl: sumTokensExport({ + owner: '0x3c3e283353f4349f6424151583A8353E8F40F2B1', + tokens: [ + ADDRESSES.ethereum.WETH, + ] + + }) + }, + }, + apiExports, +]) \ No newline at end of file From e69eb7b1207bedbc98405da8f516283ad16a79be Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 2 Jul 2024 16:01:10 +0300 Subject: [PATCH 551/855] Napier (#10848) * feat: create napier tvl adapter * feat: fix to use totalAssets * feat: add pool underlyings * code refactor --------- Co-authored-by: jsh1n --- projects/napier/index.js | 57 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 projects/napier/index.js diff --git a/projects/napier/index.js b/projects/napier/index.js new file mode 100644 index 000000000000..88fbdc781db4 --- /dev/null +++ b/projects/napier/index.js @@ -0,0 +1,57 @@ + +const { getLogs } = require("../helper/cache/getLogs"); + +// https://docs.napier.finance/contract-and-integrations/deployed-contracts +const config = { + ethereum: { + pool_factory: { + address: "0x17354e8e7518599c7f6B7095a6706766e4e4dC61", + deployedAt: 20017932, + }, + tranche_factory: { + address: "0x83CE9e95118b48DfED91632e1bB848f1D4ee12e3", + deployedAt: 20017932, + }, + }, +} + +Object.keys(config).map((network) => { + const { tranche_factory, pool_factory } = config[network]; + module.exports[network] = { + tvl: async (api) => { + const trancheDeployedLogs = tranche_factory.address ? await getLogs({ + api, + target: tranche_factory.address, + eventAbi: + "event TrancheDeployed(uint256 indexed maturity, address indexed principalToken, address indexed yieldToken)", + onlyArgs: true, + fromBlock: tranche_factory.deployedAt, + }) : []; + + const tranches = trancheDeployedLogs.map((event) => event.principalToken); + + // fetch deployed pools + const poolDeployedLogs = pool_factory.address ? await getLogs({ + api, + target: pool_factory.address, + eventAbi: "event Deployed(uint256 indexed basePool, address indexed underlying, address indexed pool)", + onlyArgs: true, + fromBlock: pool_factory.deployedAt, + }) : []; + + const pools = poolDeployedLogs.map((event) => event.pool) + + // fetch adapter contracts + const results = await api.multiCall({ + abi: "function getSeries() external view returns (tuple(address underlying, address target, address yt, address adapter, uint256 mscale, uint256 maxscale, uint64 issuanceFee, uint64 maturity))", + calls: tranches, + }); + const adapters = results.map((r) => r.adapter); + const underlyingTokens = results.map((r) => r.underlying); + const adapterBalances = await api.multiCall({ abi: 'uint256:totalAssets', calls: adapters}) + api.add(underlyingTokens, adapterBalances) + console.log({ pools, adapters, tranches}) + return api.erc4626Sum({ calls: pools, tokensAbi: 'underlying', balanceAbi: 'totalUnderlying'}) + }, + }; +}); From 1fe6e18e163082f8cf5c71a81834c0b80fe919b6 Mon Sep 17 00:00:00 2001 From: Philippe <2307365+philippe-git@users.noreply.github.com> Date: Tue, 2 Jul 2024 18:46:38 +0200 Subject: [PATCH 552/855] Update convex treasury & tvl adapters (#10844) * Add missing convex treasury data * Add fraxtal pools to convex tvl * Add locked cvx to total stakings * Add some missing tvl data to convex * Add tvl hallmarks * Add convex vefxs fraxtal balance --- projects/convex/index.js | 74 +- projects/convex/pools-crv.js | 1240 ------------------------------- projects/helper/coreAssets.json | 5 +- projects/helper/unwrapLPs.js | 48 +- projects/treasury/convex.js | 89 ++- 5 files changed, 176 insertions(+), 1280 deletions(-) delete mode 100644 projects/convex/pools-crv.js diff --git a/projects/convex/index.js b/projects/convex/index.js index b45440ae196b..10505a93fb82 100644 --- a/projects/convex/index.js +++ b/projects/convex/index.js @@ -1,13 +1,16 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const ABI = require('./abi.json') -const { sumTokensExport } = require('../helper/unwrapLPs') +const { stakings } = require('../helper/staking'); + +const boosterAddresses = { + fraxtal: '0xd3327cb05a8E0095A543D582b5B3Ce3e19270389', + default: '0xF403C135812408BFbE8713b5A23a04b3D48AAE31', +}; -const boosterAddress = "0xF403C135812408BFbE8713b5A23a04b3D48AAE31"; const staker = '0x989aeb4d175e16225e39e87d0d97a3360524ad80' -const cvxAddress = ADDRESSES.ethereum.CVX; const cvxRewardsAddress = "0xCF50b810E57Ac33B91dCF525C6ddd9881B139332"; -const crvAddress = ADDRESSES.ethereum.CRV; +const cvxLockerAddress = "0x72a19342e8F1838460eBFCCEf09F6585e32db86E"; const arbiPoolInfoABI = 'function poolInfo(uint256) view returns (address lptoken, address gauge, address rewards, bool shutdown, address factory)' @@ -22,26 +25,64 @@ async function tvl(chain, block) { params: staker, abi: 'erc20:balanceOf', block, }) - sdk.util.sumSingleBalance(balances, crvAddress, crvLocked) + sdk.util.sumSingleBalance(balances, ADDRESSES.ethereum.CRV, crvLocked) //cvxfxs supply const { output: fxsLocked } = await sdk.api.abi.call({ target: '0xc8418af6358ffdda74e09ca9cc3fe03ca6adc5b0', // veFXS - params: '0x59cfcd384746ec3035299d90782be065e466800b', + params: '0x59cfcd384746ec3035299d90782be065e466800b', // Convex Frax vote proxy + abi: 'erc20:balanceOf', block, + }) + sdk.util.sumSingleBalance(balances, ADDRESSES.ethereum.FXS, fxsLocked) + + //cvxprisma supply + const { output: [prismaLocked] } = await sdk.api.abi.call({ + target: '0x3f78544364c3eCcDCe4d9C89a630AEa26122829d', // PRISMA locker + params: '0x8ad7a9e2B3Cd9214f36Cb871336d8ab34DdFdD5b', // Convex Prisma vote proxy + abi: 'function getAccountBalances(address) view returns (uint256, uint256)', block, + }) + sdk.util.sumSingleBalance(balances, ADDRESSES.ethereum.PRISMA, prismaLocked * 1e18) + + //cvxfxn supply + const { output: fxnLocked } = await sdk.api.abi.call({ + target: '0xEC6B8A3F3605B083F7044C0F31f2cac0caf1d469', // veFXN + params: '0xd11a4Ee017cA0BECA8FA45fF2abFe9C6267b7881', // Convex F(x) vote proxy abi: 'erc20:balanceOf', block, }) - sdk.util.sumSingleBalance(balances, '0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0', fxsLocked) + sdk.util.sumSingleBalance(balances, ADDRESSES.ethereum.FXN, fxnLocked) } else { + if (chain === 'fraxtal') { + //cvxfxs supply on fraxtal + const { output: fxsLockedFraxtal } = await sdk.api.abi.call({ + target: '0x007FD070a7E1B0fA1364044a373Ac1339bAD89CF', // veFXS + params: '0x59CFCD384746ec3035299D90782Be065e466800B', // Convex Frax Fraxtal vote proxy + abi: 'erc20:balanceOf', block, chain + }) + sdk.util.sumSingleBalance(balances, ADDRESSES.ethereum.FXS, fxsLockedFraxtal) + } + abiPoolInfo = arbiPoolInfoABI } - let poolInfo = await sdk.api2.abi.fetchList({ chain, block, lengthAbi: ABI.poolLength, itemAbi: abiPoolInfo, target: boosterAddress }) + const poolInfo = await sdk.api2.abi.fetchList({ + chain, + block, + lengthAbi: ABI.poolLength, + itemAbi: abiPoolInfo, + target: boosterAddresses[chain] ?? boosterAddresses.default, + }) + const { output: gaugeBalances } = await sdk.api.abi.multiCall({ abi: 'erc20:balanceOf', - calls: Array.from(new Set(poolInfo.map(p=>p.gauge))).map(i => ({ target: i, params: staker })), - chain, block, + calls: Array.from(new Set(poolInfo.map(p => p.gauge))).map(i => ({ target: i, params: staker })), + chain, + block, }) - gaugeBalances.forEach(({ output, input }, i) => sdk.util.sumSingleBalance(balances, chain + ':' + poolInfo.find(p=>p.gauge.toLowerCase()===input.target.toLowerCase()).lptoken, output)) + + gaugeBalances.forEach(({ output, input }, i) => { + sdk.util.sumSingleBalance(balances, chain + ':' + poolInfo.find(p => p.gauge.toLowerCase() === input.target.toLowerCase()).lptoken, output) + }) + return balances } @@ -49,13 +90,20 @@ const chains = [ 'ethereum', 'arbitrum', 'polygon', + 'fraxtal', ] module.exports = { doublecounted: true, hallmarks: [ [1640164144, "cvxFXS Launched"], - [1651881600, "UST depeg"] + [1642374675, "MIM depeg"], + [1651881600, "UST depeg"], + [1654822801, "stETH depeg"], + [1667692800, "FTX collapse"], + [1690715622, "Curve reentrancy hack"], + [1695705887, "cvxFXN Launched"], + [1698409703, "cvxPRISMA Launched"], ] }; @@ -65,4 +113,4 @@ chains.forEach(chain => { } }) -module.exports.ethereum.staking = sumTokensExport({ owner: cvxRewardsAddress, tokens: [cvxAddress] }) +module.exports.ethereum.staking = stakings([cvxLockerAddress, cvxRewardsAddress], ADDRESSES.ethereum.CVX) diff --git a/projects/convex/pools-crv.js b/projects/convex/pools-crv.js deleted file mode 100644 index 06082a5be6ef..000000000000 --- a/projects/convex/pools-crv.js +++ /dev/null @@ -1,1240 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const REFERENCE_ASSETS = {}; -const coins = {}; - -module.exports = [{ - dataIndex: 0, - id: 'compound', - name: 'Compound', - pageMetaData: { - title: 'Compounded', - description: 'A curve.fi portal for swapping cDAI/cUSDC', - }, - lpTokenInfo: { - name: 'cCurve', - symbol: 'cCrv', - }, - coingeckoInfo: { - id: 'compound', - symbol: 'COMP', - }, - assets: 'cDAI+cUSDC', - coins: [ - coins.cdai, - coins.cusdc, - ], - underlyingCoins: [ - coins.dai, - coins.usdc, - ], - isLendingPool: true, - addresses: { - swap: '0xA2B47E3D5c44877cca798226B7B8118F9BFb7A56', - lpToken: '0x845838DF265Dcd2c412A1Dc9e959c7d08537f8a2', - gauge: '0x7ca5b0a2910B33e9759DC7dDB0413949071D7575', - deposit: '0xeB21209ae4C2c9FF2a86ACA31E123764A3B6Bc06', - }, - hasAMultiplier: false, - isOldPool: true, -}, { - dataIndex: 1, - id: 'usdt', - name: 'USDT', - pageMetaData: { - title: 'Tethered', - description: 'A curve.fi Tethered portal for swapping cDAI/cUSDC/USDT', - }, - lpTokenInfo: { - name: 'tCurve', - symbol: 'tCrv', - }, - coingeckoInfo: { - id: 'tether', - symbol: 'USDT', - }, - assets: 'cDAI+cUSDC+USDT', - coins: [ - coins.cdai, - coins.cusdc, - coins.usdt, - ], - underlyingCoins: [ - coins.dai, - coins.usdc, - coins.usdt, - ], - isLendingPool: true, - addresses: { - swap: '0x52EA46506B9CC5Ef470C5bf89f17Dc28bB35D85C', - lpToken: '0x9fC689CCaDa600B6DF723D9E47D84d76664a1F23', - gauge: '0xBC89cd85491d81C6AD2954E6d0362Ee29fCa8F53', - deposit: '0xac795D2c97e60DF6a99ff1c814727302fD747a80', - }, - hasAMultiplier: false, - isOldPool: true, -}, { - dataIndex: 5, - id: 'pax', - name: 'PAX', - lpTokenInfo: { - name: 'pCurve', - symbol: 'pCrv', - }, - coingeckoInfo: { - id: 'paxos-standard', - symbol: 'PAX', - }, - assets: 'ycDAI+ycUSDC+ycUSDT+PAX', - coins: [ - coins.ycdai, - coins.ycusdc, - coins.ycusdt, - coins.pax, - ], - underlyingCoins: [ - coins.dai, - coins.usdc, - coins.usdt, - coins.pax, - ], - isLendingPool: true, - // Additional context we might want to include for yctokens: `ycTokens are forked yTokens without owner and Compound lending available for ycUSDT` - addresses: { - swap: '0x06364f10B501e868329afBc005b3492902d6C763', - lpToken: '0xD905e2eaeBe188fc92179b6350807D8bd91Db0D8', - gauge: '0x64E3C23bfc40722d3B649844055F1D51c1ac041d', - deposit: '0xA50cCc70b6a011CffDdf45057E39679379187287', - }, - hasAMultiplier: false, - isOldPool: true, -}, { - dataIndex: 2, - id: 'iearn', - idAlias: 'y', - name: 'Y', - pageMetaData: { - title: 'Yield', - description: 'A curve.fi yTokens portal for swapping DAI/USDC/USDT/TUSD', - }, - lpTokenInfo: { - name: 'yCurve', - symbol: 'yCrv', - }, - coingeckoInfo: { - id: 'yearn-finance', - symbol: 'YFI', - }, - assets: 'yDAI+yUSDC+yUSDT+yTUSD', - coins: [ - coins.ydai, - coins.yusdc, - coins.yusdt, - coins.ytusd, - ], - underlyingCoins: [ - coins.dai, - coins.usdc, - coins.usdt, - coins.tusd, - ], - isLendingPool: true, - addresses: { - swap: '0x45F783CCE6B7FF23B2ab2D70e416cdb7D6055f51', - lpToken: '0xdF5e0e81Dff6FAF3A7e52BA697820c5e32D806A8', - gauge: '0xFA712EE4788C042e2B7BB55E6cb8ec569C4530c1', - deposit: '0xbBC81d23Ea2c3ec7e56D39296F0cbB648873a5d3', - stakingRewards: '0x0001FB050Fe7312791bF6475b96569D83F695C9f', - }, - hasAMultiplier: false, - isOldPool: true, -}, { - dataIndex: 3, - id: 'busd', - name: 'BUSD', - pageMetaData: { - title: 'bUSD', - description: 'A curve.fi portal for swapping BUSD and other stablecoins', - }, - lpTokenInfo: { - name: 'bCurve', - symbol: 'bCrv', - }, - coingeckoInfo: { - id: 'binance-usd', - symbol: 'BUSD', - }, - assets: 'yDAI+yUSDC+yUSDT+yBUSD', - coins: [ - coins.ydai, - coins.yusdc, - coins.yusdt, - coins.ybusd, - ], - underlyingCoins: [ - coins.dai, - coins.usdc, - coins.usdt, - coins.busd, - ], - isLendingPool: true, - addresses: { - swap: '0x79a8C46DeA5aDa233ABaFFD40F3A0A2B1e5A4F27', - lpToken: '0x3B3Ac5386837Dc563660FB6a0937DFAa5924333B', - gauge: '0x69Fb7c45726cfE2baDeE8317005d3F94bE838840', - deposit: '0xb6c057591E073249F2D9D88Ba59a46CFC9B59EdB', - }, - hasAMultiplier: false, - isOldPool: true, -}, { - dataIndex: 4, - id: 'susdv2', - name: 'sUSD', - lpTokenInfo: { - name: 'sCurve', - symbol: 'sCrv', - }, - coingeckoInfo: { - id: 'nusd', - symbol: 'SUSD', - }, - assets: 'DAI+USDC+USDT+sUSD', - coins: [ - coins.dai, - coins.usdc, - coins.usdt, - coins.susd, - ], - additionalRewards: [{ - name: 'SNX', - amountDataKey: 'snxRewards', - rewardTokenCoingeckoId: 'havven', - }], - addresses: { - swap: '0xA5407eAE9Ba41422680e2e00537571bcC53efBfD', - lpToken: '0xC25a3A3b969415c80451098fa907EC722572917F', - gauge: '0xA90996896660DEcC6E997655E065b23788857849', - deposit: '0xFCBa3E75865d2d561BE8D220616520c171F12851', - }, - hasAMultiplier: false, - isOldPool: true, -}, { - dataIndex: 7, - id: 'ren', - name: 'ren', - lpTokenInfo: { - name: 'renCurve', - symbol: 'renCrv', - }, - coingeckoInfo: { - id: 'renbtc', - symbol: 'RENBTC', - referenceAssetId: 'bitcoin', - }, - assets: 'renBTC+wBTC', - coins: [ - coins.renbtc, - coins.wbtc, - ], - referenceAsset: REFERENCE_ASSETS.BTC, - addresses: { - swap: '0x93054188d876f558f4a66B2EF1d97d16eDf0895B', - lpToken: '0x49849C98ae39Fff122806C06791Fa73784FB3675', - gauge: '0xB1F2cdeC61db658F091671F5f199635aEF202CAC', - adapter: '0x73aB2Bd10aD10F7174a1AD5AFAe3ce3D991C5047', - }, - hasAMultiplier: false, -}, { - dataIndex: 8, - id: 'sbtc', - name: 'sbtc', - lpTokenInfo: { - name: 'sbtcCurve', - symbol: 'sbtcCrv', - }, - coingeckoInfo: { - id: 'sbtc', - symbol: 'SBTC', - referenceAssetId: 'bitcoin', - }, - assets: 'renBTC+wBTC+sBTC', - coins: [ - coins.renbtc, - coins.wbtc, - coins.sbtc, - ], - referenceAsset: REFERENCE_ASSETS.BTC, - oldAdditionalRewards: [{ - name: 'SNX', - rewardTokenCoingeckoId: 'havven', - }], - addresses: { - swap: '0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714', - lpToken: '0x075b1bb99792c9E1041bA13afEf80C91a1e70fB3', - gauge: '0x705350c4BcD35c9441419DdD5d2f097d7a55410F', - stakingRewards: '0x13C1542A468319688B89E323fe9A3Be3A90EBb27', - adapter: '0xAEade605D01FE9a8e9C4B3AA0130A90d62167029', - }, - hasAMultiplier: false, -}, { - dataIndex: 9, - id: 'hbtc', - name: 'hbtc', - lpTokenInfo: { - name: 'hbtcCurve', - symbol: 'hbtcCrv', - }, - coingeckoInfo: { - id: 'huobi-btc', - symbol: 'HBTC', - referenceAssetId: 'bitcoin', - }, - assets: 'hBTC+wBTC', - coins: [ - coins.hbtc, - coins.wbtc, - ], - referenceAsset: REFERENCE_ASSETS.BTC, - addresses: { - swap: '0x4CA9b3063Ec5866A4B82E437059D2C43d1be596F', - lpToken: '0xb19059ebb43466C323583928285a49f558E572Fd', - gauge: '0x4c18E409Dc8619bFb6a1cB56D114C3f592E0aE79', - }, - hasAMultiplier: false, -}, { - dataIndex: 10, - id: '3pool', - name: '3pool', - lpTokenInfo: { - name: '3poolCurve', - symbol: '3poolCrv', - }, - assets: 'DAI+USDC+USDT', - coins: [ - coins.dai, - coins.usdc, - coins.usdt, - ], - addresses: { - swap: '0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7', - lpToken: '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490', - gauge: '0xbFcF63294aD7105dEa65aA58F8AE5BE2D9d0952A', - }, - hasAMultiplier: false, -}, { - dataIndex: 11, - id: 'gusd', - name: 'gusd', - lpTokenInfo: { - name: 'gusdCurve', - symbol: 'gusdCrv', - }, - coingeckoInfo: { - id: 'gemini-dollar', - symbol: 'GUSD', - }, - assets: 'GUSD+3pool', - isMetaPool: true, - coins: [ - coins.gusd, - coins.tricrv, - ], - metaCoins: [ - coins.dai, - coins.usdc, - coins.usdt, - ], - addresses: { - swap: '0x4f062658EaAF2C1ccf8C8e36D6824CDf41167956', - lpToken: '0xD2967f45c4f384DEEa880F807Be904762a3DeA07', - gauge: '0xC5cfaDA84E902aD92DD40194f0883ad49639b023', - deposit: '0x64448B78561690B70E17CBE8029a3e5c1bB7136e', - }, -}, { - dataIndex: 12, - id: 'husd', - name: 'husd', - lpTokenInfo: { - name: 'husdCurve', - symbol: 'husdCrv', - }, - coingeckoInfo: { - id: 'husd', - symbol: 'HUSD', - }, - assets: 'HUSD+3pool', - isMetaPool: true, - coins: [ - coins.husd, - coins.tricrv, - ], - metaCoins: [ - coins.dai, - coins.usdc, - coins.usdt, - ], - addresses: { - swap: '0x3eF6A01A0f81D6046290f3e2A8c5b843e738E604', - lpToken: '0x5B5CFE992AdAC0C9D48E05854B2d91C73a003858', - gauge: '0x2db0E83599a91b508Ac268a6197b8B14F5e72840', - deposit: '0x09672362833d8f703D5395ef3252D4Bfa51c15ca', - }, -}, { - dataIndex: 13, - id: 'usdk', - name: 'usdk', - lpTokenInfo: { - name: 'usdkCurve', - symbol: 'usdkCrv', - }, - coingeckoInfo: { - id: 'usdk', - symbol: 'USDK', - }, - assets: 'USDK+3pool', - isMetaPool: true, - coins: [ - coins.usdk, - coins.tricrv, - ], - metaCoins: [ - coins.dai, - coins.usdc, - coins.usdt, - ], - addresses: { - swap: '0x3E01dD8a5E1fb3481F0F589056b428Fc308AF0Fb', - lpToken: '0x97E2768e8E73511cA874545DC5Ff8067eB19B787', - gauge: '0xC2b1DF84112619D190193E48148000e3990Bf627', - deposit: '0xF1f85a74AD6c64315F85af52d3d46bF715236ADc', - }, -}, { - dataIndex: 14, - id: 'usdn', - name: 'usdn', - lpTokenInfo: { - name: 'usdnCurve', - symbol: 'usdnCrv', - }, - coingeckoInfo: { - id: 'neutrino', - symbol: 'USDN', - }, - assets: 'USDN+3pool', - isMetaPool: true, - coins: [ - coins.usdn, - coins.tricrv, - ], - metaCoins: [ - coins.dai, - coins.usdc, - coins.usdt, - ], - addresses: { - swap: '0x0f9cb53Ebe405d49A0bbdBD291A65Ff571bC83e1', - lpToken: '0x4f3E8F405CF5aFC05D68142F3783bDfE13811522', - gauge: '0xF98450B5602fa59CC66e1379DFfB6FDDc724CfC4', - deposit: '0x094d12e5b541784701FD8d65F11fc0598FBC6332', - }, -}, { - dataIndex: 15, - id: 'linkusd', - name: 'linkusd', - lpTokenInfo: { - name: 'linkusdCurve', - symbol: 'linkusdCrv', - }, - coingeckoInfo: { - id: 'linkusd', - symbol: 'LINKUSD', - }, - assets: 'LINKUSD+3pool', - isMetaPool: true, - coins: [ - coins.linkusd, - coins.tricrv, - ], - metaCoins: [ - coins.dai, - coins.usdc, - coins.usdt, - ], - isRiskier: true, - hasNoGauge: true, - addresses: { - swap: '0xE7a24EF0C5e95Ffb0f6684b813A78F2a3AD7D171', - lpToken: '0x6D65b498cb23deAba52db31c93Da9BFFb340FB8F', - deposit: '0x1de7f0866e2c4adAC7b457c58Cc25c8688CDa1f2', - }, - riskLevel: 3, -}, { - dataIndex: 16, - id: 'musd', - name: 'musd', - lpTokenInfo: { - name: 'musdCurve', - symbol: 'musdCrv', - }, - coingeckoInfo: { - id: 'musd', - symbol: 'MUSD', - }, - assets: 'musd+3pool', - isMetaPool: true, - coins: [ - coins.musd, - coins.tricrv, - ], - metaCoins: [ - coins.dai, - coins.usdc, - coins.usdt, - ], - oldAdditionalRewards: [{ - name: 'MTA', - rewardTokenCoingeckoId: 'meta', - }], - addresses: { - swap: '0x8474DdbE98F5aA3179B3B3F5942D724aFcdec9f6', - lpToken: '0x1AEf73d49Dedc4b1778d0706583995958Dc862e6', - gauge: '0x5f626c30EC1215f4EdCc9982265E8b1F411D1352', - deposit: '0x803A2B40c5a9BB2B86DD630B274Fa2A9202874C2', - }, -}, { - dataIndex: 17, - id: 'rsv', - name: 'rsv', - lpTokenInfo: { - name: 'rsvCurve', - symbol: 'rsvCrv', - }, - coingeckoInfo: { - id: 'reserve', - symbol: 'RSV', - }, - assets: 'rsv+3pool', - isMetaPool: true, - coins: [ - coins.rsv, - coins.tricrv, - ], - metaCoins: [ - coins.dai, - coins.usdc, - coins.usdt, - ], - additionalRewards: [{ - name: 'RSR', - amountDataKey: 'rsrRewards', - rewardTokenCoingeckoId: 'reserve-rights-token', - }], - addresses: { - swap: '0xC18cC39da8b11dA8c3541C598eE022258F9744da', - lpToken: '0xC2Ee6b0334C261ED60C72f6054450b61B8f18E35', - gauge: '0x4dC4A289a8E33600D8bD4cf5F6313E43a37adec7', - deposit: '0xBE175115BF33E12348ff77CcfEE4726866A0Fbd5', - }, -}, { - dataIndex: 18, - id: 'tbtc', - name: 'tbtc', - lpTokenInfo: { - name: 'tbtcCurve', - symbol: 'tbtcCrv', - }, - coingeckoInfo: { - id: 'tbtc', - symbol: 'TBTC', - referenceAssetId: 'bitcoin', - }, - assets: 'tbtc+sbtcCrv', - isMetaPool: true, - coins: [ - coins.tbtc, - coins.sbtccrv, - ], - metaCoins: [ - coins.renbtc, - coins.wbtc, - coins.sbtc, - ], - referenceAsset: REFERENCE_ASSETS.BTC, - oldAdditionalRewards: [{ - name: 'KEEP', - rewardTokenCoingeckoId: 'keep-network', - }], - addresses: { - swap: '0xC25099792E9349C7DD09759744ea681C7de2cb66', - lpToken: '0x64eda51d3Ad40D56b9dFc5554E06F94e1Dd786Fd', - gauge: '0x6828bcF74279eE32f2723eC536c22c51Eed383C6', - deposit: '0xaa82ca713D94bBA7A89CEAB55314F9EfFEdDc78c', - }, -}, { - dataIndex: 19, - id: 'dusd', - name: 'dusd', - lpTokenInfo: { - name: 'dusdCurve', - symbol: 'dusdCrv', - }, - coingeckoInfo: { - id: 'defidollar', - symbol: 'DUSD', - }, - assets: 'dusd+3pool', - isMetaPool: true, - coins: [ - coins.dusd, - coins.tricrv, - ], - metaCoins: [ - coins.dai, - coins.usdc, - coins.usdt, - ], - additionalRewards: [{ - name: 'DFD', - amountDataKey: 'dfdRewards', - rewardTokenCoingeckoId: 'defidollar-dao', - }], - addresses: { - swap: '0x8038C01A0390a8c547446a0b2c18fc9aEFEcc10c', - lpToken: '0x3a664Ab939FD8482048609f652f9a0B0677337B9', - gauge: '0xAEA6c312f4b3E04D752946d329693F7293bC2e6D', - deposit: '0x61E10659fe3aa93d036d099405224E4Ac24996d0', - }, -}, { - dataIndex: 20, - id: 'pbtc', - name: 'pbtc', - lpTokenInfo: { - name: 'pbtcCurve', - symbol: 'pbtcCrv', - }, - coingeckoInfo: { - id: 'ptokens-btc', - symbol: 'PBTC', - referenceAssetId: 'bitcoin', - }, - assets: 'pbtc+sbtcCrv', - isMetaPool: true, - coins: [ - coins.pbtc, - coins.sbtccrv, - ], - metaCoins: [ - coins.renbtc, - coins.wbtc, - coins.sbtc, - ], - referenceAsset: REFERENCE_ASSETS.BTC, - additionalRewards: [{ - name: 'PNT', - amountDataKey: 'pntRewards', - rewardTokenAddress: '0x89Ab32156e46F46D02ade3FEcbe5Fc4243B9AAeD', - rewardTokenDecimals: 18, - rewardTokenCoingeckoId: 'pnetwork', - }], - addresses: { - swap: '0x7F55DDe206dbAD629C080068923b36fe9D6bDBeF', - lpToken: '0xDE5331AC4B3630f94853Ff322B66407e0D6331E8', - gauge: '0xd7d147c6Bb90A718c3De8C0568F9B560C79fa416', - deposit: '0x11F419AdAbbFF8d595E7d5b223eee3863Bb3902C', - }, - gaugeVersion: 2, -}, { - dataIndex: 21, - id: 'bbtc', - name: 'bbtc', - lpTokenInfo: { - name: 'bbtcCurve', - symbol: 'bbtcCrv', - }, - coingeckoInfo: { - referenceAssetId: 'bitcoin', - }, - assets: 'bbtc+sbtcCrv', - isMetaPool: true, - coins: [ - coins.bbtc, - coins.sbtccrv, - ], - metaCoins: [ - coins.renbtc, - coins.wbtc, - coins.sbtc, - ], - referenceAsset: REFERENCE_ASSETS.BTC, - addresses: { - swap: '0x071c661B4DeefB59E2a3DdB20Db036821eeE8F4b', - lpToken: '0x410e3E86ef427e30B9235497143881f717d93c2A', - gauge: '0xdFc7AdFa664b08767b735dE28f9E84cd30492aeE', - deposit: '0xC45b2EEe6e09cA176Ca3bB5f7eEe7C47bF93c756', - }, - gaugeVersion: 2, -}, { - dataIndex: 22, - id: 'obtc', - name: 'obtc', - lpTokenInfo: { - name: 'obtcCurve', - symbol: 'obtcCrv', - }, - coingeckoInfo: { - id: 'boringdao-btc', - symbol: 'OBTC', - referenceAssetId: 'bitcoin', - }, - assets: 'obtc+sbtcCrv', - isMetaPool: true, - coins: [ - coins.obtc, - coins.sbtccrv, - ], - metaCoins: [ - coins.renbtc, - coins.wbtc, - coins.sbtc, - ], - referenceAsset: REFERENCE_ASSETS.BTC, - additionalRewards: [{ - name: 'BOR', - amountDataKey: 'borRewards', - rewardTokenAddress: '0x3c9d6c1C73b31c837832c72E04D3152f051fc1A9', - rewardTokenDecimals: 18, - rewardTokenCoingeckoId: 'boringdao', - }], - addresses: { - swap: '0xd81dA8D904b52208541Bade1bD6595D8a251F8dd', - lpToken: '0x2fE94ea3d5d4a175184081439753DE15AeF9d614', - gauge: '0x11137B10C210b579405c21A07489e28F3c040AB1', - deposit: '0xd5BCf53e2C81e1991570f33Fa881c49EEa570C8D', - }, - gaugeVersion: 2, -}, { - dataIndex: 23, - id: 'ust', - name: 'ust', - lpTokenInfo: { - name: 'ustCurve', - symbol: 'ustCrv', - }, - coingeckoInfo: { - id: 'terrausd', - symbol: 'UST', - }, - assets: 'ust+3pool', - isMetaPool: true, - coins: [ - coins.ust, - coins.tricrv, - ], - metaCoins: [ - coins.dai, - coins.usdc, - coins.usdt, - ], - addresses: { - swap: '0x890f4e345B1dAED0367A877a1612f86A1f86985f', - lpToken: '0x94e131324b6054c0D789b190b2dAC504e4361b53', - gauge: '0x3B7020743Bc2A4ca9EaF9D0722d42E20d6935855', - deposit: '0xB0a0716841F2Fc03fbA72A891B8Bb13584F52F2d', - }, - gaugeVersion: 2, -}, { - dataIndex: 24, - id: 'eurs', - name: 'eurs', - lpTokenInfo: { - name: 'eursCurve', - symbol: 'eursCrv', - }, - coingeckoInfo: { - id: 'stasis-eurs', - symbol: 'EURS', - referenceAssetId: 'stasis-eurs', // Using stasis-eurs as the oracle for EUR/USD - }, - assets: 'eurs+seur', - coins: [ - coins.eurs, - coins.seur, - ], - referenceAsset: REFERENCE_ASSETS.EUR, - oldAdditionalRewards: [{ - name: 'SNX', - rewardTokenAddress: ADDRESSES.ethereum.SNX, - rewardTokenDecimals: 18, - rewardTokenCoingeckoId: 'havven', - }], - addresses: { - swap: '0x0Ce6a5fF5217e38315f87032CF90686C96627CAA', - lpToken: '0x194eBd173F6cDacE046C53eACcE9B953F28411d1', - gauge: '0x90Bb609649E0451E5aD952683D64BD2d1f245840', - }, - gaugeVersion: 2, -}, { - dataIndex: 25, - id: 'seth', - name: 'seth', - lpTokenInfo: { - name: 'sethCurve', - symbol: 'eCrv', - }, - coingeckoInfo: { - id: 'seth', - symbol: 'SETH', - referenceAssetId: 'ethereum', - }, - assets: 'eth+seth', - coins: [ - coins.eth, - coins.seth, - ], - referenceAsset: REFERENCE_ASSETS.ETH, - addresses: { - swap: '0xc5424b857f758e906013f3555dad202e4bdb4567', - lpToken: '0xA3D87FffcE63B53E0d54fAa1cc983B7eB0b74A9c', - gauge: '0x3C0FFFF15EA30C35d7A85B85c0782D6c94e1d238', - }, - gaugeVersion: 2, -}, { - dataIndex: 26, - id: 'aave', - name: 'aave', - lpTokenInfo: { - name: 'aaveCurve', - symbol: 'a3Crv', - }, - coingeckoInfo: { - id: 'aave', - symbol: 'AAVE', - }, - assets: 'aDAI+aUSDC+aUSDT', - coins: [ - coins.adai, - coins.ausdc, - coins.ausdt, - ], - underlyingCoins: [ - coins.dai, - coins.usdc, - coins.usdt, - ], - isLendingPool: true, - isModernLendingPool: true, - addresses: { - swap: '0xDeBF20617708857ebe4F679508E7b7863a8A8EeE', - lpToken: '0xFd2a8fA60Abd58Efe3EeE34dd494cD491dC14900', - gauge: '0xd662908ADA2Ea1916B3318327A97eB18aD588b5d', - }, - gaugeVersion: 2, - additionalRewards: [{ - name: 'STKAAVE', - amountDataKey: 'aaveRewards', - rewardTokenAddress: '0x4da27a545c0c5b758a6ba100e3a049001de870f5', - rewardTokenDecimals: 18, - rewardTokenCoingeckoId: 'aave', - }], -}, { - dataIndex: 27, - id: 'steth', - name: 'steth', - lpTokenInfo: { - name: 'stethCurve', - symbol: 'stethCrv', - }, - coingeckoInfo: { - id: 'staked-ether', - symbol: 'STETH', - referenceAssetId: 'ethereum', - }, - assets: 'eth+steth', - coins: [ - coins.eth, - coins.steth, - ], - referenceAsset: REFERENCE_ASSETS.ETH, - additionalRewards: [{ - name: 'LDO', - amountDataKey: 'ldoRewards', - rewardTokenAddress: ADDRESSES.ethereum.LIDO, - rewardTokenDecimals: 18, - rewardTokenCoingeckoId: 'lido-dao', - }], - addresses: { - swap: '0xDC24316b9AE028F1497c275EB9192a3Ea0f67022', - lpToken: '0x06325440D014e39736583c165C2963BA99fAf14E', - gauge: '0x182B723a58739a9c974cFDB385ceaDb237453c28', - }, - gaugeVersion: 2, -}, { - dataIndex: 28, - id: 'saave', - name: 'saave', - lpTokenInfo: { - name: 'saaveCurve', - symbol: 'saCrv', - }, - coingeckoInfo: { - id: 'aave', - symbol: 'AAVE', - }, - assets: 'aDAI+asUSD', - coins: [ - coins.adai, - coins.asusd, - ], - underlyingCoins: [ - coins.dai, - coins.susd, - ], - isLendingPool: true, - isModernLendingPool: true, - addresses: { - swap: '0xEB16Ae0052ed37f479f7fe63849198Df1765a733', - lpToken: '0x02d341CcB60fAaf662bC0554d13778015d1b285C', - gauge: '0x462253b8F74B72304c145DB0e4Eebd326B22ca39', - }, - gaugeVersion: 2, - additionalRewards: [{ - key: 'STKAAVES', - name: 'STKAAVE', - amountDataKey: 'saaveRewards', - rewardTokenAddress: '0x4da27a545c0c5b758a6ba100e3a049001de870f5', - rewardTokenDecimals: 18, - rewardTokenCoingeckoId: 'aave', - }], -}, { - dataIndex: 29, - id: 'ankreth', - name: 'ankreth', - lpTokenInfo: { - name: 'ankrethCurve', - symbol: 'aethCrv', - }, - coingeckoInfo: { - id: 'ankreth', - symbol: 'AETH', - referenceAssetId: 'ethereum', - }, - assets: 'eth+ankreth', - coins: [ - coins.eth, - coins.ankreth, - ], - referenceAsset: REFERENCE_ASSETS.ETH, - additionalRewards: [{ - name: 'ANKR', - amountDataKey: 'ankrRewards', - rewardTokenAddress: '0x8290333cef9e6d528dd5618fb97a76f268f3edd4', - rewardTokenDecimals: 18, - rewardTokenCoingeckoId: 'ankr', - }, { - name: 'ONX', - amountDataKey: 'onxRewards', - rewardTokenAddress: '0xe0ad1806fd3e7edf6ff52fdb822432e847411033', - rewardTokenDecimals: 18, - rewardTokenCoingeckoId: 'onx-finance', - }], - addresses: { - swap: '0xA96A65c051bF88B4095Ee1f2451C2A9d43F53Ae2', - lpToken: '0xaA17A236F2bAdc98DDc0Cf999AbB47D47Fc0A6Cf', - gauge: '0x6d10ed2cf043e6fcf51a0e7b4c2af3fa06695707', - }, - gaugeVersion: 2, -}, { - dataIndex: 30, - id: 'usdp', - name: 'usdp', - lpTokenInfo: { - name: 'usdpCurve', - symbol: 'usdpCrv', - }, - coingeckoInfo: { - id: 'usdp', - symbol: 'USDP', - }, - assets: 'usdp+3pool', - isMetaPool: true, - coins: [ - coins.usdp, - coins.tricrv, - ], - metaCoins: [ - coins.dai, - coins.usdc, - coins.usdt, - ], - addresses: { - swap: '0x42d7025938bEc20B69cBae5A77421082407f053A', - lpToken: '0x7Eb40E450b9655f4B3cC4259BCC731c63ff55ae6', - gauge: '0x055be5DDB7A925BfEF3417FC157f53CA77cA7222', - deposit: '0x3c8cAee4E09296800f8D29A68Fa3837e2dae4940', - }, - gaugeVersion: 2, -}, { - dataIndex: 31, - id: 'ib', - name: 'ironbank', - lpTokenInfo: { - name: 'ibCurve', - symbol: 'ib3Crv', - }, - coingeckoInfo: { - id: 'cream-2', - symbol: 'CREAM', - }, - assets: 'cyDAI+cyUSDC+cyUSDT', - coins: [ - coins.cydai, - coins.cyusdc, - coins.cyusdt, - ], - underlyingCoins: [ - coins.dai, - coins.usdc, - coins.usdt, - ], - isLendingPool: true, - isModernLendingPool: true, - addresses: { - swap: '0x2dded6Da1BF5DBdF597C45fcFaa3194e53EcfeAF', - lpToken: '0x5282a4eF67D9C33135340fB3289cc1711c13638C', - gauge: '0xF5194c3325202F456c95c1Cf0cA36f8475C1949F', - }, - gaugeVersion: 2, -}, { - dataIndex: 32, - id: 'link', - name: 'link', - lpTokenInfo: { - name: 'linkCurve', - symbol: 'linkCrv', - }, - coingeckoInfo: { - id: 'chainlink', - symbol: 'LINK', - referenceAssetId: 'chainlink', - }, - referenceAsset: REFERENCE_ASSETS.LINK, - assets: 'LINK+sLINK', - coins: [ - coins.link, - coins.slink, - ], - addresses: { - swap: '0xF178C0b5Bb7e7aBF4e12A4838C7b7c5bA2C623c0', - lpToken: '0xcee60cfa923170e4f8204ae08b4fa6a3f5656f3a', - gauge: '0xfd4d8a17df4c27c1dd245d153ccf4499e806c87d', - }, - gaugeVersion: 2, -}, { - dataIndex: 33, - id: 'tusd', - name: 'tusd', - lpTokenInfo: { - name: 'tusdCurve', - symbol: 'tusdCrv', - }, - assets: 'tusd+3pool', - isMetaPool: true, - coins: [ - coins.tusd, - coins.tricrv, - ], - metaCoins: [ - coins.dai, - coins.usdc, - coins.usdt, - ], - addresses: { - swap: '0xecd5e75afb02efa118af914515d6521aabd189f1', - lpToken: '0xecd5e75afb02efa118af914515d6521aabd189f1', - gauge: '0x359FD5d6417aE3D8D6497d9B2e7A890798262BA4', - deposit: '0xA79828DF1850E8a3A3064576f380D90aECDD3359', - }, - gaugeVersion: 2, -},{ - dataIndex: 34, - id: 'frax', - name: 'frax', - lpTokenInfo: { - name: 'fraxCurve', - symbol: 'fraxCrv', - }, - coingeckoInfo: { - id: 'frax', - symbol: 'FRAX', - }, - assets: 'frax+3pool', - isMetaPool: true, - coins: [ - coins.frax, - coins.tricrv, - ], - metaCoins: [ - coins.dai, - coins.usdc, - coins.usdt, - ], - addresses: { - swap: '0xd632f22692FaC7611d2AA1C0D552930D43CAEd3B', - lpToken: '0xd632f22692FaC7611d2AA1C0D552930D43CAEd3B', - deposit: '0xA79828DF1850E8a3A3064576f380D90aECDD3359', - gauge: '0x72e158d38dbd50a483501c24f792bdaaa3e7d55c' - }, - isRiskier: true, - riskLevel: 2, - },{ - dataIndex: 35, - id: 'lusd', - name: 'lusd', - lpTokenInfo: { - name: 'lusdCurve', - symbol: 'lusdCrv', - }, - coingeckoInfo: { - id: 'liquity-usd', - symbol: 'LUSD', - }, - assets: 'lusd+3pool', - isMetaPool: true, - coins: [ - coins.lusd, - coins.tricrv, - ], - metaCoins: [ - coins.dai, - coins.usdc, - coins.usdt, - ], - addresses: { - swap: '0xEd279fDD11cA84bEef15AF5D39BB4d4bEE23F0cA', - lpToken: '0xEd279fDD11cA84bEef15AF5D39BB4d4bEE23F0cA', - deposit: '0xA79828DF1850E8a3A3064576f380D90aECDD3359', - gauge: '0x9b8519a9a00100720ccdc8a120fbed319ca47a14' - }, - additionalRewards: [{ - name: 'LQTY', - amountDataKey: 'lqtyRewards', - rewardTokenCoingeckoId: 'liquity', - rewardTokenAddress: '0x6dea81c8171d0ba574754ef6f8b412f2ed88c54d', - rewardTokenDecimals: 18, - }], - gaugeVersion: 2, - },{ - dataIndex: 36, - id: 'busdv2', - name: 'busdv2', - lpTokenInfo: { - name: 'busdCurve', - symbol: 'busdCrv', - }, - coingeckoInfo: { - id: 'binance-usd', - symbol: 'BUSD', - }, - assets: 'busd+3pool', - isMetaPool: true, - coins: [ - coins.busd, - coins.tricrv, - ], - metaCoins: [ - coins.dai, - coins.usdc, - coins.usdt, - ], - addresses: { - swap: '0x4807862AA8b2bF68830e4C8dc86D0e9A998e085a', - lpToken: '0x4807862AA8b2bF68830e4C8dc86D0e9A998e085a', - gauge: '0xd4b22fedca85e684919955061fdf353b9d38389b', - deposit: '0xA79828DF1850E8a3A3064576f380D90aECDD3359', - }, - gaugeVersion: 2, - },{ - dataIndex: 37, - id: 'tricrypto', - name: 'TriCrypto', - lpTokenInfo: { - name: '3CrvCrypto', - symbol: '3CrvCrypto', - }, - assets: 'usdt+weth+wbtc', - coins: [ - coins.usdt, - coins.wbtc, - coins.weth, - ], - addresses: { - swap: '0x80466c64868E1ab14a1Ddf27A676C3fcBE638Fe5', - lpToken: '0xcA3d75aC011BF5aD07a98d02f18225F9bD9A6BDF', - }, - gaugeVersion: 2, - hasNoGauge: true, - cryptoPool: true - },{ - dataIndex: 38, - id: 'alusd', - name: 'alisd', - lpTokenInfo: { - name: 'alusdCurve', - symbol: 'alusdCrv', - }, - coingeckoInfo: { - id: 'alchemix-usd', - symbol: 'ALUSD', - }, - assets: 'alusd+3pool', - isMetaPool: true, - coins: [ - coins.alusd, - coins.tricrv, - ], - metaCoins: [ - coins.dai, - coins.usdc, - coins.usdt, - ], - addresses: { - swap: '0x43b4FdFD4Ff969587185cDB6f0BD875c5Fc83f8c', - lpToken: '0x43b4FdFD4Ff969587185cDB6f0BD875c5Fc83f8c', - gauge: '0x9582C4ADACB3BCE56Fea3e590F05c3ca2fb9C477', - deposit: '0xA79828DF1850E8a3A3064576f380D90aECDD3359', - }, - gaugeVersion: 2, - }, { - dataIndex: 39, - id: 'reth', - name: 'reth', - lpTokenInfo: { - name: 'rethCurve', - symbol: 'rethCrv', - }, - coingeckoInfo: { - id: 'reth', - symbol: 'RETH', - referenceAssetId: 'ethereum', - }, - assets: 'eth+reth', - coins: [ - coins.eth, - coins.reth, - ], - referenceAsset: REFERENCE_ASSETS.ETH, - additionalRewards: [{ - name: 'FIS', - amountDataKey: 'rethRewards', - rewardTokenAddress: '0xef3A930e1FfFFAcd2fc13434aC81bD278B0ecC8d', - rewardTokenDecimals: 18, - rewardTokenCoingeckoId: 'stafi', - }], - addresses: { - swap: '0xF9440930043eb3997fc70e1339dBb11F341de7A8', - lpToken: '0x53a901d48795C58f485cBB38df08FA96a24669D5', - gauge: '0x824F13f1a2F29cFEEa81154b46C0fc820677A637', - }, - gaugeVersion: 2, - } - - ]; diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 1aacadb38c1b..65688258c23e 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -19,6 +19,7 @@ "DAI": "0x6b175474e89094c44da98b954eedeac495271d0f", "SAI": "0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359", "SDAI": "0x83f20f44975d03b1b09e64809b757c47f942beea", + "FXS": "0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0", "cvxFXS": "0xfeef77d3f69374f66429c91d732a244f074bdf74", "cvxCRV": "0x62B9c7356A2Dc64a1969e19C23e4f579F9810Aa7", "vlCVX": "0x72a19342e8f1838460ebfccef09f6585e32db86e", @@ -49,6 +50,8 @@ "AEVO": "0xB528edBef013aff855ac3c50b381f253aF13b997", "STONE": "0x4d831e22f062b5327dfdb15f0b6a5df20e2e3dd0", "USDM": "0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C", + "PRISMA": "0xdA47862a83dac0c112BA89c6abC2159b95afd71C", + "FXN": "0x365accfca291e7d3914637abf1f7635db165bb09", "USDe": "0x4c9edd5852cd905f086c759e8383e09bff1e68b3" }, "fantom": { @@ -1837,4 +1840,4 @@ "USDT": "ct_2AiMceYFXnUdA6A9Lu2ZQ2tr2TpfbGVfkxLfBnceoWgHTKZYvc", "USDC": "ct_U1i8dzJTVWdnU2cv59TZQfLFpLfjqf7MQQC5ygSMKphn8Yew2" } -} \ No newline at end of file +} diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index 3be5849ca689..6b00196ff199 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -351,7 +351,8 @@ async function unwrapSlipstreamNFT({ balances, owner, nftAddress, block, chain = positions.forEach(position => lpInfo[getKey(position)] = position) const lpInfoArray = Object.values(lpInfo) - const poolInfos = (await sdk.api.abi.multiCall({block, chain, + const poolInfos = (await sdk.api.abi.multiCall({ + block, chain, abi: slipstreamNftABI.getPool, target: factory, calls: lpInfoArray.map((info) => ({ params: [info.token0, info.token1, info.tickSpacing] })), })).output.map(positionsCall => positionsCall.output) @@ -615,6 +616,7 @@ const cvx_abi = { cvxBRP_userRewardPerTokenPaid: "function userRewardPerTokenPaid(address) view returns (uint256)", cvxBRP_stakingToken: "address:stakingToken", cvxBooster_poolInfo: "function poolInfo(uint256) view returns (address lptoken, address token, address gauge, address crvRewards, address stash, bool shutdown)", + cvxFraxFarm_lockedLiquidityOf: "function lockedLiquidityOf(address) view returns (uint256)", } const cvxBoosterAddress = "0xF403C135812408BFbE8713b5A23a04b3D48AAE31"; @@ -630,7 +632,7 @@ async function genericUnwrapCvx(balances, holder, cvx_BaseRewardPool, block, cha params: [holder], chain, block }), - // const {output: pool_id} = await + // const {output: pool_id} = await sdk.api.abi.call({ abi: cvx_abi['cvxBRP_pid'], target: cvx_BaseRewardPool, @@ -668,6 +670,43 @@ async function genericUnwrapCvxRewardPool({ api, owner, pool, balances }) { return balances } +async function genericUnwrapCvxFraxFarm({ api, owner, farm, balances }) { + if (!balances) balances = await api.getBalances() + const [bal, fraxToken] = await api.batchCall([ + { target: farm, params: owner, abi: cvx_abi.cvxFraxFarm_lockedLiquidityOf }, + { target: farm, abi: 'address:stakingToken' }, + ]) + const [curveToken] = await api.batchCall([ + { target: fraxToken, abi: 'address:curveToken' }, + ]) + sdk.util.sumSingleBalance(balances, curveToken, bal, api.chain) + return balances +} + + +async function genericUnwrapCvxPrismaPool({ api, owner, pool, balances }) { + if (!balances) balances = await api.getBalances() + const [bal, cToken] = await api.batchCall([ + { target: pool, params: owner, abi: 'erc20:balanceOf' }, + { target: pool, abi: 'address:lpToken' }, + ]) + sdk.util.sumSingleBalance(balances, cToken, bal, api.chain) + return balances +} + +async function genericUnwrapCvxCurveLendRewardPool({ api, owner, rewardsContract, lendVault, balances }) { + if (!balances) balances = await api.getBalances() + + const [bal, asset, pricePerShare] = await api.batchCall([ + { target: rewardsContract, params: owner, abi: 'erc20:balanceOf' }, + { target: lendVault, abi: 'address:asset' }, + { target: lendVault, abi: 'uint256:pricePerShare' }, + ]) + const balance = BigNumber(bal).times(pricePerShare).div(1e18).toFixed(0) + sdk.util.sumSingleBalance(balances, asset, balance, api.chain) + return balances +} + async function unwrapLPsAuto({ api, balances, block, chain = "ethereum", transformAddress, excludePool2 = false, onlyPool2 = false, pool2Tokens = [], blacklistedLPs = [], abis = {} }) { if (api) { chain = api.chain ?? chain @@ -875,7 +914,7 @@ async function sumTokens2({ if (resolveUniV3 || uniV3nftsAndOwners.length || Object.keys(uniV3ExtraConfig).length) await unwrapUniswapV3NFTs({ balances, chain, block, owner, owners, blacklistedTokens, whitelistedTokens: uniV3WhitelistedTokens, nftsAndOwners: uniV3nftsAndOwners, uniV3ExtraConfig, }) - + if (resolveSlipstream) await unwrapSlipstreamNFTs({ balances, chain, block, owner, owners, blacklistedTokens, whitelistedTokens: uniV3WhitelistedTokens, nftsAndOwners: uniV3nftsAndOwners, uniV3ExtraConfig, }) @@ -1089,6 +1128,9 @@ module.exports = { sumTokensExport, genericUnwrapCvxDeposit, genericUnwrapCvxRewardPool, + genericUnwrapCvxFraxFarm, + genericUnwrapCvxPrismaPool, + genericUnwrapCvxCurveLendRewardPool, unwrapMakerPositions, unwrap4626Tokens, unwrapConvexRewardPools, diff --git a/projects/treasury/convex.js b/projects/treasury/convex.js index f7aafb92a096..61d5bbf6ec5e 100644 --- a/projects/treasury/convex.js +++ b/projects/treasury/convex.js @@ -1,32 +1,75 @@ const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress, treasuryExports } = require("../helper/treasury"); +const { staking } = require("../helper/staking"); +const { mergeExports } = require('../helper/utils'); +const { + genericUnwrapCvxRewardPool, + genericUnwrapCvxFraxFarm, + genericUnwrapCvxPrismaPool, + genericUnwrapCvxCurveLendRewardPool, +} = require('../helper/unwrapLPs'); const convexTreasuryVault = "0x1389388d01708118b497f59521f6943Be2541bb7"; -const treasuryARB = "0x6111abf720051309012fcdbc2910054e41dcff8c" -module.exports = treasuryExports({ +const treasuryManagerPositions = [{ + type: 'convex-curve-lp', + manager: '0xa25B17D7deEE59f9e326e45cC3C0C1B158E74316', // #1 + curveLpStakingContract: '0x39D78f11b246ea4A1f68573c3A5B64E83Cff2cAe', // cvxCRV/CRV +}, { + type: 'convex-curve-lp', + manager: '0xeB8121b44a290eE16981D87B92fc16b2366dE6B3', // #2 + curveLpStakingContract: '0x19F3C877eA278e61fE1304770dbE5D78521792D2', // cvxFXS/FXS +}, { + type: 'convex-frax-curve-lp', + manager: '0x9d464B601f74C8d3d42379921106B907F1055F80', // #3 + fraxCurveLpStakingContract: '0xb01BaB994b52A37a231551f00a1B7cAcd43bc8C9', // frxETH/CVX + vaultAddress: '0x56f08393ff2e4E6b89E130646C6E7F52Af3499e5', +}, { + type: 'convex-fx-curve-lp', + manager: '0x8BE4Ec802E8Ad5Ebf8324FC81aEa03980457eDcC', // #4 + fxGauge: '0xfEFafB9446d84A9e58a3A2f2DDDd7219E8c94FbB', // FXN/cvxFXN + vaultAddress: '0x83dcBF8B0E90343FbE148F221e8f243bd16eCF46', +}, { + type: 'convex-prisma-curve-lp', + manager: '0xD60cd4AD7A2D6bF4eC9fccbCAeec769b52726dfd', // #5 + prismaLpStakingContract: '0xd91fBa4919b7BF3B757320ea48bA102F543dE341', // cvxPRISMA/PRISMA +}, { + type: 'convex-curve-lend-lp', + manager: '0x04Dd97255ddeE29c941D85F5B5cdE6ace8BD207f', // #6 + curveLpStakingContract: '0x68e400d058D4c0066344D1B3F392878e993B38Ab', // cvxCRV/CRV + lendVault: '0x4a7999c55d3a93dAf72EA112985e57c2E3b9e95D', +}] + +async function tvl(api) { + for (const treasuryManagerPosition of treasuryManagerPositions) { + if (treasuryManagerPosition.type === 'convex-curve-lp') { + const { manager, curveLpStakingContract } = treasuryManagerPosition; + await genericUnwrapCvxRewardPool({ api, owner: manager, pool: curveLpStakingContract }); + } else if (treasuryManagerPosition.type === 'convex-frax-curve-lp') { + const { vaultAddress, fraxCurveLpStakingContract } = treasuryManagerPosition; + await genericUnwrapCvxFraxFarm({ api, owner: vaultAddress, farm: fraxCurveLpStakingContract }); + } else if (treasuryManagerPosition.type === 'convex-fx-curve-lp') { + const { vaultAddress, fxGauge } = treasuryManagerPosition; + await genericUnwrapCvxRewardPool({ api, owner: vaultAddress, pool: fxGauge }); + } else if (treasuryManagerPosition.type === 'convex-prisma-curve-lp') { + const { manager, prismaLpStakingContract } = treasuryManagerPosition; + await genericUnwrapCvxPrismaPool({ api, owner: manager, pool: prismaLpStakingContract }); + } else if (treasuryManagerPosition.type === 'convex-curve-lend-lp') { + const { manager, curveLpStakingContract, lendVault } = treasuryManagerPosition; + await genericUnwrapCvxCurveLendRewardPool({ api, owner: manager, rewardsContract: curveLpStakingContract, lendVault }); + } + } + return api.getBalances() +} + +module.exports = mergeExports([treasuryExports({ ethereum: { - tokens: [ - nullAddress, - ADDRESSES.ethereum.CRV, - ADDRESSES.ethereum.SNX, - "0x31429d1856aD1377A8A0079410B297e1a9e214c2", // ANGLE - ADDRESSES.ethereum.LIDO, - "0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF", // ALCX - "0x92E187a03B6CD19CB6AF293ba17F2745Fd2357D5", // DUCK - ADDRESSES.ethereum.FTM, - "0x3472A5A71965499acd81997a54BBA8D852C6E53d", // BADGER - "0xa3BeD4E1c75D00fa6f4E5E6922DB7261B5E9AcD2", // MTA - "0x8207c1FfC5B6804F6024322CcF34F29c3541Ae26", // OGN - "0xCdF7028ceAB81fA0C6971208e83fa7872994beE5", // T - ], owners: [convexTreasuryVault], - ownTokens: [ADDRESSES.ethereum.CVX, ADDRESSES.ethereum.cvxCRV], + ownTokens: [ADDRESSES.ethereum.CVX], }, - arbitrum: { - tokens: [ - nullAddress, - ], - owners: [treasuryARB], +}), { + timetravel: false, // treasuryManagerPositions match the latest contracts and positions, so wouldn't work nor be accurate for past blocks + ethereum: { + tvl, }, -}); +}]); From 538d2483a6bd531075eb20022cbd1cd77f1f550d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vuka=C5=A1in=20Manojlovi=C4=87?= Date: Tue, 2 Jul 2024 21:05:32 +0200 Subject: [PATCH 553/855] Add new DAI to Nostra Money Market (#10841) * Add new DAI to Nostra Money Market * Update coreAssets.json --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/coreAssets.json | 1 + projects/nostra/index.js | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 65688258c23e..decd7fde7756 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1263,6 +1263,7 @@ "starknet": { "STRK": "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d", "DAI": "0x00da114221cb83fa859dbdb4c44beeaa0bb37c7537ad5ae66fe5e0efd20e6eb3", + "DAI_1": "0x05574eb6b8789a91466f902c380d978e472db68170ff82a5b650b95a58ddf4ad", "USDC": "0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8", "USDT": "0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8", "WBTC": "0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac", diff --git a/projects/nostra/index.js b/projects/nostra/index.js index f30b87d7a468..e8034e051c19 100644 --- a/projects/nostra/index.js +++ b/projects/nostra/index.js @@ -17,7 +17,7 @@ const supplyTokens = [ "0x05dcd26c25d9d8fd9fc860038dcb6e4d835e524eb8a85213a8cda5b7fff845f6", "0x06eda767a143da12f70947192cd13ee0ccc077829002412570a88cd6539c1d85", "0x05f296e1b9f4cf1ab452c218e72e02a8713cee98921dad2d3b5706235e128ee4", - // DAI + // DAIv0 "0x022ccca3a16c9ef0df7d56cbdccd8c4a6f98356dfd11abc61a112483b242db90", "0x04f18ffc850cdfa223a530d7246d3c6fc12a5969e0aa5d4a88f470f5fe6c46e9", "0x02b5fd690bb9b126e3517f7abfb9db038e6a69a068303d06cf500c49c1388e20", @@ -57,6 +57,11 @@ const supplyTokens = [ "0x6f8ad459c712873993e9ffb9013a469248343c3d361e4d91a8cac6f98575834", "0x2589fc11f60f21af6a1dda3aeb7a44305c552928af122f2834d1c3b1a7aa626", "0x46ab56ec0c6a6d42384251c97e9331aa75eb693e05ed8823e2df4de5713e9a4", + // DAI + "0x0184dd6328115c2d5f038792e427f3d81d9552e40dd675e013ccbf74ba50b979", + "0x036e722e04ef2ccadb9229b5415272353aaeb9554c989b83d4d932dba8dbe8f9", + "0x065bde349f553cf4bdd873e54cd48317eda0542764ebe5ba46984cedd940a5e4", + "0x000215cbd38a1e765cfd2c60bcb291c9d0b0bb7e7f56f682f0d3501303586185", ]; const debtTokens = [ "0x0491480f21299223b9ce770f23a2c383437f9fbf57abc2ac952e9af8cdb12c97", @@ -70,6 +75,7 @@ const debtTokens = [ "0x292be6baee291a148006db984f200dbdb34b12fb2136c70bfe88649c12d934b", "0x4b036839a8769c04144cc47415c64b083a2b26e4a7daa53c07f6042a0d35792", "0x3e0576565c1b51fcac3b402eb002447f21e97abb5da7011c0a2e0b465136814", + "0x06726ec97bae4e28efa8993a8e0853bd4bad0bd71de44c23a1cd651b026b00e7", ]; function* chunks(arr, n) { From e80eb6cbd172cd00def03dfb9f73b92bf13e1837 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 2 Jul 2024 22:24:15 +0300 Subject: [PATCH 554/855] degen: track weth --- projects/helper/tokenMapping.js | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 5fd036cb3a42..a6227d6a575a 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -45,6 +45,9 @@ const fixBalancesTokens = { [ADDRESSES.q.ELK]: { coingeckoId: "elk-finance", decimals: 18 }, [ADDRESSES.q.WETH]: { coingeckoId: "ethereum", decimals: 18 }, }, + degen: { + '0xf058eb3c946f0eaeca3e6662300cb01165c64ede': { coingeckoId: 'ethereum', decimals: 18 }, + }, stacks: { "SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.token-vlqstx::vlqstx": { coingeckoId: "blockstack", decimals: 6 }, "SP2XD7417HGPRTREMKF748VNEQPDRR0RMANB7X1NK.token-abtc::bridged-btc": { coingeckoId: "xlink-bridged-btc-stacks", decimals: 8 }, @@ -66,17 +69,6 @@ const fixBalancesTokens = { [nullAddress]: { coingeckoId: "endurance", decimals: 18 }, '0x85119527cf38f6ccf7b1b8f8fad05145358aaa81': { coingeckoId: "endurance", decimals: 18 }, }, - xlayer: { - '0x0000000000000000000000000000000000000000': { coingeckoId: "okb", decimals: 18 }, - }, - ontology_evm: { - [nullAddress]: { coingeckoId: "ontology", decimals: 18 }, - '0x219cc8e994ea6b35cdcffb5d44e229325d5ad02a': { coingeckoId: "ontology", decimals: 9 }, - '0x72b0f5612802d473a13716db71a0348bcf631d98': { coingeckoId: "tether", decimals: 6 }, - '0xae834526aa3b70de9b34f81c4bf51bc2c80a5473': { coingeckoId: "usd-coin", decimals: 6 }, - '0xfcad47c29551c7691398776c8fa73287c8fa8ec0': { coingeckoId: "wrapped-bitcoin", decimals: 8 }, - '0xd18f97592a1adf4fa18d041abb7bd89491d3a8be': { coingeckoId: "ethereum", decimals: 18 }, - }, massa: { 'AS12U4TZfNK7qoLyEERBBRDMu8nm5MKoRzPXDXans4v9wdATZedz9': { coingeckoId: 'wrapped-massa', decimals: 9 }, 'AS1hCJXjndR4c9vekLWsXGnrdigp4AaZ7uYG3UKFzzKnWVsrNLPJ': { coingeckoId: 'massa-bridged-usdc-massa', decimals: 6 }, From 6fb6bb0cf3cd6b95a207797c9d52da2d155734df Mon Sep 17 00:00:00 2001 From: sotach1 Date: Tue, 2 Jul 2024 21:34:36 +0200 Subject: [PATCH 555/855] add stip&flip in the project list (#10849) * add stip&flip in the project list * add oracle to the TVL * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/stipflip/index.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 projects/stipflip/index.js diff --git a/projects/stipflip/index.js b/projects/stipflip/index.js new file mode 100644 index 000000000000..8fab0c6fcdf9 --- /dev/null +++ b/projects/stipflip/index.js @@ -0,0 +1,25 @@ +const { getLogs2 } = require('../helper/cache/getLogs') +const ADDRESSES = require('../helper/coreAssets.json') +const { uniV3Export } = require('../helper/uniswapV3') + +async function tvl(api) { + const logs = await getLogs2({ + api, + factory: '0x352Cea820fAE79016490518b20f1FD4F53bC56Af', + eventAbi: 'event SynthCreated(address indexed oracle, address indexed synth, bool long)', + fromBlock: 20172088, + }) + const synths = logs.map(log => log.synth) + await api.sumTokens({ owners: synths, tokens: [ADDRESSES.null] }) + const uniTvl = uniV3Export({ + ethereumclassic: { blacklistedTokens: synths.concat(['0xf09ace63aa1345882a1ca200b7243f5786eb177b']), factory: '0xaCc703c9C8248a141113C672ea71d196E8118210', fromBlock: 20130563, } + }).ethereumclassic.tvl + + return uniTvl(api) +} + +module.exports = { + ethereumclassic: { + tvl, + }, +}; From c892a661cc62e9f5c51d5d9278612575e65a8fc8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 2 Jul 2024 22:47:24 +0300 Subject: [PATCH 556/855] Xei (#10853) * add xei * add xei * fix * code refactor --------- Co-authored-by: vulntor <22735155+algtm@users.noreply.github.com> --- projects/helper/coreAssets.json | 1 + projects/helper/tokenMapping.js | 3 ++- projects/xei/index.js | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 projects/xei/index.js diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index decd7fde7756..d285eddbeefe 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1470,6 +1470,7 @@ }, "sei": { "SEI": "usei", + "WSEI": "0xE30feDd158A2e3b13e9badaeABaFc5516e95e8C7", "WETH": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/4tLQqCLaoKKfNFuPjA9o39YbKUwhR1F8N29Tz3hEbfP2", "USDCet": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/Hq4tuDzhRBnxw3tFA5n6M52NVMVcC19XggbyDiJKCD6H", "USDCso": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/9fELvUhFo6yWL34ZaLgPbCPzdk9MD1tAzMycgH45qShH", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index a6227d6a575a..6ae2d4f5e47c 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -175,7 +175,8 @@ const fixBalancesTokens = { '0xb75d0b03c06a926e488e2659df1a861f860bd3d1': { coingeckoId: 'tether', decimals: 6 }, [ADDRESSES.null]: { coingeckoId: 'sei-network', decimals: 18 }, '0x160345fc359604fc6e70e3c5facbde5f7a9342d8': { coingeckoId: 'ethereum', decimals: 18 }, - '0xe30fedd158a2e3b13e9badaeabafc5516e95e8c7': { coingeckoId: 'sei-network', decimals: 18 }, + '0x5cf6826140c1c56ff49c808a1a75407cd1df9423': { coingeckoId: 'silo-staked-sei', decimals: 6 }, + [ADDRESSES.sei.WSEI]: { coingeckoId: 'sei-network', decimals: 18 }, }, core: { '0x5832f53d147b3d6cd4578b9cbd62425c7ea9d0bd': { coingeckoId: 'wrapped-bitcoin', decimals: 8 }, diff --git a/projects/xei/index.js b/projects/xei/index.js new file mode 100644 index 000000000000..fe08b8c3f913 --- /dev/null +++ b/projects/xei/index.js @@ -0,0 +1,14 @@ +const { getConfig } = require('../helper/cache') +const { sumTokens2 } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') + +async function tvl(api) { + const { data } = await getConfig('xei', 'https://app.xei.finance/indexer/1329/xei/poolList?page=1&pageSize=999') + const transformToken = i => i === ADDRESSES.null ? ADDRESSES.sei.WSEI : i + const ownerTokens = data.list.map(({ detail: i }) => ([[i.Token0, i.Token1].map(transformToken), i.Pool])) + return sumTokens2({ api, ownerTokens, }) +} + +module.exports = { + sei: { tvl }, +} \ No newline at end of file From a62bd3fb8e386d84747dc58edd53166effb74ad4 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 3 Jul 2024 00:01:26 +0300 Subject: [PATCH 557/855] fix broken adapters --- projects/blueshift/index.js | 2 + projects/brightside/index.js | 1 + projects/dehive/abi.json | 13 -- projects/dehive/assetsInfo.js | 419 ---------------------------------- projects/dehive/index.js | 366 ++++++----------------------- projects/stafi/index.js | 41 ++-- 6 files changed, 89 insertions(+), 753 deletions(-) delete mode 100644 projects/dehive/abi.json delete mode 100644 projects/dehive/assetsInfo.js diff --git a/projects/blueshift/index.js b/projects/blueshift/index.js index 2903fd214746..734f6b54d3c6 100644 --- a/projects/blueshift/index.js +++ b/projects/blueshift/index.js @@ -5,6 +5,7 @@ const { registry, manualPool, blueschain, } = require("./config.json"); async function staking(api) { const chain = api.chain + if (chain === 'milkomeda_a1') return {} if (!manualPool[chain]) return {} const value = await api.call({ abi: abi.BlueshiftEarning.getAccDeposit, target: manualPool[chain], }) const tokenAddress = await api.call({ abi: abi.BlueshiftEarning.getToken, target: manualPool[chain], }) @@ -14,6 +15,7 @@ async function staking(api) { async function tvl(api) { const chain = api.chain + if (chain === 'milkomeda_a1') return {} const { reserve, tokens } = blueschain[chain] ?? {} // Blueschain reserves diff --git a/projects/brightside/index.js b/projects/brightside/index.js index d2d2d91d7d9a..34737f3d02d7 100644 --- a/projects/brightside/index.js +++ b/projects/brightside/index.js @@ -1,6 +1,7 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { + deadFrom: '04-04-2024', // chain is shutting down misrepresentedTokens: true, milkomeda_a1: { tvl: getUniTVL({ diff --git a/projects/dehive/abi.json b/projects/dehive/abi.json deleted file mode 100644 index dc64d452a845..000000000000 --- a/projects/dehive/abi.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "poolInfo": "function poolInfo(uint256) view returns (address assetToken, uint256 lastRewardBlock, uint256 poolSupply, bool paused)", - "totalSupply": "uint256:totalSupply", - "balanceOf": "function balanceOf(address account) view returns (uint256)", - "getUnderlyingsAmountsFromClusterAmount": "function getUnderlyingsAmountsFromClusterAmount(uint256 _clusterAmount) view returns (uint256[])", - "getUnderlyings": "address[]:getUnderlyings", - "impulseMultiPoolInfo": "function poolInfo(uint256) view returns (address assetToken, uint256 lastRewardBlock, uint256 poolSupply, bool paused, address strategy)", - "wantLockedTotal": "uint256:wantLockedTotal", - "listUnderlying": "address[]:listUnderlying", - "wantPriceInUnderlying": "function wantPriceInUnderlying(uint256 _wantAmt) view returns (uint256[])", - "wantPriceInUsd": "function wantPriceInUsd(uint256 _wantAmt) view returns (uint256)", - "usdToken": "address:usdToken" -} \ No newline at end of file diff --git a/projects/dehive/assetsInfo.js b/projects/dehive/assetsInfo.js deleted file mode 100644 index c68fa859450a..000000000000 --- a/projects/dehive/assetsInfo.js +++ /dev/null @@ -1,419 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -// Auto generated at 9-2-2022 16:14 -module.exports = { - 'ethereum' : [ - {//DHV (solo) - meta: { - stakingAddress: '0x04595f9010F79422a9b411ef963e4dd1F7107704', // StakingDHV - tokenAddress: '0x62Dc4817588d53a056cBbD18231d91ffCcd34b2A', // DHV - poolId: 0 - }, - tvl: "stakingDhvTvl" - }, - {//DHV/ETH (lp) - meta: { - stakingAddress: '0x4964B3B599B82C3FdDC56e3A9Ffd77d48c6AF0f0', // StakingPools - lpAddress: '0x60c5bf43140d6341bebfe13293567fafbe01d65b', // UNI-DHV-WETH - dhvToken: '0x62Dc4817588d53a056cBbD18231d91ffCcd34b2A', - underlying: [ - '0x62Dc4817588d53a056cBbD18231d91ffCcd34b2A', // DHV - ADDRESSES.ethereum.WETH, // WETH - ], - isPool2: true, - poolId: 0 - }, - tvl: "lpStakingTvl" - }, - {//DECR (cluster) - meta: { - clusterAddress: '0x6Bc3F65Fc50E49060e21eD6996be96ee4B404752', // DECR - }, - tvl: "clusterTvl" - }, - ], - 'polygon' : [ - {//DHV (solo) - meta: { - stakingAddress: '0x88cFC1bc9aEb80f6C8f5d310d6C3761c2a646Df7', // StakingDHV - tokenAddress: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26', // DHV - poolId: 0 - }, - tvl: "stakingDhvTvl" - }, - {//Stable Curve 3-Pool (impulse-multiple) - meta: { - stakingAddress: '0xE6E6982fb5dDF4fcc74cCCe4e4eea774E002D17F', // ImpulseMultiStaking - poolId: 1 - }, - tvl: "crvStakingTvl" - }, - {//Curve 5-Pool (impulse-multiple) - meta: { - stakingAddress: '0xE6E6982fb5dDF4fcc74cCCe4e4eea774E002D17F', // ImpulseMultiStaking - poolId: 0 - }, - tvl: "crvStakingTvl" - }, - {//DHV/QUICK (impulse) - meta: { - stakingAddress: '0xf4feb23531EdBe471a4493D432f8BB29Bf0A3868', // ImpulseStaking - lpAddress: '0xfd0E242c95b271844bf6860D4bC0E3e136bC0f7C', // QCK-DHV-QUICK - dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26', - underlying: [ - '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26', // DHV - '0x831753DD7087CaC61aB5644b308642cc1c33Dc13', // QUICK - ], - poolId: 0 - }, - tvl: "impulseStakingTvl" - }, - {//WETH/DAI (impulse) - meta: { - stakingAddress: '0xf4feb23531EdBe471a4493D432f8BB29Bf0A3868', // ImpulseStaking - lpAddress: '0x4A35582a710E1F4b2030A3F826DA20BfB6703C09', // QCK-WETH-DAI - dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26', - underlying: [ - ADDRESSES.polygon.WETH_1, // WETH - ADDRESSES.polygon.DAI, // DAI - ], - poolId: 1 - }, - tvl: "impulseStakingTvl" - }, - // COMMENTED THIS OUT BECAUSE 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT' - // {//USDC/QUICK (impulse) - // meta: { - // stakingAddress: '0xf4feb23531EdBe471a4493D432f8BB29Bf0A3868', // ImpulseStaking - // lpAddress: '0x1F1E4c845183EF6d50E9609F16f6f9cAE43BC9Cb', // QCK-USDC-QUICK - // dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26', - // underlying: [ - // ADDRESSES.polygon.USDC, // USDC - // '0x831753DD7087CaC61aB5644b308642cc1c33Dc13', // QUICK - // ], - // poolId: 2 - // }, - // tvl: "impulseStakingTvl" - // }, - // COMMENTED THIS OUT BECAUSE 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT' - // {//USDT/MAI (impulse) - // meta: { - // stakingAddress: '0xf4feb23531EdBe471a4493D432f8BB29Bf0A3868', // ImpulseStaking - // lpAddress: '0xE89faE1B4AdA2c869f05a0C96C87022DaDC7709a', // QCK-MAI-USDT - // dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26', - // underlying: [ - // ADDRESSES.polygon.USDT, // USDT - // '0xa3fa99a148fa48d14ed51d610c367c61876997f1', // MAI - // ], - // poolId: 4 - // }, - // tvl: "impulseStakingTvl" - // }, - {//AVAX/WETH (impulse) - meta: { - stakingAddress: '0xf4feb23531EdBe471a4493D432f8BB29Bf0A3868', // ImpulseStaking - lpAddress: '0x1274De0DE2e9D9b1d0E06313c0E5EdD01CC335eF', // SUSHI-AVAX-WETH - dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26', - underlying: [ - '0x2C89bbc92BD86F8075d1DEcc58C7F4E0107f286b', // AVAX - ADDRESSES.polygon.WETH_1, // WETH - ], - poolId: 5 - }, - tvl: "impulseStakingTvl" - }, - {//WMATIC/WETH (impulse) - meta: { - stakingAddress: '0xf4feb23531EdBe471a4493D432f8BB29Bf0A3868', // ImpulseStaking - lpAddress: '0xc4e595acDD7d12feC385E5dA5D43160e8A0bAC0E', // SUSHI-WMATIC-WETH - dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26', - underlying: [ - ADDRESSES.polygon.WMATIC_2, // WMATIC - ADDRESSES.polygon.WETH_1, // WETH - ], - poolId: 6 - }, - tvl: "impulseStakingTvl" - }, - {//CRV/WETH (impulse) - meta: { - stakingAddress: '0xf4feb23531EdBe471a4493D432f8BB29Bf0A3868', // ImpulseStaking - lpAddress: '0x396E655C309676cAF0acf4607a868e0CDed876dB', // SUSHI-CRV-WETH - dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26', - underlying: [ - '0x172370d5Cd63279eFa6d502DAB29171933a610AF', // CRV - ADDRESSES.polygon.WETH_1, // WETH - ], - poolId: 7 - }, - tvl: "impulseStakingTvl" - }, - {//SNX/WETH (impulse) - meta: { - stakingAddress: '0xf4feb23531EdBe471a4493D432f8BB29Bf0A3868', // ImpulseStaking - lpAddress: '0x116Ff0d1Caa91a6b94276b3471f33dbeB52073E7', // SUSHI-SNX-WETH - dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26', - underlying: [ - '0x50B728D8D964fd00C2d0AAD81718b71311feF68a', // SNX - ADDRESSES.polygon.WETH_1, // WETH - ], - poolId: 8 - }, - tvl: "impulseStakingTvl" - }, - {//WMATIC/GHST (impulse) - meta: { - stakingAddress: '0xf4feb23531EdBe471a4493D432f8BB29Bf0A3868', // ImpulseStaking - lpAddress: '0xf69e93771F11AECd8E554aA165C3Fe7fd811530c', // SUSHI-WMATIC-GHST - dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26', - underlying: [ - ADDRESSES.polygon.WMATIC_2, // WMATIC - '0x385eeac5cb85a38a9a07a70c73e0a3271cfb54a7', // GHST - ], - poolId: 9 - }, - tvl: "impulseStakingTvl" - }, - {//DPOL (cluster) - meta: { - clusterAddress: '0x4964B3B599B82C3FdDC56e3A9Ffd77d48c6AF0f0', // DPOL - }, - tvl: "clusterTvl" - }, - {//DGAME (cluster) - meta: { - clusterAddress: '0x589Ea336092184d9eD74b8263c4eecA73Ed0cE7a', // DGAME - }, - tvl: "clusterTvl" - }, - ], - 'bsc' : [ - {//DHV (solo) - meta: { - stakingAddress: '0x35f28aA0B2F34eFF17d2830135312ab2a777De36', // StakingDHV - tokenAddress: '0x58759dd469ae5631c42cf8a473992335575b58d7', // DHV - poolId: 0 - }, - tvl: "stakingDhvTvl" - }, - {//DHV/BUSD (lp) - meta: { - stakingAddress: '0xF2e8CD1c40C766FEe73f56607fDffa526Ba8fa6c', // StakingPools - lpAddress: '0x72ba008B631D9FD5a8E8013023CB3c05E19A7CA9', // PANCAKE-DHV-BUSD - dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7', - underlying: [ - '0x58759dd469ae5631c42cf8a473992335575b58d7', // DHV - ADDRESSES.bsc.BUSD, // BUSD - ], - isPool2: true, - poolId: 0 - }, - tvl: "lpStakingTvl" - }, - {//CAKE/BUSD (impulse) - meta: { - stakingAddress: '0xA9c97Ff825dB9dd53056d65aE704031B4959d99a', // ImpulseStaking - lpAddress: '0x804678fa97d91B974ec2af3c843270886528a9E6', // PANCAKE-CAKE-BUSD - dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7', - underlying: [ - '0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82', // CAKE - ADDRESSES.bsc.BUSD, // BUSD - ], - poolId: 0 - }, - tvl: "impulseStakingTvl" - }, - {//USDT/USDC (impulse) - meta: { - stakingAddress: '0xA9c97Ff825dB9dd53056d65aE704031B4959d99a', // ImpulseStaking - lpAddress: '0xEc6557348085Aa57C72514D67070dC863C0a5A8c', // PANCAKE-BUSDT-USDC - dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7', - underlying: [ - ADDRESSES.bsc.USDT, // BUSDT - ADDRESSES.bsc.USDC, // BUSDC - ], - poolId: 1 - }, - tvl: "impulseStakingTvl" - }, - {//USDT/WBNB (impulse) - meta: { - stakingAddress: '0xA9c97Ff825dB9dd53056d65aE704031B4959d99a', // ImpulseStaking - lpAddress: '0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE', // PANCAKE-BUSDT-WBNB - dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7', - underlying: [ - ADDRESSES.bsc.USDT, // BUSDT - ADDRESSES.bsc.WBNB, // WBNB - ], - poolId: 2 - }, - tvl: "impulseStakingTvl" - }, - {//XVS/WBNB (impulse) - meta: { - stakingAddress: '0xA9c97Ff825dB9dd53056d65aE704031B4959d99a', // ImpulseStaking - lpAddress: '0x7EB5D86FD78f3852a3e0e064f2842d45a3dB6EA2', // PANCAKE-XVS-WBNB - dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7', - underlying: [ - '0xcF6BB5389c92Bdda8a3747Ddb454cB7a64626C63', // XVS - ADDRESSES.bsc.WBNB, // WBNB - ], - poolId: 3 - }, - tvl: "impulseStakingTvl" - }, - {//ALPACA/BUSD (impulse) - meta: { - stakingAddress: '0xA9c97Ff825dB9dd53056d65aE704031B4959d99a', // ImpulseStaking - lpAddress: '0x7752e1FA9F3a2e860856458517008558DEb989e3', // PANCAKE-ALPACA-BUSD - dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7', - underlying: [ - '0x8F0528cE5eF7B51152A59745bEfDD91D97091d2F', // ALPACA - ADDRESSES.bsc.BUSD, // BUSD - ], - poolId: 4 - }, - tvl: "impulseStakingTvl" - }, - {//LINK/WBNB (impulse) - meta: { - stakingAddress: '0xA9c97Ff825dB9dd53056d65aE704031B4959d99a', // ImpulseStaking - lpAddress: '0x824eb9faDFb377394430d2744fa7C42916DE3eCe', // PANCAKE-LINK-WBNB - dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7', - underlying: [ - '0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD', // LINK - ADDRESSES.bsc.WBNB, // WBNB - ], - poolId: 5 - }, - tvl: "impulseStakingTvl" - }, - {//CAKE/USDT (impulse) - meta: { - stakingAddress: '0xA9c97Ff825dB9dd53056d65aE704031B4959d99a', // ImpulseStaking - lpAddress: '0xA39Af17CE4a8eb807E076805Da1e2B8EA7D0755b', // PANCAKE-CAKE-BUSDT - dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7', - underlying: [ - '0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82', // CAKE - ADDRESSES.bsc.USDT, // BUSDT - ], - poolId: 6 - }, - tvl: "impulseStakingTvl" - }, - {//DODO/WBNB (impulse) - meta: { - stakingAddress: '0xA9c97Ff825dB9dd53056d65aE704031B4959d99a', // ImpulseStaking - lpAddress: '0xA9986Fcbdb23c2E8B11AB40102990a08f8E58f06', // PANCAKE-DODO-WBNB - dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7', - underlying: [ - '0x67ee3Cb086F8a16f34beE3ca72FAD36F7Db929e2', // DODO - ADDRESSES.bsc.WBNB, // WBNB - ], - poolId: 7 - }, - tvl: "impulseStakingTvl" - }, - {//BANANA/WBNB (impulse) - meta: { - stakingAddress: '0xA9c97Ff825dB9dd53056d65aE704031B4959d99a', // ImpulseStaking - lpAddress: '0xF65C1C0478eFDe3c19b49EcBE7ACc57BB6B1D713', // APE-BANANA-WBNB - dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7', - underlying: [ - '0x603c7f932ED1fc6575303D8Fb018fDCBb0f39a95', // BANANA - ADDRESSES.bsc.WBNB, // WBNB - ], - poolId: 8 - }, - tvl: "impulseStakingTvl" - }, - {//BANANA/BUSD (impulse) - meta: { - stakingAddress: '0xA9c97Ff825dB9dd53056d65aE704031B4959d99a', // ImpulseStaking - lpAddress: '0x7Bd46f6Da97312AC2DBD1749f82E202764C0B914', // APE-BANANA-BUSD - dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7', - underlying: [ - '0x603c7f932ED1fc6575303D8Fb018fDCBb0f39a95', // BANANA - ADDRESSES.bsc.BUSD, // BUSD - ], - poolId: 9 - }, - tvl: "impulseStakingTvl" - }, - {//TWT/WBNB (impulse) - meta: { - stakingAddress: '0xA9c97Ff825dB9dd53056d65aE704031B4959d99a', // ImpulseStaking - lpAddress: '0x4c48D692e3de076C7b844B956b28cdd1DD5C0945', // APE-TWT-WBNB - dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7', - underlying: [ - '0x4B0F1812e5Df2A09796481Ff14017e6005508003', // TWT - ADDRESSES.bsc.WBNB, // WBNB - ], - poolId: 10 - }, - tvl: "impulseStakingTvl" - }, - {//AVAX/WBNB (impulse) - meta: { - stakingAddress: '0xA9c97Ff825dB9dd53056d65aE704031B4959d99a', // ImpulseStaking - lpAddress: '0x40aFc7CBd0Dc2bE5860F0035b717d20Afb4827b2', // APE-AVAX-WBNB - dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7', - underlying: [ - '0x1CE0c2827e2eF14D5C4f29a091d735A204794041', // AVAX - ADDRESSES.bsc.WBNB, // WBNB - ], - poolId: 11 - }, - tvl: "impulseStakingTvl" - }, - {//DBSC (cluster) - meta: { - clusterAddress: '0x0a684421ef48b431803BFd75F38675EAb1e38Ed5', // DBSC - }, - tvl: "clusterTvl" - }, - ], - 'xdai' : [ - {//DHV (solo) - meta: { - stakingAddress: '0x589Ea336092184d9eD74b8263c4eecA73Ed0cE7a', // StakingDHV - tokenAddress: '0xFbdd194376de19a88118e84E279b977f165d01b8', // DHV - poolId: 0 - }, - tvl: "stakingDhvTvl" - }, - {//DHV/XDAI (lp) - meta: { - stakingAddress: '0xa4E7BE054000603B82B79208aC3eE5428554CaF6', // StakingPools - lpAddress: '0x14EE6d20B8167eacb885F4F2F45C3Bf2d4FD06f4', // HONEY-DHV-WXDAI - dhvToken: '0xFbdd194376de19a88118e84E279b977f165d01b8', - underlying: [ - '0xFbdd194376de19a88118e84E279b977f165d01b8', // DHV - ADDRESSES.xdai.WXDAI, // WXDAI - ], - isPool2: true, - poolId: 1 - }, - tvl: "lpStakingTvl" - }, - {//Stable Curve 3-Pool (impulse-multiple) - meta: { - stakingAddress: '0xfa7Ca14a28CD419a69E45e8416cA4FA87457aCE8', // ImpulseMultiStaking - poolId: 0 - }, - tvl: "crvStakingTvl" - }, - {//DXDC (cluster) - meta: { - clusterAddress: '0xF557B2B73b872E6d2F43826f9D77B7402A363Bc0', // DXDC - }, - tvl: "clusterTvl" - }, - {//DXIN (cluster) - meta: { - clusterAddress: '0xA6C090c5572f54d529B0839b8fd2D50a4afB1E6B', // DXIN - }, - tvl: "clusterTvl" - }, - ], -}; - diff --git a/projects/dehive/index.js b/projects/dehive/index.js index d3c800c2aafb..336a05844999 100644 --- a/projects/dehive/index.js +++ b/projects/dehive/index.js @@ -1,298 +1,76 @@ -const sdk = require("@defillama/sdk"); -const BigNumber = require("bignumber.js"); -const abi = require('./abi.json') - -const assetsInfo = require("./assetsInfo"); - -const EXPORT_TYPE_TVL = 0; -const EXPORT_TYPE_DHV_STAKING = 1; -const EXPORT_TYPE_POOL2 = 2; - -async function stakingTvl(chain, meta, ethBlock) { - return (await sdk.api.abi.call({ - target: meta.stakingAddress, - abi: abi.poolInfo, - params: meta.poolId, - chain, - block: ethBlock - })).output.poolSupply; -} - -async function stakingDhvTvl(chain, meta, ethBlock) { - return (await sdk.api.abi.call({ - target: meta.tokenAddress, - abi: abi.balanceOf, - params: meta.stakingAddress, - chain, - block: ethBlock - })).output; -} - -async function lpStakingTvl(chain, meta, ethBlock) { - const { poolSupply } = (await sdk.api.abi.call({ - target: meta.stakingAddress, - abi: abi.poolInfo, - params: meta.poolId, - chain, - block: ethBlock - })).output; - const poolSupplyBN = new BigNumber(poolSupply); - - const lpTotalSupply = (await sdk.api.abi.call({ - target: meta.lpAddress, - abi: abi.totalSupply, - chain, - block: ethBlock - })).output; - const lpTotalSupplyBN = new BigNumber(lpTotalSupply); - - const tvl = []; - for (let i = 0; i < meta.underlying.length; i++) { - const underlyingLpBalance = (await sdk.api.abi.call({ - target: meta.underlying[i], - abi: abi.balanceOf, - params: meta.lpAddress, - chain, - block: ethBlock - })).output; - const underlyingLpBalanceBN = new BigNumber(underlyingLpBalance); - const underlyingTvl = poolSupplyBN.multipliedBy(underlyingLpBalanceBN).div(lpTotalSupplyBN); - - tvl.push([meta.underlying[i], underlyingTvl.integerValue().toFixed()]); - } - - if (meta.dhvToken) { - const dhvBalance = (await sdk.api.abi.call({ - target: meta.dhvToken, - abi: abi.balanceOf, - params: meta.stakingAddress, - chain, - block: ethBlock - })).output; - tvl.push([meta.dhvToken, dhvBalance]); - } - return tvl; -} - -async function crvStakingTvl(chain, meta, ethBlock) { - const { strategy } = (await sdk.api.abi.call({ - target: meta.stakingAddress, - abi: abi.impulseMultiPoolInfo, - params: meta.poolId, - chain, - block: ethBlock - })).output; - - const wantLockedTotal = (await sdk.api.abi.call({ - target: strategy, - abi: abi.wantLockedTotal, - chain, - block: ethBlock - })).output; - - const underlyingList = (await sdk.api.abi.call({ - target: strategy, - abi: abi.listUnderlying, - chain, - block: ethBlock - })).output; - - const underlyingAmount = (await sdk.api.abi.call({ - target: strategy, - abi: abi.wantPriceInUnderlying, - params: wantLockedTotal, - chain, - block: ethBlock - })).output; - - return underlyingList.map((_, i) => [underlyingList[i], underlyingAmount[i]]); -} - -async function impulseStakingTvl(chain, meta, ethBlock) { - if (chain === 'bsc') { - return await lpStakingTvl(chain, meta, ethBlock); // from staking pool - } - const { strategy } = (await sdk.api.abi.call({ - target: meta.stakingAddress, - abi: abi.impulseMultiPoolInfo, - params: meta.poolId, - chain, - block: ethBlock - })).output; - - const wantLockedTotal = (await sdk.api.abi.call({ - target: strategy, - abi: abi.wantLockedTotal, - chain, - block: ethBlock - })).output; - - const usdToken = (await sdk.api.abi.call({ - target: strategy, - abi: abi.usdToken, - chain, - block: ethBlock - })).output; - - const wantPrice = (await sdk.api.abi.call({ - target: strategy, - abi: abi.wantPriceInUsd, - params: wantLockedTotal, - chain, - block: ethBlock - })).output; - - let tvl = await lpStakingTvl(chain, meta, ethBlock); // from staking pool - tvl.push([usdToken, wantPrice]); // from strategy - - return tvl; -} - -async function clusterTvl(chain, meta, ethBlock) { - const poolSupply = (await sdk.api.abi.call({ - target: meta.clusterAddress, - abi: "erc20:totalSupply", - chain, - block: ethBlock - })).output; - - const underlyingList = (await sdk.api.abi.call({ - target: meta.clusterAddress, - abi: abi.getUnderlyings, - chain, - block: ethBlock - })).output; - - const underlyingAmount = (await sdk.api.abi.call({ - target: meta.clusterAddress, - abi: abi.getUnderlyingsAmountsFromClusterAmount, - params: poolSupply, - chain, - block: ethBlock - })).output; - - return underlyingList.map((_, i) => [underlyingList[i], underlyingAmount[i]]); -} - -async function chainTvl(chain, chainBlocks, exportType) { - const tvl = {}; - const transform = addr => `${chain}:${addr}` - const block = chainBlocks[chain] - await Promise.all(assetsInfo[chain].map(async (staking) => { - { - let calculateTvlFunction = undefined; - switch (staking.tvl) { - case "stakingTvl": - calculateTvlFunction = stakingTvl; - break; - case "stakingDhvTvl": - calculateTvlFunction = stakingDhvTvl; - break; - case "lpStakingTvl": - calculateTvlFunction = lpStakingTvl; - break; - case "crvStakingTvl": - calculateTvlFunction = crvStakingTvl; - break; - case "clusterTvl": - calculateTvlFunction = clusterTvl; - break; - case "impulseStakingTvl": - calculateTvlFunction = impulseStakingTvl; - break; - default: - sdk.log('unknown tvl type', JSON.stringify(staking, null, 4)); - return; - } - if ( - (staking.tvl === "stakingDhvTvl" && exportType !== EXPORT_TYPE_DHV_STAKING) - || (staking.tvl !== "stakingDhvTvl" && exportType === EXPORT_TYPE_DHV_STAKING) - || (staking.tvl === "lpStakingTvl" && exportType === EXPORT_TYPE_POOL2 && (staking.isPool2 !== true)) - || (staking.tvl === "lpStakingTvl" && exportType !== EXPORT_TYPE_POOL2 && (staking.isPool2 === true)) - ) { - return; - } - const tvls = await calculateTvlFunction(chain, staking.meta, block); - if (typeof tvls === 'string') { - sdk.util.sumSingleBalance(tvl, transform(staking.meta.tokenAddress), tvls) - } else { - for (let i = 0; i < tvls.length; i++) { - sdk.util.sumSingleBalance(tvl, transform(tvls[i][0]), tvls[i][1]) - } +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const config = { + ethereum: { + clusters: ['0x6Bc3F65Fc50E49060e21eD6996be96ee4B404752'], + pool2s: [['0x60c5bf43140d6341bebfe13293567fafbe01d65b', '0x4964B3B599B82C3FdDC56e3A9Ffd77d48c6AF0f0']], + stakings: [['0x62Dc4817588d53a056cBbD18231d91ffCcd34b2A', '0x04595f9010F79422a9b411ef963e4dd1F7107704']], + }, + polygon: { + stakings: [['0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26', '0x88cFC1bc9aEb80f6C8f5d310d6C3761c2a646Df7']], + pool2s: [['0xfd0E242c95b271844bf6860D4bC0E3e136bC0f7C', '0xf4feb23531EdBe471a4493D432f8BB29Bf0A3868']], + impulses: ['0xE6E6982fb5dDF4fcc74cCCe4e4eea774E002D17F', '0xf4feb23531EdBe471a4493D432f8BB29Bf0A3868'], + clusters: ['0x4964B3B599B82C3FdDC56e3A9Ffd77d48c6AF0f0', '0x589Ea336092184d9eD74b8263c4eecA73Ed0cE7a'], + }, + bsc: { + stakings: [['0x58759dd469ae5631c42cf8a473992335575b58d7', '0x35f28aA0B2F34eFF17d2830135312ab2a777De36']], + pool2s: [['0x72ba008B631D9FD5a8E8013023CB3c05E19A7CA9', '0xF2e8CD1c40C766FEe73f56607fDffa526Ba8fa6c']], + impulses: ['0xA9c97Ff825dB9dd53056d65aE704031B4959d99a'], + clusters: ['0x0a684421ef48b431803BFd75F38675EAb1e38Ed5'], + }, + xdai: { + stakings: [['0xFbdd194376de19a88118e84E279b977f165d01b8', '0x589Ea336092184d9eD74b8263c4eecA73Ed0cE7a']], + pool2s: [['0x14EE6d20B8167eacb885F4F2F45C3Bf2d4FD06f4', '0xa4E7BE054000603B82B79208aC3eE5428554CaF6']], + impulses: ['0xfa7Ca14a28CD419a69E45e8416cA4FA87457aCE8'], + clusters: ['0xF557B2B73b872E6d2F43826f9D77B7402A363Bc0', '0xA6C090c5572f54d529B0839b8fd2D50a4afB1E6B'], + }, +} + +Object.keys(config).forEach(chain => { + const { clusters, pool2s, stakings, impulses } = config[chain] + + const blacklistedTokens = [] + if (pool2s) pool2s.forEach(p => blacklistedTokens.push(p[0])) + if (stakings) stakings.forEach(s => blacklistedTokens.push(s[0])) + + const blacklistedSet = new Set(blacklistedTokens.map(i => i.toLowerCase())) + + const exportObj = { + tvl: async (api) => { + if (clusters) { + const tokens = await api.multiCall({ abi: 'address[]:getUnderlyings', calls: clusters }) + const ownerTokens = tokens.map((t, i) => [t, clusters[i]]) + await api.sumTokens({ ownerTokens }) + } + + if (impulses) { + for (const impulse of impulses) { + let i = 0 + let length = 5 + let moreTokens = true + do { + const calls = [] + for (let j = 0; j < length; j++) { + calls.push(i + j) + i += length } + const data = await api.multiCall({ abi: 'function poolInfo(uint256) view returns (address token, uint256 lastReward, uint256 poolSupply, bool paused, address strategy)', calls, target: impulse, permitFailure: true }) + moreTokens = data.some(d => !d) + data.forEach(i => { + if (!i) return; + if (blacklistedSet.has(i.token.toLowerCase())) return; + api.add(i.token, i.poolSupply) + }) + } while (moreTokens) } - })) - return tvl -} - -async function ethereumTvl(timestamp, ethBlock, chainBlocks) { - return chainTvl('ethereum', chainBlocks, EXPORT_TYPE_TVL); -} - -async function polygonTvl(timestamp, ethBlock, chainBlocks) { - return chainTvl('polygon', chainBlocks, EXPORT_TYPE_TVL); -} - -async function bscTvl(timestamp, ethBlock, chainBlocks) { - return chainTvl('bsc', chainBlocks, EXPORT_TYPE_TVL); -} - -async function xdaiTvl(timestamp, ethBlock, chainBlocks) { - return chainTvl('xdai', chainBlocks, EXPORT_TYPE_TVL); -} - -async function ethereumStaking(timestamp, ethBlock, chainBlocks) { - return chainTvl('ethereum', chainBlocks, EXPORT_TYPE_DHV_STAKING); -} - -async function polygonStaking(timestamp, ethBlock, chainBlocks) { - return chainTvl('polygon', chainBlocks, EXPORT_TYPE_DHV_STAKING); -} - -async function bscStaking(timestamp, ethBlock, chainBlocks) { - return chainTvl('bsc', chainBlocks, EXPORT_TYPE_DHV_STAKING); -} - -async function xdaiStaking(timestamp, ethBlock, chainBlocks) { - return chainTvl('xdai', chainBlocks, EXPORT_TYPE_DHV_STAKING); -} - -async function ethereumPool2(timestamp, ethBlock, chainBlocks) { - return chainTvl('ethereum', chainBlocks, EXPORT_TYPE_POOL2); -} - -async function polygonPool2(timestamp, ethBlock, chainBlocks) { - return chainTvl('polygon', chainBlocks, EXPORT_TYPE_POOL2); -} - -async function bscPool2(timestamp, ethBlock, chainBlocks) { - return chainTvl('bsc', chainBlocks, EXPORT_TYPE_POOL2); -} - -async function xdaiPool2(timestamp, ethBlock, chainBlocks) { - return chainTvl('xdai', chainBlocks, EXPORT_TYPE_POOL2); -} + } + } + } + if (pool2s) + exportObj.pool2 = sumTokensExport({ tokensAndOwners: pool2s, resolveLP: true, }) -module.exports = { - ethereum: { - tvl: ethereumTvl, - pool2: ethereumPool2, - staking: ethereumStaking - }, - polygon: { - tvl: polygonTvl, - pool2: polygonPool2, - staking: polygonStaking - }, - bsc: { - tvl: bscTvl, - pool2: bscPool2, - staking: bscStaking - }, - xdai: { - tvl: xdaiTvl, - pool2: xdaiPool2, - staking: xdaiStaking - } -}; + if (stakings) + exportObj.staking = sumTokensExport({ tokensAndOwners: stakings, }) + module.exports[chain] = exportObj +}) diff --git a/projects/stafi/index.js b/projects/stafi/index.js index 8aba8f04f06b..413d22371c6e 100644 --- a/projects/stafi/index.js +++ b/projects/stafi/index.js @@ -1,21 +1,18 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); -const {chainExports} = require('../helper/exports') -const {usdtAddress} = require('../helper/balances') -const {getApiTvl} = require('../helper/historicalApi'); -const { fetchURL } = require('../helper/utils'); +const { get } = require('../helper/http'); const wethAddress = ADDRESSES.ethereum.WETH async function ethereum(api) { - const totalSupply = await api.call({ target: '0x9559Aaa82d9649C7A7b220E7c461d2E74c9a3593', abi: 'uint256:totalSupply'}); - const rate = await api.call({ target: '0x9559Aaa82d9649C7A7b220E7c461d2E74c9a3593', abi: 'uint256:getExchangeRate'}); + const totalSupply = await api.call({ target: '0x9559Aaa82d9649C7A7b220E7c461d2E74c9a3593', abi: 'uint256:totalSupply' }); + const rate = await api.call({ target: '0x9559Aaa82d9649C7A7b220E7c461d2E74c9a3593', abi: 'uint256:getExchangeRate' }); return { - [wethAddress]: (totalSupply * rate)/1e18 + [wethAddress]: (totalSupply * rate) / 1e18 } } -const chainToParams={ +const chainToParams = { bsc: ["RBNB", "binancecoin"], polygon: ["RMATIC", "matic-network"], polkadot: ["RDOT", "polkadot"], @@ -24,37 +21,27 @@ const chainToParams={ cosmos: ["RATOM", "cosmos"], carbon: ["RSWTH", "switcheo"], chihuahua: ["RHUAHUA", "chihuahua-token"], - irisnet:["RIRIS","iris-network"] + irisnet: ["RIRIS", "iris-network"] } -function getTvlFunction(token, cgId){ - return async timestamp=>{ - const bal = await getApiTvl(timestamp, async()=>{ - const data = await fetchURL(API) - return Number(data.data.data.currentStake.find(r=>r.rsymbol ===token).stakeAmount) - }, async()=>{ - const data = await fetchURL(API) - return data.data.data.historyStake[token].map(p=>({ - date: p.timestamp, - totalLiquidityUSD: Number(p.stakeAmount) - })) - }) - return { - [cgId]: Number(bal[usdtAddress])/(10**6) - } +function getTvlFunction(token, cgId) { + return async api => { + const { data: { currentStake } } = await get(API) + api.addCGToken(cgId, Number(currentStake.find(r => r.rsymbol === token)?.stakeAmount ?? 0)) + return api.getBalances() } } const API = "https://partner-api.stafi.io/stafi/v1/partnerapi/rtoken/getstakelist" -function chainTvl(chain){ +function chainTvl(chain) { const [token, cgId] = chainToParams[chain] return getTvlFunction(token, cgId) } module.exports = { - ethereum: { + ethereum: { tvl: sdk.util.sumChainTvls([chainTvl('polygon'), ethereum]), - staking: getTvlFunction("RFIS", "stafi") + staking: getTvlFunction("RFIS", "stafi") }, bsc: { tvl: chainTvl('bsc') From a241e3604124e964cdc4d712756b58be855354f1 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 3 Jul 2024 08:59:10 +0300 Subject: [PATCH 558/855] Step-fi (#10858) * add step finance adapter * code refactor --------- Co-authored-by: Aaron <20787054+aaronovz1@users.noreply.github.com> --- projects/step-finance/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/step-finance/index.js diff --git a/projects/step-finance/index.js b/projects/step-finance/index.js new file mode 100644 index 000000000000..793750a3e315 --- /dev/null +++ b/projects/step-finance/index.js @@ -0,0 +1,11 @@ +const { sumTokens2 } = require("../helper/solana"); + +const STAKING_VAULT = 'ANYxxG365hutGYaTdtUQG8u2hC4dFX9mFHKuzy9ABQJi'; + +module.exports = { + timetravel: false, + solana: { + tvl: () => ({}), + staking: () => sumTokens2({ tokenAccounts: [STAKING_VAULT] }) + }, +} \ No newline at end of file From 1c5f234d64f172aba6aec925d2d92be74cdc9862 Mon Sep 17 00:00:00 2001 From: SeaZarrgh <133594081+SeaZarrgh@users.noreply.github.com> Date: Tue, 2 Jul 2024 23:35:51 -0700 Subject: [PATCH 559/855] Add Stack TVL adapter (#10850) * Add Stack TVL adapter * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/tokenMapping.js | 9 ++++++--- projects/stack/index.js | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 projects/stack/index.js diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 6ae2d4f5e47c..6ac21dbeeaa8 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -158,10 +158,13 @@ const fixBalancesTokens = { '0x2967e7bb9daa5711ac332caf874bd47ef99b3820': { coingeckoId: 'wrapped-stbtc', decimals: 18 }, }, real: { - [ADDRESSES.null]: { coingeckoId: 'bitcoin', decimals: 18 }, - '0x90c6e93849e06ec7478ba24522329d14a5954df4': { coingeckoId: 'ethereum', decimals: 18 }, + [ADDRESSES.null]: { coingeckoId: 'ethereum', decimals: 18 }, + '0x90c6E93849E06EC7478ba24522329d14A5954Df4': { coingeckoId: 'ethereum', decimals: 18 }, '0x75d0cbf342060b14c2fc756fd6e717dfeb5b1b70': { coingeckoId: 'dai', decimals: 18 }, - '0x83fedbc0b85c6e29b589aa6bdefb1cc581935ecd': { coingeckoId: 'mountain-protocol-usdm', decimals: 18 }, + '0x83fedbc0b85c6e29b589aa6bdefb1cc581935ecd': { coingeckoId: 'real-us-t-bill', decimals: 18 }, + '0xAEC9e50e3397f9ddC635C6c429C8C7eca418a143': { coingeckoId: 'arcana-2', decimals: 18 }, // arcUSD + '0xeAcFaA73D34343FcD57a1B3eB5B0D949df727712': { coingeckoId: 'arcana-2', decimals: 18 }, // PTa, 1:1 wrapped arcUSD + '0x25ea98ac87A38142561eA70143fd44c4772A16b6': { coingeckoId: 'stack-2', decimals: 18 }, // MORE }, taiko: { [ADDRESSES.null]: { coingeckoId: 'ethereum', decimals: 18 }, diff --git a/projects/stack/index.js b/projects/stack/index.js new file mode 100644 index 000000000000..d7a6e6a9a002 --- /dev/null +++ b/projects/stack/index.js @@ -0,0 +1,23 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +module.exports = { + methodology: + "TVL counts the collateral tokens that are deposited within the respective Stack vault", +}; + +const config = { + real: { + vaultFactory: "0x303C5d72D2d123ac6C36957d167Ca7Cfee3414e7", + }, +}; + +Object.keys(config).forEach((chain) => { + const { vaultFactory } = config[chain]; + module.exports[chain] = { + tvl: async (api) => { + const vaults = await api.fetchList({ lengthAbi: 'allVaultsLength', itemAbi: 'allVaults', target: vaultFactory }) + const tokens = await api.multiCall({ abi: 'address:collateralToken', calls: vaults }) + return sumTokens2({ tokensAndOwners2: [tokens, vaults], api }) + } + } +}) From a7ad191cea2ed4ef494c6120ada2617eaf8ef18b Mon Sep 17 00:00:00 2001 From: 0xR <99395193+0xrmvdao@users.noreply.github.com> Date: Wed, 3 Jul 2024 10:19:12 +0300 Subject: [PATCH 560/855] Add LineHub Perps (#10859) --- projects/linehub-perps/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 projects/linehub-perps/index.js diff --git a/projects/linehub-perps/index.js b/projects/linehub-perps/index.js new file mode 100644 index 000000000000..e3267bf1eec5 --- /dev/null +++ b/projects/linehub-perps/index.js @@ -0,0 +1,15 @@ +const ADDRESSES = require("../helper/coreAssets.json"); + +const { nullAddress } = require("../helper/unwrapLPs"); + +async function LineaTvl(api) { + const tokens = [nullAddress, ADDRESSES.linea.USDC]; + const owners = ["0xC94cFd8F4fB8Ef3EB360Ec92e2A9Ca969Cadf095"]; + return api.sumTokens({ owners, tokens }); +} + +module.exports = { + linea: { + tvl: LineaTvl, + }, +}; From 6a456f2d144e54b20c584cfc7cb23786713104ae Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 3 Jul 2024 10:46:50 +0300 Subject: [PATCH 561/855] update tangible rwa --- projects/tangible/index.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/projects/tangible/index.js b/projects/tangible/index.js index 0311d7a26a6d..bf48c1b3dedd 100644 --- a/projects/tangible/index.js +++ b/projects/tangible/index.js @@ -6,6 +6,16 @@ const { getInsuranceFundValueOp } = require("./insurance-fund-optimism"); const { getInsuranceFundValueBase } = require("./insurance-fund-base"); const { getInsuranceFundValueArb } = require("./insurance-fund-arbitrum"); +const realTvl = async (api) => { + const USTB = '0x83fedbc0b85c6e29b589aa6bdefb1cc581935ecd' + const basketManager = '0x5e581ce0472bF528E7F5FCB96138d7759AC2ac3f'.toLowerCase() + // get all baskets in existance + const baskets = await api.call({ abi: 'address[]:getBasketsArray', target: basketManager }) + console.log(baskets) + const basketTVL = await api.multiCall({ abi: 'uint256:getTotalValueOfBasket', calls: baskets}) + api.add(USTB, basketTVL) +} + // doc: https://docs.tangible.store/real-usd/real-usd-v3-contracts-and-addresses const TNGBL = '0x49e6A20f1BBdfEeC2a8222E052000BbB14EE6007'.toLowerCase() const USDR = '0x40379a439d4f6795b6fc9aa5687db461677a2dba'.toLowerCase() @@ -188,7 +198,7 @@ async function tangiblePOL(api) { module.exports = { hallmarks: [ - [1697032800,"USDR Depeg"] + [1697032800, "USDR Depeg"] ], misrepresentedTokens: true, polygon: { tvl, }, @@ -196,6 +206,7 @@ module.exports = { base: { tvl: tvlBase }, arbitrum: { tvl: tvlArb }, optimism: { tvl: tvlOp }, + real: { tvl: realTvl }, } async function unwrapBalancerToken(api, owner) { From 9dd06d82c33d9ee8ba797ab7974121163f510e39 Mon Sep 17 00:00:00 2001 From: santino <83203265+santinoYoung@users.noreply.github.com> Date: Wed, 3 Jul 2024 15:49:39 +0800 Subject: [PATCH 562/855] update bitlayer chain (#10838) * add desyn protocol * update lpposition token * Update index.js add resolveLP * Update index.js remove resolveLP * add tvl * Update index.js update sumTokensExport * code refactor * update desyn chain * update bitlayer chain * disable merlin --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/desyn/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/desyn/index.js b/projects/desyn/index.js index 04a9d5381e5d..437dfa162d33 100644 --- a/projects/desyn/index.js +++ b/projects/desyn/index.js @@ -9,6 +9,8 @@ const config = { ethereum: { factory: '0x01a38B39BEddCD6bFEedBA14057E053cBF529cD2', fromBlock: 17335174}, arbitrum: { factory: '0xdE6b117384452b21F5a643E56952593B88110e78', fromBlock: 175985457}, //merlin chain is tracked under a new listing for farm + // merlin: { factory: '0x790b4ee7998A93702f29e56f8b615eF35BE5af43', fromBlock: 11260440}, + btr: { factory: '0x09eFC8C8F08B810F1F76B0c926D6dCeb37409665', fromBlock: 2393247}, } Object.keys(config).forEach(chain => { From b0ff5910ffb976abbcc4be12bcb47d82a681efc1 Mon Sep 17 00:00:00 2001 From: neoiss <85328218+neoiss@users.noreply.github.com> Date: Wed, 3 Jul 2024 16:21:15 +0800 Subject: [PATCH 563/855] support multiple versions of MOS contract (#10861) --- projects/butternetwork/index.js | 90 +++++++++++++++++++++++---------- 1 file changed, 63 insertions(+), 27 deletions(-) diff --git a/projects/butternetwork/index.js b/projects/butternetwork/index.js index c0e1fe185d24..1432096f63bc 100644 --- a/projects/butternetwork/index.js +++ b/projects/butternetwork/index.js @@ -1,9 +1,11 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport } = require('../helper/sumTokens') +const {sumTokensExport} = require('../helper/sumTokens') const config = { bsc: { - mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + mosContract: { + v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + }, tokens: { USDT: ADDRESSES.bsc.USDT, USDC: ADDRESSES.bsc.USDC, @@ -13,7 +15,9 @@ const config = { } }, polygon: { - mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + mosContract: { + v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + }, tokens: { USDT: ADDRESSES.polygon.USDT, USDC: ADDRESSES.polygon.USDC, @@ -23,7 +27,9 @@ const config = { } }, ethereum: { - mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + mosContract: { + v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + }, tokens: { USDT: ADDRESSES.ethereum.USDT, USDC: ADDRESSES.ethereum.USDC, @@ -33,7 +39,9 @@ const config = { } }, near: { - mosContract: "mosv21.mfac.butternetwork.near", + mosContract: { + v2: "mosv21.mfac.butternetwork.near", + }, tokens: { USDT: "dac17f958d2ee523a2206206994597c13d831ec7.factory.bridge.near", USDC: "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.factory.bridge.near", @@ -43,7 +51,10 @@ const config = { } }, map: { - mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + mosContract: { + v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + v3: "0x1ad1a4a19bc9983a98f5d9ac8442c6dfc4276167" + }, tokens: { // USDT: "0x33daba9618a75a7aff103e53afe530fbacf4a3dd", // USDC: ADDRESSES.map.USDC, @@ -53,7 +64,9 @@ const config = { } }, merlin: { - mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + mosContract: { + v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + }, tokens: { WBTC: ADDRESSES.merlin.WBTC, WBTC_1: ADDRESSES.merlin.WBTC_1, @@ -62,7 +75,9 @@ const config = { } }, klaytn: { - mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + mosContract: { + v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + }, tokens: { WKLAY: ADDRESSES.klaytn.WKLAY, oETH: ADDRESSES.klaytn.oETH, @@ -92,7 +107,9 @@ const config = { } }, base: { - mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + mosContract: { + v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + }, tokens: { WETH: ADDRESSES.base.WETH, USDbC: ADDRESSES.base.USDbC, @@ -115,11 +132,12 @@ const config = { "USD+": "0xb79dd08ea68a908a97220c76d19a6aa9cbde4376", ZRX: "0x3bb4445d30ac020a84c1b5a8a2c6248ebc9779d0", USDC: ADDRESSES.base.USDC - } }, conflux: { - mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + mosContract: { + v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + }, tokens: { USDT: ADDRESSES.conflux.USDT, USDC: ADDRESSES.conflux.USDC, @@ -135,7 +153,9 @@ const config = { } }, blast: { - mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + mosContract: { + v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + }, tokens: { MIM: "0x76DA31D7C9CbEAE102aff34D3398bC450c8374c1", OMNI: "0x9e20461bc2c4c980f62f1B279D71734207a6A356", @@ -145,7 +165,9 @@ const config = { } }, arbitrum: { - mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + mosContract: { + v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + }, tokens: { USDT: ADDRESSES.arbitrum.USDT, USDC: ADDRESSES.arbitrum.USDC, @@ -155,7 +177,9 @@ const config = { } }, optimism: { - mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + mosContract: { + v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + }, tokens: { USDT: ADDRESSES.optimism.USDT, USDC: ADDRESSES.optimism.USDC, @@ -165,36 +189,46 @@ const config = { } }, era: { - mosContract: "0xBEf06a32166C4B819fF04cCfa887733B8bb67eB5", + mosContract: { + v2: "0xBEf06a32166C4B819fF04cCfa887733B8bb67eB5", + }, tokens: { - USDT: ADDRESSES.era.USDT, + USDT: ADDRESSES.era.USDT, USDC: ADDRESSES.era.USDC, WETH: ADDRESSES.era.WETH }, }, // ainn: { - // mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", - // tokens: { - // USDT: "0x0663C09Bd0911181B39D66ec4bfAC9d89c8516BA", - // USDC: "0xfaBc451eA1Fd9707c6Ba1769F570E760101C7f22", - // } + // mosContract: { + // v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + // }, + // tokens: { + // USDT: "0x0663C09Bd0911181B39D66ec4bfAC9d89c8516BA", + // USDC: "0xfaBc451eA1Fd9707c6Ba1769F570E760101C7f22", + // } // }, mantle: { - mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + mosContract: { + v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + }, tokens: { USDT: ADDRESSES.mantle.USDT, USDC: ADDRESSES.mantle.USDC, } }, tron: { - mosContract: "TYMpgB8Q9vSoGtkyE3hXsvUrpte3KCDGj6", + mosContract: { + v2: "TYMpgB8Q9vSoGtkyE3hXsvUrpte3KCDGj6", + }, tokens: { USDT: ADDRESSES.tron.USDT, USDC: ADDRESSES.tron.USDC, } }, scroll: { - mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + mosContract: { + v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + }, tokens: { USDT: ADDRESSES.scroll.USDT, USDC: ADDRESSES.scroll.USDC, @@ -204,7 +238,9 @@ const config = { } }, linea: { - mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + mosContract: { + v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380", + }, tokens: { USDT: ADDRESSES.linea.USDT, USDC: ADDRESSES.linea.USDC, @@ -218,8 +254,8 @@ module.exports = { }; Object.keys(config).forEach(chain => { - const { mosContract, tokens } = config[chain] + const {mosContract, tokens} = config[chain] module.exports[chain] = { - tvl:sumTokensExport({ owner: mosContract, tokens: Object.values(tokens), logCalls: true }) + tvl: sumTokensExport({owners: Object.values(mosContract), tokens: Object.values(tokens), logCalls: true}) } }) From 9478e0036e06d9526b5fafa787d63724ce1c997b Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 3 Jul 2024 11:45:11 +0300 Subject: [PATCH 564/855] workaround for ankr api --- projects/helper/env.js | 1 + projects/helper/token.js | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/projects/helper/env.js b/projects/helper/env.js index dcffe5e9cc1d..da015f0d834e 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -45,6 +45,7 @@ const ENV_KEYS = [ 'SUMMER_HISTORY_ENDPOINT', 'SUMMER_AJNA_ENDPOINT', 'SUMMER_CONFIRMED_VAULTS_ENDPOINT', + 'ETHEREUM_TOKENS_ENDPOINT', 'UNISAT_AUTH' ] diff --git a/projects/helper/token.js b/projects/helper/token.js index af51880dcc5e..f122188e8901 100644 --- a/projects/helper/token.js +++ b/projects/helper/token.js @@ -71,7 +71,7 @@ const ankrChainMapping = { syscoin: 'syscoin', } -async function ankrGetTokens(address, { onlyWhitelisted = true } = {}) { +async function ankrGetTokens(address, { onlyWhitelisted = true, skipCacheRead = false } = {}) { address = address.toLowerCase() if (!ankrTokenCalls[address]) ankrTokenCalls[address] = _call() @@ -83,9 +83,9 @@ async function ankrGetTokens(address, { onlyWhitelisted = true } = {}) { const timeNow = Math.floor(Date.now() / 1e3) const THREE_DAYS = 3 * 24 * 3600 const cache = (await getCache(project, key)) ?? {} - if (cache.timestamp && (timeNow - cache.timestamp) < THREE_DAYS) + if (!skipCacheRead && cache.timestamp && (timeNow - cache.timestamp) < THREE_DAYS) return cache.tokens - + sdk.log('Pulling tokens for ' + address) const options = { @@ -97,6 +97,7 @@ async function ankrGetTokens(address, { onlyWhitelisted = true } = {}) { jsonrpc: '2.0', method: 'ankr_getAccountBalance', params: { + blockchain: Object.values(ankrChainMapping).filter(i => i !== 'eth'), onlyWhitelisted, nativeFirst: true, skipSyncCheck: true, @@ -116,12 +117,27 @@ async function ankrGetTokens(address, { onlyWhitelisted = true } = {}) { for (const [chain, values] of Object.entries(tokens)) { tokens[chain] = getUniqueAddresses(values) } + tokens.eth = await getETHTokens(address, onlyWhitelisted) await setCache(project, key, tokenCache) return tokens } } +async function getETHTokens(address, onlyWhitelisted) { + const endpoint = getEnv('ETHEREUM_TOKENS_ENDPOINT') + if (!endpoint) throw new Error('Missing endpoint for ethereum tokens') + const url = `${endpoint}/v1/1/address/${address}/balances_v2/` + const { data: { items } } = await get(url) + const tokenSet = new Set() + items.forEach(i => { + const token = i.native_token ? ADDRESSES.null : i.contract_address + if (i.is_spam && onlyWhitelisted) return; + tokenSet.add(token) + }) + return Array.from(tokenSet) +} + async function getComplexTreasury(owners) { const networks = ["ethereum", "polygon", "optimism", "gnosis", "binance-smart-chain", "fantom", "avalanche", "arbitrum", "celo", "harmony", "moonriver", "bitcoin", "cronos", "aurora", "evmos"] From 90f1430f10cfc1adb6b20649b5ce22b7673b3244 Mon Sep 17 00:00:00 2001 From: leeamijo <154820412+leeamijo@users.noreply.github.com> Date: Wed, 3 Jul 2024 17:10:15 +0800 Subject: [PATCH 565/855] feat: add support core chain (#10862) --- projects/pell/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/pell/index.js b/projects/pell/index.js index 9d6365a47cbf..3f3cc6209bb6 100644 --- a/projects/pell/index.js +++ b/projects/pell/index.js @@ -1,7 +1,7 @@ const { sumTokens2 } = require('../helper/unwrapLPs') const { getConfig } = require('../helper/cache') -const chains = ['merlin', 'bouncebit', 'btr', 'bsc', 'bsquared'] +const chains = ['merlin', 'bouncebit', 'btr', 'bsc', 'bsquared', 'core'] chains.forEach(chain => { module.exports[chain] = { From 860c9a5efb3b6458d4ed1bf57f6de62dc77545b2 Mon Sep 17 00:00:00 2001 From: abdulrafay-contrax <122004952+abdulrafay-contrax@users.noreply.github.com> Date: Wed, 3 Jul 2024 16:26:33 +0500 Subject: [PATCH 566/855] chore: contrax steer vaults addresses updated (#10865) Co-authored-by: Saqlain Riaz --- projects/contrax-finance/index.js | 34 +++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/projects/contrax-finance/index.js b/projects/contrax-finance/index.js index 60d1d69d721a..8590e085a6cb 100644 --- a/projects/contrax-finance/index.js +++ b/projects/contrax-finance/index.js @@ -26,7 +26,12 @@ const Vaults = [ const HOP_MAGIC_VAULT = "0x2d79B76841191c9c22238535a93Ee8169096A5Cc"; const GMX_VAULT = "0x8CdF8d10ea6Cd3492e67C4250481A695c2a75C4a"; const GMX = ADDRESSES.arbitrum.GMX; -const STEER_VAULTS = ["0x3fB6C1C5b7319Af78608570F97b920a553aB0Ed3", "0xe41586C416D8fAb3ee01e8a29DaD6f3a8655097d"]; +const STEER_VAULTS = [ + "0x404148F0B94Bc1EA2fdFE98B0DbF36Ff3E015Bb5", + "0x84f35729fF344C76FA73989511735c85E1F7487D", + "0x79deCB182664B1E7809a7EFBb94B50Db4D183310", + "0x4fFD588241Fa9183f5cDd57C4CACCac3817A380d", +]; async function getHopMagicData(api) { const tokenAddress = await api.call({ @@ -42,12 +47,28 @@ async function getHopMagicData(api) { } async function getSteerData(api) { - let tokens = await api.multiCall({ abi: "address:steerVault", calls: STEER_VAULTS }); - let bals = await api.multiCall({ - abi: "uint256:balance", - calls: STEER_VAULTS, + let tokens = await api.multiCall({ abi: "address:token", calls: STEER_VAULTS }); + const [token0s, token1s, supplies, reserves, bals] = await Promise.all([ + api.multiCall({ abi: "address:token0", calls: tokens }), + api.multiCall({ abi: "address:token1", calls: tokens }), + api.multiCall({ abi: "uint256:totalSupply", calls: tokens }), + api.multiCall({ + abi: "function getTotalAmounts() view returns (uint256 total0, uint256 total1)", + calls: tokens, + }), + api.multiCall({ + abi: "uint256:balance", + calls: STEER_VAULTS, + }), + ]); + + bals.forEach((bal, i) => { + const ratio = bal / supplies[i]; + const token0Bal = reserves[i][0] * ratio; + const token1Bal = reserves[i][1] * ratio; + api.addToken(token0s[i], token0Bal); + api.addToken(token1s[i], token1Bal); }); - api.addTokens(tokens, bals); } async function getGMXData(api) { @@ -74,6 +95,7 @@ async function tvl(api) { await getSteerData(api); api.addTokens(tokens, bals); + return sumTokens2({ api, resolveLP: true }); } From 2202d4fb6e401f10af07c261910f515a865ae83e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 3 Jul 2024 15:05:32 +0300 Subject: [PATCH 567/855] limitless: track value in margin contract --- projects/limitless/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/projects/limitless/index.js b/projects/limitless/index.js index ac9ad3ebbbaf..11240d9aef3e 100644 --- a/projects/limitless/index.js +++ b/projects/limitless/index.js @@ -1,13 +1,13 @@ const { nullAddress, addUniV3LikePosition } = require("../helper/unwrapLPs") const config = { - base: { postionManager: '0x3eF54A2Cf152f6E06C0928722412883D448F92eC', factory: '0x33128a8fC17869897dcE68Ed026d694621f6FDfD', limWETH: '0x845d629D2485555514B93F05Bdbe344cC2e4b0ce', }, + base: { postionManager: '0x3eF54A2Cf152f6E06C0928722412883D448F92eC', factory: '0x33128a8fC17869897dcE68Ed026d694621f6FDfD', limWETH: '0x845d629D2485555514B93F05Bdbe344cC2e4b0ce', marginContract: '0x536801AaE40cb214c08f178c6727d7594a7c655b', }, arbitrum: { postionManager: '0x6D73fc6F4C299E369377C0e60CebFef2409f86A0', factory: '0x1F98431c8aD98523631AE4a59f267346ea31F984', limWETH: '0xdEe4326E0a8B5eF94E50a457F7c70d4821be9f4C', }, linea: { postionManager: '0x726e3116AE07f43A7E1921c635352B75e2DEa4Ad', factory: '0x31FAfd4889FA1269F7a13A66eE0fB458f27D72A9', limWETH: '0x5188b47Cb80D1A3E22Cc6221792F199f1Fb0DD3c', }, } Object.keys(config).forEach(chain => { - const { postionManager, factory, limWETH } = config[chain] + const { postionManager, factory, limWETH, marginContract } = config[chain] module.exports[chain] = { tvl: async (api) => { @@ -15,6 +15,7 @@ Object.keys(config).forEach(chain => { const token = await api.call({ abi: 'address:asset', target: limWETH }) await api.sumTokens({ owner: limWETH, tokens: [token]}) } + const allTokens = [] const getKey = (token0, token1, fee) => `${token0}-${token1}-${fee}` @@ -25,6 +26,10 @@ Object.keys(config).forEach(chain => { if (liquidity === 0) return; if (token0 === nullAddress && token1 === nullAddress) return; poolData[getKey(token0, token1, fee)] = { call: { params: [token0, token1, fee] } } + if (marginContract) { + allTokens.push(token0) + allTokens.push(token1) + } api.add(token0, tokensOwed0) api.add(token1, tokensOwed1) }) @@ -41,6 +46,7 @@ Object.keys(config).forEach(chain => { if (!tick) return; // pool not found addUniV3LikePosition({ api, token0, token1, tick, liquidity, tickUpper, tickLower, }) }) + if (marginContract) return api.sumTokens({ tokens: allTokens, owner: marginContract}) } } }) From 3a613c4ef3562f877ee86df499688e48541e06a8 Mon Sep 17 00:00:00 2001 From: LeviathanYou <168118002+LeviathanYou@users.noreply.github.com> Date: Wed, 3 Jul 2024 22:31:37 +0800 Subject: [PATCH 568/855] feat: add skale-europa for meson (#10868) --- projects/meson/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/meson/index.js b/projects/meson/index.js index 6b6fbe6e191d..0b4c087c2cc5 100644 --- a/projects/meson/index.js +++ b/projects/meson/index.js @@ -100,7 +100,8 @@ const config = { polygon_zkevm: { id: 'zkevm'}, era: { id: 'zksync'}, btr: { id: 'bitlayer'}, - bouncebit: { id: 'bb'} + bouncebit: { id: 'bb'}, + europa: { id: 'skale-europa' } } async function addCoinfg(id, ownerTokens) { From 1cbd37ff14dde8d25d82e8e63fce5d273663c500 Mon Sep 17 00:00:00 2001 From: John Letey Date: Wed, 3 Jul 2024 16:55:03 +0200 Subject: [PATCH 569/855] feat: add USDY on Noble (#10867) --- projects/helper/chains.json | 1 + projects/ondofinance/index.js | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 71efd4e4638f..3bb62b2dc603 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -208,6 +208,7 @@ "neutron", "new", "nibiru", + "noble", "nolus", "nos", "nova", diff --git a/projects/ondofinance/index.js b/projects/ondofinance/index.js index 84e2339b5494..5db659f803a5 100644 --- a/projects/ondofinance/index.js +++ b/projects/ondofinance/index.js @@ -1,6 +1,7 @@ const { getTokenSupply } = require("../helper/solana"); const sui = require("../helper/chain/sui"); const { aQuery } = require("../helper/chain/aptos"); +const { get } = require("../helper/http"); module.exports = { methodology: "Sums the total supplies of Ondo's issued tokens.", @@ -28,6 +29,9 @@ const config = { aptos: { USDY: "0xcfea864b32833f157f042618bd845145256b1bf4c0da34a7013b76e42daa53cc", }, + noble: { + USDY: "ausdy", + }, }; async function getUSDYTotalSupplySUI() { @@ -67,6 +71,9 @@ Object.keys(config).forEach((chain) => { supply.vec[0].integer.vec[0].value / Math.pow(10, decimals); api.addTokens(config.ethereum.USDY, aptosSupply * 1e18, { skipChain: true, }); + } else if (chain === "noble") { + const res = await get(`https://noble-api.polkachu.com/cosmos/bank/v1beta1/supply/${config.noble.USDY}`); + api.addTokens(config.ethereum.USDY, parseInt(res.amount.amount), { skipChain: true, }); } else { supplies = await api.multiCall({ abi: "erc20:totalSupply", From 67b8b71ecd06a031f13eeee421878d959d75ef9a Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Wed, 3 Jul 2024 16:09:31 +0100 Subject: [PATCH 570/855] vfat --- projects/vfat/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/vfat/index.js b/projects/vfat/index.js index afb8a4a3e484..de0d3f222e52 100644 --- a/projects/vfat/index.js +++ b/projects/vfat/index.js @@ -307,7 +307,7 @@ async function tvlArbitrumLinea(api) { const masterchefPositions = await fetchSickleNftPositions(api, sickles, config[api.chain].masterchefV3, true); positions.forEach(position => addUniV3LikePosition({ ...position, api })); - masterchefPositions.forEach(position => addUniV3LikePosition({ ...position, api })); + masterchefPositions.splice(6, 1).forEach(position => addUniV3LikePosition({ ...position, api })); return sumTokens2({ api, resolveLP: true }); From 51a19f9d53c3b721ee19289b184ce6595b5ee723 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Wed, 3 Jul 2024 16:17:28 +0100 Subject: [PATCH 571/855] remove duplicated vault (#10871) --- projects/etherfi-liquid/index.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/projects/etherfi-liquid/index.js b/projects/etherfi-liquid/index.js index d485b235f8e1..ba6a87b35187 100644 --- a/projects/etherfi-liquid/index.js +++ b/projects/etherfi-liquid/index.js @@ -22,11 +22,7 @@ async function tvl(api) { throw new Error('Data is outdated') } console.log(updatedTimestamp, api.timestamp) - const balETH2 = await api.call({ - abi: "uint256:totalSupply", - target: '0x917ceE801a67f933F2e6b33fC0cD1ED2d5909D88', - }); - api.add(ADDRESSES.ethereum.EETH, BigInt(balETH) - BigInt(wethBal) + BigInt(balETH2)); + api.add(ADDRESSES.ethereum.EETH, BigInt(balETH) - BigInt(wethBal)); api.add(ADDRESSES.ethereum.WETH, wethBal) const balUSD = await api.call({ abi: "uint256:totalSupply", From 42fe46d4395a5e489eea101a2a9a16b6f45502b3 Mon Sep 17 00:00:00 2001 From: Robert Chu Date: Wed, 3 Jul 2024 12:02:58 -0700 Subject: [PATCH 572/855] Corrects the calculation of avax borrowed positions. (#10872) --- projects/term-finance/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/term-finance/index.js b/projects/term-finance/index.js index d3a6af84763d..77b168a9d3b7 100644 --- a/projects/term-finance/index.js +++ b/projects/term-finance/index.js @@ -4,8 +4,8 @@ const { getLogs } = require('../helper/cache/getLogs') const graphs = { ethereum: "https://public-graph-proxy.mainnet.termfinance.io", - avax: - "https://public-graph-proxy.avalanche.mainnet.termfinance.io", + avax: + "https://public-graph-proxy.avalanche.mainnet.termfinance.io", }; const query = ` @@ -40,7 +40,7 @@ query auctionsQuery($lastId: ID) { const startBlocks = { "ethereum": 16380765, - "avalanche": 43162228, + "avax": 43162228, }; const emitters = { "ethereum": [ @@ -48,7 +48,7 @@ const emitters = { "0xf268E547BC77719734e83d0649ffbC25a8Ff4DB3", // 0.4.1 "0xc60e0f5cD9EE7ACd22dB42F7f56A67611ab6429F", // 0.6.0 ], - "avalanche": [ + "avax": [ "0xb81afB6724ba9d19a3572Fb29ed7ef633fD50093", // 0.6.0 ], }; From 03c03084df006fbda8dc7bada078564d40f90f1d Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 3 Jul 2024 21:32:56 +0100 Subject: [PATCH 573/855] add usde --- projects/helper/tokenMapping.js | 3 +++ projects/synthetix-v3/index.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 6ac21dbeeaa8..0d061228e426 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -239,6 +239,9 @@ const fixBalancesTokens = { [ADDRESSES.aeternity.USDC]:{ coingeckoId: 'usd-coin', decimals: 18 }, [ADDRESSES.aeternity.USDT]:{ coingeckoId: 'tether', decimals: 18 }, [ADDRESSES.aeternity.WBTC]:{ coingeckoId: 'wrapped-bitcoin', decimals: 18 }, + }, + arbitrum: { + '0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34': { coingeckoId:'ethereum:0x4c9edd5852cd905f086c759e8383e09bff1e68b3', decimals:0 } } } diff --git a/projects/synthetix-v3/index.js b/projects/synthetix-v3/index.js index a556bbf52cc6..168346a3d0c8 100644 --- a/projects/synthetix-v3/index.js +++ b/projects/synthetix-v3/index.js @@ -6,6 +6,6 @@ module.exports = { tvl: sumTokensExport({ owner: '0x32C222A9A159782aFD7529c87FA34b96CA72C696', tokens: [ADDRESSES.base.USDC] }) }, arbitrum: { - tvl: sumTokensExport({ owner: '0xffffffaEff0B96Ea8e4f94b2253f31abdD875847', tokens: [ADDRESSES.arbitrum.USDC_CIRCLE, ADDRESSES.arbitrum.WETH, ADDRESSES.arbitrum.ARB] }) + tvl: sumTokensExport({ owner: '0xffffffaEff0B96Ea8e4f94b2253f31abdD875847', tokens: [ADDRESSES.arbitrum.USDC_CIRCLE, ADDRESSES.arbitrum.WETH, ADDRESSES.arbitrum.ARB, ADDRESSES.arbitrum.USDe] }) } } From f56e95b4b95e093a4cb0ab1ad3afd903a5d1e0e8 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Wed, 3 Jul 2024 22:16:17 +0100 Subject: [PATCH 574/855] tokenMapping monthly move (#10864) --- projects/helper/tokenMapping.js | 165 ++++++++++++++++---------------- 1 file changed, 83 insertions(+), 82 deletions(-) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 0d061228e426..f2642454e63d 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -38,62 +38,62 @@ const ibcMappings = { const fixBalancesTokens = { ftn: { [ADDRESSES.null]: { coingeckoId: 'fasttoken', decimals: 18 }, - '0x4084ab20f8ffca76c19aaf854fb5fe9de6217fbb': { coingeckoId: 'fasttoken', decimals: 18 }, - '0x498d1cf9ad2d66144c98057a5880ee16e801e2f7': { coingeckoId: 'fasttoken', decimals: 18 }, + '0x4084ab20f8ffca76c19aaf854fb5fe9de6217fbb': { coingeckoId: 'fasttoken', decimals: 18 }, //done + '0x498d1cf9ad2d66144c98057a5880ee16e801e2f7': { coingeckoId: 'fasttoken', decimals: 18 }, //done }, q: { - [ADDRESSES.q.ELK]: { coingeckoId: "elk-finance", decimals: 18 }, - [ADDRESSES.q.WETH]: { coingeckoId: "ethereum", decimals: 18 }, + [ADDRESSES.q.ELK]: { coingeckoId: "elk-finance", decimals: 18 }, //done + [ADDRESSES.q.WETH]: { coingeckoId: "ethereum", decimals: 18 }, //done }, degen: { - '0xf058eb3c946f0eaeca3e6662300cb01165c64ede': { coingeckoId: 'ethereum', decimals: 18 }, + '0xf058eb3c946f0eaeca3e6662300cb01165c64ede': { coingeckoId: 'ethereum', decimals: 18 }, //done }, stacks: { - "SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.token-vlqstx::vlqstx": { coingeckoId: "blockstack", decimals: 6 }, - "SP2XD7417HGPRTREMKF748VNEQPDRR0RMANB7X1NK.token-abtc::bridged-btc": { coingeckoId: "xlink-bridged-btc-stacks", decimals: 8 }, - "SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.token-alex::alex": { coingeckoId: "alexgo", decimals: 8 }, + "SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.token-vlqstx::vlqstx": { coingeckoId: "blockstack", decimals: 6 }, // no clue what is the symbol + "SP2XD7417HGPRTREMKF748VNEQPDRR0RMANB7X1NK.token-abtc::bridged-btc": { coingeckoId: "xlink-bridged-btc-stacks", decimals: 8 }, //done + "SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.token-alex::alex": { coingeckoId: "alexgo", decimals: 8 }, //done }, stellar: { - [ADDRESSES.stellar.XLM]: { coingeckoId: "stellar", decimals: 7}, - [ADDRESSES.stellar.USDC]: { coingeckoId: "usd-coin", decimals: 7}, + [ADDRESSES.stellar.XLM]: { coingeckoId: "stellar", decimals: 7}, //done + [ADDRESSES.stellar.USDC]: { coingeckoId: "usd-coin", decimals: 7}, //done }, defichain_evm: { - [ADDRESSES.defichain_evm.DFI]: { coingeckoId: "defichain", decimals: 18 }, - [ADDRESSES.defichain_evm.USDT]: { coingeckoId: "usd-coin", decimals: 18 }, - [ADDRESSES.defichain_evm.USDC]: { coingeckoId: "tether", decimals: 18 }, - [ADDRESSES.defichain_evm.ETH]: { coingeckoId: "ethereum", decimals: 18 }, - [ADDRESSES.defichain_evm.DUSD]: { coingeckoId: "decentralized-usd", decimals: 18 }, - '0x66F3Cf265D2D146A0348F6fC67E3Da0835e0968E': { coingeckoId: "javsphere", decimals: 18 }, + [ADDRESSES.defichain_evm.DFI]: { coingeckoId: "defichain", decimals: 18 }, //done + [ADDRESSES.defichain_evm.USDT]: { coingeckoId: "usd-coin", decimals: 18 }, //done + [ADDRESSES.defichain_evm.USDC]: { coingeckoId: "tether", decimals: 18 }, //done + [ADDRESSES.defichain_evm.ETH]: { coingeckoId: "ethereum", decimals: 18 }, //done + [ADDRESSES.defichain_evm.DUSD]: { coingeckoId: "decentralized-usd", decimals: 18 }, //done + '0x66F3Cf265D2D146A0348F6fC67E3Da0835e0968E': { coingeckoId: "javsphere", decimals: 18 }, //done }, ace: { - [nullAddress]: { coingeckoId: "endurance", decimals: 18 }, - '0x85119527cf38f6ccf7b1b8f8fad05145358aaa81': { coingeckoId: "endurance", decimals: 18 }, + [nullAddress]: { coingeckoId: "endurance", decimals: 18 }, //done + '0x85119527cf38f6ccf7b1b8f8fad05145358aaa81': { coingeckoId: "endurance", decimals: 18 }, //done }, 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 }, + 'AS12U4TZfNK7qoLyEERBBRDMu8nm5MKoRzPXDXans4v9wdATZedz9': { coingeckoId: 'wrapped-massa', decimals: 9 }, //done + 'AS1hCJXjndR4c9vekLWsXGnrdigp4AaZ7uYG3UKFzzKnWVsrNLPJ': { coingeckoId: 'massa-bridged-usdc-massa', decimals: 6 }, //done + 'AS1ZGF1upwp9kPRvDKLxFAKRebgg7b3RWDnhgV7VvdZkZsUL7Nuv': { coingeckoId: 'massa-bridged-dai-massa', decimals: 18 }, //done + 'AS124vf3YfAJCSCQVYKczzuWWpXrximFpbTmX4rheLs5uNSftiiRY': { coingeckoId: 'wrapped-ether-massa', decimals: 18 }, //done }, // 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 }, - '0x01f0a31698c4d065659b9bdc21b3610292a1c506': { coingeckoId: "ethereum:0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee", decimals: 0 }, + [ADDRESSES.mode.STONE]: { coingeckoId: "ethereum:0x7122985656e38bdc0302db86685bb972b145bd3c", decimals: 0 }, //done wrong decimals + '0x3ba89d490ab1c0c9cc2313385b30710e838370a4': { coingeckoId: "solv-btc", decimals: 18 }, //done + '0x01f0a31698c4d065659b9bdc21b3610292a1c506': { coingeckoId: "ethereum:0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee", decimals: 0 }, //done wrong decimals }, tezos: { - "KT1PnUZCp3u2KzWr93pn4DD7HAJnm3rWVrgn": { coingeckoId: "tezos", decimals: 6 }, - "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-17": { coingeckoId: "usd-coin", decimals: 6 }, - "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-18": { coingeckoId: "tether", decimals: 6 }, + "KT1PnUZCp3u2KzWr93pn4DD7HAJnm3rWVrgn": { coingeckoId: "tezos", decimals: 6 }, //done + "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-17": { coingeckoId: "usd-coin", decimals: 6 }, //done + "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-18": { coingeckoId: "tether", decimals: 6 }, //done }, iotaevm: { - "0x6e47f8d48a01b44DF3fFF35d258A10A3AEdC114c": { coingeckoId: 'iota', decimals: 18 }, + "0x6e47f8d48a01b44DF3fFF35d258A10A3AEdC114c": { coingeckoId: 'iota', decimals: 18 }, //done }, aurora: { - '0x368ebb46aca6b8d0787c96b2b20bd3cc3f2c45f7': { coingeckoId: 'usd-coin', decimals: 6 }, + '0x368ebb46aca6b8d0787c96b2b20bd3cc3f2c45f7': { coingeckoId: 'usd-coin', decimals: 6 }, //done }, acala: { ACA: { coingeckoId: "acala", decimals: 12 }, @@ -110,101 +110,102 @@ const fixBalancesTokens = { KBTC: { coingeckoId: "kintsugi-btc", decimals: 8 }, }, ham: { - [ADDRESSES.optimism.WETH_1]: { coingeckoId: 'ethereum', decimals: 18 }, + [ADDRESSES.optimism.WETH_1]: { coingeckoId: 'ethereum', decimals: 18 }, //DONE }, 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 - [ADDRESSES.arbitrum.USDe]: { coingeckoId: "ethena-usde", decimals: 18 }, + '0x0000000000000000000000000000000000000001': { coingeckoId: 'ethereum', decimals: 18 }, //DONE + '0xf7bc58b8d8f97adc129cfc4c9f45ce3c0e1d2692': { coingeckoId: "wrapped-bitcoin", decimals: 8 }, //DONE + '0x9e0d7d79735e1c63333128149c7b616a0dc0bbdb': { coingeckoId: "weth", decimals: 18 }, //pirex eth //DONE + '0xde55b113a27cc0c5893caa6ee1c020b6b46650c0': { coingeckoId: "deus-finance-2", decimals: 18 }, // deus //DONE + [ADDRESSES.arbitrum.USDe]: { coingeckoId: "ethena-usde", decimals: 18 }, // DONE }, solana: { - 'AZsHEMXd36Bj1EMNXhowJajpUXzrKcK57wW4ZGXVa7yR': { coingeckoId: "guacamole", decimals: 5 }, + 'AZsHEMXd36Bj1EMNXhowJajpUXzrKcK57wW4ZGXVa7yR': { coingeckoId: "guacamole", decimals: 5 }, // DONE }, chz: { - '0x677F7e16C7Dd57be1D4C8aD1244883214953DC47': { coingeckoId: "wrapped-chiliz", decimals: 18 } + '0x677F7e16C7Dd57be1D4C8aD1244883214953DC47': { coingeckoId: "wrapped-chiliz", decimals: 18 } // DONE }, zklink: { - '0xbEAf16cFD8eFe0FC97C2a07E349B9411F5dC272C': { coingeckoId: "solv-btc", decimals: 18 }, - '0xFb8dBdc644eb54dAe0D7A9757f1e6444a07F8067': { coingeckoId: "bitcoin-trc20", decimals: 18 }, - '0x85D431A3a56FDf2d2970635fF627f386b4ae49CC': { coingeckoId: "merlin-s-seal-btc", decimals: 18 }, + '0xbEAf16cFD8eFe0FC97C2a07E349B9411F5dC272C': { coingeckoId: "solv-btc", decimals: 18 }, // DONE + '0xFb8dBdc644eb54dAe0D7A9757f1e6444a07F8067': { coingeckoId: "bitcoin-trc20", decimals: 18 }, // DONE + '0x85D431A3a56FDf2d2970635fF627f386b4ae49CC': { coingeckoId: "merlin-s-seal-btc", decimals: 18 }, // DONE }, btr: { - [ADDRESSES.null]: { coingeckoId: 'bitcoin', decimals: 18 }, - '0xff204e2681a6fa0e2c3fade68a1b28fb90e4fc5f': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, - '0xfe9f969faf8ad72a83b761138bf25de87eff9dd2': { coingeckoId: 'tether', decimals: 6 }, - '0x9827431e8b77e87c9894bd50b055d6be56be0030': { coingeckoId: 'usd-coin', decimals: 6 }, + [ADDRESSES.null]: { coingeckoId: 'bitcoin', decimals: 18 }, // DONE + '0xff204e2681a6fa0e2c3fade68a1b28fb90e4fc5f': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, // DONE + '0xfe9f969faf8ad72a83b761138bf25de87eff9dd2': { coingeckoId: 'tether', decimals: 6 }, // DONE + '0x9827431e8b77e87c9894bd50b055d6be56be0030': { coingeckoId: 'usd-coin', decimals: 6 }, // DONE // fix these by pricing the tokens in coins repo - '0xd53E6f1d37f430d84eFad8060F9Fec558B36F6fa': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, - '0xf6718b2701d4a6498ef77d7c152b2137ab28b8a3': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, + '0xd53E6f1d37f430d84eFad8060F9Fec558B36F6fa': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, // DONE + '0xf6718b2701d4a6498ef77d7c152b2137ab28b8a3': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, // DONE //REMOVE '0x9a6ae5622990ba5ec1691648c3a2872469d161f9': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, //REMOVE '0xA984b70f7B41EE736B487D5F3D9C1e1026476Ea3': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, }, cyeth: { - [ADDRESSES.optimism.WETH_1]: { coingeckoId: 'ethereum', decimals: 18 }, + [ADDRESSES.optimism.WETH_1]: { coingeckoId: 'ethereum', decimals: 18 }, //DONE }, bouncebit: { - [ADDRESSES.null]: { coingeckoId: 'bouncebit', decimals: 18 }, - '0xf4c20e5004c6fdcdda920bdd491ba8c98a9c5863': { coingeckoId: 'bouncebit', decimals: 18 }, - '0x77776b40c3d75cb07ce54dea4b2fd1d07f865222': { coingeckoId: 'tether', decimals: 18 }, - '0xF5e11df1ebCf78b6b6D26E04FF19cD786a1e81dC': { coingeckoId: 'bitcoin', decimals: 18 }, + [ADDRESSES.null]: { coingeckoId: 'bouncebit', decimals: 18 }, //DONE + '0xf4c20e5004c6fdcdda920bdd491ba8c98a9c5863': { coingeckoId: 'bouncebit', decimals: 18 }, //DONE + '0x77776b40c3d75cb07ce54dea4b2fd1d07f865222': { coingeckoId: 'tether', decimals: 18 }, //DONE + '0xF5e11df1ebCf78b6b6D26E04FF19cD786a1e81dC': { coingeckoId: 'bitcoin', decimals: 18 }, //DONE }, linea: { - '0x63ba74893621d3d12f13cec1e86517ec3d329837': { coingeckoId: 'liquity-usd', decimals: 18 }, + '0x63ba74893621d3d12f13cec1e86517ec3d329837': { coingeckoId: 'liquity-usd', decimals: 18 }, //DONE }, bevm: { - '0x2967e7bb9daa5711ac332caf874bd47ef99b3820': { coingeckoId: 'wrapped-stbtc', decimals: 18 }, + '0x2967e7bb9daa5711ac332caf874bd47ef99b3820': { coingeckoId: 'wrapped-stbtc', decimals: 18 }, //DONE }, real: { [ADDRESSES.null]: { coingeckoId: 'ethereum', decimals: 18 }, '0x90c6E93849E06EC7478ba24522329d14A5954Df4': { coingeckoId: 'ethereum', decimals: 18 }, - '0x75d0cbf342060b14c2fc756fd6e717dfeb5b1b70': { coingeckoId: 'dai', decimals: 18 }, - '0x83fedbc0b85c6e29b589aa6bdefb1cc581935ecd': { coingeckoId: 'real-us-t-bill', decimals: 18 }, - '0xAEC9e50e3397f9ddC635C6c429C8C7eca418a143': { coingeckoId: 'arcana-2', decimals: 18 }, // arcUSD - '0xeAcFaA73D34343FcD57a1B3eB5B0D949df727712': { coingeckoId: 'arcana-2', decimals: 18 }, // PTa, 1:1 wrapped arcUSD - '0x25ea98ac87A38142561eA70143fd44c4772A16b6': { coingeckoId: 'stack-2', decimals: 18 }, // MORE + '0x75d0cbf342060b14c2fc756fd6e717dfeb5b1b70': { coingeckoId: 'dai', decimals: 18 }, //DONE + '0x83fedbc0b85c6e29b589aa6bdefb1cc581935ecd': { coingeckoId: 'real-us-t-bill', decimals: 18 }, //DONE + '0xAEC9e50e3397f9ddC635C6c429C8C7eca418a143': { coingeckoId: 'arcana-2', decimals: 18 }, // arcUSD //DONE + '0xeAcFaA73D34343FcD57a1B3eB5B0D949df727712': { coingeckoId: 'arcana-2', decimals: 18 }, // PTa, 1:1 wrapped arcUSD //DONE + '0x25ea98ac87A38142561eA70143fd44c4772A16b6': { coingeckoId: 'stack-2', decimals: 18 }, // MORE //DONE }, 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 }, + [ADDRESSES.null]: { coingeckoId: 'ethereum', decimals: 18 }, //DONE + [ADDRESSES.taiko.WETH]: { coingeckoId: 'ethereum', decimals: 18 }, //DONE + [ADDRESSES.taiko.USDC]: { coingeckoId: 'usd-coin', decimals: 6 }, //DONE + [ADDRESSES.taiko.USDC_e]: { coingeckoId: 'usd-coin', decimals: 6 }, //DONE + [ADDRESSES.taiko.USDT]: { coingeckoId: 'tether', decimals: 6 }, //DONE }, sei: { - '0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1': { coingeckoId: 'usd-coin', decimals: 6 }, - '0xb75d0b03c06a926e488e2659df1a861f860bd3d1': { coingeckoId: 'tether', decimals: 6 }, - [ADDRESSES.null]: { coingeckoId: 'sei-network', decimals: 18 }, - '0x160345fc359604fc6e70e3c5facbde5f7a9342d8': { coingeckoId: 'ethereum', decimals: 18 }, - '0x5cf6826140c1c56ff49c808a1a75407cd1df9423': { coingeckoId: 'silo-staked-sei', decimals: 6 }, - [ADDRESSES.sei.WSEI]: { coingeckoId: 'sei-network', decimals: 18 }, + '0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1': { coingeckoId: 'usd-coin', decimals: 6 }, //DONE + '0xb75d0b03c06a926e488e2659df1a861f860bd3d1': { coingeckoId: 'tether', decimals: 6 }, //DONE + [ADDRESSES.null]: { coingeckoId: 'sei-network', decimals: 18 }, //DONE + '0x160345fc359604fc6e70e3c5facbde5f7a9342d8': { coingeckoId: 'ethereum', decimals: 18 }, //DONE + '0x5cf6826140c1c56ff49c808a1a75407cd1df9423': { coingeckoId: 'silo-staked-sei', decimals: 6 }, //DONE + [ADDRESSES.sei.WSEI]: { coingeckoId: 'sei-network', decimals: 18 }, //DONE }, core: { - '0x5832f53d147b3d6cd4578b9cbd62425c7ea9d0bd': { coingeckoId: 'wrapped-bitcoin', decimals: 8 }, - '0x5B1Fb849f1F76217246B8AAAC053b5C7b15b7dc3': { coingeckoId: 'solv-btc', decimals: 18 }, + '0x5832f53d147b3d6cd4578b9cbd62425c7ea9d0bd': { coingeckoId: 'wrapped-bitcoin', decimals: 8 }, //DONE + '0x5B1Fb849f1F76217246B8AAAC053b5C7b15b7dc3': { coingeckoId: 'solv-btc', decimals: 18 }, //DONE }, lukso: { - [ADDRESSES.lukso.WLYX]: { coingeckoId: 'lukso-token-2', decimals: 18 }, + [ADDRESSES.lukso.WLYX]: { coingeckoId: 'lukso-token-2', decimals: 18 }, //DONE }, planq: { - [ADDRESSES.functionx.USDT]: { coingeckoId: 'usd-coin', decimals: 6 }, - [ADDRESSES.planq.USDC_1]: { coingeckoId: 'usd-coin', decimals: 18 }, + [ADDRESSES.functionx.USDT]: { coingeckoId: 'usd-coin', decimals: 6 }, //DONE + [ADDRESSES.planq.USDC_1]: { coingeckoId: 'usd-coin', decimals: 18 }, //DONE }, zeta: { - "0x1e4bF3CaBD7707089138dD5a545B077413FA83Fc": { coingeckoId: 'pufeth', decimals: 18 }, + "0x1e4bF3CaBD7707089138dD5a545B077413FA83Fc": { coingeckoId: 'pufeth', decimals: 18 }, //DONE }, etlk: { - '0xc9b53ab2679f573e480d01e0f49e2b5cfb7a3eab': { coingeckoId: 'tezos', decimals: 18 }, + '0xc9b53ab2679f573e480d01e0f49e2b5cfb7a3eab': { coingeckoId: 'tezos', decimals: 18 }, //DONE }, - 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 }, + sanko: { + [ADDRESSES.null]: { coingeckoId: 'wrapped-dmt', decimals: 18 }, //DONE + "0x754cdad6f5821077d6915004be2ce05f93d176f8": { coingeckoId: 'wrapped-dmt', decimals: 18 }, //DONE + "0xe01e3b20c5819cf919f7f1a2b4c18bbfd222f376": { coingeckoId: 'sanko-bridged-weth-sanko', decimals: 18 }, //DONE + "0x13d675bc5e659b11cfa331594cf35a20815dcf02": { coingeckoId: 'sanko-bridged-usdc-sanko', decimals: 6 }, //DONE "0x3c84f959f4b8ca0c39847d02f936e13fa8fc4eb9": { coingeckoId: 'beat-the-allegations', decimals: 18 }, // star }, + // WILL ADD THIS ONE IN A BIT xai: { "0x3fb787101dc6be47cfe18aeee15404dcc842e6af": { coingeckoId: 'xai-blockchain', decimals: 18 }, "0xbee82cfdaff4a6aa4e4793cb81eb1c2e79ac463c": { coingeckoId: 'weth', decimals: 18 }, From 498f2992604d773e388f5ff6d70ebf70ce7f2982 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Wed, 3 Jul 2024 22:35:17 +0100 Subject: [PATCH 575/855] Remove god dam eth (#10875) * remove duplicated vault * change logic etherfi --- projects/etherfi-lrt/index.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/projects/etherfi-lrt/index.js b/projects/etherfi-lrt/index.js index 1d339ce506dd..576cdac1e000 100644 --- a/projects/etherfi-lrt/index.js +++ b/projects/etherfi-lrt/index.js @@ -1,14 +1,17 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport } = require('../helper/sumTokens'); +const ADDRESSES = require('../helper/coreAssets.json'); +const sdk = require('@defillama/sdk'); -const owners = ["0x917ceE801a67f933F2e6b33fC0cD1ED2d5909D88"] +async function tvl(api) { + const balETH2 = await api.call({ + abi: "uint256:totalSupply", + target: '0x917ceE801a67f933F2e6b33fC0cD1ED2d5909D88', + }); + api.add(ADDRESSES.ethereum.EETH, BigInt(balETH2)); +} module.exports = { - methodology: "LRTS on 0x917ceE801a67f933F2e6b33fC0cD1ED2d5909D88", doublecounted: true, ethereum: { - tvl: sumTokensExport({ - owners, - tokens: [ADDRESSES.ethereum.WSTETH, ADDRESSES.ethereum.sfrxETH, ADDRESSES.ethereum.cbETH, ADDRESSES.ethereum.EETH, ADDRESSES.ethereum.RETH, ADDRESSES.null, "0xf951E335afb289353dc249e82926178EaC7DEd78", "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee", "0xA35b1B31Ce002FBF2058D22F30f95D405200A15b", "0xa2E3356610840701BDf5611a53974510Ae27E2e1", "0xd5F7838F5C461fefF7FE49ea5ebaF7728bB0ADfa" ] - }), - }} + tvl, + }, +}; From f3e431384e1d343895cd5e70ca1a098467e9981a Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 4 Jul 2024 03:32:35 +0100 Subject: [PATCH 576/855] add eth vault --- projects/mitosis/index.js | 85 +++++++++++++++++++++++++++++++-------- 1 file changed, 68 insertions(+), 17 deletions(-) diff --git a/projects/mitosis/index.js b/projects/mitosis/index.js index cbd3fca05f69..e0b048e7703a 100644 --- a/projects/mitosis/index.js +++ b/projects/mitosis/index.js @@ -1,5 +1,6 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokens2 } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json'); +const { sumTokens2 } = require('../helper/unwrapLPs'); +const sdk = require('@defillama/sdk'); const WEETH_ADDRESS = { ethereum: "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee", @@ -12,6 +13,10 @@ const WEETH_ADDRESS = { scroll: "0x01f0a31698c4d065659b9bdc21b3610292a1c506", }; +const VAULT_weETHs = { + ethereum: "0x917ceE801a67f933F2e6b33fC0cD1ED2d5909D88", +}; + const CAP_ADDRESS = { scroll: "0x4a6219E25a41FD4165fbd158D89723a7175EA382", ethereum: "0x451d791b6e9a9b8c9237bb55e58a7757342b16f9", @@ -20,18 +25,64 @@ const CAP_ADDRESS = { }; const vaults = { - scroll: '0xB9Ca61A6D5fA0c443F3c48Ab1fbf0118964308D6' -} - -Object.keys(WEETH_ADDRESS).forEach((chain) => { - module.exports[chain] = { - tvl: async (api) => { - const vault = vaults[chain]; - if (vault) return sumTokens2({ api, owner: vault, tokens: [WEETH_ADDRESS[chain]] }) - const cap = - CAP_ADDRESS[chain] ?? "0xb883ee478d3b7fea8a5357a3c3e27e2d2292b1d2"; - const tvl = await api.call({ abi: "uint256:load", target: cap }); - api.add(WEETH_ADDRESS[chain], tvl); - }, - }; -}); + scroll: '0xB9Ca61A6D5fA0c443F3c48Ab1fbf0118964308D6', + ethereum: '0xE4cf2D4eb9c01784798679F2FED4CF47cc59a3ec' +}; + +const ethCapTVL = async (api) => { + const ethcap = CAP_ADDRESS.ethereum; + const tvl = await api.call({ abi: "uint256:load", target: ethcap }); + + const balance = {}; + balance[WEETH_ADDRESS.ethereum] = tvl; + + return balance; +}; + +const ethVaultTVL = async (api) => { + const ethvault = vaults.ethereum; + return sumTokens2({ api, owner: ethvault, tokens: [VAULT_weETHs.ethereum] }); +}; + +const scrollVaultTVL = async (api) => { + const vault = vaults.scroll; + return sumTokens2({ api, owner: vault, tokens: [WEETH_ADDRESS.scroll] }); +}; + +const capTVL = (chain) => async (api) => { + const cap = CAP_ADDRESS[chain] ?? "0xb883ee478d3b7fea8a5357a3c3e27e2d2292b1d2"; + const tvl = await api.call({ abi: "uint256:load", target: cap }); + api.add(WEETH_ADDRESS[chain], tvl); +}; + + +module.exports = { + ethereum: { + tvl: sdk.util.sumChainTvls([ethCapTVL, ethVaultTVL]) + }, + scroll: { + tvl: scrollVaultTVL, + }, + arbitrum: { + tvl: capTVL("arbitrum"), + }, + optimism: { + tvl: capTVL("optimism"), + }, + mode: { + tvl: capTVL("mode"), + }, + manta: { + tvl: capTVL("manta"), + }, + blast: { + tvl: capTVL("blast"), + }, + linea: { + tvl: capTVL("linea"), + }, +}; + + + + From bdda03fbdf27e8fa7eb6fe6d1aec5d56a3b6765a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Mendes?= <43360747+mendesfabio@users.noreply.github.com> Date: Thu, 4 Jul 2024 01:15:35 -0300 Subject: [PATCH 577/855] add fraxtal and mode to balancer (#10879) --- projects/balancer/onchain.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/balancer/onchain.js b/projects/balancer/onchain.js index 0009056f6e20..33b90fd91635 100644 --- a/projects/balancer/onchain.js +++ b/projects/balancer/onchain.js @@ -23,6 +23,8 @@ const config = { polygon_zkevm: { fromBlock: 203079, }, base: { fromBlock: 1196036, }, avax: { fromBlock: 26386141, }, + mode: { fromBlock: 8110317, }, + fraxtal: { fromBlock: 4708596 } } module.exports = {}; From 7eba99f2ee2bb1ab4872469ec53f862bd9a1a281 Mon Sep 17 00:00:00 2001 From: tstemko <57684389+tstemko@users.noreply.github.com> Date: Thu, 4 Jul 2024 00:38:36 -0400 Subject: [PATCH 578/855] Add PancakeSwap and QuickSwap on zkEvm to tvl calcs, remove Zero (#10877) Co-authored-by: Tatyana Stemkovski --- projects/ichifarm/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/ichifarm/index.js b/projects/ichifarm/index.js index acf81a2b571f..982a5bf1f65c 100644 --- a/projects/ichifarm/index.js +++ b/projects/ichifarm/index.js @@ -129,7 +129,8 @@ const config = { }, polygon_zkevm: { vaultConfigs: [ - { factory: '0x9FAb4bdD4E05f5C023CCC85D2071b49791D7418F', fromBlock: 4830529, isAlgebra: false, }, // Zero + { factory: '0xe8532Db60408f2d47693dA5b9093D71580B8C23F', fromBlock: 10890417, isAlgebra: false, }, // PancakeSwap + { factory: '0x1721cB3ff3cAF70a79bDE9d771B27646ed8115b1', fromBlock: 11102475, isAlgebra: true, }, // QuickSwap ] }, } From 17aeb3d05c6e24261395e7f104cb1e5edaac4102 Mon Sep 17 00:00:00 2001 From: tezosOG Date: Thu, 4 Jul 2024 08:37:45 +0200 Subject: [PATCH 579/855] organic-growth tvl (#10878) * organic-growth tvl * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/tokenMapping.js | 1 + projects/organic-growth/index.js | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 projects/organic-growth/index.js diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index f2642454e63d..8de864df8182 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -197,6 +197,7 @@ const fixBalancesTokens = { }, etlk: { '0xc9b53ab2679f573e480d01e0f49e2b5cfb7a3eab': { coingeckoId: 'tezos', decimals: 18 }, //DONE + '0x3571aed54ccea5b69b00516d5a149a6baea77118': { coingeckoId: 'tezos', decimals: 18 }, }, sanko: { [ADDRESSES.null]: { coingeckoId: 'wrapped-dmt', decimals: 18 }, //DONE diff --git a/projects/organic-growth/index.js b/projects/organic-growth/index.js new file mode 100644 index 000000000000..87a7085a917c --- /dev/null +++ b/projects/organic-growth/index.js @@ -0,0 +1,22 @@ +const { getLogs2 } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +async function tvl(api) { + const logs = await getLogs2({ + api, + factory: '0x9767E409259E314F3C69fe1E7cA0D3161Bba4F5a', + eventAbi: 'event PairCreated(address indexed token, address indexed weth, address pair)', + fromBlock: 308542, + }) + + const wethBalances = await api.multiCall({ abi: 'erc20:balanceOf', calls: logs.map(i => ({ target: i.weth, params: i.pair })) }) + const tokens = logs.map(i => i.weth) + api.add(tokens, wethBalances) + api.add(tokens, wethBalances) // second time to add equivalent token value + return sumTokens2({ api, }) +} + +module.exports = { + misrepresentedTokens: true, + etlk: { tvl } +} \ No newline at end of file From 88ccfd35713d2af6465704dc8e2445d07f9a34ac Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 4 Jul 2024 09:47:58 +0300 Subject: [PATCH 580/855] fix sushiswap --- projects/sushiswap-v3/index.js | 18 +++++++++++++++ projects/sushiswap/api.js | 41 +++++++++++++++++++++++++++++----- 2 files changed, 53 insertions(+), 6 deletions(-) diff --git a/projects/sushiswap-v3/index.js b/projects/sushiswap-v3/index.js index 155d691e5c7d..b5a00d2a66be 100644 --- a/projects/sushiswap-v3/index.js +++ b/projects/sushiswap-v3/index.js @@ -3,6 +3,24 @@ const { cachedGraphQuery, getConfig, } = require('../helper/cache'); const { sumTokens2 } = require("../helper/unwrapLPs"); const factory = "0xc35dadb65012ec5796536bd9864ed8773abc74c4" +/* +Arbitrum: https://thegraph.com/explorer/subgraphs/96EYD64NqmnFxMELu2QLWB95gqCmA9N96ssYsZfFiYHg +Avalanche: https://thegraph.com/explorer/subgraphs/4BxsTB5ADnYdgJgdmzyddmnDGCauctDia28uxB1hgTBE +Base: https://thegraph.com/explorer/subgraphs/Cz4Snpih41NNNPZcbj1gd3fYXPwFr5q92iWMoZjCarEb +Boba: https://thegraph.com/explorer/subgraphs/71VWMKCvsWRqrJouxmEQwSEMqqnqiiVYSxTZvzR8PHRx +BSC: https://thegraph.com/explorer/subgraphs/FiJDXMFCBv88GP17g2TtPh8BcA8jZozn5WRW7hCN7cUT +Ethereum: https://thegraph.com/explorer/subgraphs/5nnoU1nUFeWqtXgbpC54L9PWdpgo7Y9HYinR3uTMsfzs +Fantom: https://thegraph.com/explorer/subgraphs/4BzEvR229mwKjneCbJTDM8dsS3rjgoKcXt5C7J1DaUxK +Fuse: https://thegraph.com/explorer/subgraphs/8P62wYTJvhd6Aas656hVYhsccsGo2ihrJShaEnCoLJRK +Gnosis: https://thegraph.com/explorer/subgraphs/GFvGfWBX47RNnvgwL6SjAAf2mrqrPxF91eA53F4eNegW +Linea: https://thegraph.com/explorer/subgraphs/E2vqqvSzDdUiPP1r7PFnPKZQ34pAhNZjc6rEcdj3uE5t +Moonriver: https://thegraph.com/explorer/subgraphs/F46W9YVQXGism5iN9NZNhKm2DQCvjhr4u847rL1tRebS +Optimism: https://thegraph.com/explorer/subgraphs/Dr3FkshPgTMMDwxckz3oZdwLxaPcbzZuAbE92i6arYtJ +Polygon: https://thegraph.com/explorer/subgraphs/CqLnQY1d6DLcBYu7aZvGmt17LoNdTe4fDYnGbE2EgotR +PolygonZkEVM: https://thegraph.com/explorer/subgraphs/E2x2gmtYdm2HX3QXorUBY4KegfGu79Za6TEQYjVrx15c +Scroll: https://thegraph.com/explorer/subgraphs/5gyhoHx768oHn3GxsHsEc7oKFMPFg9AH8ud1dY8EirRc +*/ + module.exports = uniV3Export({ ethereum: { factory: "0xbACEB8eC6b9355Dfc0269C18bac9d6E2Bdc29C4F", diff --git a/projects/sushiswap/api.js b/projects/sushiswap/api.js index 5ab6116ee0e6..1efce7786f2f 100644 --- a/projects/sushiswap/api.js +++ b/projects/sushiswap/api.js @@ -3,6 +3,32 @@ const { toUSDTBalances } = require('../helper/balances'); const { blockQuery } = require('../helper/http') const { getUniTVL } = require("../helper/unknownTokens") + +/* +Arbitrum: https://thegraph.com/explorer/subgraphs/8yBXBTMfdhsoE5QCf7KnoPmQb7QAWtRzESfYjiCjGEM9 +Avalanche: https://thegraph.com/explorer/subgraphs/5DpWu6oLUEwKYLcya5fJf3MW5CE6yEMnZ8iwekmTNAbV +Base: https://thegraph.com/explorer/subgraphs/7pXNLCc12pRM3bBPUAP9ZoEvkgUCjaBe9QC3DV9L2qzE +Boba: https://thegraph.com/explorer/subgraphs/9cssJAh4EyzEWqZySBFguiXyygwZZAGBE3ETsGetNUK +BSC: https://thegraph.com/explorer/subgraphs/24xqSifM5xPfGrW8MDwRhgaDsq7uaP2762fmxjyxJzot +CELO: https://thegraph.com/explorer/subgraphs/8WcZLSs8QUSJptPbpBScoDafmp8E9whnSqYJc9TMyYFs +Ethereum: https://thegraph.com/explorer/subgraphs/GyZ9MgVQkTWuXGMSd3LXESvpevE8S8aD3uktJh7kbVmc +Fantom: https://thegraph.com/explorer/subgraphs/J7wEPt9nDHCno143dk6whAUesPyszxPqCDKhqDqWJHuz +Fuse: https://thegraph.com/explorer/subgraphs/FrcJbZ3j9GZ3vF8G9uVEFQZeTD8uiCc1A1eujtxYUwYH +Gnosis: https://thegraph.com/explorer/subgraphs/7czeiia7ZXvsW45szX2w8EK1ZNgZWZET83zYCwE6JT9x +Harmony: https://thegraph.com/explorer/subgraphs/3k9M7aZqeJXWLUogc2FSFBgXuxej2qstKSUNBXcPCcK5 +Linea: https://thegraph.com/explorer/subgraphs/G4sRz1YAcEFYFewGLQ9bt76gQuP1oyuzhVSTvs9bj7qn +Moonbeam: https://thegraph.com/explorer/subgraphs/6MMVBsG9hgS8BzLZfPnU8KJdGiEFbd3CyNXVG6gQKCdQ +Moonriver: https://thegraph.com/explorer/subgraphs/DuB755c1VYFSLLhq4b783ryPcvYdsvimGuZzBpFqoapX +Optimism: https://thegraph.com/explorer/subgraphs/4KvWjKY89DefJ6mPMASCTUDAZ6dyHSu7osCNQqaaaY3y +Polygon: https://thegraph.com/explorer/subgraphs/8obLTNcEuGMieUt6jmrDaQUhWyj2pys26ULeP3gFiGNv +PolygonZkEVM: https://thegraph.com/explorer/subgraphs/6QS4nmWq9Wv6WPQRk1F7RJnnKcAcUBhzaiF9ZHfkUcp4 +Scroll: https://thegraph.com/explorer/subgraphs/CiW3nquNZjKDoMfR4TbSpB4ox8Pq66FDxwSsohigSdxw +*/ + +const graphEndpoints = { + polygon: sdk.graph.modifyEndpoint('8obLTNcEuGMieUt6jmrDaQUhWyj2pys26ULeP3gFiGNv') +} + const graphUrl = sdk.graph.modifyEndpoint('8TXwDMLemg6p4eicVuixKk7Mw9aNxpod1PQQFdSvFj6H') const graphQuery = ` query get_tvl($block: Int) { @@ -17,17 +43,17 @@ query get_tvl($block: Int) { `; const graphQueryPolygon = ` query get_tvl($block: Int) { - factory( + uniswapFactory( id: "0xc35dadb65012ec5796536bd9864ed8773abc74c4", block: { number: $block } ) { - liquidityUSD + totalLiquidityUSD } } `; async function eth(api) { - const { uniswapFactory } = await blockQuery(graphUrl, graphQuery, { api, }); + const { uniswapFactory } = await blockQuery(graphUrl, graphQuery, { api, blockCatchupLimit: 1000 }); const usdTvl = Number(uniswapFactory.totalLiquidityUSD) return toUSDTBalances(usdTvl) @@ -35,8 +61,11 @@ async function eth(api) { function getChainTVL() { return async (api) => { - const { factory } = await blockQuery('https://api.thegraph.com/subgraphs/name/sushiswap/exchange-' + api.chain, graphQueryPolygon, { api, }); - const usdTvl = Number(factory.liquidityUSD) + let endpoint = graphEndpoints[api.chain] + if (!endpoint) throw new Error('Missing graph endpoint') + + const { factory } = await blockQuery(endpoint, graphQueryPolygon, { api, blockCatchupLimit: 1000 }); + const usdTvl = Number(factory.totalLiquidityUSD) return toUSDTBalances(usdTvl) } @@ -106,7 +135,7 @@ module.exports = { islm: { tvl: tvl2 }, } -module.exports.polygon.tvl = getChainTVL('polygon') +// module.exports.polygon.tvl = getChainTVL('polygon') // module.exports.bsc.tvl = getChainTVL('bsc') // module.exports.fantom.tvl = getChainTVL('fantom') // module.exports.harmony.tvl = getChainTVL('harmony') From b4a1d7f2956e8236bf8e8f05d3e1962c07adda51 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 4 Jul 2024 10:11:40 +0300 Subject: [PATCH 581/855] price map tokens --- projects/helper/tokenMapping.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 8de864df8182..bc7d4ffef77c 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -36,6 +36,10 @@ const ibcMappings = { } const fixBalancesTokens = { + map: { + '0x7eb8b1fe3ee3287fd5864e50f32322ce3285b39d': {coingeckoId: 'solv-btc', decimals: 18 }, + '0x9bd1e0a3a727d0d4f4e9a6d59022e071ddc79924 ': {coingeckoId: 'marcopolo', decimals: 18 }, + }, ftn: { [ADDRESSES.null]: { coingeckoId: 'fasttoken', decimals: 18 }, '0x4084ab20f8ffca76c19aaf854fb5fe9de6217fbb': { coingeckoId: 'fasttoken', decimals: 18 }, //done From 10f942fe7391ab7c5d8246431ceb960ecabe683a Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Thu, 4 Jul 2024 09:56:35 +0200 Subject: [PATCH 582/855] Fix Team-finance update (#10880) Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> --- projects/team-finance/config.js | 100 +++++++++++++++++++++++++------- 1 file changed, 78 insertions(+), 22 deletions(-) diff --git a/projects/team-finance/config.js b/projects/team-finance/config.js index 77a48b03182d..efdfcfc77073 100644 --- a/projects/team-finance/config.js +++ b/projects/team-finance/config.js @@ -3,36 +3,92 @@ const abi_v2 = require("./lockcontract.abi.json"); module.exports = { ethereum: [ - { contract: "0xe2fe530c047f2d85298b07d9333c05737f1435fb", contractABI: abi, }, - { contract: "0xdbf72370021babafbceb05ab10f99ad275c6220a", contractABI: abi_v2, }, - { contract: "0xc77aab3c6d7dab46248f3cc3033c856171878bd5", contractABI: abi_v2, }, + { + contract: "0xe2fe530c047f2d85298b07d9333c05737f1435fb", + contractABI: abi, + }, + { + contract: "0xdbf72370021babafbceb05ab10f99ad275c6220a", + contractABI: abi_v2, + }, + { + contract: "0xc77aab3c6d7dab46248f3cc3033c856171878bd5", + contractABI: abi_v2, + }, + ], + kava: [ + { + contract: "0xa9ec655dac35d989c0c8be075b1106dcd32502d6", + contractABI: abi_v2, + }, ], - kava: [{ contract: "0xa9ec655dac35d989c0c8be075b1106dcd32502d6", contractABI: abi_v2, },], polygon: [ - { contract: "0x3eF7442dF454bA6b7C1deEc8DdF29Cfb2d6e56c7", contractABI: abi_v2, }, - { contract: "0x586c21a779c24efd2a8af33c9f7df2a2ea9af55c", contractABI: abi_v2, }, + { + contract: "0x3eF7442dF454bA6b7C1deEc8DdF29Cfb2d6e56c7", + contractABI: abi_v2, + }, + { + contract: "0x586c21a779c24efd2a8af33c9f7df2a2ea9af55c", + contractABI: abi_v2, + }, ], avax: [ - { contract: "0x88ada02f6fce2f1a833cd9b4999d62a7ebb70367", contractABI: abi_v2, }, - { contract: "0xe2fe530c047f2d85298b07d9333c05737f1435fb", contractABI: abi, }, - ], - arbitrum: [{ contract: "0xE0B0D2021293Bee9715e1Db3be31b55C00F72A75", contractABI: abi_v2, }], - base: [{ contract: "0x4f0fd563be89ec8c3e7d595bf3639128c0a7c33a", contractABI: abi_v2 },], - velas: [{ contract: "0x586c21A779C24eFd2a8aF33C9F7Df2a2EA9aF55c", contractABI: abi_v2 },], - fantom: [{ contract: "0x9F726019452d65a120E1F7Ae6b937eE9EbD72440", contractABI: abi_v2 },], - cronos: [{ contract: "0x05b711Df32d73ECaa877d45a637a2eB415e7995f", contractABI: abi_v2 },], + { + contract: "0x88ada02f6fce2f1a833cd9b4999d62a7ebb70367", + contractABI: abi_v2, + }, + { + contract: "0xe2fe530c047f2d85298b07d9333c05737f1435fb", + contractABI: abi, + }, + ], + arbitrum: [ + { + contract: "0xE0B0D2021293Bee9715e1Db3be31b55C00F72A75", + contractABI: abi_v2, + }, + ], + base: [ + { + contract: "0x4f0fd563be89ec8c3e7d595bf3639128c0a7c33a", + contractABI: abi_v2, + }, + ], + velas: [ + { + contract: "0x586c21A779C24eFd2a8aF33C9F7Df2a2EA9aF55c", + contractABI: abi_v2, + blacklist: ["0xc2995a065106b5c5c738b2320387460ebd12c12d"], + }, + ], + fantom: [ + { + contract: "0xccebbe9e2b8f46c2c6862238e60a396af790b63e", + contractABI: abi_v2, + blacklist: ["0xc2995a065106b5c5c738b2320387460ebd12c12d"], // KyberSwap LP WFTM-DOA + }, + ], + cronos: [ + { + contract: "0x05b711Df32d73ECaa877d45a637a2eB415e7995f", + contractABI: abi_v2, + }, + ], bsc: [ { contract: "0x0c89c0407775dd89b12918b9c0aa42bf96518820", contractABI: abi_v2, blacklist: [ - '0x6c7c87d9868b1db5a0f62d867baa90e0adfa7cfd', //TNNS - '0xf2619476bd0ca0eda08744029c66b62a904c2bf8', //JRIT - '0x854b4c305554c5fa72353e31b8480c0e5128a152', //WEL - '0x070a08beef8d36734dd67a491202ff35a6a16d97', // SLP - '0x9b83f4b893cf061d8c14471aa97ef24c352f5abe', // ubec-lp - ] + "0x6c7c87d9868b1db5a0f62d867baa90e0adfa7cfd", //TNNS + "0xf2619476bd0ca0eda08744029c66b62a904c2bf8", //JRIT + "0x854b4c305554c5fa72353e31b8480c0e5128a152", //WEL + "0x070a08beef8d36734dd67a491202ff35a6a16d97", // SLP + "0x9b83f4b893cf061d8c14471aa97ef24c352f5abe", // ubec-lp + ], + }, + { + contract: "0x7536592bb74b5d62eb82e8b93b17eed4eed9a85c", + contractABI: abi_v2, }, - { contract: "0x7536592bb74b5d62eb82e8b93b17eed4eed9a85c", contractABI: abi_v2, }, ], -} \ No newline at end of file +}; From f064f3332272330ae6db931535d57dd9106a667f Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Thu, 4 Jul 2024 10:02:08 +0100 Subject: [PATCH 583/855] patch --- projects/arbitrum/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/arbitrum/index.js b/projects/arbitrum/index.js index d59dd9f85cc9..df07c4dfb7d0 100644 --- a/projects/arbitrum/index.js +++ b/projects/arbitrum/index.js @@ -12,6 +12,7 @@ module.exports = { "0xA10c7CE4b876998858b1a9E12b10092229539400", ], fetchCoValentTokens: true, + permitFailure: true }), }, }; From a060e7b4f0d42a6c491322844c3d4e7b290fb5f0 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Thu, 4 Jul 2024 11:17:34 +0100 Subject: [PATCH 584/855] fix usde decimals (#10888) --- projects/helper/tokenMapping.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index bc7d4ffef77c..2f72e4d9fe11 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -247,7 +247,7 @@ const fixBalancesTokens = { [ADDRESSES.aeternity.WBTC]:{ coingeckoId: 'wrapped-bitcoin', decimals: 18 }, }, arbitrum: { - '0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34': { coingeckoId:'ethereum:0x4c9edd5852cd905f086c759e8383e09bff1e68b3', decimals:0 } + '0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34': { coingeckoId:'ethereum:0x4c9edd5852cd905f086c759e8383e09bff1e68b3', decimals:18 } } } From 95eddf9557fbe22d5bbc4410d86b8d7cb68971e9 Mon Sep 17 00:00:00 2001 From: Aymen <146243083+aymentrosh@users.noreply.github.com> Date: Thu, 4 Jul 2024 12:08:57 +0100 Subject: [PATCH 585/855] added blast to karak tvl (#10885) --- projects/karak/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/karak/index.js b/projects/karak/index.js index 8e1fc4e132e4..4596dcbd6e4d 100644 --- a/projects/karak/index.js +++ b/projects/karak/index.js @@ -5,7 +5,8 @@ const config = { arbitrum: { factory: '0x399f22ae52a18382a67542b3de9bed52b7b9a4ad', }, karak: { factory: '0xB308474350D75447cA8731B7Ce87c9ee9DA03B1C', }, mantle: { factory: '0x4a2b015CcB8658998692Db9eD4522B8e846962eD', }, - bsc: { factory: '0x4a2b015CcB8658998692Db9eD4522B8e846962eD', }, + bsc: { factory: '0x4a2b015CcB8658998692Db9eD4522B8e846962eD', }, + blast: { factory: '0x58b5dc145ca2BE84fe087614CFe36055be609BB3', }, } Object.keys(config).forEach(chain => { From 9231a249e1a8ea8b34946a921f7dfc3074edc6e3 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 4 Jul 2024 14:23:13 +0300 Subject: [PATCH 586/855] move token mapping to the server --- projects/helper/coreAssets.json | 16 ++- projects/helper/tokenMapping.js | 209 -------------------------------- 2 files changed, 13 insertions(+), 212 deletions(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index d285eddbeefe..2320ba33c2c4 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -273,7 +273,7 @@ "GMX": "0xfc5A1A6EB076a2C7aD06eD22C90d7E710E35ad0a", "WSTETH": "0x5979D7b546E38E414F7E9822514be443A4800529", "plvGLP": "0x5326e71ff593ecc2cf7acae5fe57582d6e74cff1", - "USDe": "0x5d3a1ff2b6bab83b63cd9ad0787074081a52ef34" + "USDe": "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34" }, "fuse": { "WFUSE": "0x0be9e53fd7edac9f859882afdda116645287c629", @@ -1689,7 +1689,10 @@ }, "xai": { "XAI": "0x36be1fd6ff2a6beb34b500a04f89103a524516d8", - "USDC": "0x300a7b57dc85b6a9776e249614abf0fe5c9905fb" + "USDC": "0x300a7b57dc85b6a9776e249614abf0fe5c9905fb", + "WXAI": "0x3fb787101dc6be47cfe18aeee15404dcc842e6af", + "WETH": "0xbee82cfdaff4a6aa4e4793cb81eb1c2e79ac463c", + "USDC_1": "0x1e3769bd5fb2e9e9e7d4ed8667c947661f9a82e3" }, "merlin": { "SATS": "0x4dcb91cc19aadfe5a6672781eb09abad00c19e4c", @@ -1841,5 +1844,12 @@ "WBTC": "ct_26Q5MYFKE4z4GaYLmhZiZ9AHsSVqVNZiiyzySSHTorWyr4od4K", "USDT": "ct_2AiMceYFXnUdA6A9Lu2ZQ2tr2TpfbGVfkxLfBnceoWgHTKZYvc", "USDC": "ct_U1i8dzJTVWdnU2cv59TZQfLFpLfjqf7MQQC5ygSMKphn8Yew2" + }, + "etlk": { + "OGV1WXTZ": "0x3571aed54ccea5b69b00516d5a149a6baea77118" + }, + "rari": { + "WETH": "0xf037540e51d71b2d2b1120e8432ba49f29edfbd0", + "USDC.e": "0xfbda5f676cb37624f28265a144a48b0d6e87d3b6" } -} +} \ No newline at end of file diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 2f72e4d9fe11..1ce0f489f1f4 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -36,219 +36,10 @@ const ibcMappings = { } const fixBalancesTokens = { - map: { - '0x7eb8b1fe3ee3287fd5864e50f32322ce3285b39d': {coingeckoId: 'solv-btc', decimals: 18 }, - '0x9bd1e0a3a727d0d4f4e9a6d59022e071ddc79924 ': {coingeckoId: 'marcopolo', decimals: 18 }, - }, - ftn: { - [ADDRESSES.null]: { coingeckoId: 'fasttoken', decimals: 18 }, - '0x4084ab20f8ffca76c19aaf854fb5fe9de6217fbb': { coingeckoId: 'fasttoken', decimals: 18 }, //done - '0x498d1cf9ad2d66144c98057a5880ee16e801e2f7': { coingeckoId: 'fasttoken', decimals: 18 }, //done - }, - q: { - [ADDRESSES.q.ELK]: { coingeckoId: "elk-finance", decimals: 18 }, //done - [ADDRESSES.q.WETH]: { coingeckoId: "ethereum", decimals: 18 }, //done - }, - degen: { - '0xf058eb3c946f0eaeca3e6662300cb01165c64ede': { coingeckoId: 'ethereum', decimals: 18 }, //done - }, - stacks: { - "SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.token-vlqstx::vlqstx": { coingeckoId: "blockstack", decimals: 6 }, // no clue what is the symbol - "SP2XD7417HGPRTREMKF748VNEQPDRR0RMANB7X1NK.token-abtc::bridged-btc": { coingeckoId: "xlink-bridged-btc-stacks", decimals: 8 }, //done - "SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.token-alex::alex": { coingeckoId: "alexgo", decimals: 8 }, //done - }, - stellar: { - [ADDRESSES.stellar.XLM]: { coingeckoId: "stellar", decimals: 7}, //done - [ADDRESSES.stellar.USDC]: { coingeckoId: "usd-coin", decimals: 7}, //done - }, - defichain_evm: { - [ADDRESSES.defichain_evm.DFI]: { coingeckoId: "defichain", decimals: 18 }, //done - [ADDRESSES.defichain_evm.USDT]: { coingeckoId: "usd-coin", decimals: 18 }, //done - [ADDRESSES.defichain_evm.USDC]: { coingeckoId: "tether", decimals: 18 }, //done - [ADDRESSES.defichain_evm.ETH]: { coingeckoId: "ethereum", decimals: 18 }, //done - [ADDRESSES.defichain_evm.DUSD]: { coingeckoId: "decentralized-usd", decimals: 18 }, //done - '0x66F3Cf265D2D146A0348F6fC67E3Da0835e0968E': { coingeckoId: "javsphere", decimals: 18 }, //done - }, - ace: { - [nullAddress]: { coingeckoId: "endurance", decimals: 18 }, //done - '0x85119527cf38f6ccf7b1b8f8fad05145358aaa81': { coingeckoId: "endurance", decimals: 18 }, //done - }, - massa: { - 'AS12U4TZfNK7qoLyEERBBRDMu8nm5MKoRzPXDXans4v9wdATZedz9': { coingeckoId: 'wrapped-massa', decimals: 9 }, //done - 'AS1hCJXjndR4c9vekLWsXGnrdigp4AaZ7uYG3UKFzzKnWVsrNLPJ': { coingeckoId: 'massa-bridged-usdc-massa', decimals: 6 }, //done - 'AS1ZGF1upwp9kPRvDKLxFAKRebgg7b3RWDnhgV7VvdZkZsUL7Nuv': { coingeckoId: 'massa-bridged-dai-massa', decimals: 18 }, //done - 'AS124vf3YfAJCSCQVYKczzuWWpXrximFpbTmX4rheLs5uNSftiiRY': { coingeckoId: 'wrapped-ether-massa', decimals: 18 }, //done - }, // Sample Code ozone: { // '0x83048f0bf34feed8ced419455a4320a735a92e9d': { coingeckoId: "ozonechain", decimals: 18 }, // was mapped to wrong chain }, - scroll: { - [ADDRESSES.mode.STONE]: { coingeckoId: "ethereum:0x7122985656e38bdc0302db86685bb972b145bd3c", decimals: 0 }, //done wrong decimals - '0x3ba89d490ab1c0c9cc2313385b30710e838370a4': { coingeckoId: "solv-btc", decimals: 18 }, //done - '0x01f0a31698c4d065659b9bdc21b3610292a1c506': { coingeckoId: "ethereum:0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee", decimals: 0 }, //done wrong decimals - }, - tezos: { - "KT1PnUZCp3u2KzWr93pn4DD7HAJnm3rWVrgn": { coingeckoId: "tezos", decimals: 6 }, //done - "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-17": { coingeckoId: "usd-coin", decimals: 6 }, //done - "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-18": { coingeckoId: "tether", decimals: 6 }, //done - }, - iotaevm: { - "0x6e47f8d48a01b44DF3fFF35d258A10A3AEdC114c": { coingeckoId: 'iota', decimals: 18 }, //done - }, - aurora: { - '0x368ebb46aca6b8d0787c96b2b20bd3cc3f2c45f7': { coingeckoId: 'usd-coin', decimals: 6 }, //done - }, - acala: { - ACA: { coingeckoId: "acala", decimals: 12 }, - LDOT: { coingeckoId: "liquid-staking-dot", decimals: 10 }, - DOT: { coingeckoId: "polkadot", decimals: 10 }, - }, - karura: { - KSM: { coingeckoId: "kusama", decimals: 12 }, - LKSM: { coingeckoId: "liquid-ksm", decimals: 12 }, - KAR: { coingeckoId: "karura", decimals: 12 }, - BNC: { coingeckoId: "bifrost-native-coin", decimals: 12 }, - PHA: { coingeckoId: "pha", decimals: 12 }, - KINT: { coingeckoId: "kintsugi", decimals: 12 }, - KBTC: { coingeckoId: "kintsugi-btc", decimals: 8 }, - }, - ham: { - [ADDRESSES.optimism.WETH_1]: { coingeckoId: 'ethereum', decimals: 18 }, //DONE - }, - blast: { - '0x0000000000000000000000000000000000000001': { coingeckoId: 'ethereum', decimals: 18 }, //DONE - '0xf7bc58b8d8f97adc129cfc4c9f45ce3c0e1d2692': { coingeckoId: "wrapped-bitcoin", decimals: 8 }, //DONE - '0x9e0d7d79735e1c63333128149c7b616a0dc0bbdb': { coingeckoId: "weth", decimals: 18 }, //pirex eth //DONE - '0xde55b113a27cc0c5893caa6ee1c020b6b46650c0': { coingeckoId: "deus-finance-2", decimals: 18 }, // deus //DONE - [ADDRESSES.arbitrum.USDe]: { coingeckoId: "ethena-usde", decimals: 18 }, // DONE - }, - solana: { - 'AZsHEMXd36Bj1EMNXhowJajpUXzrKcK57wW4ZGXVa7yR': { coingeckoId: "guacamole", decimals: 5 }, // DONE - }, - chz: { - '0x677F7e16C7Dd57be1D4C8aD1244883214953DC47': { coingeckoId: "wrapped-chiliz", decimals: 18 } // DONE - }, - zklink: { - '0xbEAf16cFD8eFe0FC97C2a07E349B9411F5dC272C': { coingeckoId: "solv-btc", decimals: 18 }, // DONE - '0xFb8dBdc644eb54dAe0D7A9757f1e6444a07F8067': { coingeckoId: "bitcoin-trc20", decimals: 18 }, // DONE - '0x85D431A3a56FDf2d2970635fF627f386b4ae49CC': { coingeckoId: "merlin-s-seal-btc", decimals: 18 }, // DONE - }, - btr: { - [ADDRESSES.null]: { coingeckoId: 'bitcoin', decimals: 18 }, // DONE - '0xff204e2681a6fa0e2c3fade68a1b28fb90e4fc5f': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, // DONE - '0xfe9f969faf8ad72a83b761138bf25de87eff9dd2': { coingeckoId: 'tether', decimals: 6 }, // DONE - '0x9827431e8b77e87c9894bd50b055d6be56be0030': { coingeckoId: 'usd-coin', decimals: 6 }, // DONE - - // fix these by pricing the tokens in coins repo - '0xd53E6f1d37f430d84eFad8060F9Fec558B36F6fa': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, // DONE - '0xf6718b2701d4a6498ef77d7c152b2137ab28b8a3': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, // DONE - //REMOVE '0x9a6ae5622990ba5ec1691648c3a2872469d161f9': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, - //REMOVE '0xA984b70f7B41EE736B487D5F3D9C1e1026476Ea3': { coingeckoId: 'wrapped-bitcoin', decimals: 18 }, - }, - cyeth: { - [ADDRESSES.optimism.WETH_1]: { coingeckoId: 'ethereum', decimals: 18 }, //DONE - }, - bouncebit: { - [ADDRESSES.null]: { coingeckoId: 'bouncebit', decimals: 18 }, //DONE - '0xf4c20e5004c6fdcdda920bdd491ba8c98a9c5863': { coingeckoId: 'bouncebit', decimals: 18 }, //DONE - '0x77776b40c3d75cb07ce54dea4b2fd1d07f865222': { coingeckoId: 'tether', decimals: 18 }, //DONE - '0xF5e11df1ebCf78b6b6D26E04FF19cD786a1e81dC': { coingeckoId: 'bitcoin', decimals: 18 }, //DONE - }, - linea: { - '0x63ba74893621d3d12f13cec1e86517ec3d329837': { coingeckoId: 'liquity-usd', decimals: 18 }, //DONE - }, - bevm: { - '0x2967e7bb9daa5711ac332caf874bd47ef99b3820': { coingeckoId: 'wrapped-stbtc', decimals: 18 }, //DONE - }, - real: { - [ADDRESSES.null]: { coingeckoId: 'ethereum', decimals: 18 }, - '0x90c6E93849E06EC7478ba24522329d14A5954Df4': { coingeckoId: 'ethereum', decimals: 18 }, - '0x75d0cbf342060b14c2fc756fd6e717dfeb5b1b70': { coingeckoId: 'dai', decimals: 18 }, //DONE - '0x83fedbc0b85c6e29b589aa6bdefb1cc581935ecd': { coingeckoId: 'real-us-t-bill', decimals: 18 }, //DONE - '0xAEC9e50e3397f9ddC635C6c429C8C7eca418a143': { coingeckoId: 'arcana-2', decimals: 18 }, // arcUSD //DONE - '0xeAcFaA73D34343FcD57a1B3eB5B0D949df727712': { coingeckoId: 'arcana-2', decimals: 18 }, // PTa, 1:1 wrapped arcUSD //DONE - '0x25ea98ac87A38142561eA70143fd44c4772A16b6': { coingeckoId: 'stack-2', decimals: 18 }, // MORE //DONE - }, - taiko: { - [ADDRESSES.null]: { coingeckoId: 'ethereum', decimals: 18 }, //DONE - [ADDRESSES.taiko.WETH]: { coingeckoId: 'ethereum', decimals: 18 }, //DONE - [ADDRESSES.taiko.USDC]: { coingeckoId: 'usd-coin', decimals: 6 }, //DONE - [ADDRESSES.taiko.USDC_e]: { coingeckoId: 'usd-coin', decimals: 6 }, //DONE - [ADDRESSES.taiko.USDT]: { coingeckoId: 'tether', decimals: 6 }, //DONE - }, - sei: { - '0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1': { coingeckoId: 'usd-coin', decimals: 6 }, //DONE - '0xb75d0b03c06a926e488e2659df1a861f860bd3d1': { coingeckoId: 'tether', decimals: 6 }, //DONE - [ADDRESSES.null]: { coingeckoId: 'sei-network', decimals: 18 }, //DONE - '0x160345fc359604fc6e70e3c5facbde5f7a9342d8': { coingeckoId: 'ethereum', decimals: 18 }, //DONE - '0x5cf6826140c1c56ff49c808a1a75407cd1df9423': { coingeckoId: 'silo-staked-sei', decimals: 6 }, //DONE - [ADDRESSES.sei.WSEI]: { coingeckoId: 'sei-network', decimals: 18 }, //DONE - }, - core: { - '0x5832f53d147b3d6cd4578b9cbd62425c7ea9d0bd': { coingeckoId: 'wrapped-bitcoin', decimals: 8 }, //DONE - '0x5B1Fb849f1F76217246B8AAAC053b5C7b15b7dc3': { coingeckoId: 'solv-btc', decimals: 18 }, //DONE - }, - lukso: { - [ADDRESSES.lukso.WLYX]: { coingeckoId: 'lukso-token-2', decimals: 18 }, //DONE - }, - planq: { - [ADDRESSES.functionx.USDT]: { coingeckoId: 'usd-coin', decimals: 6 }, //DONE - [ADDRESSES.planq.USDC_1]: { coingeckoId: 'usd-coin', decimals: 18 }, //DONE - }, - zeta: { - "0x1e4bF3CaBD7707089138dD5a545B077413FA83Fc": { coingeckoId: 'pufeth', decimals: 18 }, //DONE - }, - etlk: { - '0xc9b53ab2679f573e480d01e0f49e2b5cfb7a3eab': { coingeckoId: 'tezos', decimals: 18 }, //DONE - '0x3571aed54ccea5b69b00516d5a149a6baea77118': { coingeckoId: 'tezos', decimals: 18 }, - }, - sanko: { - [ADDRESSES.null]: { coingeckoId: 'wrapped-dmt', decimals: 18 }, //DONE - "0x754cdad6f5821077d6915004be2ce05f93d176f8": { coingeckoId: 'wrapped-dmt', decimals: 18 }, //DONE - "0xe01e3b20c5819cf919f7f1a2b4c18bbfd222f376": { coingeckoId: 'sanko-bridged-weth-sanko', decimals: 18 }, //DONE - "0x13d675bc5e659b11cfa331594cf35a20815dcf02": { coingeckoId: 'sanko-bridged-usdc-sanko', decimals: 6 }, //DONE - "0x3c84f959f4b8ca0c39847d02f936e13fa8fc4eb9": { coingeckoId: 'beat-the-allegations', decimals: 18 }, // star - }, - // WILL ADD THIS ONE IN A BIT - 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 }, - '0xEAa3C2fa77c306592750C9220a8f52DA8A849Ede': { coingeckoId: 'bouncebit-btc', 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 }, - }, - aeternity: { - [ADDRESSES.null]:{ coingeckoId: 'aeternity', decimals: 18 }, - [ADDRESSES.aeternity.WAE]:{ coingeckoId: 'aeternity', decimals: 18 }, - [ADDRESSES.aeternity.WETH]:{ coingeckoId: 'ethereum', decimals: 18 }, - [ADDRESSES.aeternity.USDC]:{ coingeckoId: 'usd-coin', decimals: 18 }, - [ADDRESSES.aeternity.USDT]:{ coingeckoId: 'tether', decimals: 18 }, - [ADDRESSES.aeternity.WBTC]:{ coingeckoId: 'wrapped-bitcoin', decimals: 18 }, - }, - arbitrum: { - '0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34': { coingeckoId:'ethereum:0x4c9edd5852cd905f086c759e8383e09bff1e68b3', decimals:18 } - } } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) From 62c1e47efb79f50de0b4f71478faa60ba824026e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 4 Jul 2024 14:25:47 +0300 Subject: [PATCH 587/855] rosen: track bitcoin --- projects/rosen-bridge/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/rosen-bridge/index.js b/projects/rosen-bridge/index.js index acd2ceb0f632..35fbc3262e80 100644 --- a/projects/rosen-bridge/index.js +++ b/projects/rosen-bridge/index.js @@ -18,6 +18,7 @@ module.exports = { }), staking: sumTokensExport({ owners: [ + "NY4PEzZ7VfjtnTN697R7my9uAVkCYb6N71J2RSmJCFSdDqVf9aPvFQqKXujYDBtSA8hxYVUgkGgU9SP2Ss7JDUkHkdGLBqZwH4yDcPyVvbVbcre3o7nR59wiFDVtjzCjfZmVvMVJD9HiW4GKqVuZGTQCKns8tDe3sJoDNTL3VmhzRUPZf9JCN4TNji1ruXf5CxqWtDrCfoxE4xfbRWGmtBMdLMoRdL85V7z1fP5KxroWX5YgZQo28nTCU3WjPuY2YrjqYYGNHXvFZ9G8E85kCcseNtRWqViXGFzmwqHWKaYe4AdJzBbMKzJWYszsbiemNvisPtT2Yj3FjAmAErpW3gMeWyH3WtbipaAu9D31ggpLeLkLTGscJ9HB2oExpGWvv6u9mGdkTJMHYUuZJUGrcJPE3m7ZTEFxwkbeR9oD8nHHgW4SB46kHFbxzNoUksGPZQnxf95J3e5PUnhYgg7mrQLNpq6pphgGukFcHDgAN2rgFmUSDVsuzomhP735SMiveXSPzx6PZeP7CmrEHyXN6mFbBJuY17kvzzix1w9eFwryZDuZqnAANkYhF3TLkLyGZfSC4o9iAGynpivuNMUgbKAuj6D116tKoCq9PHELL8eTefmXNLFuhauQuKRjmWQKj9zYSd7qi6Zf49KX25PnWHkC3REc4abYpjtiQFefT2HkWRwneTCkJ8uMvoHs6kJzLg8NVzH8XwEZhTM2tNSDhBKZaURpYiQcHwLDgv5uFiwhasLAdZi2EJywBYX51NKc6m4MEsTiAJC9jkEydWcwyDzSHN18yEr4rvEgMNkUhLHJokgV2v3BNFhUTJqe58e2QXAmx9MytUDqzg3vwexEpMhueC2roYA27P1mmb85HKEz15a8LnuUT8ZjmG8kDbHuPYFyxcATytVuDrFDzqKBt9X36bocip4ZU4RRY8JcWjJvMcrBCjV3EhDVQ4it8bhoZnn79PsXazvDteua1NEYEJniPnNrRaiKTUWrseEUQ2vVjWy134jMxRbeiARhoj7MDxug2kFP8jRGSsxWt3Qqbv2SezT3xZ8jYxTyQ2CiyJ61CvUQwPtmoY3XKjrgrJKwnSzJRs4egKPYZKoSiSy6UdHMKuNDmys8wYo3Gi2EgVdUYRLLWcHh5Z2H91odSbTW2h5e6pZeY4a45TgihE6ZnZBhHGc75zJjukhPgP1wEp8GrreHA7ejvTEmpwNgj571x5JrvRD5TxWaFuZKBonGexovAK2L5v", // bitcoin rsn permit collateral address "ChTbcUHgBNqNMVjzV1dvCb2UDrX9nh6rGGcURCFEYXuH5ykKh7Ea3FvpFhHb9AnxXJkgAZ6WASN7Rdn7VMgkFaqP5Z5RWp84cDTmsZkhYrgAVGN7mjeLs8UxqUvRi2ArZbm35Xqk8Y88Uq2MJzmDVHLHzCYRGym8XPxFM4YEVxqzHSKYYDvaMLgKvoskFXKrvceAqEiyih26hjpekCmefiF1VmrPwwShrYYxgHLFCZdigw5JWKV4DmewuR1FH3oNtGoFok859SXeuRbpQfrTjHhGVfDsbXEo3GYP2imAh1APKyLEsG9LcE5WZnJV8eseQnYA8sACLDKZ8Tbpp9KUE7QZNFpnwGnkYx7eybbrCeFDFjTGpsBzaS6fRKrWj2J4Wy3TTyTU1F8iMCrHBF8inZPw9Kg9YEZuJMdXDFNtuaK15u86mF2s2Z5B1vdL5MtZfWThFLnixKds8ABEmGbe8n75Dym5Wv3pkEXQ6XPpaMjUxHfRJB3EfcoFM5nsZHWSTfbFBcHxSRnEiiU67cgJsBUpQn7FvEvqNLiKM4fL3yyykMtQ6RjAS8rhycszphvQa5qFrDHie4vPuTq8", "LXwmG9jPiXvYd6Z1DWRazpc2wTdpW2awCB9NV5qjJx4UFoncqYxve6G1gzTVBNCsDwSu5ZPEi6LNLuPdzM1r9DUMgAzEfGghKeoGebPAyLCerZ8Us4ukQSJPj8j3TQY5JLZDqS2BRcPkmovmt7SZCKD95zoNgsitrYdmv2JhoC8Wmq7aM3DpwmhejCZ59n1ZYCAL7LsKw4zX45tH3sGLXxmeBNCCkcT2yxiziEAn2C3ybXqqab7cMhkoNdRMwXpUUpk3489kfyTY7SjbUPqPKhkH9veUS6H4U7a4HaEi7tPyueHTbjjQZjCZd5uGi5tC7jMvrgjYqByUG9PA9oeXHj89RxK5TPbbmkmsZVHVtdBzfHiexJh32LMszDRHuUc6YfisZKx9kNSSzadBdLbJUGHeCd8XaBg6w3e1uUBQDghpx2z44C2GZbAmUQSUQ2jqY8BBwEhtaxzZ69NK3dEjTFgsZ1R3nkbhbAu5Xs5fabBWZo6RvaPf8jTKRwKaNgQZrL93QV2JEZoapbRHCdvzaHHpBLr1p6nkDg2kB3rUTj6kmaabxswG8bSLAA9qYZhDCyh1QdSyUnd9T2o7qHybaoeEuqG1kEWYon4741ut8HCqbwEjKze6rDuEbnPUYzSr7kiwoPeV2GrdsVFRLgxwgHJoENgjUhj1VVKZB2q7n8S6smwf7CJyYZZCZGkg5bLpywJddmegJjk2FuLwA2VEmnrDKRGpFkhxBc2rbj974XgGcBZ66mPTtwrXUwjY9G5hUArtYs8WhsCDAH58yaHFFViaAhBNDQ3HBtFbXwh6b1osdv8zDSvncYXPx2iikhmf6TRC2DE2ENYtzhLHJmgyXmQkm7yXp6nWxJaeLnUuxRaWdxxQSPy1Wnm1GvKJYzRBhv9RdcmDnEgKs21ex5uSSdqJ4H53Qs6StxGyQ4HyjTjEVUxTbUZpnzvECgAufKkuSPyC2mYkKKGrzWmvv5sh6fyo4eAq9QnfXB9YMETMpJbx5dFpc6ZXYimSCfJbJfP1bpCe1hXkhTPWeZJ9aPX6HZEfu89ChZiX32MaSM3QnnUhRbSnzdQ2jVAtqqwjNN5SeNNvXNxS6B1UHj52TGvGrLnNUp4BWgNKAAwpBxAAB7wny9tUSXt6jHVnGHBG1vJWF7S9DeaVjKg3qR8j1bUsGqh9bVkarag4SREopK8cHwFpb2yFcdGERfaKHyekAUjVkhqySH3Vb8GiAdDbRArKV2ip4eveocsFwjoCD5i9rotksNysgi9RDjkApYm7aJegC79omCujHVYFpU6HtV2AhNVFRvVBG2xDW9YEKEm3RxrjoCttM6sFkbNX61CSiQ3LsBPvcd5Aix9NUESjbNxFwARZ75UgquvFddApn13yxSqfzVoE9L3eRnAMxd7KHudBWQsnDK", "LXwmG9jPiXvYd6Z1DWRazpc2wTdpW2awCB9NV5qjJx4UFoncqYxve6G1gzTVBNCsDwSu5ZPEi6LNLuPdzM1r9DUMgAzEfGghKeoGebPAyLCerZ8Us4ukQSJPj8j3TQY5JLZBwceKrx1KHjeRRQBwBgxTkfButyeLtHgMELArAC9DDaZbYg7o2t98LMUZyArDzmK5fmhdKgeo6Dw4oZ1ENbepgqG35kR2pS63heXUeEuhH4nvqfLGHwSTanzhsQeBmYH9iqxSFfCvoRFnasoEPkWAv6PwGURqUk23wS5J9CaSadgPYRNdB915Vjf2kvxxmPFwoW9Uq1ZRo5DDS49goU3YbMgDJPnekbGQ9u9jMcwvo8FGRMiJVyEy2zdncnqPUaipekDaDowgf8EKYxBRYPo93DGga9FCVAoMC2PzRXRN1Q4X2zCx9onwMPoTWu2nFjYdx58bqzqs2ToK4S7UXZw4vpt6oSam7XN2miAfSN8WJmYRJ3FSGNfUz1ryo6N8uoecwEGeFksvbkobAvykuDGzeCNgdeNnRnMFZrco3kPvdzMf75tsRJu5ZTpTMW5mJWm6NbPJwxgV5JdxUvHPd8SCCmFKxhFywqVifp6WRMMqfVKaBdmXWG7zzN6hJZhf9EHupjR4KZExmuShvpx5bA1YyMUz1MpE9VP7vkLJWDYXfpJHJEWFRiADfSHt2RE5LzepxScfoHfpE7C6e4TBQBZd3dndxWDRREZSV45A1iXdq14AYqcsoBJ5Y8JCGHzXaGCLiBHvsXFMfUdTHhbPA8cegddhhZ2tK29UhR3veSGcjVZ1YwzVthQeJZK8RMbbbdf2s3f7dr8a7YGLU31T2jjy4tPR26ZFSadcuuMFR6QQisRP7qBKpgmUJc68fWdwNsLr8FLW8q2yipH1YnsWG389BQ9aXM4Zfb2WmXUT6JCpaeABWUFCLv6w3BkuBHyUFmmfiiHNx1E9u1VEuibAJYEkC6BEuoCKDqxMV62wdjbahsAn4fZdpQyVMK6xADbY2FXrREeaq4KDGzY4XYVZxaEZs3CEeedoZjFLbBe7ysm4MWqCiK7tucARTFF4XaxoH1C5JqqiraqRm4HBGVcjfzcyMwMHUC15m2N4AoQycb97Dn8W4Qp7s7gmchThLotvP2E7t7CXDa21cwKdVx9nh2xTJRPaXzMjt49L4AbXqT9RJ9PeRsYzKcQLcgugdDoB3vDtFBTZeoNNvf43JFpapTozoQtSfj7iNrPYfaEkNvCEzLjqJVyMPZ7gt13aySy5jDPp2vF5hGd5f6yv21PAiwQtfV47hn7y5hZfKv4T3gDE4sD6UQ2HFmhrAXmcuZ4AtfZZXpC3vgw6vhraKUFsHKjLZU3WKKAwnPW1HJC61jiutpnaBK1hDhop6FHkjvNtGrSnti", @@ -38,4 +39,7 @@ module.exports = { ] }), }, + bitcoin: { + tvl: sumTokensExport({ owners: ['bc1qs0852en99dfctv0egj2qxnmc79mhjgn9ap975t']}) + } }; From ed6ac285a86a71145111cd64702c56a7c0a26382 Mon Sep 17 00:00:00 2001 From: leeamijo <154820412+leeamijo@users.noreply.github.com> Date: Thu, 4 Jul 2024 19:26:24 +0800 Subject: [PATCH 588/855] feat: add support bevm chain (#10882) --- projects/pell/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/pell/index.js b/projects/pell/index.js index 3f3cc6209bb6..e5c090319422 100644 --- a/projects/pell/index.js +++ b/projects/pell/index.js @@ -1,7 +1,7 @@ const { sumTokens2 } = require('../helper/unwrapLPs') const { getConfig } = require('../helper/cache') -const chains = ['merlin', 'bouncebit', 'btr', 'bsc', 'bsquared', 'core'] +const chains = ['merlin', 'bouncebit', 'btr', 'bsc', 'bsquared', 'core', 'bevm'] chains.forEach(chain => { module.exports[chain] = { From 079786e7857101652022f7ea2d1cd65f56d47199 Mon Sep 17 00:00:00 2001 From: santino <83203265+santinoYoung@users.noreply.github.com> Date: Thu, 4 Jul 2024 19:27:05 +0800 Subject: [PATCH 589/855] update Desyn hallmarks (#10881) * add desyn protocol * update lpposition token * Update index.js add resolveLP * Update index.js remove resolveLP * add tvl * Update index.js update sumTokensExport * code refactor * update desyn chain * update bitlayer chain * disable merlin * add desyn hallmarks --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/desyn/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/desyn/index.js b/projects/desyn/index.js index 437dfa162d33..0ef8f12b4e64 100644 --- a/projects/desyn/index.js +++ b/projects/desyn/index.js @@ -2,7 +2,12 @@ const { getLogs } = require('../helper/cache/getLogs') module.exports = { 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.', + hallmarks: [ + [1719734400, "Launched on Merlin Chain"], + [1718092800, "DeSyn KelpDAO Restaking Fund Launched"], + [1713340800, "Restaking Fund Series Launched"], + ], + methodology: '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 = { From f84435184a132be71222dfa3eedba8d3774c727e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 4 Jul 2024 14:32:27 +0300 Subject: [PATCH 590/855] stop prettier --- .prettierignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .prettierignore diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000000..37184e3d9ffd --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +# Ignore all files +* \ No newline at end of file From 22624070fb573e5383bd1db38c9c042ae156010c Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Thu, 4 Jul 2024 13:58:01 +0200 Subject: [PATCH 591/855] fix Sablier v1 update (#10884) * fix Sablier v1 update * use permitFailure instead of filter null Address --------- Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> --- projects/sablier/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/sablier/index.js b/projects/sablier/index.js index 4320c50909c5..c081272f1b7e 100644 --- a/projects/sablier/index.js +++ b/projects/sablier/index.js @@ -14,7 +14,7 @@ const blacklistedTokens = [ async function getTokens(api, owners, isVesting) { let tokens = (await Promise.all(owners.map(i => covalentGetTokens(i, api, { onlyWhitelisted: false, })))).flat().filter(i => !blacklistedTokens.includes(i)) tokens = getUniqueAddresses(tokens) - const symbols = await api.multiCall({ abi: 'erc20:symbol', calls: tokens }) + const symbols = await api.multiCall({ abi: 'erc20:symbol', calls: tokens, permitFailure: true }) return tokens.filter((v, i) => isWhitelistedToken(symbols[i], v, isVesting)) } From ced053e9998eabcb8b15493832f4a942bb88e3bd Mon Sep 17 00:00:00 2001 From: CardanoTokenIO <163329108+CardanoTokenIO@users.noreply.github.com> Date: Thu, 4 Jul 2024 22:01:38 +0300 Subject: [PATCH 592/855] Include Danzo-Arena TVL - Cardano Native Token DANZO (#10893) * Include Danzo-Arena TVL - Cardano Native Token DANZO Name: Danzo Arena Twitter Link: https://twitter.com/DanzoADA Website Link: https://cardanzoada.com/arena Logo: https://ipfs.io/ipfs/QmVMkGxon5spreGhynpTTZCiAcKtz8Z17BJdgxXEizmQeB Chain: Cardano Coingecko ID: https://api.coingecko.com/api/v3/coins/danzo Short Description: DANZO ARENA is a gamified DeFi platform where users can deposit tokens, borrow against holdings, and share in trading and withdrawal fees. Token address and ticker if any: DANZO (bf3e19192da77dfadc7c9065944e50ca7e1a439d90833e3ae58b720a) Category: Gaming methodology: Calculates the total of idle tokens held in the given script address * Rename projects/Danzo-Arena to projects/danzo-arena/index.js fix file type and name --------- Co-authored-by: Real Shaman <85087525+realdealshaman@users.noreply.github.com> --- projects/danzo-arena/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 projects/danzo-arena/index.js diff --git a/projects/danzo-arena/index.js b/projects/danzo-arena/index.js new file mode 100644 index 000000000000..b7084cb67d3a --- /dev/null +++ b/projects/danzo-arena/index.js @@ -0,0 +1,15 @@ +const { sumTokensExport } = require("../helper/chain/cardano"); + +const scriptAdresses = [ + "addr1vx4caaf06swdn7cdfc7pu3sw235zvuhd02tw2np4uac9mwcp2vt4y", //Danzo Tokens locked inside the address for the DeFi game DANZO ARENA: https://cardanzoada.com/arena/ +]; + +module.exports = { + methodology: + "Calculates the total of idle tokens held in the above mentioned address", + timetravel: false, + cardano: { + tvl: ()=>({}), + staking: sumTokensExport({ scripts: scriptAdresses }), + } +}; From 234a7c369b34dedf966952df6f3f0b1e4bb37827 Mon Sep 17 00:00:00 2001 From: Jasper <104004836+j-vp@users.noreply.github.com> Date: Thu, 4 Jul 2024 21:02:54 +0200 Subject: [PATCH 593/855] =?UTF-8?q?=E2=9C=A8=20add=20staked=20slipstream?= =?UTF-8?q?=20Arcadia=20V2=20(#10891)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- projects/arcadia-finance-v2/index.js | 28 ++++++++++++++++++++++++---- projects/helper/unwrapLPs.js | 15 +++++++++------ 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/projects/arcadia-finance-v2/index.js b/projects/arcadia-finance-v2/index.js index 52ab1570d3b0..561698f4362f 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, unwrapSlipstreamNFT, } = require("../helper/unwrapLPs"); const config = { base: { @@ -11,13 +11,15 @@ const config = { slipNFT: "0x827922686190790b37229fd06084350e74485b72", wAeroNFT: "0x17B5826382e3a5257b829cF0546A08Bd77409270".toLowerCase(), sAeroNFT: "0x9f42361B7602Df1A8Ae28Bf63E6cb1883CD44C27".toLowerCase(), + sSlipNFT: "0x1Dc7A0f5336F52724B650E39174cfcbbEdD67bF1".toLowerCase(), }, }; async function unwrapArcadiaAeroLP({ api, ownerIds, }) { - const { wAeroNFT, sAeroNFT } = config[api.chain] + const { wAeroNFT, sAeroNFT, sSlipNFT } = config[api.chain] const wAERONFTIds = [] const sAERONFTIds = [] + const sSlipNftIds = [] // for each asset address owned by an account // check if the asset is the wrapped or staked aero asset module @@ -34,6 +36,9 @@ async function unwrapArcadiaAeroLP({ api, ownerIds, }) { case sAeroNFT: sAERONFTIds.push(ids[i]); break; + case sSlipNFT: + sSlipNftIds.push(ids[i]); + break; } } } @@ -42,10 +47,21 @@ async function unwrapArcadiaAeroLP({ api, ownerIds, }) { 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)); + + await uwrapStakedSlipstreamLP({api, sSlipNftIds, }); } +async function uwrapStakedSlipstreamLP( {api, sSlipNftIds, }) { + const { slipNFT } = config[api.chain]; + const balances = api.getBalances(); + + // Arcadia's staked slipstream NFT wrapper issues a position with the same ID as the wrapped NFT + // -> fetch the values of the wrapped IDs by simply fetching the values of those IDs on the native slipstream NFT + await unwrapSlipstreamNFT({balances:balances, positionIds:sSlipNftIds, nftAddress:slipNFT, chain:'base', blacklistedTokens:[], whitelistedTokens:[], uniV3ExtraConfig:{} }); + } + async function tvl(api) { - let { factory, pools, uniNFT, slipNFT, wAeroNFT, sAeroNFT } = + let { factory, pools, uniNFT, slipNFT, wAeroNFT, sAeroNFT, sSlipNFT } = config[api.chain]; pools = Object.values(pools); const uTokens = await api.multiCall({ abi: "address:asset", calls: pools }); @@ -59,11 +75,15 @@ async function tvl(api) { assetData[i][1], account, ]); - await api.sumTokens({ ownerTokens, blacklistedTokens: [uniNFT, slipNFT, wAeroNFT, sAeroNFT], }); + // add all simple ERC20s + await api.sumTokens({ ownerTokens, blacklistedTokens: [uniNFT, slipNFT, wAeroNFT, sAeroNFT, sSlipNFT], }); + // add all Arcadia-wrapped LP positions await unwrapArcadiaAeroLP({ api, ownerIds }); + // add all native LP positions return sumTokens2({ api, owners: accounts, resolveUniV3: true, resolveSlipstream: true }) + } module.exports = { diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index 6b00196ff199..dd4afd596d8e 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -326,21 +326,23 @@ async function unwrapSlipstreamNFTs({ balances = {}, nftsAndOwners = [], block, return balances } -async function unwrapSlipstreamNFT({ balances, owner, nftAddress, block, chain = 'base', blacklistedTokens = [], whitelistedTokens = [], uniV3ExtraConfig = {}, }) { +async function unwrapSlipstreamNFT({ balances, owner, positionIds = [], nftAddress, block, chain = 'base', blacklistedTokens = [], whitelistedTokens = [], uniV3ExtraConfig = {}, }) { blacklistedTokens = getUniqueAddresses(blacklistedTokens, chain) whitelistedTokens = getUniqueAddresses(whitelistedTokens, chain) let nftIdFetcher = uniV3ExtraConfig.nftIdFetcher ?? nftAddress - const nftPositions = (await sdk.api.erc20.balanceOf({ target: nftIdFetcher, owner, block, chain })).output const factoryKey = getFactoryKey(chain, nftAddress) if (!factories[factoryKey]) factories[factoryKey] = sdk.api.abi.call({ target: nftAddress, abi: wildCreditABI.factory, block, chain }) let factory = (await factories[factoryKey]).output - const positionIds = (await sdk.api.abi.multiCall({ - block, chain, abi: wildCreditABI.tokenOfOwnerByIndex, target: nftIdFetcher, - calls: Array(Number(nftPositions)).fill(0).map((_, index) => ({ params: [owner, index] })), - })).output.map(positionIdCall => positionIdCall.output) + if (!positionIds) { + const nftPositions = (await sdk.api.erc20.balanceOf({ target: nftIdFetcher, owner, block, chain })).output + positionIds = (await sdk.api.abi.multiCall({ + block, chain, abi: wildCreditABI.tokenOfOwnerByIndex, target: nftIdFetcher, + calls: Array(Number(nftPositions)).fill(0).map((_, index) => ({ params: [owner, index] })), + })).output.map(positionIdCall => positionIdCall.output) + } const positions = (await sdk.api.abi.multiCall({ block, chain, abi: slipstreamNftABI.positions, target: nftAddress, @@ -1110,6 +1112,7 @@ async function unwrapSolidlyVeNft({ api, baseToken, veNft, owner, hasTokensOfOwn module.exports = { PANCAKE_NFT_ADDRESS, unwrapUniswapLPs, + unwrapSlipstreamNFT, addTokensAndLPs, sumTokensAndLPsSharedOwners, sumTokensAndLPs, From 97ba37fb04b115750ebc6ab92f774977c63946a7 Mon Sep 17 00:00:00 2001 From: dunglv-smartosc <108668260+dunglv-smartosc@users.noreply.github.com> Date: Fri, 5 Jul 2024 12:09:47 +0700 Subject: [PATCH 594/855] Listing D2Finance (#10894) --- projects/d2finance/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 projects/d2finance/index.js diff --git a/projects/d2finance/index.js b/projects/d2finance/index.js new file mode 100644 index 000000000000..975a89d36bf1 --- /dev/null +++ b/projects/d2finance/index.js @@ -0,0 +1,22 @@ +const { sumERC4626VaultsExport } = require("../helper/erc4626"); + +const vaultTvl = sumERC4626VaultsExport({ + vaults: [ + "0x27D22Eb71f00495Eccc89Bb02c2B68E6988C6A42", + "0x183424d5ae5ec9fd486634bc566d0f75ad9c9109", + "0x80c403807b1032d7cb19b6d612ce23f05a213d36", + "0x5b49d7fae00de64779ddcd6b067c8eb046bd9a0b", + "0x291344FBaaC4fE14632061E4c336Fe3B94c52320", + "0xEd80C858D43a1D043E86Cf1F20384e189cf23BDA", + "0x4ada76cc8755f62508a2df65d7fafa4fd26e76c6", + "0x1c17a39B156189BF40905425170a3Ff62fb650DA", + "0x7348925D3C63e4E61e9F5308eEec0f06EaA3bB7b", + ], + isOG4626: true, +}); + +module.exports = { + arbitrum: { + tvl: vaultTvl, + }, +}; From c438bfc92c9192c43811187d893baa4a45a56efc Mon Sep 17 00:00:00 2001 From: langyoung Date: Fri, 5 Jul 2024 13:19:41 +0800 Subject: [PATCH 595/855] feat: add astherus TVL (#10883) * feat: add astherus * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/astherus/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 projects/astherus/index.js diff --git a/projects/astherus/index.js b/projects/astherus/index.js new file mode 100644 index 000000000000..e3e924285ffb --- /dev/null +++ b/projects/astherus/index.js @@ -0,0 +1,21 @@ +const { getConfig } = require('../helper/cache') + +const config = { + bsc: '0x128463A60784c4D3f46c23Af3f65Ed859Ba87974', + ethereum: '0x604DD02d620633Ae427888d41bfd15e38483736E' +} + +module.exports = { + start: 1706716800, // 02/01/2024 @ 00:00:00pm (UTC) +} + +Object.keys(config).forEach(chain => { + const vault = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const { data } = await getConfig(`astherus/${api.chain}`, `https://astherus.finance/bapi/futures/v1/public/future/web3/ae-deposit-asset?chainId=${api.chainId}`) + const tokens = data.map(i => i.contractAddress) + return api.sumTokens({ owner: vault, tokens }) + } + } +}) \ No newline at end of file From 63305dcc5cd2c7be8e019308fb339cd1b3a51fca Mon Sep 17 00:00:00 2001 From: Zorag44 <75122924+Zorag44@users.noreply.github.com> Date: Fri, 5 Jul 2024 11:15:14 +0530 Subject: [PATCH 596/855] AlphaFi TVL (#10876) * alphafi TVL * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/alphafi/index.js | 94 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 projects/alphafi/index.js diff --git a/projects/alphafi/index.js b/projects/alphafi/index.js new file mode 100644 index 000000000000..93ca30732747 --- /dev/null +++ b/projects/alphafi/index.js @@ -0,0 +1,94 @@ +const sui = require("../helper/chain/sui") +const { addUniV3LikePosition } = require("../helper/unwrapLPs") + +const ALPHAFI_TVL_IDS = [ + { + + poolID: "0x30066d9879374276dc01177fbd239a9377b497bcd347c82811d75fcda35b18e5", + cetusPoolID: "0xc8d7a1503dc2f9f5b05449a87d8733593e2f0f3e7bffd90541252782e4d2ca20", + investorID: "0x87a76889bf4ed211276b16eb482bf6df8d4e27749ebecd13017d19a63f75a6d5", + token0Type: "0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN", + token1Type: "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN" + }, + { + poolID: "0xa7239a0c727c40ee3a139689b16b281acfd0682a06c23531b184a61721ece437", + cetusPoolID: "0x0e809689d04d87f4bd4e660cd1b84bf5448c5a7997e3d22fc480e7e5e0b3f58d", + investorID: "0x1b923520f19660d4eb013242c6d03c84fdea034b8f784cfd71173ef72ece50e1", + token0Type: "0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY", + token1Type: "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN" + }, + { + poolID: "0xee6f6392cbd9e1997f6e4cf71db0c1ae1611f1f5f7f23f90ad2c64b8f23cceab", + cetusPoolID: "0xcf994611fd4c48e277ce3ffd4d4364c914af2c3cbb05f7bf6facd371de688630", + investorID: "0xb6ca8aba0fb26ed264a3ae3d9c1461ac7c96cdcbeabb01e71086e9a8340b9c55", + token0Type: "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN", + token1Type: "0x2::sui::SUI" + }, + { + poolID: "0x676fc5cad79f51f6a7d03bfa3474ecd3c695d322380fc68e3d4f61819da3bf8a", + cetusPoolID: "0xaa57c66ba6ee8f2219376659f727f2b13d49ead66435aa99f57bb008a64a8042", + investorID: "0x9ae0e56aa0ebc27f9d8a17b5a9118d368ba262118d878977b6194a10a671bbbc", + token0Type: "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN", + token1Type: "0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN" + }, + { + poolID: "0xbdf4f673b34274f36be284bca3f765083380fefb29141f971db289294bf679c6", + cetusPoolID: "0x5b0b24c27ccf6d0e98f3a8704d2e577de83fa574d3a9060eb8945eeb82b3e2df", + investorID: "0x05fa099d1df7b5bfb2e420d5ee2d63508db17c40ce7c4e0ca0305cd5df974e43", + token0Type: "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN", + token1Type: "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN" + }, +] + +const ALPHAFI_POOL2_IDS = [{ + poolID: "0x594f13b8f287003fd48e4264e7056e274b84709ada31e3657f00eeedc1547e37", + cetusPoolID: "0xda7347c3192a27ddac32e659c9d9cbed6f8c9d1344e605c71c8886d7b787d720", + investorID: "0x46d901d5e1dba34103038bd2ba789b775861ea0bf4d6566afd5029cf466a3d88", + token0Type: "0xfe3afec26c59e874f3c1d60b8203cb3852d2bb2aa415df9548b8d688e6683f93::alpha::ALPHA", + token1Type: "0x2::sui::SUI" +}, +] + +const ALPHA_POOL_ID = "0x6ee8f60226edf48772f81e5986994745dae249c2605a5b12de6602ef1b05b0c1" +const ALPHA_COIN_TYPE = "0xfe3afec26c59e874f3c1d60b8203cb3852d2bb2aa415df9548b8d688e6683f93::alpha::ALPHA" + +function asIntN(int, bits = 32) { + return Number(BigInt.asIntN(bits, BigInt(int))) +} + +async function addPoolTVL(api, pools) { + for (const { poolID, cetusPoolID, investorID, token0Type, token1Type } of pools) { + let investorObject = await sui.getObject(investorID) + let poolObject = await sui.getObject(poolID) + let cetusPoolObject = await sui.getObject(cetusPoolID) + addUniV3LikePosition({ + api, + tickLower: asIntN(investorObject.fields.lower_tick), + tickUpper: asIntN(investorObject.fields.upper_tick), + tick: asIntN(cetusPoolObject.fields.current_tick_index.fields.bits), + liquidity: poolObject.fields.tokensInvested, + token0: token0Type, + token1: token1Type + }) + } +} + +async function tvl(api) { + await addPoolTVL(api, ALPHAFI_TVL_IDS) +} +async function pool2(api) { + await addPoolTVL(api, ALPHAFI_POOL2_IDS) +} + +async function staking(api) { + let alphaPoolObject = await sui.getObject(ALPHA_POOL_ID) + api.addToken(ALPHA_COIN_TYPE, Number(alphaPoolObject.fields.alpha_bal)) +} + +module.exports = { + timetravel: false, + doublecounted: true, + sui: { + tvl, pool2, staking, + }, +} \ No newline at end of file From 8a93137158c3944e44c7ca09907db9b70edc95fd Mon Sep 17 00:00:00 2001 From: 0xYFLOW <139814596+0xYFLOW@users.noreply.github.com> Date: Fri, 5 Jul 2024 09:50:25 +0400 Subject: [PATCH 597/855] Update underlying contracts - Add ETH/ARB (#10869) * Update index.js * Update index.js --- projects/yieldflow/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/yieldflow/index.js b/projects/yieldflow/index.js index 1fd1903ae697..533ea1b3ed01 100644 --- a/projects/yieldflow/index.js +++ b/projects/yieldflow/index.js @@ -60,6 +60,10 @@ const managers = [ '0x780A252d7C797cFB255fe2EAa4E1a257a897B6ed', '0xffF3c0063f2Fc1Af569C359480b5b62841357169', '0xEFF4A3260263A927D0707190C931bE13292bD4Ba', + + '0xD4c68a094De7e1336E261c6EDD595F64cd70A064', + '0x88609B69feDc0EEF4326c3390a8ae1b2073DcF03', + '0xdcC4391042d462158C847f73F4232ce47A8F999c', ] async function tvl(api) { From 746b9b156f1e8eedebefb21abe92b97e7ced37c4 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 5 Jul 2024 08:59:56 +0300 Subject: [PATCH 598/855] track novaswap-v2 (#10887) --- projects/novaswap-v2/index.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 projects/novaswap-v2/index.js diff --git a/projects/novaswap-v2/index.js b/projects/novaswap-v2/index.js new file mode 100644 index 000000000000..ed1b823fcd29 --- /dev/null +++ b/projects/novaswap-v2/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + zklink: { factory: '0x9f94c91b178F5bc9fCcA3e5428b09A3d01CE5AC6', fromBlock: 3416798 }, +}) \ No newline at end of file From f9bf55145b85aa3f530f194391fc931e2493a3c9 Mon Sep 17 00:00:00 2001 From: Chaz Schmidt Date: Fri, 5 Jul 2024 03:16:48 -0400 Subject: [PATCH 599/855] Adding Base treasury assets and Aerodrome NFTs (#10788) * added base treasury assets * added veAERO * used solidlyVeNfts instead --- projects/treasury/klima-dao.js | 42 ++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/projects/treasury/klima-dao.js b/projects/treasury/klima-dao.js index 07fcc2391143..5059eb015f97 100644 --- a/projects/treasury/klima-dao.js +++ b/projects/treasury/klima-dao.js @@ -1,10 +1,26 @@ const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress, treasuryExports } = require("../helper/treasury"); + const klimaTreasury1 = "0x7dd4f0b986f032a44f913bf92c9e8b7c17d77ad7"; -const daoWallet = "0x65A5076C0BA74e5f3e069995dc3DAB9D197d995c" +const daoWallet_polygon = "0x65A5076C0BA74e5f3e069995dc3DAB9D197d995c" +const daoWallet_base = "0xa79cd47655156b299762dfe92a67980805ce5a31" + +const KLIMA_polygon = "0x4e78011ce80ee02d2c3e649fb657e45898257815"; // on polygon +const KLIMA_base = "0xdcefd8c8fcc492630b943abcab3429f12ea9fea2"; // on base + +const AERO = "0x940181a94A35A4569E4529A3CDfB74e38FD98631"; +const aeroVotingEscrow = "0xebf418fe2512e7e6bd9b87a8f0f294acdc67e6b4"; -const KLIMA = "0x4e78011ce80ee02d2c3e649fb657e45898257815"; +// aerodrome pools +// const vAMM_WETH_KLIMA = "0xB37642E87613d8569Fd8Ec80888eA6c63684E79e" + +const veAEROIds = [ + "22922", + "20882", + "20680", + "19983", +]; module.exports = treasuryExports({ polygon: { @@ -33,7 +49,23 @@ module.exports = treasuryExports({ "0x672688C6Ee3E750dfaA4874743Ef693A6f2538ED", // CRISP-C "0x82B37070e43C1BA0EA9e2283285b674eF7f1D4E2", // CCO2 ], - owners: [klimaTreasury1, daoWallet], - ownTokens: [KLIMA], + owners: [klimaTreasury1, daoWallet_polygon], + ownTokens: [KLIMA_polygon], + }, + base: { + tokens: [ + nullAddress, + ADDRESSES.base.USDC, // USDC + //ADDRESSES.base.USDT, + ADDRESSES.base.WETH, + '0x576Bca23DcB6d94fF8E537D88b0d3E1bEaD444a2', // BCT (base address) + '0x20b048fa035d5763685d695e66adf62c5d9f5055', // CHAR + AERO, + ], + solidlyVeNfts: [ + { baseToken: AERO, veNft: aeroVotingEscrow}, + ], + owners: [daoWallet_base], + ownTokens: [KLIMA_base], }, -}) +}); From fb496fd0a7db858706e56b267b761dca07eaa9d8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 5 Jul 2024 10:32:32 +0300 Subject: [PATCH 600/855] track catalyst amm --- projects/catalyst/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/catalyst/index.js diff --git a/projects/catalyst/index.js b/projects/catalyst/index.js new file mode 100644 index 000000000000..03ec2be2de51 --- /dev/null +++ b/projects/catalyst/index.js @@ -0,0 +1,23 @@ +const { getLogs2 } = require('../helper/cache/getLogs') + +const config = { + optimism: { fromBlock: 120302044, }, + blast: { fromBlock: 3696521, }, + base: { fromBlock: 14706751, }, +} + +Object.keys(config).forEach(chain => { + const { factory = '0x00000000E5E81E25aeaD7fCCb4C9560C6b5b718F', fromBlock, } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const logs = await getLogs2({ + api, + factory, + eventAbi: 'event VaultDeployed (address indexed vaultTemplate, address indexed chainInterface, address indexed deployer, address vaultAddress, address[] assets, uint256 k)', + fromBlock, + }) + + return api.sumTokens({ ownerTokens: logs.map(i => [i.assets, i.vaultAddress]) }) + } + } +}) \ No newline at end of file From b1e5c31416cb8d5ee0a7cac83bd982560a044e5c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 5 Jul 2024 10:36:02 +0300 Subject: [PATCH 601/855] catalyst: track arbitrum --- projects/catalyst/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/catalyst/index.js b/projects/catalyst/index.js index 03ec2be2de51..591292a259bb 100644 --- a/projects/catalyst/index.js +++ b/projects/catalyst/index.js @@ -4,6 +4,7 @@ const config = { optimism: { fromBlock: 120302044, }, blast: { fromBlock: 3696521, }, base: { fromBlock: 14706751, }, + arbitrum: { fromBlock: 223877881, }, } Object.keys(config).forEach(chain => { From 2eb2b403501c095d494254f0ec9dfad0c603ab22 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 5 Jul 2024 10:52:35 +0300 Subject: [PATCH 602/855] update lyra v2 --- projects/lyra-v2/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/lyra-v2/index.js b/projects/lyra-v2/index.js index a743d5f462e8..cc0875f99323 100644 --- a/projects/lyra-v2/index.js +++ b/projects/lyra-v2/index.js @@ -4,13 +4,13 @@ const { getConfig } = require('../helper/cache') const chains = ['ethereum', 'base', 'arbitrum', 'optimism', 'mode', 'blast'] async function getOldToA(api) { - const data = await getConfig('lyra-v2/old-contracts', 'https://raw.githubusercontent.com/0xdomrom/socket-plugs/feat/lyra-base/deployments/superbridge/prod_lyra-old_addresses.json') + const data = await getConfig('lyra-v2/old-contracts', 'https://raw.githubusercontent.com/0xdomrom/socket-plugs/main/deployments/superbridge/prod_lyra-old_addresses.json') const vaults = Object.values(data[api.chainId+'']?? {}).map(i => i.Vault) const tokens = await api.multiCall({ abi: 'address:token__', calls: vaults}) return vaults.map((vault, i) => [tokens[i], vault]) } async function getToA(api) { - const data = await getConfig('lyra-v2/contracts', 'https://raw.githubusercontent.com/0xdomrom/socket-plugs/feat/lyra-base/deployments/superbridge/prod_lyra_addresses.json') + const data = await getConfig('lyra-v2/contracts', 'https://raw.githubusercontent.com/0xdomrom/socket-plugs/main/deployments/superbridge/prod_lyra_addresses.json') const vaults = Object.values(data[api.chainId+'']?? {}).map(i => i.Vault) const tokens = await api.multiCall({ abi: 'address:token', calls: vaults}) return vaults.map((vault, i) => [tokens[i], vault]) @@ -21,6 +21,7 @@ chains.forEach(chain => { tvl: async (api) => { const oldToA = await getOldToA(api) const toa = await getToA(api) + console.log(chain, oldToA.concat(toa)) return sumTokens2({ tokensAndOwners: oldToA.concat(toa), api }) } } From 5137b1ec9bc2c39ec3275a2bd80d6bb0d0c8676b Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Fri, 5 Jul 2024 10:38:54 +0100 Subject: [PATCH 603/855] Nance montly july (#10897) * binance July Update * fix --- projects/binance/config.js | 5 ++++- projects/helper/cex.js | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/binance/config.js b/projects/binance/config.js index b9851721ea45..0b44ea3fd7f1 100644 --- a/projects/binance/config.js +++ b/projects/binance/config.js @@ -22,6 +22,8 @@ const assetList = [ ['ARB', 'ARB', '0xa7c0d36c4698981fab42a7d8c783674c6fe2592d'], ['ARB', 'ARB', '0xb38e8c17e38363af6ebdcb3dae12e0243582891d'], ['ARB', 'ARB', '0xf977814e90da44bfa03b6295a0616a897441acec'], + ['ARB', 'ARB', '0x25681ab599b4e2ceea31f8b498052c53fc2d74db'], + ['ARB', 'ARB', '0x3931dab967c3e2dbb492fe12460a66d0fe4cc857'], ['ARB', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'], ['BNB', 'BEP2', 'bnb142q467df6jun6rt5u2ar58sp47hm5f9wvz2cvg'], ['BNB', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'], @@ -591,7 +593,6 @@ const assetList = [ ['XRP', 'XRP', 'rhWj9gaovwu2hZxYW7p388P8GRbuXFLQkK'], ['XRP', 'XRP', 'rpmxpWis42eYV4oMhyxJNSzrLRdacJVooa'], ['XRP', 'XRP', 'rs8ZPbYqgecRcDzQpJYAMhSxSi5htsjnza'], - ] function getAddresses(chain) { @@ -678,7 +679,9 @@ module.exports = { near: { owners: getOwners('NEAR') }, + /* doge: { owners: getOwners('DOGE') }, + */ } \ No newline at end of file diff --git a/projects/helper/cex.js b/projects/helper/cex.js index 7cf9874faadf..b319e478e719 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -170,6 +170,7 @@ const defaultTokens = { '0xfe1d7f7a8f0bda6e415593a2e4f82c64b446d404', //blp '0xe9d78bf51ae04c7e1263a76ed89a65537b9ca903', // GMEX '0x59769630b236398c2471eb26e6a529448030d94f', //NKYC nonkyc exchange token + '0xbf5140a22578168fd562dccf235e5d43a02ce9b1', // UNI ], eos: [ ["eosio.token", "EOS", "eos"], From d5ec8bddd553385752e18de205afb114309fd2a5 Mon Sep 17 00:00:00 2001 From: MaksimKrukovichWeb3 Date: Fri, 5 Jul 2024 15:11:57 +0200 Subject: [PATCH 604/855] Add amphrLRT Vault to TVL aggregation (#10802) * add amphrLRT to lv tokens * add total supply call * Remove no-needed TVL * add new hallmark and replace previous --------- Co-authored-by: denissergeev Co-authored-by: Maksim --- projects/amphor/index.js | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/projects/amphor/index.js b/projects/amphor/index.js index 1d34398948e3..c78db9fe28a9 100644 --- a/projects/amphor/index.js +++ b/projects/amphor/index.js @@ -6,13 +6,18 @@ const sdk = require('@defillama/sdk'); const config = { ethereum: { lvTokens: { - 'ampr-LP-USD': '0x3b022EdECD65b63288704a6fa33A8B9185b5096b', - 'ampr-LP-ETH': '0x2791EB5807D69Fe10C02eED6B4DC12baC0701744', - 'ampr-LP-BTC': '0xC4A324fDF8a2495776B4d6cA46599B5a52f96489', - amprPTweETH: '0xf97ecda5F9ff31d83f635a6EA70D2D3B9C8f2e00', - amprPTrsETH: '0x0498b85FB4EC85EF5EFe82513aa9DaF767358A15', - amprPTezETH: '0x920F17e741029D904936c58a545DFFC72f82C079', - amprETH: '0xcdc51f2b0e5f0906f2fd5f557de49d99c34df54e', + totalAssets: [ + '0x3b022EdECD65b63288704a6fa33A8B9185b5096b', // ampr-LP-USD + '0x2791EB5807D69Fe10C02eED6B4DC12baC0701744', // ampr-LP-ETH + '0xC4A324fDF8a2495776B4d6cA46599B5a52f96489', // ampr-LP-BTC + '0xf97ecda5F9ff31d83f635a6EA70D2D3B9C8f2e00', // amprPTweETH + '0x0498b85FB4EC85EF5EFe82513aa9DaF767358A15', // amprPTrsETH + '0x920F17e741029D904936c58a545DFFC72f82C079', // amprPTezETH + '0xcdc51f2b0e5f0906f2fd5f557de49d99c34df54e', // amprETH + ], + totalSupply: [ + '0x06824C27C8a0DbDe5F72f770eC82e3c0FD4DcEc3', // amphrLRT + ], }, }, }; @@ -21,17 +26,26 @@ const claimableSilo = '0x06eCFaAde8fcb8C1bC58CB05104604282f8a8144'; const pendingSilo = '0x361a027e660844f336d5fa07E4cb38c40d5880d9'; const WETH = ADDRESSES.ethereum.WETH; +const totalAssetsVaults = config.ethereum.lvTokens.totalAssets; +const totalSupplyVaults = config.ethereum.lvTokens.totalSupply; + const tvl = sdk.util.sumChainTvls([ sumERC4626VaultsExport({ - vaults: Object.values(config.ethereum.lvTokens), + vaults: totalAssetsVaults, tokenAbi: 'asset', balanceAbi: 'totalAssets', }), + sumERC4626VaultsExport({ + vaults: totalSupplyVaults, + tokenAbi: 'asset', + balanceAbi: 'totalSupply', + }), sumTokensExport({ owners: [claimableSilo, pendingSilo], tokens: [WETH] }), ]); module.exports['ethereum'] = { tvl }; module.exports.hallmarks = [ [1710115200, 'Beta test closing'], - [1712361600, 'LRT vault release'], + [1712361600, 'ETH Boosted Vault Release'], + [1718064000, 'Symbiotic LRT Vault Release'], ]; From 23f61fff6f3125eee8d74bb75ec1ee34830adaa0 Mon Sep 17 00:00:00 2001 From: HappyFeet07 <34086197+HappyFeet07@users.noreply.github.com> Date: Fri, 5 Jul 2024 21:19:12 +0800 Subject: [PATCH 605/855] feat: add gudchain (#10896) --- projects/gudchain/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 projects/gudchain/index.js diff --git a/projects/gudchain/index.js b/projects/gudchain/index.js new file mode 100644 index 000000000000..3d6d22fec118 --- /dev/null +++ b/projects/gudchain/index.js @@ -0,0 +1,22 @@ +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const launchBridge = "0xd759e176DEF0F14e5C2D300238d41b1CBB5585BF"; + +module.exports = { + ethereum: { + tvl: sumTokensExport({ + owner: launchBridge, + start: 20203960, + tokens: [ + "0x0000000000000000000000000000000000000000", + "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84", + "0xa2E3356610840701BDf5611a53974510Ae27E2e1", + "0xd5F7838F5C461fefF7FE49ea5ebaF7728bB0ADfa", + "0x6B175474E89094C44Da98b954EedeAC495271d0F", + "0x83F20F44975D03b1b09e64809B757c47f942BEeA", + "0xdAC17F958D2ee523a2206206994597C13D831ec7", + "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" + ] + }) + } +}; From 9f46a5cd20dcc112d3ea287369b2c4358ef944be Mon Sep 17 00:00:00 2001 From: Oleh Kalenyk <80328073+okalenyk@users.noreply.github.com> Date: Fri, 5 Jul 2024 16:19:45 +0300 Subject: [PATCH 606/855] *kim v2/v4 for base network (#10895) --- projects/kim-v2/index.js | 3 +++ projects/kim-v4/index.js | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/projects/kim-v2/index.js b/projects/kim-v2/index.js index d4c8f3d0e7ec..bb5564ecfa0d 100644 --- a/projects/kim-v2/index.js +++ b/projects/kim-v2/index.js @@ -4,4 +4,7 @@ module.exports = { mode: { tvl: getUniTVL({ factory: "0xc02155946dd8C89D3D3238A6c8A64D04E2CD4500", useDefaultCoreAssets: true, }), }, + base: { + tvl: getUniTVL({ factory: "0x14658340D7D1c112b62509bbF449be1897e8dE01", useDefaultCoreAssets: true, }), + }, }; \ No newline at end of file diff --git a/projects/kim-v4/index.js b/projects/kim-v4/index.js index 22ad87949589..775c89aebaa4 100644 --- a/projects/kim-v4/index.js +++ b/projects/kim-v4/index.js @@ -6,4 +6,9 @@ module.exports = uniV3Export({ fromBlock: 4823915, isAlgebra: true, }, + base: { + factory: '0x2F0d41f94d5D1550b79A83D2fe85C82d68c5a3ca', + fromBlock: 15395969, + isAlgebra: true, + }, }) From 90d6b5c9b1000a9c3161d97eb8d14e3e705c5dd2 Mon Sep 17 00:00:00 2001 From: 0xKoaj <141654454+0xKoaj@users.noreply.github.com> Date: Fri, 5 Jul 2024 11:45:26 -0300 Subject: [PATCH 607/855] feat: add avalanche to meanfinance (#10898) * feat: add rsk to meanfinance * feat: add avalanche to meanfinance --- projects/meanfinance/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/meanfinance/index.js b/projects/meanfinance/index.js index ee8962fa60bf..3be9d2b6e73b 100644 --- a/projects/meanfinance/index.js +++ b/projects/meanfinance/index.js @@ -65,6 +65,7 @@ module.exports = { bsc: getV2TvlObject('bsc'), xdai: getV2TvlObject('xdai'), moonbeam: getV2TvlObject('moonbeam'), + avax: getV2TvlObject('avax'), rsk: getV2TvlObject('rsk'), hallmarks: [ [1650082958, "Protocol is paused due to non-critical vulnerability"], From 8f3601f897527fc6f176dcf3d5a96ba15192c062 Mon Sep 17 00:00:00 2001 From: Yotam Katznelson Date: Fri, 5 Jul 2024 17:46:06 +0300 Subject: [PATCH 608/855] Added Backed bNVDA token (#10889) * Added Backed bNVDA token * Fixed bNVDA to be picked only on Ethereum --------- Co-authored-by: hemulin <> --- projects/backed/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/projects/backed/index.js b/projects/backed/index.js index 97e5d428bae2..a12f59da604a 100644 --- a/projects/backed/index.js +++ b/projects/backed/index.js @@ -13,17 +13,22 @@ const contracts = [ "0xAde6057FcAfa57d6d51FFa341C64ce4814995995", // bZPR1 ].map(i => i.toLowerCase()) +const bNVDA = "0xA34C5e0AbE843E10461E2C9586Ea03E55Dbcc495".toLowerCase() // Deployed atm only on Ethereum + const blacklistedOwners = [ '0x5F7A4c11bde4f218f0025Ef444c369d838ffa2aD', // working capital '0x43624c744A4AF40754ab19b00b6f681Ca56F1E5b', // treasury/cold wallet ] - + async function tvl(api) { let tokens = [...contracts] if (api.chain === 'base') { tokens.push('0xC3cE78B037DDA1B966D31EC7979d3f3a38571A8E') tokens = tokens.filter(i => i !== '0x1e2c4fb7ede391d116e6b41cd0608260e8801d59') } + if (api.chain === 'ethereum') { + tokens.push(bNVDA) + } const supply = await api.multiCall({ abi: 'erc20:totalSupply', calls: tokens }) const balances = {} await sumTokens2({ api, tokens, owners: blacklistedOwners, balances, transformAddress: i => i}) @@ -39,4 +44,4 @@ const chains = ["ethereum", "polygon", 'xdai', 'bsc', "avax", "fantom", "base", chains.forEach(chain => { module.exports[chain] = { tvl } -}) \ No newline at end of file +}) From 6fe67a6d3964d233e981dad393b907d0edcf8a0a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 5 Jul 2024 17:48:11 +0300 Subject: [PATCH 609/855] bakerfi: track base (#10873) --- projects/bakerfi/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/bakerfi/index.js b/projects/bakerfi/index.js index 2df658e5c05f..11aaf5cb1515 100644 --- a/projects/bakerfi/index.js +++ b/projects/bakerfi/index.js @@ -2,6 +2,9 @@ const config = { "arbitrum": { vaults: ["0x5c1b2312FaE6c0d61B6A15A8093842E9fE5b1e44"] }, + base: { + vaults: ["0x37327c99bBc522e677a97d01021dB20227faF60A"] + }, } async function getVaultTVL(api, vaults) { From d166f84ebd2f1e1dbdeb8892ff5b4260db7cf05c Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Fri, 5 Jul 2024 16:47:34 +0100 Subject: [PATCH 610/855] add hallmark --- projects/merchant/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/merchant/index.js b/projects/merchant/index.js index dfaa453da654..67e383e77043 100644 --- a/projects/merchant/index.js +++ b/projects/merchant/index.js @@ -1,6 +1,9 @@ const { compoundExports2 } = require("../helper/compound"); module.exports = { + hallmarks: [ + [1720051200,"Rug Pull"] + ], methodology: "Same as Compound Finance, we just count all the tokens supplied (not borrowed money) on the lending markets", merlin: { From 6169340f0fbe6c415ac83667da28cfce1feb4be8 Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Fri, 5 Jul 2024 17:58:16 +0200 Subject: [PATCH 611/855] use proxy for reject request (#10899) * use proxy for reject request * Update proxyRequest.js --------- Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> Co-authored-by: 0xngmi <80541789+0xngmi@users.noreply.github.com> --- projects/helper/proxyRequest.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 projects/helper/proxyRequest.js diff --git a/projects/helper/proxyRequest.js b/projects/helper/proxyRequest.js new file mode 100644 index 000000000000..8fedad1e7add --- /dev/null +++ b/projects/helper/proxyRequest.js @@ -0,0 +1,24 @@ +const axios = require('axios'); +const https = require('https'); + +const agent = new https.Agent({ + rejectUnauthorized: false +}); + +async function fetchThroughProxy(rawUrl) { + const url = new URL(rawUrl) + const response = await axios({ + method: 'get', + url: `https://pr.oxylabs.io:7777${url.pathname}`, + httpsAgent: agent, + headers: { + 'Proxy-Authorization': 'Basic ' + Buffer.from(`${process.env.PROXY_AUTH}`).toString('base64'), + Host: url.host + } + }); + return response.data +} + +module.exports = { + fetchThroughProxy +} From a593e432a9eca48b61321dec9126060b408c24fa Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 5 Jul 2024 19:30:53 +0300 Subject: [PATCH 612/855] limitless: fix bug (#10257) --- projects/limitless/index.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/projects/limitless/index.js b/projects/limitless/index.js index 11240d9aef3e..e0869719352d 100644 --- a/projects/limitless/index.js +++ b/projects/limitless/index.js @@ -12,16 +12,15 @@ Object.keys(config).forEach(chain => { module.exports[chain] = { tvl: async (api) => { if (limWETH) { - const token = await api.call({ abi: 'address:asset', target: limWETH }) - await api.sumTokens({ owner: limWETH, tokens: [token]}) + const token = await api.call({ abi: 'address:asset', target: limWETH }) + await api.sumTokens({ owner: limWETH, tokens: [token] }) } const allTokens = [] const getKey = (token0, token1, fee) => `${token0}-${token1}-${fee}` - - const positionData = await api.fetchList({ lengthAbi: 'totalSupply', itemAbi: abi.positions, target: postionManager }) + const tokenIds = await api.fetchList({ lengthAbi: 'totalSupply', itemAbi: abi.tokenByIndex, target: postionManager }) + const positionData = await api.multiCall({ calls: tokenIds, abi: abi.positions, target: postionManager }) const poolData = {} - // console.table(positionData.map(({ token0, token1, tokensOwed0, tokensOwed1, fee, liquidity }) => ({ token0, token1, tokensOwed0, tokensOwed1, fee, liquidity }))) positionData.forEach(({ token0, token1, tokensOwed0, tokensOwed1, fee, liquidity }) => { if (liquidity === 0) return; if (token0 === nullAddress && token1 === nullAddress) return; @@ -41,17 +40,19 @@ Object.keys(config).forEach(chain => { Object.values(poolData).forEach((data, i) => data.tick = ticks[i]?.tick) positionData.forEach(({ token0, token1, tickUpper, tickLower, fee, liquidity }) => { - if (liquidity === 0) return; + if (+liquidity === 0) return; const tick = poolData[getKey(token0, token1, fee)]?.tick + if (!tick) console.log({ token0, token1, fee, tickUpper, tickLower, liquidity }) if (!tick) return; // pool not found addUniV3LikePosition({ api, token0, token1, tick, liquidity, tickUpper, tickLower, }) }) - if (marginContract) return api.sumTokens({ tokens: allTokens, owner: marginContract}) + if (marginContract) return api.sumTokens({ tokens: allTokens, owner: marginContract }) } } }) const abi = { + "tokenByIndex": "function tokenByIndex(uint256 index) view returns (uint256)", "positions": "function positions(uint256 tokenId) view returns (address owner, address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)", "totalSupply": "uint256:totalSupply", "getPool": "function getPool(address, address, uint24) view returns (address)", From e9f037e991edbc998eb87178f41b593ef34f77f0 Mon Sep 17 00:00:00 2001 From: rivusdao <160065241+rivusdao@users.noreply.github.com> Date: Fri, 5 Jul 2024 12:36:37 -0400 Subject: [PATCH 613/855] update-rivusdao-tvl-adapter (#10900) --- projects/rivusdao/index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/projects/rivusdao/index.js b/projects/rivusdao/index.js index bf74c5a389c4..2c901fc67d0f 100644 --- a/projects/rivusdao/index.js +++ b/projects/rivusdao/index.js @@ -1,7 +1,8 @@ const rTokens = [ - '0xdad3d3c5cac4f2c8eca2b483aba9e928a4b88783', // rsTAO - '0xae173ac44c0041cda87907f52a1e531934e49610' // rsCOMAI -] + '0x5e17abe30f0b804730c4e4db0ad217d8c29d05a0', // rsTAO + '0xcD7D22146ea9F26d0208848B6a1A9d1Bb538245A', // rsCOMAI + '0x3d8ede6231243d56e7896477789a450ce7fd2ad3' // rsNMT + ] async function tvl(api) { const tokens = await api.multiCall({ abi: 'address:wrappedToken', calls: rTokens}) @@ -10,7 +11,7 @@ async function tvl(api) { } module.exports = { - methodology: "TVL is calculated as the sum of the total supplies of rsTAO and rsCOMAI tokens.", + methodology: "TVL is calculated as the sum of the total supplies of rsTAO, rsCOMAI and rsNMT tokens.", ethereum: { tvl, } From fa8166339c28a6f82c9ec3c78e8f19241f1a5a76 Mon Sep 17 00:00:00 2001 From: Mykola Bezruk Date: Fri, 5 Jul 2024 19:40:31 +0300 Subject: [PATCH 614/855] add myso v2 whale match and covered call of the week feature to calculate tvl (#10640) * add myso whale match and covered call of the week * enable mantle * code refactor * remove log * fix big array of tokens * fix empty logs * re-run tests * re-run tests * try to fix tests * comment covered call of the week * add await to results * only blitz match * only whale match * remove await * rollback refactor * back changes * remove chunks --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/myso-v2/index.js | 102 +++++++++++++++++++++++++++++++++----- 1 file changed, 90 insertions(+), 12 deletions(-) diff --git a/projects/myso-v2/index.js b/projects/myso-v2/index.js index f6957fd3805d..ea154c604b29 100644 --- a/projects/myso-v2/index.js +++ b/projects/myso-v2/index.js @@ -30,8 +30,8 @@ const getContracts = async (chainId) => { const response = await get( `https://api.myso.finance/chainIds/${chainId}/contracts`, { - decompress: false, responseType: "stream", + decompress: false, transformResponse: (data) => { return data.pipe(zlib.createBrotliDecompress()); }, @@ -43,21 +43,19 @@ const getContracts = async (chainId) => { return data.contracts; }; -async function tvl(api) { - const { fromBlock } = config[api.chain]; - let contracts; +const CoveredCallStrategiesAbi = + "function strategies(uint256) view returns (address underlying, uint128 maxDeposits, uint128 minDeposits, uint128 startTime, uint128 tenor, uint128 minStrike, uint128 subscribeEndTime, uint256 totalDeposits, uint128 tokenRewardsPerDeposit)"; - try { - contracts = await getContracts(api.chainId); - await setCache("myso-v2", api.chain, contracts); - } catch (e) { - contracts = await getCache("myso-v2", api.chain); - } +const whaleMatchTotalSubscriptionsAbi = + "function totalSubscriptions(address) view returns (uint256)"; +const getBlitzMatchBalances = async (api, contracts, fromBlock) => { const vaultFactory = contracts?.find( (contract) => contract.type === "vault_factory" )?.contractAddr; + if (!vaultFactory); + const logs = await getLogs({ api, target: vaultFactory, @@ -67,6 +65,8 @@ async function tvl(api) { fromBlock, }); + if (!logs.length) return; + let ownerTokens = logs.map((i) => { return [ contracts @@ -76,10 +76,88 @@ async function tvl(api) { ]; }); - return sumTokens2({ + return sumTokens2({ api, ownerTokens }); +}; + +const getCoveredCallOfTheWeekBalances = async (api, contracts) => { + const coveredCallOfTheWeeks = contracts?.filter( + (contract) => contract.type === "p2p" + ); + + if (!coveredCallOfTheWeeks) return balances; + + const coveredCallOfTheWeekStrategies = await api.multiCall({ + calls: coveredCallOfTheWeeks.map((contract) => ({ + target: contract?.contractAddr, + params: [contract.poolData.strategyId], + })), + abi: CoveredCallStrategiesAbi, + }); + + if (!coveredCallOfTheWeekStrategies.length) return; + + coveredCallOfTheWeekStrategies.forEach((strategy) => + api.add(strategy.underlying, strategy.totalDeposits) + ); +}; + +const getWhaleMatchBalances = async (api, contracts, fromBlock) => { + const fundingPoolFactory = contracts.find( + (contract) => contract.type === "funding_pool_factory" + )?.contractAddr; + + const fundingPools = + contracts.filter((contract) => contract.type === "funding_pool") || []; + + if (!(fundingPoolFactory && fundingPools.length)) return; + + const logs = await getLogs({ api, - ownerTokens, + target: fundingPoolFactory, + eventAbi: + "event LoanProposalCreated(address indexed loanProposalAddr, address indexed fundingPool, address indexed sender, address collToken, uint256 arrangerFee, uint256 unsubscribeGracePeriod, uint256 numLoanProposals)", + onlyArgs: true, + fromBlock, + }); + + if (logs.length) { + const loanProposalBalances = await api.multiCall({ + calls: logs.map((log) => ({ + target: log?.fundingPool, + params: [log.loanProposalAddr], + })), + abi: whaleMatchTotalSubscriptionsAbi, + }); + const tokens = await api.multiCall({ + abi: "address:depositToken", + calls: logs.map((log) => log.fundingPool), + }); + api.add(tokens, loanProposalBalances); + } + + let tokensAndOwners = fundingPools.map((fundingPool) => { + return [fundingPool.loanCcyToken, fundingPool.contractAddr]; }); + + return sumTokens2({ api, tokensAndOwners }); +}; + +async function tvl(api) { + const { fromBlock } = config[api.chain]; + + let contracts; + + try { + contracts = await getContracts(api.chainId); + await setCache("myso-v2", api.chain, contracts); + } catch (e) { + contracts = await getCache("myso-v2", api.chain); + } + + await getBlitzMatchBalances(api, contracts, fromBlock); + await getCoveredCallOfTheWeekBalances(api, contracts); + + return getWhaleMatchBalances(api, contracts, fromBlock); } const config = { From f22f500ece461506612a6f689bfc0b384523ddee Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 5 Jul 2024 19:49:39 +0300 Subject: [PATCH 615/855] Add sturgeon and refactor code (#10784) * add sturgeon * code refactor * review fixes --------- Co-authored-by: Alien Deployer --- projects/helper/tokenMapping.js | 6 ++++++ projects/sturgeon/index.js | 31 +++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 projects/sturgeon/index.js diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 1ce0f489f1f4..15bd6e253b09 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -40,6 +40,12 @@ const fixBalancesTokens = { ozone: { // '0x83048f0bf34feed8ced419455a4320a735a92e9d': { coingeckoId: "ozonechain", decimals: 18 }, // was mapped to wrong chain }, + + real: { + '0x4644066f535ead0cde82d209df78d94572fcbf14': { coingeckoId: 're-al', decimals: 18 }, + '0xaec9e50e3397f9ddc635c6c429c8c7eca418a143': { coingeckoId: 'arcana-2', decimals: 18 }, + '0xce1581d7b4ba40176f0e219b2cac30088ad50c7a': { coingeckoId: 'pearl', decimals: 18 }, + }, } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) diff --git a/projects/sturgeon/index.js b/projects/sturgeon/index.js new file mode 100644 index 000000000000..519ae34d1d1c --- /dev/null +++ b/projects/sturgeon/index.js @@ -0,0 +1,31 @@ +const { sumTokens2 } = require("../helper/unwrapLPs") + +const config = { + "real": { + controller: "0xE0E71B484Bb20E37d18Ab51fB60c32deC778478A", + }, +} + +Object.keys(config).forEach(chain => { + const { controller } = config[chain] + module.exports[chain] = { + tvl: async function (api) { + const compounderVaults = await api.call({ abi: 'address[]:compounderVaultsList', target: controller }) + const harvesterVaults = await api.call({ abi: 'address[]:harvesterVaultsList', target: controller }) + await api.erc4626Sum({ calls: compounderVaults, isOG4626: true }) + const tridents = await api.multiCall({ abi: 'address:asset', calls: harvesterVaults }) + const tridentBalances = await api.multiCall({ abi: 'uint256:totalAssets', calls: harvesterVaults }) + const token0s = await api.multiCall({ abi: 'address:token0', calls: tridents }) + const tokenBals = await api.multiCall({ abi: 'function getTotalAmounts() external view returns (uint total0, uint total1, uint128 liquidity)', calls: tridents }) + const token1s = await api.multiCall({ abi: 'address:token1', calls: tridents }) + const totalSupplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: tridents }) + + tridents.forEach((_, i) => { + const ratio = tridentBalances[i] / totalSupplies[i] + api.add(token0s[i], tokenBals[i].total0 * ratio) + api.add(token1s[i], tokenBals[i].total1 * ratio) + }) + return sumTokens2({ api }) + }, + } +}) From 3a6ae5f14af8d366852ad3d2a5f03ca62392129a Mon Sep 17 00:00:00 2001 From: arcc0s <97156729+arcc0s@users.noreply.github.com> Date: Fri, 5 Jul 2024 21:16:57 +0200 Subject: [PATCH 616/855] invalid LRT date (#10901) --- projects/amphor/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/amphor/index.js b/projects/amphor/index.js index c78db9fe28a9..00bd04b5d258 100644 --- a/projects/amphor/index.js +++ b/projects/amphor/index.js @@ -47,5 +47,5 @@ module.exports['ethereum'] = { tvl }; module.exports.hallmarks = [ [1710115200, 'Beta test closing'], [1712361600, 'ETH Boosted Vault Release'], - [1718064000, 'Symbiotic LRT Vault Release'], + [1719878399, 'Symbiotic LRT Vault Release'], ]; From e9f57a3904779b92b384838a2fb2e83bc88eb91c Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sat, 6 Jul 2024 13:07:50 +0100 Subject: [PATCH 617/855] fix unexisting var --- projects/myso-v2/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/myso-v2/index.js b/projects/myso-v2/index.js index ea154c604b29..610e65d6bc89 100644 --- a/projects/myso-v2/index.js +++ b/projects/myso-v2/index.js @@ -84,7 +84,7 @@ const getCoveredCallOfTheWeekBalances = async (api, contracts) => { (contract) => contract.type === "p2p" ); - if (!coveredCallOfTheWeeks) return balances; + if (!coveredCallOfTheWeeks) return; const coveredCallOfTheWeekStrategies = await api.multiCall({ calls: coveredCallOfTheWeeks.map((contract) => ({ From 7352e53eedd07b5c925ffab7908f1e16612e0e50 Mon Sep 17 00:00:00 2001 From: arcc0s <97156729+arcc0s@users.noreply.github.com> Date: Sat, 6 Jul 2024 14:08:37 +0200 Subject: [PATCH 618/855] errors happened on the timeline... (#10905) --- projects/amphor/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/amphor/index.js b/projects/amphor/index.js index 00bd04b5d258..878b3c59686e 100644 --- a/projects/amphor/index.js +++ b/projects/amphor/index.js @@ -47,5 +47,5 @@ module.exports['ethereum'] = { tvl }; module.exports.hallmarks = [ [1710115200, 'Beta test closing'], [1712361600, 'ETH Boosted Vault Release'], - [1719878399, 'Symbiotic LRT Vault Release'], + [1718927999, 'Symbiotic LRT Vault Release'], ]; From 73d3e2c44abe87ea703821c59508736f4a3954d8 Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Sat, 6 Jul 2024 20:55:06 +0200 Subject: [PATCH 619/855] Securitize Protocol (BUIDL) (#10906) * add securitize protocol (BUIDL) * reoganization file (require a top of file) --------- Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> --- projects/securitize/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 projects/securitize/index.js diff --git a/projects/securitize/index.js b/projects/securitize/index.js new file mode 100644 index 000000000000..97790fae5b48 --- /dev/null +++ b/projects/securitize/index.js @@ -0,0 +1,15 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const BUIDL = "0x7712c34205737192402172409a8f7ccef8aa2aec" + +module.exports = { + ethereum: { + tvl: async (api) => { + const totalSupply = await api.call({ + target: BUIDL, + abi: 'erc20:totalSupply' + }) + return api.add(ADDRESSES.ethereum.USDC, totalSupply) + } + } +} \ No newline at end of file From 6c3072399d82c5c1cb286d50dee9d6f1b3971c92 Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Sat, 6 Jul 2024 20:58:00 +0200 Subject: [PATCH 620/855] Arca-labs (RCOIN) (#10907) * Arc-Labs protocol, RWA * Adjust Supply --------- Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> --- projects/arca-labs/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 projects/arca-labs/index.js diff --git a/projects/arca-labs/index.js b/projects/arca-labs/index.js new file mode 100644 index 000000000000..3a115b626af0 --- /dev/null +++ b/projects/arca-labs/index.js @@ -0,0 +1,21 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const RCOIN = "0x252739487c1fa66eaeae7ced41d6358ab2a6bca9" + +module.exports = { + ethereum: { + tvl: async (api) => { + const [usdcDecimals, rcoinDecimals,totalSupply] = await Promise.all([ + api.call({target: ADDRESSES.ethereum.USDC, abi:'erc20:decimals'}), + api.call({target: RCOIN, abi:'erc20:decimals'}), + api.call({target: RCOIN, abi:'erc20:totalSupply'}) + ]) + // Adjusting the total supply of RCOIN to match the decimal places of USDC + // USDC has 6 decimals, whereas RCOIN has 8 decimals + const rcoinDecimalAdjustment = Math.pow(10, usdcDecimals) / Math.pow(10, rcoinDecimals); + const adjustedSupply = totalSupply * rcoinDecimalAdjustment + + return api.add(ADDRESSES.ethereum.USDC, adjustedSupply) + } + } +} \ No newline at end of file From cea8fae15e8bb2d9d3c1300253f5d96f61a27f13 Mon Sep 17 00:00:00 2001 From: gaawai-l Date: Sun, 7 Jul 2024 22:53:09 +0800 Subject: [PATCH 621/855] (Jaspervault) added new pools for 2H 8H 12H options (#10910) * add jaspervault tvl * minor fix * Add a new liquidity pool for selling puts. * Add 2 new liquidity pool for selling options * added new pools for 2H 8H 12H options --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Co-authored-by: Gary.Leung --- projects/jaspervault/index.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/projects/jaspervault/index.js b/projects/jaspervault/index.js index 46f54ba173bb..a327a6ec8b90 100644 --- a/projects/jaspervault/index.js +++ b/projects/jaspervault/index.js @@ -5,12 +5,15 @@ module.exports = { arbitrum: { tvl: sumTokensExport({ owners: [ - '0xE980FD1dEA4E93c25B7f5B27351CF069C4f63a41', // sell ETH CALL - '0xE26f15B3cc23e8a5adE4c10CCc69e50520eE2a89', // sell ETH PUT - '0xaaa5a76b9397eE41309CC15Bd71a5ae99662d6cd', // sell WBTC CALL - '0xd9344b56AE4C3Eb40a248c2548F128cCcd6208A0' // sell WBTC PUT + '0xE980FD1dEA4E93c25B7f5B27351CF069C4f63a41', + '0xE26f15B3cc23e8a5adE4c10CCc69e50520eE2a89', + '0x5954B84F4ba745E1A85E9A5875ce3bDf863200ba', + '0xaaa5a76b9397eE41309CC15Bd71a5ae99662d6cd', + '0x3cF1A20AE73ff128D3A40F4492fdE59F2B2D1e8C', + '0x1eb466780e412C796A7BEdA541CfF47E0571A000', + '0x1DDD814589376Db497F91eFD2E6AFF969822a951' ], - tokens: [ADDRESSES.arbitrum.WBTC, ADDRESSES.null, ADDRESSES.arbitrum.USDT] + tokens: [ADDRESSES.arbitrum.WBTC, ADDRESSES.null, ADDRESSES.arbitrum.USDT, ADDRESSES.arbitrum.ARB] }) }, } From 78c44df2764d2bbebacec6ab022ed934860cfbc0 Mon Sep 17 00:00:00 2001 From: kaka527 Date: Sun, 7 Jul 2024 22:55:10 +0800 Subject: [PATCH 622/855] add project doubler (#10909) --- projects/doubler/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/doubler/index.js diff --git a/projects/doubler/index.js b/projects/doubler/index.js new file mode 100644 index 000000000000..4ecc77fbf9b3 --- /dev/null +++ b/projects/doubler/index.js @@ -0,0 +1,17 @@ +const WETH_CONTRACT = '0x82af49447d8a07e3bd95bd0d56f35241523fbab1'; +const DOUBLER_CONTRACT = '0x56386f04111057a5D8DF8d719827038B716333F0'; + +async function tvl(api) { + const collateralBalance = await api.call({ + abi: 'erc20:balanceOf', + target: WETH_CONTRACT, + params: [DOUBLER_CONTRACT], + }); + api.add(WETH_CONTRACT, collateralBalance) +} + +module.exports = { + arbitrum: { + tvl, + } +}; \ No newline at end of file From 2101962d95a0f0b542ae07f91433c81826682ecf Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sun, 7 Jul 2024 18:04:04 +0300 Subject: [PATCH 623/855] add core token --- projects/helper/coreAssets.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 2320ba33c2c4..0d22e9243e3b 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1846,7 +1846,8 @@ "USDC": "ct_U1i8dzJTVWdnU2cv59TZQfLFpLfjqf7MQQC5ygSMKphn8Yew2" }, "etlk": { - "OGV1WXTZ": "0x3571aed54ccea5b69b00516d5a149a6baea77118" + "OGV1WXTZ": "0x3571aed54ccea5b69b00516d5a149a6baea77118", + "WXTZ": "0xc9B53AB2679f573e480d01e0f49e2B5CFB7a3EAb" }, "rari": { "WETH": "0xf037540e51d71b2d2b1120e8432ba49f29edfbd0", From 522541237a37c66e1f46b0c18250a95e3b70c3d9 Mon Sep 17 00:00:00 2001 From: Maxime Desalle <70470326+maxdesalle@users.noreply.github.com> Date: Sun, 7 Jul 2024 17:08:32 +0200 Subject: [PATCH 624/855] refactor: add scroll/zksync support for sablier-v2 (#10908) --- projects/sablier-v2/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/sablier-v2/index.js b/projects/sablier-v2/index.js index 63ee4894707c..ce8929492277 100644 --- a/projects/sablier-v2/index.js +++ b/projects/sablier-v2/index.js @@ -40,8 +40,10 @@ const config = { avax: { endpoints: [sdk.graph.modifyEndpoint('FdVwZuMV43yCb1nPmjnLQwmzS58wvKuLMPzcZ4UWgWAc')], }, base: { endpoints: [sdk.graph.modifyEndpoint('HS6B8Wi9ZY7D9bjHEuJwDqHa5eCMX5d6H59YyGVnQ5QP')], }, blast: { endpoints: ['https://api.studio.thegraph.com/query/57079/sablier-v2-blast/version/latest'], }, + scroll: { endpoints: [sdk.graph.modifyEndpoint('HVcngokCByfveLwguuafrBC34xB65Ne6tpGrXHmqDSrh')], }, + era: { endpoints: [sdk.graph.modifyEndpoint('GY2fGozmfZiZ3xF2MfevohLR4YGnyxGxAyxzi9zmU5bY')], }, } Object.keys(config).forEach(chain => { module.exports[chain] = { tvl, vesting } -}) \ No newline at end of file +}) From 2fcb7fc83ae4c967af5377cab63072a8803f6433 Mon Sep 17 00:00:00 2001 From: LeeChunHao2000 <64617939+LeeChunHao2000@users.noreply.github.com> Date: Sun, 7 Jul 2024 08:09:48 -0700 Subject: [PATCH 625/855] add Blast USDz (#10904) --- projects/anzen-v2/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/projects/anzen-v2/index.js b/projects/anzen-v2/index.js index a315fbc51619..bf999d4aeae7 100644 --- a/projects/anzen-v2/index.js +++ b/projects/anzen-v2/index.js @@ -4,6 +4,7 @@ const sdk = require('@defillama/sdk') const USDz = '0xa469b7ee9ee773642b3e93e842e5d9b5baa10067'; const Base_USDz = '0x04d5ddf5f3a8939889f11e97f8c4bb48317f1938'; +const Blast_USDz = '0x52056ed29fe015f4ba2e3b079d10c0b87f46e8c6'; const SPCT = '0xf30a29f1c540724fd8c5c4be1af604a6c6800d29'; // Secured collateral const mainnet_tvl = async (api) => { @@ -16,6 +17,11 @@ const base_tvl = async (api) => { api.add(Base_USDz, supply) } +const blast_tvl = async (api) => { + const supply = await api.call({ abi: 'erc20:totalSupply', target: Blast_USDz }) + api.add(Blast_USDz, supply) +} + const collateral_assets = async (api) => { const supply = await api.call({ abi: 'erc20:totalSupply', target: SPCT }) api.add(SPCT, supply) @@ -29,4 +35,7 @@ module.exports = { base: { tvl: base_tvl, }, + blast: { + tvl: blast_tvl, + }, }; From c33c15b9582fe202c0c89b67a9d53e71ec4a4ba4 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sun, 7 Jul 2024 21:48:10 +0300 Subject: [PATCH 626/855] Harmonix (#10911) * Add Harmonix Project * code refactor --------- Co-authored-by: baonguyen1904 Co-authored-by: Bao Nguyen <151540392+baonguyen1904@users.noreply.github.com> --- projects/harmonix/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 projects/harmonix/index.js diff --git a/projects/harmonix/index.js b/projects/harmonix/index.js new file mode 100644 index 000000000000..f0a7bb5b75a7 --- /dev/null +++ b/projects/harmonix/index.js @@ -0,0 +1,21 @@ +module.exports = { + misrepresentedTokens: true, + start: 1709251200, // Friday, March 1, 2024 12:00:00 AM + methodology: "Aggregates total value of each Harmonix vault" +} + +const config = { + arbitrum: "0x7274463BF93E0058481042Cbd6e0cc73042E6285", + ethereum: "0xC7C8Cdd1E9817Fc98AD1b05cD3633c6471A9473b", + base: "0x45dC73fB760f2382Cfd11e28C0Dd0a3A8d3E4C31", +} + +Object.keys(config).forEach(chain => { + const factory = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const bal = await api.call({ abi: 'uint256:getVaultsTVL', target: factory }) + api.addCGToken("tether", bal/1e6) + } + } +}) \ No newline at end of file From 13330c3242e70fe4aaa0814e5aa441c586098499 Mon Sep 17 00:00:00 2001 From: 0x <43978164+0xtjoe@users.noreply.github.com> Date: Mon, 8 Jul 2024 16:26:11 +1000 Subject: [PATCH 627/855] add scroll stablefactory for stablepairs (#10912) * feat: add scroll stablefactory * feat: minor update --------- Co-authored-by: 0xl2 --- projects/impermax/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/impermax/index.js b/projects/impermax/index.js index 4282c17f2de8..2ec9d1774178 100644 --- a/projects/impermax/index.js +++ b/projects/impermax/index.js @@ -51,6 +51,7 @@ const config = { scroll: { factories: [ '0x02Ff7B4d96EeBF8c9B34Fae0418E591e11da3099', + '0xFBD17F3AA7d6506601D2bF7e15a6C96081296a01', // scroll stablefactory ] }, } From a97e004a98dbba0f5f5c95f2065e1772520a8375 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 8 Jul 2024 09:37:30 +0300 Subject: [PATCH 628/855] fail if raydium returns wrong value --- projects/raydium/api.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/projects/raydium/api.js b/projects/raydium/api.js index 22d01f64b5bd..01ea1e8f65fb 100644 --- a/projects/raydium/api.js +++ b/projects/raydium/api.js @@ -1,6 +1,21 @@ const { getExports } = require('../helper/heroku-api') +const { sumTokens2 } = require('../helper/solana') module.exports = { timetravel: false, - ...getExports("raydium", ['solana'], ['staking']), } +const { solana: { tvl } } = getExports("raydium", ['solana']) + +module.exports.solana = { + staking: () => sumTokens2({ tokenAccounts: ['8tnpAECxAT9nHBqR1Ba494Ar5dQMPGhL31MmPJz1zZvY'] }), + tvl: tvlWithCheck, +} + +async function tvlWithCheck(api) { + const balances = await tvl(api) + api.addBalances(balances) + const usdValue = await api.getUSDValue() + // for some godforsaken reason, the TVL is sometimes reported as 60M, we fail in that case rather than report a wrong number + if (usdValue < 2e8) throw new Error('TVL is too low :' + usdValue / 1e6 + 'M') + return api.getBalances() +} \ No newline at end of file From 2edbe821a0771fe34b06d9139b70408fac6c354c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 8 Jul 2024 10:31:30 +0300 Subject: [PATCH 629/855] update yearn --- projects/yearn/index.js | 53 +++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/projects/yearn/index.js b/projects/yearn/index.js index a753745a9048..177cef1743a6 100644 --- a/projects/yearn/index.js +++ b/projects/yearn/index.js @@ -1,4 +1,4 @@ -const { sumTokens2 } = require('../helper/unwrapLPs') +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') const { getConfig } = require('../helper/cache') const v1Vaults = [ @@ -38,18 +38,33 @@ const blacklist = [ '0x7F83935EcFe4729c4Ea592Ab2bC1A32588409797', '0x123964EbE096A920dae00Fb795FFBfA0c9Ff4675', '0x39546945695DCb1c037C836925B355262f551f55', - ...v1Vaults, -] + ...v1Vaults, +].map(i => i.toLowerCase()) async function tvl(api) { - if(api.chain==="polygon"){ - const data = await getConfig('yearn/' + api.chain, `https://ydaemon.yearn.finance/vaults/all?chainids=137&limit=100000`) - await api.erc4626Sum({ calls: data.filter(v=>v.kind==="Multi Strategy").map(v=>v.address), balanceAbi: 'totalAssets', tokenAbi: "asset" }) - } else { - const data = await getConfig('yearn/' + api.chain, `https://api.yearn.finance/v1/chains/${api.chainId}/vaults/all`) - const vaults = data.map(i => i.address).filter(i => !blacklist.includes(i)) - await api.erc4626Sum({ calls: vaults, balanceAbi: 'totalAssets', }) + let data = await getConfig('yearn/v2-' + api.chain, `https://ydaemon.yearn.finance/vaults/all?chainids=${api.chainId}&limit=100000`) + if (!data.length) { + data = await getConfig('yearn/old-' + api.chain, `https://api.yexporter.io/v1/chains/${api.chainId}/vaults/all`) } + let strategies = data.map(v => v.strategies ?? []).flat().map(v => v.address.toLowerCase()) + let vaults = data.filter(i => i.tvl.tvl > 0).map(v => v.address.toLowerCase()).filter(i => !blacklist.includes(i) && !strategies.includes(i)) + const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: vaults }) + const calls = [...vaults] + bals.forEach((bal, i) => { + if (+bal === 0) + calls[i] = nullAddress // skip empty vaults + }) + const tokens = await api.multiCall({ abi: 'address:token', calls, permitFailure: true }) + + tokens.forEach((token, i) => { + if (token) + calls[i] = nullAddress // skip vaults that have a token + }) + const tokensAlt = await api.multiCall({ abi: 'address:asset', calls, permitFailure: true }) + bals.forEach((bal, i) => { + const token = tokens[i] || tokensAlt[i] + if (token) api.add(token, bal) + }) if (api.chain === 'ethereum') { const tokens = await api.multiCall({ abi: 'address:token', calls: v1Vaults }) let bals = await api.multiCall({ abi: 'erc20:totalSupply', calls: v1Vaults }) @@ -57,21 +72,19 @@ async function tvl(api) { bals = bals.map((bal, i) => bal * ratio[i] / 1e18) api.addTokens(tokens, bals) } - return sumTokens2({ api, resolveLP: true,}) + return sumTokens2({ api, resolveLP: true, }) } + module.exports = { doublecounted: true, - misrepresentedTokens: true, - timetravel: false, - fantom: { tvl }, - ethereum: { tvl }, - arbitrum: { tvl }, - optimism: { tvl }, - base: { tvl }, - polygon: { tvl }, hallmarks: [ [1594944000, "YFI token Launch"], ] -}; +} + +const chains = ['ethereum', 'fantom', 'arbitrum', 'optimism', 'polygon', 'base'] +chains.forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file From 815a05d3a7581058b4045915796b2831befebfc8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 8 Jul 2024 12:05:29 +0300 Subject: [PATCH 630/855] update sdk version --- package-lock.json | 6 +++--- projects/helper/env.js | 9 --------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index b2a77fb27696..9262e7eddef6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -886,9 +886,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "5.0.71", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.71.tgz", - "integrity": "sha512-5hZ8TdYIrFa/f4hxb2ADzARmXxeuG5P8yukuQwNbiO8EnLcrDNPKwv5JXNaslWkMexlaeVy1m+EMLnTlbzeQSw==", + "version": "5.0.73", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.73.tgz", + "integrity": "sha512-uLZeOFNWPKVyZAMtO7dXSJreHKWqETHpbPMZzpNR47icGl4nS2o/SX8xW82BmdLU7cp25EG9sN/sKkht/KnWvA==", "dependencies": { "@aws-sdk/client-s3": "^3.400.0", "@elastic/elasticsearch": "^8.13.1", diff --git a/projects/helper/env.js b/projects/helper/env.js index da015f0d834e..efebeaec62d2 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -21,17 +21,8 @@ const DEFAULTS = { TAIKO_RPC: 'https://rpc.taiko.xyz', // added manually short name is tko-mainnet REAL_RPC_MULTICALL: '0xcA11bde05977b3631167028862bE2a173976CA11', SEI_RPC_MULTICALL: '0xcA11bde05977b3631167028862bE2a173976CA11', - TAIKO_RPC_MULTICALL: '0xcb2436774C3e191c85056d248EF4260ce5f27A9D', SEI_RPC: 'https://evm-rpc.sei-apis.com/', - 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", AETERNITY_HTTP_ENDPOINT: 'https://mainnet.aeternity.io', } From d4bb969c18beafe3013046c3ef0a536c4254cfb6 Mon Sep 17 00:00:00 2001 From: jan-magpie <155635960+jan-magpie@users.noreply.github.com> Date: Mon, 8 Jul 2024 14:55:23 +0530 Subject: [PATCH 631/855] adding listapie tvl (#10914) * adding listapie tvl * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/listapie/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 projects/listapie/index.js diff --git a/projects/listapie/index.js b/projects/listapie/index.js new file mode 100644 index 000000000000..24a0986960a1 --- /dev/null +++ b/projects/listapie/index.js @@ -0,0 +1,22 @@ +const config = { + bsc: { + listarush: "0x934c69e35cA3a2774Cc0aa36f5632f1C39f3aC36", + } +} + +async function staking(api) { + const { listarush } = config[api.chain]; + + const token_lista = await api.call({ abi: 'address:Lista', target: listarush, }); + const bal = await api.call({ abi: 'uint256:totalDeposited', target: listarush, }); + api.add(token_lista, bal) +} + +Object.keys(config).forEach((chain) => { + module.exports[chain] = { + tvl: () => ({}), + staking, + } +}) + +module.exports.doublecounted = true \ No newline at end of file From 3abbb14bf9483509cfc9694bd0094900b156e35a Mon Sep 17 00:00:00 2001 From: joshuamind <124139705+joshuamind@users.noreply.github.com> Date: Mon, 8 Jul 2024 17:26:10 +0800 Subject: [PATCH 632/855] add mind restake (#10917) * add mind restake * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/mind-restake/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 projects/mind-restake/index.js diff --git a/projects/mind-restake/index.js b/projects/mind-restake/index.js new file mode 100644 index 000000000000..ede72d4bf6ca --- /dev/null +++ b/projects/mind-restake/index.js @@ -0,0 +1,21 @@ +const config = { + ethereum: "0x6a5D488EC17d6a7a1872AaB88feC90c1B2Df4196", + scroll: "0xea3E87699D11B77Fba754Bf0257a25664B97437d" +}; + +module.exports = { + methodology: "Counts the total amount of asset tokens deposited in each of the Strategy contracts registered in the helper contract on each chain.", +} + +Object.keys(config).forEach(chain => { + const target = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const [_vaults, tokens, bals] = await api.call({ + abi: "function getPoolTotalAssets() view returns (address[] memory,address[] memory, uint256[] memory)", + target, + }) + api.add(tokens, bals) + } + } +}) From a098df8ad3a6e37c6a44a400033acc66d0cc1f09 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Mon, 8 Jul 2024 11:17:53 +0100 Subject: [PATCH 633/855] methodology DeSyn (#10921) --- projects/desyn-farm/index.js | 2 +- projects/desyn/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/desyn-farm/index.js b/projects/desyn-farm/index.js index 5830b13a4529..9e773382f8de 100644 --- a/projects/desyn-farm/index.js +++ b/projects/desyn-farm/index.js @@ -2,7 +2,7 @@ const { getLogs } = require('../helper/cache/getLogs') module.exports = { doublecounted: true, - methodology: 'TVL: Solv.btc deposite in the vault', + methodology: 'On-chain restaking', } const config = { diff --git a/projects/desyn/index.js b/projects/desyn/index.js index 0ef8f12b4e64..71e81b30e9ef 100644 --- a/projects/desyn/index.js +++ b/projects/desyn/index.js @@ -7,7 +7,7 @@ module.exports = { [1718092800, "DeSyn KelpDAO Restaking Fund Launched"], [1713340800, "Restaking Fund Series Launched"], ], - methodology: '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.', + methodology: 'Liquid restaking strategies', } const config = { From bbcc5daeb6790ad2a3731366aedf30e35654a7bc Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 8 Jul 2024 14:18:29 +0300 Subject: [PATCH 634/855] Update op contracts (#10722) * add new op contracts * vfat: ignore failed * hide errors under the rug * code refactor --------- Co-authored-by: stepollo Co-authored-by: 0xChupaCabra <56636447+0xChupaCabra@users.noreply.github.com> --- projects/vfat/config.js | 81 +++++++++++ projects/vfat/index.js | 295 ++++++++++++---------------------------- projects/vfat/utils.js | 72 ++++++++++ 3 files changed, 237 insertions(+), 211 deletions(-) create mode 100644 projects/vfat/config.js create mode 100644 projects/vfat/utils.js diff --git a/projects/vfat/config.js b/projects/vfat/config.js new file mode 100644 index 000000000000..3a3692d45294 --- /dev/null +++ b/projects/vfat/config.js @@ -0,0 +1,81 @@ +module.exports = { + base: { + factory: '0x71D234A3e1dfC161cc1d081E6496e76627baAc31', + gaugeFactory: '0x35f35cA5B132CaDf2916BaB57639128eAC5bbcb5', + gaugeFactory2: '0xD30677bd8dd15132F251Cb54CbDA552d2A05Fb08', + voter: '0x16613524e02ad97edfef371bc883f2f5d6c480a5', + NonfungiblePositionManager: '0x827922686190790b37229fd06084350E74485b72', + masterchefV3: '0xC6A2Db661D5a5690172d8eB0a7DEA2d3008665A3', + fromBlock: 3200567, + fromBlockSickle: 12116234, + chainName: 'base', + }, + optimism: { + factory: '0xB4C31b0f0B76b351395D4aCC94A54dD4e6fbA1E8', + gaugeFactory: '0x8391fE399640E7228A059f8Fa104b8a7B4835071', + oldGaugeFactory2: '0x282AC0eA96493650F1A5E5e5d20490C782F1592a', + gaugeFactory2: '0x327147eE440252b893A771345025B41A267Ad985', + voter: '0x41C914ee0c7E1A5edCD0295623e6dC557B5aBf3C', + oldNonfungiblePositionManager: '0xbB5DFE1380333CEE4c2EeBd7202c80dE2256AdF4', + NonfungiblePositionManager: '0x416b433906b1B72FA758e166e239c43d68dC6F29', + fromBlock: 105896812, + fromBlockSickle: 117753454, + chainName: 'optimism', + }, + arbitrum: { + factory: '0x53d9780DbD3831E3A797Fd215be4131636cD5FDf', + gaugeFactory: '0xAAA2564DEb34763E3d05162ed3f5C2658691f499', + gaugeFactory2: '0xaa2fbd0c9393964af7c66c1513e44a8caaae4fda', + NonfungiblePositionManager: '0xAA277CB7914b7e5514946Da92cb9De332Ce610EF', + masterchefV3: '0x5e09ACf80C0296740eC5d6F643005a4ef8DaA694', + fromBlock: 69820005, + fromBlockSickle: 197499243, + chainName: 'arbitrum', + }, + linea: { + factory: '0x0F6aBc6B808B377d6AeD8dA1FAD5E135C99C81a3', + fromBlockSickle: 4949355, + fromBlock: 381770, + gaugeFactory: '0xAAA932839641c037452f826BB9d7B2057129833b', + gaugeFactory2: '0xAAA2D4987EEd427Ba5E2c933EeFCD75C84b446B7', + voter: '0xAAAf3D9CDD3602d117c67D80eEC37a160C8d9869', + NonfungiblePositionManager: '0xAAA78E8C4241990B4ce159E105dA08129345946A', + masterchefV3: '0x22E2f236065B780FA33EC8C4E58b99ebc8B55c57', + chainName: 'linea', + }, + ethereum: { + factory: '0x9D70B9E5ac2862C405D64A0193b4A4757Aab7F95', + chainName: 'ethereum', + masterchefV3: '0x556B9306565093C855AEA9AE92A594704c2Cd59e', + fromBlockSickle: 19580798, + }, + mode: { + factory: '0x53d9780DbD3831E3A797Fd215be4131636cD5FDf', + chainName: 'mode', + fromBlockSickle: 7464171, + gaugeFactory: '0x31832f2a97Fd20664D76Cc421207669b55CE4BC0', + voter: '0xD2F998a46e4d9Dd57aF1a28EBa8C34E7dD3851D7', + fromBlock: 7453232, + }, + fantom: { + factory: '0x53d9780DbD3831E3A797Fd215be4131636cD5FDf', + chainName: 'fantom', + fromBlockSickle: 79166260, + NonfungiblePositionManager: '0x2B52294425a9a229322228de659eDE9D146D7c2f', + gaugeFactory: '0x5b3220cb732245ffe8e26df228ac93feb685c157', + fromBlock: 58469764, + voter: '0xe3d1a117df7dcac2eb0ac8219341bad92f18dac1', + }, + mantle: { + factory: '0xB4C31b0f0B76b351395D4aCC94A54dD4e6fbA1E8', + chainName: 'mantle', + fromBlockSickle: 62383980, + moeMasterchef: '0xA756f7D419e1A5cbd656A438443011a7dE1955b5' + }, + bsc: { + factory: '0x53d9780DbD3831E3A797Fd215be4131636cD5FDf', + chainName: 'bsc', + masterchefV3: '0x556B9306565093C855AEA9AE92A594704c2Cd59e', + fromBlockSickle: 37565801 + }, +} \ No newline at end of file diff --git a/projects/vfat/index.js b/projects/vfat/index.js index de0d3f222e52..e4aa86c89cbd 100644 --- a/projects/vfat/index.js +++ b/projects/vfat/index.js @@ -1,85 +1,8 @@ const { getLogs } = require('../helper/cache/getLogs'); const { sumTokens2, addUniV3LikePosition } = require('../helper/unwrapLPs'); -const config = { - base: { - factory: '0x71D234A3e1dfC161cc1d081E6496e76627baAc31', - gaugeFactory: '0x35f35cA5B132CaDf2916BaB57639128eAC5bbcb5', - gaugeFactory2: '0xD30677bd8dd15132F251Cb54CbDA552d2A05Fb08', - voter: '0x16613524e02ad97edfef371bc883f2f5d6c480a5', - NonfungiblePositionManager: '0x827922686190790b37229fd06084350E74485b72', - masterchefV3: '0xC6A2Db661D5a5690172d8eB0a7DEA2d3008665A3', - fromBlock: 3200567, - fromBlockSickle: 12116234, - chainName: 'base', - }, - optimism: { - factory: '0xB4C31b0f0B76b351395D4aCC94A54dD4e6fbA1E8', - gaugeFactory: '0x8391fE399640E7228A059f8Fa104b8a7B4835071', - gaugeFactory2: '0x282AC0eA96493650F1A5E5e5d20490C782F1592a', - voter: '0x41C914ee0c7E1A5edCD0295623e6dC557B5aBf3C', - NonfungiblePositionManager: '0xbB5DFE1380333CEE4c2EeBd7202c80dE2256AdF4', - fromBlock: 105896812, - fromBlockSickle: 117753454, - chainName: 'optimism', - }, - arbitrum: { - factory: '0x53d9780DbD3831E3A797Fd215be4131636cD5FDf', - gaugeFactory: '0xAAA2564DEb34763E3d05162ed3f5C2658691f499', - gaugeFactory2: '0xaa2fbd0c9393964af7c66c1513e44a8caaae4fda', - NonfungiblePositionManager: '0xAA277CB7914b7e5514946Da92cb9De332Ce610EF', - masterchefV3: '0x5e09ACf80C0296740eC5d6F643005a4ef8DaA694', - fromBlock: 69820005, - fromBlockSickle: 197499243, - chainName: 'arbitrum', - }, - linea: { - factory: '0x0F6aBc6B808B377d6AeD8dA1FAD5E135C99C81a3', - fromBlockSickle: 4949355, - fromBlock: 381770, - gaugeFactory: '0xAAA932839641c037452f826BB9d7B2057129833b', - gaugeFactory2: '0xAAA2D4987EEd427Ba5E2c933EeFCD75C84b446B7', - voter: '0xAAAf3D9CDD3602d117c67D80eEC37a160C8d9869', - NonfungiblePositionManager: '0xAAA78E8C4241990B4ce159E105dA08129345946A', - masterchefV3: '0x22E2f236065B780FA33EC8C4E58b99ebc8B55c57', - chainName: 'linea', - }, - ethereum: { - factory: '0x9D70B9E5ac2862C405D64A0193b4A4757Aab7F95', - chainName: 'ethereum', - masterchefV3: '0x556B9306565093C855AEA9AE92A594704c2Cd59e', - fromBlockSickle: 19580798, - }, - mode: { - factory: '0x53d9780DbD3831E3A797Fd215be4131636cD5FDf', - chainName: 'mode', - fromBlockSickle: 7464171, - gaugeFactory: '0x31832f2a97Fd20664D76Cc421207669b55CE4BC0', - voter: '0xD2F998a46e4d9Dd57aF1a28EBa8C34E7dD3851D7', - fromBlock: 7453232, - }, - fantom: { - factory: '0x53d9780DbD3831E3A797Fd215be4131636cD5FDf', - chainName: 'fantom', - fromBlockSickle: 79166260, - NonfungiblePositionManager: '0x2B52294425a9a229322228de659eDE9D146D7c2f', - gaugeFactory: '0x5b3220cb732245ffe8e26df228ac93feb685c157', - fromBlock: 58469764, - voter: '0xe3d1a117df7dcac2eb0ac8219341bad92f18dac1', - }, - mantle: { - factory: '0xB4C31b0f0B76b351395D4aCC94A54dD4e6fbA1E8', - chainName: 'mantle', - fromBlockSickle: 62383980, - moeMasterchef: '0xA756f7D419e1A5cbd656A438443011a7dE1955b5' - }, - bsc: { - factory: '0x53d9780DbD3831E3A797Fd215be4131636cD5FDf', - chainName: 'bsc', - masterchefV3: '0x556B9306565093C855AEA9AE92A594704c2Cd59e', - fromBlockSickle: 37565801 - }, -}; +const config = require('./config'); +const { sumLPBalances } = require('./utils'); // Helper function to fetch sickles async function fetchSickles(api, factory, fromBlockSickle) { @@ -88,12 +11,13 @@ async function fetchSickles(api, factory, fromBlockSickle) { target: factory, fromBlock: fromBlockSickle, eventAbi: 'event Deploy(address indexed admin, address sickle)', + onlyArgs: true, }); - return deployLogs.map(log => log.args.sickle); + return deployLogs.map(log => log.sickle); } // Helper function to fetch and process gauges -async function fetchGauges(api, voter, fromBlock, gaugeFactory, gaugeFactory2) { +async function fetchGauges(api, voter, fromBlock, gaugeFactory, gaugeFactory2, includeOldContract = false, oldGaugeFactory2 = '') { const deployAeroLogs = await getLogs({ api, target: voter, @@ -116,7 +40,7 @@ async function fetchGauges(api, voter, fromBlock, gaugeFactory, gaugeFactory2) { const gaugeAddress = log.args.gauge; if (gaugeFactoryAddress === gaugeFactory) { acc.lp.push(gaugeAddress); - } else if (gaugeFactoryAddress === gaugeFactory2) { + } else if (gaugeFactoryAddress === gaugeFactory2 || (includeOldContract && gaugeFactoryAddress === oldGaugeFactory2)) { acc.nft.push(gaugeAddress); } return acc; @@ -125,6 +49,7 @@ async function fetchGauges(api, voter, fromBlock, gaugeFactory, gaugeFactory2) { ); } + async function fetchGauges2(api, fromBlock, gaugeFactory, gaugeFactory2, voter, chainName) { const eventAbi = `event GaugeCreated( address indexed gauge, @@ -162,52 +87,48 @@ async function fetchGauges2(api, fromBlock, gaugeFactory, gaugeFactory2, voter, } async function fetchSickleNftPositions(api, sickles, managerAddress, isMasterchef = false) { - const sickleBalances = {}; - - for (const sickle of sickles) { - const balanceCallsSickle = [{ target: managerAddress, params: [sickle] }]; - const sickleBals = await api.multiCall({ abi: 'erc20:balanceOf', calls: balanceCallsSickle }); - const balance = sickleBals[0]; + const nftCalls = []; - if (balance === '0') continue; + const sickleBals = await api.multiCall({ abi: 'erc20:balanceOf', target: managerAddress, calls: sickles }); + for (let i = 0; i < sickles.length; i++) { + const sickle = sickles[i] + let nftBals = +sickleBals[i]; + for (let j = 0; j < nftBals; j++) + nftCalls.push({ params: [sickle, j] }); - const nftCalls = []; - for (let i = 0; i < balance; i++) { - nftCalls.push({ target: managerAddress, params: [sickle, i] }); - } - - const nftIds = await api.multiCall({ abi: 'function tokenOfOwnerByIndex(address owner, uint256 index) view returns (uint256)', calls: nftCalls }); - sickleBalances[sickle] = nftIds; } - const positionCalls = []; - for (const sickle in sickleBalances) { - const nftIds = sickleBalances[sickle]; - nftIds.forEach(nftId => { - positionCalls.push({ target: managerAddress, params: [nftId] }); - }); - } + const nftIds = await api.multiCall({ abi: 'function tokenOfOwnerByIndex(address owner, uint256 index) view returns (uint256)', calls: nftCalls, target: managerAddress }); const positions = await api.multiCall({ abi: isMasterchef ? 'function userPositionInfos(uint256 tokenId) view returns (uint128 liquidity, uint128 boostLiquidity, int24 tickLower, int24 tickUpper, uint256 rewardGrowthInside, uint256 reward, address user, uint256 pid, uint256 boostMultiplier)' : 'function positions(uint256 tokenId) view returns (uint96 nonce, address operator, address token0, address token1, int24 tickSpacing, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)', - calls: positionCalls, + calls: nftIds, + target: managerAddress, }); - if (isMasterchef) { - const poolInfoCalls = positions.map(position => ({ - target: managerAddress, - params: [position.pid], - })); + const pidSet = new Set(positions.map(position => position.pid)); + const pids = [...pidSet]; + if (isMasterchef) { const poolInfos = await api.multiCall({ abi: 'function poolInfo(uint256 pid) view returns (uint256 allocPoint, address v3Pool, address token0, address token1, uint24 fee, uint256 totalLiquidity, uint256 totalBoostLiquidity)', - calls: poolInfoCalls, + calls: pids, + permitFailure: true, + target: managerAddress, + }); + const poolInfoMap = {}; + poolInfos.forEach((info, index) => { + poolInfoMap[pids[index]] = info; }); - positions.forEach((position, index) => { - const poolInfo = poolInfos[index]; + positions.forEach((position) => { + if (!position) return; + const poolInfo = poolInfoMap[position.pid]; + if (!poolInfo) { + console.log('Missing pool info for pid', position.pid, position, managerAddress) + } position.allocPoint = poolInfo.allocPoint; position.v3Pool = poolInfo.v3Pool; position.token0 = poolInfo.token0; @@ -218,7 +139,9 @@ async function fetchSickleNftPositions(api, sickles, managerAddress, isMasterche }); } - return positions; + return positions.filter(position => position).forEach(position => { + addUniV3LikePosition({ ...position, api }) + }) } async function fetchGauges3(api, voter, fromBlock) { @@ -240,39 +163,16 @@ async function fetchGauges3(api, voter, fromBlock) { return deployLogs.map(log => log.args[2]); } -async function getLPBalances(api, gauges, sickles, stakingTokens) { - const gaugeTokenMapping = {}; - stakingTokens.forEach((stakingToken, index) => { - gaugeTokenMapping[gauges[index]] = stakingToken; - }); - - const balanceCallsLP = []; - const tokens = []; - for (const gauge of gauges) { - for (const sickle of sickles) { - balanceCallsLP.push({ target: gauge, params: [sickle] }); - tokens.push(gaugeTokenMapping[gauge]); - } - } - - const lpBals = await api.multiCall({ abi: 'erc20:balanceOf', calls: balanceCallsLP }); - - return { - balances: lpBals, - tokens: tokens - }; -} - // TVL calculation for Base and Optimism async function tvlBaseOptimism(api) { - const { factory, gaugeFactory, gaugeFactory2, voter, NonfungiblePositionManager, fromBlock, fromBlockSickle, chainName } = config[api.chain]; + const { factory, gaugeFactory, gaugeFactory2, oldGaugeFactory2, voter, NonfungiblePositionManager, oldNonfungiblePositionManager, fromBlock, fromBlockSickle, chainName } = config[api.chain]; const sickles = await fetchSickles(api, factory, fromBlockSickle); - const deployedAeroGauges = await fetchGauges(api, voter, fromBlock, gaugeFactory, gaugeFactory2); - const stakingTokens = await api.multiCall({ abi: 'address:stakingToken', calls: deployedAeroGauges.lp }); - const { balances, tokens } = await getLPBalances(api, deployedAeroGauges.lp, sickles, stakingTokens); + const includeOldContract = chainName === 'optimism'; + const deployedAeroGauges = await fetchGauges(api, voter, fromBlock, gaugeFactory, gaugeFactory2, includeOldContract, oldGaugeFactory2); - api.add(tokens, balances); + const stakingTokens = await api.multiCall({ abi: 'address:stakingToken', calls: deployedAeroGauges.lp }); + await sumLPBalances(api, deployedAeroGauges.lp, sickles, stakingTokens); const pools = await api.multiCall({ abi: 'address:pool', calls: deployedAeroGauges.nft }); const slot0s = await api.multiCall({ abi: 'function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, bool unlocked)', calls: pools }); @@ -280,14 +180,16 @@ async function tvlBaseOptimism(api) { await Promise.all(deployedAeroGauges.nft.map(async (gauge, i) => { const tick = slot0s[i].tick; const nftIds = (await api.multiCall({ abi: 'function stakedValues(address depositor) view returns (uint256[])', calls: sickles, target: gauge })).flat(); - const positions = await api.multiCall({ abi: 'function positions(uint256 tokenId) view returns (uint96 nonce, address operator, address token0, address token1, int24 tickSpacing, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)', calls: nftIds, target: NonfungiblePositionManager }); - positions.forEach(position => addUniV3LikePosition({ ...position, tick, api })); + const positions = await api.multiCall({ abi: 'function positions(uint256 tokenId) view returns (uint96 nonce, address operator, address token0, address token1, int24 tickSpacing, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)', calls: nftIds, target: NonfungiblePositionManager, permitFailure: true, }); + if (chainName === 'optimism' && oldNonfungiblePositionManager) { + const oldPositions = await api.multiCall({ abi: 'function positions(uint256 tokenId) view returns (uint96 nonce, address operator, address token0, address token1, int24 tickSpacing, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)', calls: nftIds, target: oldNonfungiblePositionManager, permitFailure: true, }); + positions.push(...oldPositions); + } + positions.filter(i => i).forEach(position => addUniV3LikePosition({ ...position, tick, api })); })); - if (chainName === 'base') { - const masterchefPositions = await fetchSickleNftPositions(api, sickles, config[api.chain].masterchefV3, true); - masterchefPositions.forEach(position => addUniV3LikePosition({ ...position, api })); - } + if (chainName === 'base') + await fetchSickleNftPositions(api, sickles, config[api.chain].masterchefV3, true); return sumTokens2({ api, resolveLP: true }); } @@ -300,17 +202,12 @@ async function tvlArbitrumLinea(api) { const gauges = await fetchGauges2(api, fromBlock, gaugeFactory, gaugeFactory2, voter, chainName); const stakingTokens = await api.multiCall({ abi: 'address:stake', calls: gauges.lp }); - const { balances, tokens } = await getLPBalances(api, gauges.lp, sickles, stakingTokens); - api.add(tokens, balances); - - const positions = await fetchSickleNftPositions(api, sickles, config[api.chain].NonfungiblePositionManager); - const masterchefPositions = await fetchSickleNftPositions(api, sickles, config[api.chain].masterchefV3, true); + await sumLPBalances(api, gauges.lp, sickles, stakingTokens); - positions.forEach(position => addUniV3LikePosition({ ...position, api })); - masterchefPositions.splice(6, 1).forEach(position => addUniV3LikePosition({ ...position, api })); + await fetchSickleNftPositions(api, sickles, config[api.chain].NonfungiblePositionManager); + await fetchSickleNftPositions(api, sickles, config[api.chain].masterchefV3, true); return sumTokens2({ api, resolveLP: true }); - } async function modeTvl(api) { @@ -318,8 +215,7 @@ async function modeTvl(api) { const sickles = await fetchSickles(api, factory, fromBlockSickle); const gauges = await fetchGauges3(api, voter, fromBlock); const stakingTokens = await api.multiCall({ abi: 'address:stakingToken', calls: gauges }); - const { balances, tokens } = await getLPBalances(api, gauges, sickles, stakingTokens); - api.add(tokens, balances); + await sumLPBalances(api, gauges, sickles, stakingTokens); return sumTokens2({ api, resolveLP: true }); } @@ -329,20 +225,16 @@ async function genericTvl(api) { const sickles = await fetchSickles(api, factory, fromBlockSickle); - if (masterchefV3) { - const masterchefPositions = await fetchSickleNftPositions(api, sickles, masterchefV3, true); - masterchefPositions.forEach(position => addUniV3LikePosition({ ...position, api })); - } + if (masterchefV3) + await fetchSickleNftPositions(api, sickles, masterchefV3, true); - if (NonfungiblePositionManager) { - const positions = await fetchSickleNftPositions(api, sickles, NonfungiblePositionManager); - positions.forEach(position => addUniV3LikePosition({ ...position, api })); - } - return sumTokens2({ api, resolveLP: true }); + if (NonfungiblePositionManager) + await fetchSickleNftPositions(api, sickles, NonfungiblePositionManager); + } -async function fetchFantomGauges(api, fromBlock, gaugeFactory, voter, chainName) { +async function fetchFantomGauges(api, fromBlock, gaugeFactory) { const eventAbi = `event GaugeCreated( address indexed maker, address indexed pool, @@ -358,9 +250,10 @@ async function fetchFantomGauges(api, fromBlock, gaugeFactory, voter, chainName) target: gaugeFactory, fromBlock, eventAbi, + onlyArgs: true, }); - return deployLogs.map(log => log.args.g); + return deployLogs.map(log => log.g); } // TVL calculation for Fantom @@ -370,8 +263,7 @@ async function tvlFantom(api) { const sickles = await fetchSickles(api, factory, fromBlockSickle); const gauges = await fetchFantomGauges(api, fromBlock, gaugeFactory, voter, chainName); const stakingTokens = await api.multiCall({ abi: 'address:stake', calls: gauges }); - const { balances, tokens } = await getLPBalances(api, gauges, sickles, stakingTokens); - api.add(tokens, balances); + await sumLPBalances(api, gauges, sickles, stakingTokens); return sumTokens2({ api, resolveLP: true }); } @@ -381,21 +273,14 @@ async function tvlMantle(api) { const sickles = await fetchSickles(api, factory, fromBlockSickle); - const numberOfFarms = await api.call({ - abi: 'function getNumberOfFarms() view returns (uint256)', - target: moeMasterchef - }); - - const farmIds = Array.from({ length: numberOfFarms }, (_, i) => i); - const tokens = await api.multiCall({ - abi: 'function getToken(uint256 pid) view returns (address)', - calls: farmIds.map(pid => ({ target: moeMasterchef, params: [pid] })) - }); + const tokens = await api.fetchList({ lengthAbi: 'getNumberOfFarms', itemAbi: 'getToken', target: moeMasterchef }) - const farmTokenMap = farmIds.reduce((map, pid, index) => { - map[pid] = tokens[index]; - return map; - }, {}); + const farmTokenMap = {} + const farmIds = [] + tokens.forEach((token, index) => { + farmTokenMap[index] = token + farmIds.push(index) + }) const depositCalls = []; sickles.forEach(sickle => { @@ -409,40 +294,28 @@ async function tvlMantle(api) { calls: depositCalls }); - const tokenBalanceMap = {}; - depositCalls.forEach((call, index) => { const pid = call.params[0]; const deposit = deposits[index]; const token = farmTokenMap[pid]; - - if (!tokenBalanceMap[token]) { - tokenBalanceMap[token] = deposit; - } else { - tokenBalanceMap[token] = (BigInt(tokenBalanceMap[token]) + BigInt(deposit)).toString(); - } + api.add(token, deposit) }); - - const tokenList = Object.keys(tokenBalanceMap); - const balanceList = Object.values(tokenBalanceMap); - - api.add(tokenList, balanceList); - return sumTokens2({ api, resolveLP: true }); } Object.keys(config).forEach(chain => { - if (['base', 'optimism'].includes(chain)) { - module.exports[chain] = { tvl: tvlBaseOptimism }; - } else if (['arbitrum', 'linea'].includes(chain)) { - module.exports[chain] = { tvl: tvlArbitrumLinea }; - } else if (chain === 'fantom') { - module.exports[chain] = { tvl: tvlFantom }; - } else if (chain === 'mode') { - module.exports[chain] = { tvl: modeTvl }; - } else if (chain === 'mantle') { - module.exports[chain] = { tvl: tvlMantle }; - } else if (!['base', 'optimism', 'arbitrum', 'linea', 'fantom', 'mode', 'mantle'].includes(chain)) { - module.exports[chain] = { tvl: genericTvl }; + let tvl + switch (chain) { + case 'base': + case 'optimism': tvl = tvlBaseOptimism; break; + case 'arbitrum': + case 'linea': tvl = tvlArbitrumLinea; break; + case 'fantom': tvl = tvlFantom; break; + case 'mode': tvl = modeTvl; break; + case 'mantle': tvl = tvlMantle; break; + default: + tvl = genericTvl } -}); \ No newline at end of file + + module.exports[chain] = { tvl } +}) diff --git a/projects/vfat/utils.js b/projects/vfat/utils.js new file mode 100644 index 000000000000..0339c2e58325 --- /dev/null +++ b/projects/vfat/utils.js @@ -0,0 +1,72 @@ +const { Balances } = require('@defillama/sdk'); +const { sumTokens2 } = require('../helper/unwrapLPs'); + +async function sumLPBalances(api, gauges, sickles, lpTokens) { + api.log(api.chain, sickles.length, gauges.length,) + lpTokens.forEach((lpToken, index) => lpTokens[index] = lpToken.toLowerCase()) + let minLPValue = 4e3 + if (lpTokens.length > 200) minLPValue = 15e3 + if (lpTokens.length > 400) minLPValue = 25e3 + + const filteredLPSet = new Set(await filteredLPTokens({ api, lpTokens, minLPValue, })) + + const gaugeTokenMapping = {}; + const tokens = [] + lpTokens.forEach((lpToken, index) => { + if (!filteredLPSet.has(lpToken)) return; + + const gauge = gauges[index].toLowerCase() + tokens.push(gauge) + gaugeTokenMapping[gauge] = lpToken + }); + + const transformAddress = (token) => { + token = token.toLowerCase() + return `${api.chain}:${gaugeTokenMapping[token] ?? token}` + } + await sumTokens2({ api, transformAddress, tokens, owners: sickles }) +} + +// we are going to filter out tokens that we dont have price in the server and LP tokens with less than 1k value in it +async function filteredLPTokens({ api, lpTokens, minLPValue = 10e3 }) { + const token0s = await api.multiCall({ abi: 'address:token0', calls: lpTokens, permitFailure: true, }) + const token1s = await api.multiCall({ abi: 'address:token1', calls: lpTokens, permitFailure: true, }) + const reserves = await api.multiCall({ abi: 'function getReserves() view returns (uint256 bal0, uint256 bal1, uint256 block)', calls: lpTokens, permitFailure: true, }) + const allTokens = [lpTokens, token0s, token1s,].flat().filter(i => i).map(i => i.toLowerCase()) + const dummyBals = {} + allTokens.forEach(i => dummyBals[api.chain + ':' + i] = 1e20) // hack to cache token prices to memory + await Balances.getUSDValue(dummyBals) + + const filteredLPTokens = [] + for (let i = 0; i < lpTokens.length; i++) { + const tokenBalance = new Balances({ chain: api.chain, }) + tokenBalance.add(lpTokens[i], 1e20) + const tokenValue = await tokenBalance.getUSDValue() + if (tokenValue > 0) { + filteredLPTokens.push(lpTokens[i]) + continue; + } + + if (!reserves[i]) { + continue; + } + + + const lpBalance = new Balances({ chain: api.chain, }) + lpBalance.add(token0s[i], reserves[i].bal0) + lpBalance.add(token1s[i], reserves[i].bal1) + const lpValue = await lpBalance.getUSDValue() + if (lpValue < minLPValue) { // LP has less than 2k value, we ignore it + continue; + } + filteredLPTokens.push(lpTokens[i]) + } + + api.log(api.chain, 'filteredLPTokens', filteredLPTokens.length, 'out of', lpTokens.length, 'LP tokens are filtered out.') + return filteredLPTokens +} + + +module.exports = { + sumLPBalances, +} \ No newline at end of file From 0ca8e247f08b3566790ad8eff57ce5de9758bd75 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 8 Jul 2024 15:30:24 +0300 Subject: [PATCH 635/855] Napier-2 (#10923) * fix(napier): Fix event sig and fetch TVL on pools * reset cache --------- Co-authored-by: onibakuchi --- projects/napier/index.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/projects/napier/index.js b/projects/napier/index.js index 88fbdc781db4..af81a748b58f 100644 --- a/projects/napier/index.js +++ b/projects/napier/index.js @@ -6,7 +6,7 @@ const config = { ethereum: { pool_factory: { address: "0x17354e8e7518599c7f6B7095a6706766e4e4dC61", - deployedAt: 20017932, + deployedAt: 20212038, }, tranche_factory: { address: "0x83CE9e95118b48DfED91632e1bB848f1D4ee12e3", @@ -34,7 +34,7 @@ Object.keys(config).map((network) => { const poolDeployedLogs = pool_factory.address ? await getLogs({ api, target: pool_factory.address, - eventAbi: "event Deployed(uint256 indexed basePool, address indexed underlying, address indexed pool)", + eventAbi: "event Deployed(address indexed basePool, address indexed underlying, address indexed pool)", onlyArgs: true, fromBlock: pool_factory.deployedAt, }) : []; @@ -48,10 +48,9 @@ Object.keys(config).map((network) => { }); const adapters = results.map((r) => r.adapter); const underlyingTokens = results.map((r) => r.underlying); - const adapterBalances = await api.multiCall({ abi: 'uint256:totalAssets', calls: adapters}) + const adapterBalances = await api.multiCall({ abi: 'uint256:totalAssets', calls: adapters }) api.add(underlyingTokens, adapterBalances) - console.log({ pools, adapters, tranches}) - return api.erc4626Sum({ calls: pools, tokensAbi: 'underlying', balanceAbi: 'totalUnderlying'}) + return api.erc4626Sum({ calls: pools, tokenAbi: 'underlying', balanceAbi: 'totalUnderlying' }) }, }; }); From 7b5515d101bf8e3f408dd1d17ed9e8f9a7372a08 Mon Sep 17 00:00:00 2001 From: LeviathanYou <168118002+LeviathanYou@users.noreply.github.com> Date: Mon, 8 Jul 2024 21:06:07 +0800 Subject: [PATCH 636/855] feat: update tvl for free protocol (#10924) --- projects/free-protocol/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/free-protocol/index.js b/projects/free-protocol/index.js index 7ce2b8688dd4..7a71b7d233e8 100644 --- a/projects/free-protocol/index.js +++ b/projects/free-protocol/index.js @@ -59,6 +59,7 @@ module.exports = { bsc: { tvl: sumTokensExport({ owners: [ + '0x40a25786937eCc0643e78ca40Df02Db4dff27bb0', '0xF8aeD4da2598d3dF878488F40D982d6EcC8B13Ad', '0xBA43F3C8733b0515B5C23DFF46F47Af6EB46F85C', '0x0A80028d73Faaee6e57484E3335BeFda0de7f455', From 673a22599836be2dcfac9a525549b75d5a57aae3 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Mon, 8 Jul 2024 14:40:08 +0100 Subject: [PATCH 637/855] move-collateral-bsquared (#10925) --- projects/bsquared/index.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/projects/bsquared/index.js b/projects/bsquared/index.js index 9ef51a592544..9cb2cef416a2 100644 --- a/projects/bsquared/index.js +++ b/projects/bsquared/index.js @@ -4,12 +4,18 @@ const { sumTokensExport } = require('../helper/sumTokens'); const ADDRESSES = require('../helper/coreAssets.json') const BTCOwners = [ + // pre deposited wallets //Bitcoin Multisig Addresses "bc1q4fsk5pgnmnu7ngp79xclsw2t0yk46sjqw22ffz", - "bc1qva5m5e7da2zm590z03tdnj42u9q2uye3hgrehwrzgg8j4kxq9seq9rvw0m", - "bc1qjv2lfrv672rqagycs5zdsggmury0cz2vufek46jj86ddqynyp2qsxm3qfs", + "bc1qva5m5e7da2zm590z03tdnj42u9q2uye3hgrehwrzgg8j4kxq9seq9rvw0m", //Bitcoin Multisig Addresses + "bc1qjv2lfrv672rqagycs5zdsggmury0cz2vufek46jj86ddqynyp2qsxm3qfs", //Bitcoin Multisig Addresses + //Bitcoin Custodian Addresses + "131fpYjELat58RVzPp2A9Bo8oNuKiP4vxg", + "bc1qr4cpjazz6hhjh44yrshqw4xs4e3eld60wnsq2m", + "14UwPgMLZY6rLZRDxxvmNWQ9rMkg2iraHG", + "bc1quetqhxs809mwgms0rhae4cw98chzqe0er8fryr", ]; const BRC20Owners = [ - "bc1q97ctqygjgj0ljxgge4q735ujxvlad8smass7f0axc6x3ggffr8xqwn69hc", + "bc1q97ctqygjgj0ljxgge4q735ujxvlad8smass7f0axc6x3ggffr8xqwn69hc", //Bitcoin Multisig Addresses ]; const ADDRESSES_ETHEREUM_STONE = '0x7122985656e38BDC0302Db86685bb972b145bD3C'; @@ -28,7 +34,7 @@ module.exports = { ethereum: { tvl: sumTokensExport({ ownerTokens: [ - [[ADDRESSES_ETHEREUM_STONE, ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.WBTC], "0xeea3A032f381AB1E415e82Fe08ebeb20F513c42c",], + [[ADDRESSES_ETHEREUM_STONE, ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.WBTC], "0xeea3A032f381AB1E415e82Fe08ebeb20F513c42c",], //Ethereum Multisignature Address (WBTC) ] }), }, @@ -42,7 +48,7 @@ module.exports = { bsc: { tvl: sumTokensExport({ ownerTokens: [ - [[ADDRESSES.bsc.BTCB, ADDRESSES.ethereum.FDUSD], "0x0A80028d73Faaee6e57484E3335BeFda0de7f455",], + [[ADDRESSES.bsc.BTCB, ADDRESSES.ethereum.FDUSD], "0x0A80028d73Faaee6e57484E3335BeFda0de7f455",], //BNB Chain Multisig Address (BTCB) ] }), }, From 16552029cc447a5939f1c8d1b42543245ea8f874 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 8 Jul 2024 16:57:00 +0300 Subject: [PATCH 638/855] stip: include oracle tvl --- projects/stipflip/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/stipflip/index.js b/projects/stipflip/index.js index 8fab0c6fcdf9..8883dd0ef628 100644 --- a/projects/stipflip/index.js +++ b/projects/stipflip/index.js @@ -1,6 +1,7 @@ const { getLogs2 } = require('../helper/cache/getLogs') const ADDRESSES = require('../helper/coreAssets.json') const { uniV3Export } = require('../helper/uniswapV3') +const ORACLE = "0x4AC635E92801e657F44BDEfcc7660Ea1431DF846"; async function tvl(api) { const logs = await getLogs2({ @@ -10,7 +11,7 @@ async function tvl(api) { fromBlock: 20172088, }) const synths = logs.map(log => log.synth) - await api.sumTokens({ owners: synths, tokens: [ADDRESSES.null] }) + await api.sumTokens({ owners: [...synths, ORACLE], tokens: [ADDRESSES.null, ADDRESSES.ethereumclassic.WETC] }) const uniTvl = uniV3Export({ ethereumclassic: { blacklistedTokens: synths.concat(['0xf09ace63aa1345882a1ca200b7243f5786eb177b']), factory: '0xaCc703c9C8248a141113C672ea71d196E8118210', fromBlock: 20130563, } }).ethereumclassic.tvl From c26d5dc4a172bfaad25cc120de1aa45dd810a8e3 Mon Sep 17 00:00:00 2001 From: 0xmDreamy <124707942+0xmDreamy@users.noreply.github.com> Date: Mon, 8 Jul 2024 16:00:01 +0200 Subject: [PATCH 639/855] feat(mimswap): Add support for Kava (#10892) --- projects/mimswap/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/mimswap/index.js b/projects/mimswap/index.js index fd60862869b3..2a11adf308f2 100644 --- a/projects/mimswap/index.js +++ b/projects/mimswap/index.js @@ -3,6 +3,7 @@ const { getLogs2 } = require('../helper/cache/getLogs') const config = { arbitrum: { factory: '0x8D0Cd3eEf1794F59F2B3a664Ef07fCAD401FEc73', fromBlock: 205217727 }, blast: { factory: '0x7E05363E225c1c8096b1cd233B59457104B84908', fromBlock: 1067907 }, + kava: { factory: '0x7Ad0e580d8458BbeF71EC6A1755c59651E1EAaa7', fromBlock: 10023543 }, } Object.keys(config).forEach(chain => { From ff8ede3bd532b6e2e3c68b12732eff490de778d8 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Mon, 8 Jul 2024 15:18:32 +0100 Subject: [PATCH 640/855] add bingx cex adapter (#10926) --- projects/bing-cex/index.js | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 projects/bing-cex/index.js diff --git a/projects/bing-cex/index.js b/projects/bing-cex/index.js new file mode 100644 index 000000000000..103fb69b2ef0 --- /dev/null +++ b/projects/bing-cex/index.js @@ -0,0 +1,44 @@ +const { cexExports } = require('../helper/cex') + +const config = { + bitcoin: { + owners: [ + 'bc1qr8e6kmev99jxnk7hpyhex434t59ke5tpvmnyd3', + 'bc1qzzn5tszxn3ha87xfke540k8pr4favsk9cusakq' + ] + }, + arbitrum: { + owners: [ + '0xd3D3a295bE556Cf8cef2a7FF4cda23D22c4627E8', + ] + }, + bsc: { + owners: [ + '0xd3D3a295bE556Cf8cef2a7FF4cda23D22c4627E8', + ] + }, + ethereum: { + owners: [ + '0xd3D3a295bE556Cf8cef2a7FF4cda23D22c4627E8', + '0x909C1c195FC0a31758C7169B321B707C9F44886B', + '0xF7b7775f6D31eC2d14984f1cA3e736F5FB896DA2', + '0xAd8E5cEb7D77e10403Be8430717c515273c31b8d', + '0x74E7Fd0b532f88cf8cC50922F7a8f51e3F320Fa7', + '0xA1195F0d9B010F86633E1553F1286d74F80eF52B', + ] + }, + tron: { + owners: [ + 'TC8WxPjG7VDdeCK2FriRZwiPTFBayS9PHy', + 'TB1xcvdYDgWwqzCvVJV6mKxSdjjq8pvwRn', + 'TSCC14Y9nxdL4kLfbqwaUw2rX32n1sUpzB' + ] + }, + ripple: { + owners: [ + 'rsbENGVE1pXuM6AQT3VQweLhYdsxR6ZESj' + ] + }, +} + +module.exports = cexExports(config) \ No newline at end of file From 2e1bf087d65bc57b1632b44e2dbfc42fedf72b30 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 8 Jul 2024 19:24:29 +0300 Subject: [PATCH 641/855] update limitless --- projects/devil-finance/index.js | 1 + projects/limitless/index.js | 147 +++++++++++++++++++++++++------- 2 files changed, 118 insertions(+), 30 deletions(-) diff --git a/projects/devil-finance/index.js b/projects/devil-finance/index.js index 627b6ae59247..e21ba8637d71 100644 --- a/projects/devil-finance/index.js +++ b/projects/devil-finance/index.js @@ -16,6 +16,7 @@ module.exports = { pool2: tvl("nativeLP"), staking: tvl("native"), }, + deadFrom: '2023-01-01', }; module.exports.fantom = { tvl: () => 0} \ No newline at end of file diff --git a/projects/limitless/index.js b/projects/limitless/index.js index e0869719352d..5c9946464eac 100644 --- a/projects/limitless/index.js +++ b/projects/limitless/index.js @@ -1,13 +1,41 @@ const { nullAddress, addUniV3LikePosition } = require("../helper/unwrapLPs") +const { graphFetchById } = require('../helper/cache') +const { getUniqueAddresses } = require("../helper/utils") +const sdk = require('@defillama/sdk') const config = { - base: { postionManager: '0x3eF54A2Cf152f6E06C0928722412883D448F92eC', factory: '0x33128a8fC17869897dcE68Ed026d694621f6FDfD', limWETH: '0x845d629D2485555514B93F05Bdbe344cC2e4b0ce', marginContract: '0x536801AaE40cb214c08f178c6727d7594a7c655b', }, + base: { postionManager: '0x3eF54A2Cf152f6E06C0928722412883D448F92eC', factory: '0x33128a8fC17869897dcE68Ed026d694621f6FDfD', limWETH: '0x845d629D2485555514B93F05Bdbe344cC2e4b0ce', marginContract: '0x536801AaE40cb214c08f178c6727d7594a7c655b', graphEndpoint: 'https://api.studio.thegraph.com/query/71042/limitless-subgraph-base/version/latest', dataProvider: '0x87E697c3EBe41eD707E4AD52541f19292Be81177', lmQuoter: '0xED14586763578147136e55D20a0Ee884Cd8fBC6d', }, arbitrum: { postionManager: '0x6D73fc6F4C299E369377C0e60CebFef2409f86A0', factory: '0x1F98431c8aD98523631AE4a59f267346ea31F984', limWETH: '0xdEe4326E0a8B5eF94E50a457F7c70d4821be9f4C', }, linea: { postionManager: '0x726e3116AE07f43A7E1921c635352B75e2DEa4Ad', factory: '0x31FAfd4889FA1269F7a13A66eE0fB458f27D72A9', limWETH: '0x5188b47Cb80D1A3E22Cc6221792F199f1Fb0DD3c', }, } +const liquidityProvidedQuery = ` +query { + liquidityProvideds(first:1000 orderBy: blockTimestamp orderDirection: desc) { + pool + recipient + liquidity + tickLower + tickUpper + blockTimestamp + } +} +` + +const liquidityWithdrawnQuery = ` +query { + liquidityWithdrawns(first:1000 orderBy: blockTimestamp orderDirection: desc) { + pool + recipient + liquidity + tickLower + tickUpper + blockTimestamp + } +} +` Object.keys(config).forEach(chain => { - const { postionManager, factory, limWETH, marginContract } = config[chain] + const { postionManager, factory, limWETH, marginContract, graphEndpoint, dataProvider, lmQuoter, } = config[chain] module.exports[chain] = { tvl: async (api) => { @@ -18,43 +46,102 @@ Object.keys(config).forEach(chain => { const allTokens = [] const getKey = (token0, token1, fee) => `${token0}-${token1}-${fee}` - const tokenIds = await api.fetchList({ lengthAbi: 'totalSupply', itemAbi: abi.tokenByIndex, target: postionManager }) - const positionData = await api.multiCall({ calls: tokenIds, abi: abi.positions, target: postionManager }) - const poolData = {} - positionData.forEach(({ token0, token1, tokensOwed0, tokensOwed1, fee, liquidity }) => { - if (liquidity === 0) return; - if (token0 === nullAddress && token1 === nullAddress) return; - poolData[getKey(token0, token1, fee)] = { call: { params: [token0, token1, fee] } } - if (marginContract) { - allTokens.push(token0) - allTokens.push(token1) - } - api.add(token0, tokensOwed0) - api.add(token1, tokensOwed1) - }) - - // fetch tick info from uni v3 pools - const calls = Object.values(poolData).map(i => i.call) - const pools = await api.multiCall({ abi: abi.getPool, calls, target: factory }) - const ticks = await api.multiCall({ abi: abi.slot0, calls: pools, permitFailure: true }) - Object.values(poolData).forEach((data, i) => data.tick = ticks[i]?.tick) - - positionData.forEach(({ token0, token1, tickUpper, tickLower, fee, liquidity }) => { - if (+liquidity === 0) return; - const tick = poolData[getKey(token0, token1, fee)]?.tick - if (!tick) console.log({ token0, token1, fee, tickUpper, tickLower, liquidity }) - if (!tick) return; // pool not found - addUniV3LikePosition({ api, token0, token1, tick, liquidity, tickUpper, tickLower, }) - }) + if (!graphEndpoint) { + const tokenIds = await api.fetchList({ lengthAbi: 'totalSupply', itemAbi: abi.tokenByIndex, target: postionManager }) + const positionData = await api.multiCall({ calls: tokenIds, abi: abi.positions, target: postionManager }) + const poolData = {} + positionData.forEach(({ token0, token1, tokensOwed0, tokensOwed1, fee, liquidity }) => { + if (liquidity === 0) return; + if (token0 === nullAddress && token1 === nullAddress) return; + poolData[getKey(token0, token1, fee)] = { call: { params: [token0, token1, fee] } } + if (marginContract) { + allTokens.push(token0) + allTokens.push(token1) + } + api.add(token0, tokensOwed0) + api.add(token1, tokensOwed1) + }) + + // fetch tick info from uni v3 pools + const calls = Object.values(poolData).map(i => i.call) + const pools = await api.multiCall({ abi: abi.getPool, calls, target: factory }) + const ticks = await api.multiCall({ abi: abi.slot0, calls: pools, permitFailure: true }) + Object.values(poolData).forEach((data, i) => data.tick = ticks[i]?.tick) + + positionData.forEach(({ token0, token1, tickUpper, tickLower, fee, liquidity }) => { + if (+liquidity === 0) return; + const tick = poolData[getKey(token0, token1, fee)]?.tick + if (!tick) console.log({ token0, token1, fee, tickUpper, tickLower, liquidity }) + if (!tick) return; // pool not found + addUniV3LikePosition({ api, token0, token1, tick, liquidity, tickUpper, tickLower, }) + }) + + } else { + + const provided = await graphFetchById({ + endpoint: graphEndpoint, + query: liquidityProvidedQuery, + api, + options: { + useBlock: true, + safeBlockLimit: 500, + } + }) + const withdrawn = await graphFetchById({ + endpoint: graphEndpoint, + query: liquidityWithdrawnQuery, + api, + options: { + useBlock: true, + safeBlockLimit: 500, + } + }) + + console.log(provided.length, withdrawn.length) + const pools = getUniqueAddresses(provided.map(entry => entry.pool).concat(withdrawn.map(entry => entry.pool))) + const token0s = await api.multiCall({ abi: 'address:token0', calls: pools}) + const token1s = await api.multiCall({ abi: 'address:token1', calls: pools}) + + const ticks = await api.multiCall({ abi: abi.slot0, calls: pools, permitFailure: true }) + + const poolMap = {} + pools.forEach((pool, index) => { + allTokens.push(token0s[index]) + allTokens.push(token1s[index]) + poolMap[pool] = { + token0: token0s[index], + token1: token1s[index], + tick: ticks[index].tick + } + }) + + const withdrawnBalancesApi = new sdk.ChainApi({ chain: api.chain}) + + provided.forEach(({ pool, tickLower, tickUpper, liquidity }) => { + const { token0, token1, tick } = poolMap[pool.toLowerCase()] + addUniV3LikePosition({ api, token0, token1, tick, liquidity, tickUpper, tickLower, }) + }) + withdrawn.forEach(({ pool, tickLower, tickUpper, liquidity }) => { + const { token0, token1, tick } = poolMap[pool.toLowerCase()] + addUniV3LikePosition({ api: withdrawnBalancesApi, token0, token1, tick, liquidity, tickUpper, tickLower, }) + }) + + const balances = api.getBalancesV2() + const withdrawnBalances = withdrawnBalancesApi.getBalancesV2() + balances.subtract(withdrawnBalances) + } if (marginContract) return api.sumTokens({ tokens: allTokens, owner: marginContract }) } } }) + const abi = { "tokenByIndex": "function tokenByIndex(uint256 index) view returns (uint256)", "positions": "function positions(uint256 tokenId) view returns (address owner, address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)", "totalSupply": "uint256:totalSupply", "getPool": "function getPool(address, address, uint24) view returns (address)", "slot0": "function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)", + "getPoolData": "function getPoolkeys(address pool) view returns (address token0, address token1, uint24 fee)", + "getPoolKeys": "function getPoolKeys() view returns (tuple(address, address, string, string, uint24, string, string, uint8, uint8, int24)[])", } \ No newline at end of file From 669c932272f94e13e18a378bda650daaafd40db0 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 8 Jul 2024 19:25:42 +0300 Subject: [PATCH 642/855] minor fix --- projects/limitless/index.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/projects/limitless/index.js b/projects/limitless/index.js index 5c9946464eac..6eb7584beb92 100644 --- a/projects/limitless/index.js +++ b/projects/limitless/index.js @@ -35,7 +35,7 @@ query { ` Object.keys(config).forEach(chain => { - const { postionManager, factory, limWETH, marginContract, graphEndpoint, dataProvider, lmQuoter, } = config[chain] + const { postionManager, factory, limWETH, marginContract, graphEndpoint, } = config[chain] module.exports[chain] = { tvl: async (api) => { @@ -142,6 +142,4 @@ const abi = { "totalSupply": "uint256:totalSupply", "getPool": "function getPool(address, address, uint24) view returns (address)", "slot0": "function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)", - "getPoolData": "function getPoolkeys(address pool) view returns (address token0, address token1, uint24 fee)", - "getPoolKeys": "function getPoolKeys() view returns (tuple(address, address, string, string, uint24, string, string, uint8, uint8, int24)[])", } \ No newline at end of file From 45ad018896f74aefac10c8f8cb028968502473ff Mon Sep 17 00:00:00 2001 From: MishaShWoof Date: Mon, 8 Jul 2024 19:32:56 +0300 Subject: [PATCH 643/855] feat: add mainnet cUSDTv3 (#10928) --- projects/compound-v3/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/compound-v3/index.js b/projects/compound-v3/index.js index 834ad6a39382..dbaae8937bfa 100644 --- a/projects/compound-v3/index.js +++ b/projects/compound-v3/index.js @@ -5,6 +5,7 @@ module.exports = compoundV3Exports({ markets: [ '0xc3d688B66703497DAA19211EEdff47f25384cdc3', // USDC Market '0xa17581a9e3356d9a858b789d68b4d866e593ae94', // ETH Market + '0x3Afdc9BCA9213A35503b077a6072F3D0d5AB0840', // USDT Market ], }, arbitrum: { From 9a14db82638b9f9e86510e973d11722a465f953b Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Mon, 8 Jul 2024 18:33:25 +0200 Subject: [PATCH 644/855] feat: fix, solidly v3 on base -> add permitFailure (#10927) Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> --- projects/solidly-v3/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/solidly-v3/index.js b/projects/solidly-v3/index.js index e496cca3105d..24181e4bee60 100644 --- a/projects/solidly-v3/index.js +++ b/projects/solidly-v3/index.js @@ -4,7 +4,7 @@ const { uniV3Export } = require("../helper/uniswapV3"); module.exports = uniV3Export({ ethereum: { factory: "0x70fe4a44ea505cfa3a57b95cf2862d4fd5f0f687", fromBlock: 18044650, }, optimism: { factory: "0x70fe4a44ea505cfa3a57b95cf2862d4fd5f0f687", fromBlock: 115235065, }, - base: { factory: "0x70fe4a44ea505cfa3a57b95cf2862d4fd5f0f687", fromBlock: 9672720, }, + base: { factory: "0x70fe4a44ea505cfa3a57b95cf2862d4fd5f0f687", fromBlock: 9672720, permitFailure: true }, arbitrum: { factory: "0x70fe4a44ea505cfa3a57b95cf2862d4fd5f0f687", fromBlock: 173576189, permitFailure: true, }, fantom: { factory: "0x70fe4a44ea505cfa3a57b95cf2862d4fd5f0f687", fromBlock: 73057898, permitFailure: true, }, }); From 132f54926c769e2aa8c14c63a1a2cbcf1926ffdd Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Mon, 8 Jul 2024 21:14:54 +0200 Subject: [PATCH 645/855] fix:Bluberry (#10929) * fix:Bluberry * add check if multicall fail/returns null/undefined --------- Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> --- projects/blueberry/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/blueberry/index.js b/projects/blueberry/index.js index f0bc883cd0a3..535d5bad63b5 100644 --- a/projects/blueberry/index.js +++ b/projects/blueberry/index.js @@ -8,7 +8,8 @@ const sdk = require('@defillama/sdk'); const BANK = '0xa34F59F634d48E2c3606048f2367326c46a4B5fA'; async function tvl(timestamp, block, chainBlocks, {api}) { - const positionValues = await api.fetchList({ lengthAbi: abi.getNextPositionId, itemAbi: abi.getPositionValue, target: BANK}) + const positionValuesRes = await api.fetchList({ lengthAbi: abi.getNextPositionId, itemAbi: abi.getPositionValue, target: BANK, permitFailure: true}) + const positionValues = positionValuesRes.filter(value => value != null) api.addCGToken('tether', positionValues.reduce((acc, i) => acc + i/1e18, 0)) return api.getBalances() } From 413ee396cd7f212133930f27f71cd200bcb85281 Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Mon, 8 Jul 2024 21:26:21 +0200 Subject: [PATCH 646/855] fix ContraxFinance update (#10930) * fix ContraxFinance update * add check if multicall is returning null/undefined * only check on bals variable since other calls do not allow error --------- Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> --- projects/contrax-finance/index.js | 38 ++++++++++++++----------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/projects/contrax-finance/index.js b/projects/contrax-finance/index.js index 8590e085a6cb..4ad4b22c7cb4 100644 --- a/projects/contrax-finance/index.js +++ b/projects/contrax-finance/index.js @@ -34,20 +34,15 @@ const STEER_VAULTS = [ ]; async function getHopMagicData(api) { - const tokenAddress = await api.call({ - abi: "function token() view returns (address token)", - target: HOP_MAGIC_VAULT, - params: [], - }); - const balance = await api.call({ - abi: "uint256:balance", - target: HOP_MAGIC_VAULT, - }); + const [tokenAddress, balance] = await Promise.all([ + api.call({ abi: "function token() view returns (address token)", target: HOP_MAGIC_VAULT,params: [] }), + api.call({ abi: "uint256:balance", target: HOP_MAGIC_VAULT }) + ]) api.add(tokenAddress, balance); } async function getSteerData(api) { - let tokens = await api.multiCall({ abi: "address:token", calls: STEER_VAULTS }); + const tokens = await api.multiCall({ abi: "address:token", calls: STEER_VAULTS }); const [token0s, token1s, supplies, reserves, bals] = await Promise.all([ api.multiCall({ abi: "address:token0", calls: tokens }), api.multiCall({ abi: "address:token1", calls: tokens }), @@ -59,16 +54,19 @@ async function getSteerData(api) { api.multiCall({ abi: "uint256:balance", calls: STEER_VAULTS, + permitFailure: true }), ]); - bals.forEach((bal, i) => { + + for (const [i, bal] of bals.entries()) { + if (!bal) continue const ratio = bal / supplies[i]; const token0Bal = reserves[i][0] * ratio; const token1Bal = reserves[i][1] * ratio; api.addToken(token0s[i], token0Bal); api.addToken(token1s[i], token1Bal); - }); + } } async function getGMXData(api) { @@ -80,22 +78,20 @@ async function getGMXData(api) { } async function tvl(api) { - let tokens = await api.multiCall({ abi: "address:token", calls: Vaults }); - let bals = await api.multiCall({ - abi: "uint256:balance", - calls: Vaults, - }); + const [tokens, bals] = await Promise.all([ + api.multiCall({ abi: "address:token", calls: Vaults }), + api.multiCall({ abi: "uint256:balance", calls: Vaults }), + getHopMagicData(api), + getGMXData(api), + getSteerData(api) + ]) // const bals = await api.multiCall({ // abi: "erc20:balanceOf", // calls: tokens.map((t, i) => ({ target: targets[i], params: [t] })), // }); - await getHopMagicData(api); - await getGMXData(api); - await getSteerData(api); api.addTokens(tokens, bals); - return sumTokens2({ api, resolveLP: true }); } From 51b571e19747651f7cc44ccd7fba84095ae0a036 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 9 Jul 2024 03:23:50 +0100 Subject: [PATCH 647/855] add arbitrum --- projects/venus.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/venus.js b/projects/venus.js index d60ffe1c2dee..6f552d30a8cf 100644 --- a/projects/venus.js +++ b/projects/venus.js @@ -11,4 +11,5 @@ module.exports = fullCoumpoundExports("0xfd36e2c2a6789db23113685031d7f1632915838 }) module.exports.ethereum = compoundExports2({ comptroller: '0x67aA3eCc5831a65A5Ba7be76BED3B5dc7DB60796'}) -module.exports.op_bnb = compoundExports2({ comptroller: '0xd6e3e2a1d8d95cae355d15b3b9f8e5c2511874dd'}) \ No newline at end of file +module.exports.op_bnb = compoundExports2({ comptroller: '0xd6e3e2a1d8d95cae355d15b3b9f8e5c2511874dd'}) +module.exports.arbitrum = compoundExports2({ comptroller: '0x317c1A5739F39046E20b08ac9BeEa3f10fD43326'}) \ No newline at end of file From dceb496ae7fc9e377e214b27371d33dfec6a29bd Mon Sep 17 00:00:00 2001 From: Linuxods <154751538+Hedge001@users.noreply.github.com> Date: Tue, 9 Jul 2024 12:16:49 +0530 Subject: [PATCH 648/855] Add Landshare SDK adapter (#10931) * Add Landshare SDK adapter * code refactor --------- Co-authored-by: Ubuntu Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/landshare/index.js | 41 +++++++++---------------------------- 1 file changed, 10 insertions(+), 31 deletions(-) diff --git a/projects/landshare/index.js b/projects/landshare/index.js index a4a86020c323..9a34857342bc 100644 --- a/projects/landshare/index.js +++ b/projects/landshare/index.js @@ -1,34 +1,13 @@ - -const { toUSDTBalances } = require('../helper/balances'); -const { get } = require('../helper/http'); - -const LandshareApi = "https://api.landshare.io/api/properties"; - -async function landshareTVL() { - const rentals = await get(LandshareApi + "/rentals"); - const flips = await get(LandshareApi + "/flips"); - - const totalRentals = rentals.reduce((acc, item) => { - acc = acc + item.value - return acc; - }, 0); - - const totalFlips = flips.reduce((acc, item) => { - acc = acc + item; - return acc; - }, 0); - - const total = totalRentals + totalFlips; - - return toUSDTBalances(total); -} +const { pool2 } = require('../helper/pool2') +const { staking } = require('../helper/staking') +const LANDSHARE_TOKEN_CONTRACT = '0xA73164DB271931CF952cBaEfF9E8F5817b42fA5C' +const LANDSHARE_STAKING_CONTRACT = '0x3f9458892fB114328Bc675E11e71ff10C847F93b' +const LANDSHARE_LP_TOKEN_CONTRACT = '0x13f80c53b837622e899e1ac0021ed3d1775caefa' module.exports = { - timetravel: false, - misrepresentedTokens: true, bsc: { - tvl: landshareTVL, - } -}; - -// node test.js projects/landshare/index.js + tvl: () => ({}), + staking: staking(LANDSHARE_STAKING_CONTRACT, LANDSHARE_TOKEN_CONTRACT), + pool2: pool2(LANDSHARE_STAKING_CONTRACT, LANDSHARE_LP_TOKEN_CONTRACT), + }, +} \ No newline at end of file From cb37d6c9c36acf8e785ff3bb6d0377f7d16ae4c4 Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Tue, 9 Jul 2024 09:18:58 +0200 Subject: [PATCH 649/855] fix: Vela-Exchange new endpoints + small refacto (#10933) Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> --- projects/vela-exchange/index.js | 52 +++++++++++---------------------- 1 file changed, 17 insertions(+), 35 deletions(-) diff --git a/projects/vela-exchange/index.js b/projects/vela-exchange/index.js index e7652239c761..277265bb6ee5 100644 --- a/projects/vela-exchange/index.js +++ b/projects/vela-exchange/index.js @@ -5,54 +5,36 @@ const { graphQuery } = require('../helper/http') const VELA = '0x088cd8f5eF3652623c22D48b1605DCfE860Cd704' -const arbitrumEndpoint = sdk.graph.modifyEndpoint('6H9PEiNPZgwXfpbijjesZh96LFBzUvkHmEutMoYQ9fvp') -const baseEndpoint = sdk.graph.modifyEndpoint('2qsbZ4X5TJM7NupC2eRJv167kBDFCDBd37KnK7PQtdga') -async function staking_arbitrum_(api) { +const arbitrumEndpoint = sdk.graph.modifyEndpoint('8YXEzf1jmgVVt5d32fEo836bUzZKkCnYNcjAUXPEPhZQ') +const baseEndpoint = sdk.graph.modifyEndpoint('E2kcVHn6gD2nAs6Yf7a7REsYqBp8Pk3tnWhj8WvbVBhj') +async function velaStaking(api, endpoint) { const query = ` - query { - poolInfos(where: { - id: "all" - }) { - pid1 - pid2 - pid3 - } + query { + poolInfos(where: { + id: "all" + }) { + pid1 + pid2 + pid3 } - `; - const graphRes = (await graphQuery(arbitrumEndpoint, query)).poolInfos.find(x => true); - api.add(VELA, graphRes?.pid2) - api.add(VELA, graphRes?.pid3) -} - -async function staking_base_(api) { - - const query = ` - query { - poolInfos(where: { - id: "all" - }) { - pid1 - pid2 - pid3 - } - } - `; - const graphRes = (await graphQuery(baseEndpoint, query)).poolInfos.find(x => true); - api.add(VELA, graphRes?.pid2) - api.add(VELA, graphRes?.pid3) + } + `; + const graphRes = (await graphQuery(endpoint, query)).poolInfos.find(x => true); + api.add(VELA, graphRes?.pid2); + api.add(VELA, graphRes?.pid3); } module.exports = { methodology: "Counts USDC deposited to trade and to mint VLP. Staking counts VELA and esVELA deposited to earn esVELA", arbitrum: { tvl: staking('0xC4ABADE3a15064F9E3596943c699032748b13352', [ADDRESSES.arbitrum.USDC_CIRCLE, ADDRESSES.arbitrum.USDC]), - staking: staking_arbitrum_ + staking: async (api) => velaStaking(api,arbitrumEndpoint) }, base: { start: 3566528, tvl: staking("0xC4ABADE3a15064F9E3596943c699032748b13352", ADDRESSES.base.USDbC), - staking: staking_base_ + staking: async (api) => velaStaking(api,baseEndpoint) }, hallmarks: [ [Math.floor(new Date('2023-04-13') / 1e3), 'Refunded tokens to VLP holders & traders'], From d6007fa6d1b1a80144c5261d648fec921db0f1af Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 9 Jul 2024 10:44:25 +0300 Subject: [PATCH 650/855] synfutures: track base --- projects/synfutures-v3/index.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/projects/synfutures-v3/index.js b/projects/synfutures-v3/index.js index 8137beac85a8..ce88eaf6cd1d 100644 --- a/projects/synfutures-v3/index.js +++ b/projects/synfutures-v3/index.js @@ -1,29 +1,26 @@ -const { sumTokensExport } = require('../helper/unwrapLPs') -const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/unwrapLPs') -const { getLogs, getAddress } = require('../helper/cache/getLogs'); -const { ethers } = require('ethers'); - +const { getLogs2, } = require('../helper/cache/getLogs') const config = { - blast: { gate: '0x6A372dBc1968f4a07cf2ce352f410962A972c257', tokens: [ADDRESSES.blast.USDB, ADDRESSES.blast.WETH], fromBlock: 193856 }, + blast: { gate: '0x6A372dBc1968f4a07cf2ce352f410962A972c257', fromBlock: 193856 }, + base: { gate: '0x208B443983D8BcC8578e9D86Db23FbA547071270', fromBlock: 16297319 }, } Object.keys(config).forEach(chain => { - const { gate, tokens, fromBlock } = config[chain] + const { gate, fromBlock } = config[chain] module.exports[chain] = { tvl: async (api) => { // calculate the balance of all instruments - const logs = await getLogs({ + const logs = await getLogs2({ api, target: gate, - topics: ['0x2f642d4751a7e76430c4c9b3abe8ab9fd9ed0daa08cae14b5594765049008e02'], fromBlock, eventAbi: 'event NewInstrument(bytes32 index, address instrument, address base, address quote, string symbol, uint total)', }) - const tokensAndOwners = logs.map(i => ([i.args.quote, i.args.instrument])) - tokens.forEach(token => tokensAndOwners.push([token, gate])) - return sumTokens2({ api, tokensAndOwners: tokensAndOwners }) + const ownerTokens = logs.map(i => ([[i.quote], i.instrument])) + const allTokens = logs.map(i => i.quote) + ownerTokens.push([allTokens, gate]) + return sumTokens2({ api, ownerTokens }) } } }) From 213708c6de6153cf58f3a3735f2bff1ce91866da Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 9 Jul 2024 11:08:06 +0300 Subject: [PATCH 651/855] fix napier --- projects/clearpool/index.js | 122 +++++++++++++++++------------------- projects/napier/index.js | 1 + 2 files changed, 59 insertions(+), 64 deletions(-) diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index 0fd614a23b10..8aa895451798 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -1,14 +1,15 @@ -const abi = require("./abi.json"); +const abi = require("./abi.json") -const { stakings } = require("../helper/staking"); -const { getLogs } = require("../helper/cache/getLogs"); +const { stakings } = require("../helper/staking") +const { getLogs } = require("../helper/cache/getLogs") +const { sumTokens2 } = require("../helper/unwrapLPs") -const singleStakingContracts = ["0x629E39da1Db5654fe59cAE31d48CAEBB8dC2A9c6"]; -const CPOOL = "0x66761fa41377003622aee3c7675fc7b5c1c2fac5"; +const singleStakingContracts = ["0x629E39da1Db5654fe59cAE31d48CAEBB8dC2A9c6"] +const CPOOL = "0x66761fa41377003622aee3c7675fc7b5c1c2fac5" module.exports = { methodology: "We count liquidity by Stables deposited on the pools contracts", -}; +} const CHAIN = { ARBITRUM: "arbitrum", @@ -20,7 +21,7 @@ const CHAIN = { FLARE: "flare", BASE: "base", MANTLE: "mantle", -}; +} const config = { [CHAIN.ETHEREUM]: { @@ -97,55 +98,47 @@ const config = { fromBlock: 23711495, }, }, -}; +} const getEventAndABI = (protocol) => { - let borrowFn = ""; - let abi = ""; + let borrowFn + let abi switch (protocol) { case "dynamic": - (abi = - "event PoolCreated(address indexed pool, address indexed owner, address indexed token)"), - (borrowFn = "uint256:borrows"); - break; + abi = "event PoolCreated(address indexed pool, address indexed owner, address indexed token)"; + borrowFn = "uint256:borrows"; break; case "vaults": - (abi = - "event PoolCreated(uint256 depositCap, uint256 repaymentFrequency, uint256 minimumNoticePeriod, uint256 minDeposit, uint256 lendAPR, address indexed asset, address indexed borrower, address pool, address bondNft, bool indexed kycRequired)"), - (borrowFn = "uint256:poolSize"); - break; + abi = "event PoolCreated(uint256 depositCap, uint256 repaymentFrequency, uint256 minimumNoticePeriod, uint256 minDeposit, uint256 lendAPR, address indexed asset, address indexed borrower, address pool, address bondNft, bool indexed kycRequired)"; + borrowFn = "uint256:poolSize"; break; case "treasury": - (abi = - "event PoolCreated(address asset, address treasuryYieldAddress, address manager, bool kycRequired)"), - (borrowFn = "uint256:cash"); - break; + abi = "event PoolCreated(address asset, address treasuryYieldAddress, address manager, bool kycRequired)"; + borrowFn = "uint256:cash"; break; case "prime": - abi = - "event PoolCreated(address pool, address indexed borrower, bool isBulletLoan, address indexed asset, uint256 size, uint256 rateMantissa, uint256 tenor, uint256 depositWindow, uint256 spreadRate, uint256 originationRate, uint256 incrementPerRoll, uint256 penaltyRatePerYear)"; - borrowFn = "uint256:currentSize"; - break; + abi = "event PoolCreated(address pool, address indexed borrower, bool isBulletLoan, address indexed asset, uint256 size, uint256 rateMantissa, uint256 tenor, uint256 depositWindow, uint256 spreadRate, uint256 originationRate, uint256 incrementPerRoll, uint256 penaltyRatePerYear)" + borrowFn = "uint256:currentSize"; break; } - return { borrowFn, abi }; -}; + return { borrowFn, abi } +} const prepareProtocolsPerChain = (chain) => { - let contracts = []; - const protocols = Object.keys(config[chain]); + let contracts = [] + const protocols = Object.keys(config[chain]) protocols.forEach((protocol) => { - const { fromBlock, factory } = config[chain][protocol]; - const { abi, borrowFn } = getEventAndABI(protocol); + const { fromBlock, factory } = config[chain][protocol] + const { abi, borrowFn } = getEventAndABI(protocol) contracts.push({ fromBlock, factory, abi, borrowFn, protocol, - }); - }); - return contracts; -}; + }) + }) + return contracts +} Object.keys(config).forEach((chain) => { - const dataPerChain = prepareProtocolsPerChain(chain); + const dataPerChain = prepareProtocolsPerChain(chain) const _getLogs = async (api, factory, fromBlock, abi, protocol) => { const logs = await getLogs({ api, @@ -153,20 +146,20 @@ Object.keys(config).forEach((chain) => { fromBlock, eventAbi: abi, onlyArgs: true, - }); + }) const pools = logs.map((log) => protocol == "treasury" ? log.treasuryYieldAddress : log.pool - ); + ) const tokens = logs.map((log) => protocol == "dynamic" ? log.token : log.asset - ); - return { pools, tokens }; - }; + ) + return { pools, tokens } + } const tvl = async (api) => { - let allTokens = []; - let allPools = []; + let allTokens = [] + let allPools = [] const promiseArray = dataPerChain.map( async ({ factory, fromBlock, abi, borrowFn, protocol }) => { @@ -176,20 +169,20 @@ Object.keys(config).forEach((chain) => { fromBlock, abi, protocol - ); - allTokens.push(...tokens); - allPools.push(...pools); + ) + allTokens.push(...tokens) + allPools.push(...pools) } - ); + ) - await Promise.all(promiseArray); + await Promise.all(promiseArray) - return api.sumTokens({ tokensAndOwners2: [allTokens, allPools] }); - }; + return sumTokens2({ api, tokensAndOwners2: [allTokens, allPools] }) + } const borrowed = async (api) => { - const balances = []; - const allTokens = []; + const balances = [] + const allTokens = [] const promiseArray = dataPerChain.map( async ({ factory, fromBlock, abi, borrowFn, protocol }) => { @@ -199,17 +192,18 @@ Object.keys(config).forEach((chain) => { fromBlock, abi, protocol - ); - const bals = await api.multiCall({ abi: borrowFn, calls: pools }); - balances.push(...bals); - allTokens.push(...tokens); + ) + const bals = await api.multiCall({ abi: borrowFn, calls: pools }) + balances.push(...bals) + allTokens.push(...tokens) } - ); - await Promise.all(promiseArray); + ) + await Promise.all(promiseArray) - return api.addTokens(allTokens, balances); - }; - module.exports[chain] = { tvl, borrowed }; -}); + api.addTokens(allTokens, balances) + return sumTokens2({ api }) + } + module.exports[chain] = { tvl, borrowed } +}) -module.exports.ethereum.staking = stakings(singleStakingContracts, CPOOL); +module.exports.ethereum.staking = stakings(singleStakingContracts, CPOOL) diff --git a/projects/napier/index.js b/projects/napier/index.js index af81a748b58f..ca2f1f0d2e15 100644 --- a/projects/napier/index.js +++ b/projects/napier/index.js @@ -26,6 +26,7 @@ Object.keys(config).map((network) => { "event TrancheDeployed(uint256 indexed maturity, address indexed principalToken, address indexed yieldToken)", onlyArgs: true, fromBlock: tranche_factory.deployedAt, + extraKey: 'fix-cache-issue' }) : []; const tranches = trancheDeployedLogs.map((event) => event.principalToken); From 5ee80638932ade26e119ae7045eecb383aa485b7 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Tue, 9 Jul 2024 14:30:04 +0100 Subject: [PATCH 652/855] add arbitrum --- projects/venus-isolated-pools/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/venus-isolated-pools/index.js b/projects/venus-isolated-pools/index.js index 4622bd4693b7..d4585e82f706 100644 --- a/projects/venus-isolated-pools/index.js +++ b/projects/venus-isolated-pools/index.js @@ -9,7 +9,11 @@ const config = { ethereum: { endpoint: sdk.graph.modifyEndpoint('Htf6Hh1qgkvxQxqbcv4Jp5AatsaiY5dNLVcySkpCaxQ8'), corePools: ['0x67aA3eCc5831a65A5Ba7be76BED3B5dc7DB60796'], - } + }, + /*arbitrum: { + endpoint: sdk.graph.modifyEndpoint('2zqpTYBL3X1E2eb129bKno1pJdx6xBawr8urp61w33Z8'), + corePools: ['0x317c1A5739F39046E20b08ac9BeEa3f10fD43326'] + },*/ } Object.keys(config).forEach(chain => { From bba48e591c162d4b03d96646c5d39f4e9f87492b Mon Sep 17 00:00:00 2001 From: sofa-org <161308389+sofa-org@users.noreply.github.com> Date: Tue, 9 Jul 2024 23:35:15 +0800 Subject: [PATCH 653/855] add new vaults for sofa-org (#10934) --- projects/sofa-org/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/projects/sofa-org/index.js b/projects/sofa-org/index.js index 380b0d6d94be..14109d2f9dbe 100644 --- a/projects/sofa-org/index.js +++ b/projects/sofa-org/index.js @@ -13,7 +13,13 @@ const config = { "0x9C5D3C3AbD633b8eA68C5a51325f8630DC620AD9", "0x2F1C60bA96ec6925fA9bBbFC9Eb7908bD35Bc224", "0x72e0906558e4Ee528974cD7803bfF12d9f2869C3", - "0x9377f17ABde96887943e5Fcc92Db034c76820529" + "0x9377f17ABde96887943e5Fcc92Db034c76820529", + "0x6f4DBcfC81Dd22AE3EDeC5f9724E43cba8C92E50", + "0xA8fcc1BA1D4893a4894206986B65F652D5FE04AB", + "0xA76Ee91c6E51D248782d7C81826dF91522a6EF96", + "0x7E11ce3e893081B111b720dF29669dEf14e81cDE", + "0x8E882A56604F2b5735EA979bD6fa06C064d2f3f9", + "0xf7Be091BCBbB79f3D9029A25Dc94bC8FDd134EaC" ] }, ethereum: { @@ -45,4 +51,4 @@ Object.keys(config).forEach(chain => { return api.sumTokens({ tokensAndOwners2: [[tokens, tokens2, atokens].flat(), [vaults, aVaults, aVaults].flat()] }) } } -}) \ No newline at end of file +}) From 51bf900e1cd53c02902fac9d7e94446221e42630 Mon Sep 17 00:00:00 2001 From: TJ <58812386+TJ-2@users.noreply.github.com> Date: Tue, 9 Jul 2024 16:35:38 +0100 Subject: [PATCH 654/855] Add Meridian Trade: Meter Network (#10935) --- projects/meridian-trade/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/projects/meridian-trade/index.js b/projects/meridian-trade/index.js index f4c28ef79e8d..bc3b1d327421 100644 --- a/projects/meridian-trade/index.js +++ b/projects/meridian-trade/index.js @@ -1,9 +1,13 @@ const { gmxExports } = require('../helper/gmx') -const Vault = '0x853a8cE6B6338f5B0A14BCfc97F9D68396099C9C'; +const base_vault = '0x853a8cE6B6338f5B0A14BCfc97F9D68396099C9C'; +const meter_vault = '0x95cd3F1DE20A29B473FcC1773069316a424c746D'; module.exports = { base: { - tvl: gmxExports({ vault: Vault, blacklistedTokens: ['0x5e06ea564efcb3158a85dbf0b9e017cb003ff56f'] }) + tvl: gmxExports({ vault: base_vault, blacklistedTokens: ['0x5e06ea564efcb3158a85dbf0b9e017cb003ff56f'] }), }, + meter: { + tvl: gmxExports({ vault: meter_vault }) + } }; From fa92dbfa1f21a2e1c23ab5f4d607661129332c29 Mon Sep 17 00:00:00 2001 From: Yolley Date: Tue, 9 Jul 2024 17:36:32 +0200 Subject: [PATCH 655/855] Streamflow: add tvl for Sui (#10939) --- projects/streamflow/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/streamflow/index.js b/projects/streamflow/index.js index 0c829ce41adf..95425c75a325 100644 --- a/projects/streamflow/index.js +++ b/projects/streamflow/index.js @@ -10,6 +10,7 @@ const chains = [ "bsc", "polygon", "ethereum", + "sui", ]; const chainMapping = { bsc: 'bnb' From ed074830b58f72784ffcaa1c6c9abbcb60b5156b Mon Sep 17 00:00:00 2001 From: lsblk07 <154802093+lsblk07@users.noreply.github.com> Date: Tue, 9 Jul 2024 23:37:45 +0800 Subject: [PATCH 656/855] Blasterswap Vault tvl (#10943) * blasterswap-vaults-tvl * blasterswap-vaults-tvl * blasterswap vault tvl * import * token * network --------- Co-authored-by: lsblk07 --- projects/blasterswap-vaults/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/blasterswap-vaults/index.js diff --git a/projects/blasterswap-vaults/index.js b/projects/blasterswap-vaults/index.js new file mode 100644 index 000000000000..bc4663a084d0 --- /dev/null +++ b/projects/blasterswap-vaults/index.js @@ -0,0 +1,12 @@ +const stakingContract = '0x0464a36beCf9967111D2dCAb57CAf4a2376f6E3F' +const blast = '0xb1a5700fa2358173fe465e6ea4ff52e36e88e2ad' +const { staking } = require('../helper/staking') + + +module.exports = { + methodology: "BLAST can be staked in Blasterswap vault", + blast: { + tvl: () => ({}), + staking: staking(stakingContract, blast), + }, +} From e5d9432e4a60c2991e85c7048ecd9bfe8f7d2b78 Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Tue, 9 Jul 2024 18:46:01 +0200 Subject: [PATCH 657/855] feat:Adapter,Aurus (#10942) Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> --- projects/aurus/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 projects/aurus/index.js diff --git a/projects/aurus/index.js b/projects/aurus/index.js new file mode 100644 index 000000000000..e7094e6b1b56 --- /dev/null +++ b/projects/aurus/index.js @@ -0,0 +1,15 @@ +const ASSETS = [ + '0xe4a6f23fb9e00fca037aa0ea0a6954de0a6c53bf', // TXAU - gold + '0x34abce75d2f8f33940c721dca0f562617787bff3', // TXAG - silver + '0x19b22dbadc298c359a1d1b59e35f352a2b40e33c' // TXPT - platinum +] + +module.exports = { + methodology: "TVL corresponds to the total amount of Assets minted", + ethereum: { + tvl: async (api) => { + const totalSupplies = await api.multiCall({calls: ASSETS, abi: 'erc20:totalSupply'}) + api.add(ASSETS, totalSupplies) + } + } +} From 3c419f390e39f798ff361dda8998df852567fd05 Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Tue, 9 Jul 2024 18:48:47 +0200 Subject: [PATCH 658/855] feat:Adapter,Paxos-Gold (PAXG, ethereum) (#10940) Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> --- projects/paxos-gold/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/paxos-gold/index.js diff --git a/projects/paxos-gold/index.js b/projects/paxos-gold/index.js new file mode 100644 index 000000000000..ed819b2e470c --- /dev/null +++ b/projects/paxos-gold/index.js @@ -0,0 +1,11 @@ +const PAXG = '0x45804880de22913dafe09f4980848ece6ecbaf78' + +module.exports = { + methodology: "TVL corresponds to the total amount of PAXG minted", + ethereum: { + tvl: async (api) => { + const totalSupply = await api.call({target: PAXG, abi: 'erc20:totalSupply'}) + api.add(PAXG, totalSupply) + } + } +} From 94129b278bb1036005a34426ea08506824807634 Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Tue, 9 Jul 2024 18:49:01 +0200 Subject: [PATCH 659/855] feat:Adapter,Tether-gold (XAUt,Ethereum) (#10941) Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> --- projects/tether-gold/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/tether-gold/index.js diff --git a/projects/tether-gold/index.js b/projects/tether-gold/index.js new file mode 100644 index 000000000000..0a36aa839213 --- /dev/null +++ b/projects/tether-gold/index.js @@ -0,0 +1,11 @@ +const XAUt = '0x68749665ff8d2d112fa859aa293f07a622782f38' + +module.exports = { + methodology: "TVL corresponds to the total amount of XAUt minted", + ethereum: { + tvl: async (api) => { + const totalSupply = await api.call({target: XAUt, abi: 'erc20:totalSupply'}) + api.add(XAUt, totalSupply) + } + } +} From f69de8d72c9ceea81455783eb877d134db5a8eb5 Mon Sep 17 00:00:00 2001 From: "Kalax.io" <163113001+Kalaxio@users.noreply.github.com> Date: Wed, 10 Jul 2024 00:49:22 +0800 Subject: [PATCH 660/855] add new pools (#10938) --- projects/kalax/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/kalax/index.js b/projects/kalax/index.js index 971b519abef4..ed945f180c71 100644 --- a/projects/kalax/index.js +++ b/projects/kalax/index.js @@ -1,7 +1,7 @@ const { sumTokens2 } = require("../helper/unwrapLPs") const KALAX = "0x2F67F59b3629Bf24962290DB9edE0CD4127e606D" -const farms = ['0xE63153C3360aCa0F4e7Ca7A1FC61c2215FAEF5A1', '0xFe899401A1d86cC1113020fb40878c76239142a5'] +const farms = ['0xE63153C3360aCa0F4e7Ca7A1FC61c2215FAEF5A1', '0xFe899401A1d86cC1113020fb40878c76239142a5',"0x1CB8f6cecf7c8FBB9863417f8371Cb2A076C9115"] async function tvl(api) { let pools = (await api.multiCall({ abi: abiInfo.poolInfos, calls: farms })).flat() From 45b89d1c90cc16a0178a9b43a4e19da0239f9483 Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Tue, 9 Jul 2024 18:49:57 +0200 Subject: [PATCH 661/855] Fix: Swaap-v2 (#10936) * fix swaap-v2 (permitFailure on arbitrum Chain) * use permitFailure as optional option --------- Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> --- projects/helper/balancer.js | 4 ++-- projects/swaap-v2/index.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/projects/helper/balancer.js b/projects/helper/balancer.js index e8f6beeadef0..8ab6be241de3 100644 --- a/projects/helper/balancer.js +++ b/projects/helper/balancer.js @@ -1,7 +1,7 @@ const { sumTokens2 } = require('./unwrapLPs'); const { getLogs } = require('./cache/getLogs') -function onChainTvl(vault, fromBlock, { blacklistedTokens = [], preLogTokens = [], onlyUseExistingCache } = {}) { +function onChainTvl(vault, fromBlock, { blacklistedTokens = [], preLogTokens = [], onlyUseExistingCache, permitFailure } = {}) { return async (api) => { const logs = await getLogs({ api, @@ -29,7 +29,7 @@ function onChainTvl(vault, fromBlock, { blacklistedTokens = [], preLogTokens = [ const pools = logs.map(i => i.poolAddress) blacklistedTokens = [...blacklistedTokens, ...pools] - return sumTokens2({ api, owner: vault, tokens, blacklistedTokens, }) + return sumTokens2({ api, owner: vault, tokens, blacklistedTokens, permitFailure }) } } diff --git a/projects/swaap-v2/index.js b/projects/swaap-v2/index.js index 85b4c305395d..c2a7fecc9211 100644 --- a/projects/swaap-v2/index.js +++ b/projects/swaap-v2/index.js @@ -6,7 +6,7 @@ const {onChainTvl} = require("../helper/balancer"); */ const config = { ethereum: { vault: '0xd315a9c38ec871068fec378e4ce78af528c76293', fromBlock: 17598578, }, - arbitrum: { vault: '0xd315a9c38ec871068fec378e4ce78af528c76293', fromBlock: 137451745,}, + arbitrum: { vault: '0xd315a9c38ec871068fec378e4ce78af528c76293', fromBlock: 137451745, permitFailure: true }, polygon: { vault: '0xd315a9c38ec871068fec378e4ce78af528c76293', fromBlock: 44520023,}, optimism: { vault: '0xd315a9c38ec871068fec378e4ce78af528c76293', fromBlock: 120693792, }, bsc: { vault: '0x03c01acae3d0173a93d819efdc832c7c4f153b06', fromBlock: 39148730,}, @@ -22,8 +22,8 @@ const config = { Object.keys(config).forEach(chain => { - const { vault, fromBlock } = config[chain] + const { vault, fromBlock, permitFailure } = config[chain] module.exports[chain] = { - tvl: onChainTvl(vault, fromBlock) + tvl: onChainTvl(vault, fromBlock, { permitFailure }) } }) \ No newline at end of file From f5024a8530d1308a8a76ecb400ae11e442dc50f3 Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Wed, 10 Jul 2024 14:27:30 +0200 Subject: [PATCH 662/855] fix: Xave-Finance, add permitFailure when multicall is returning null + check if data null (#10949) Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> --- projects/xave-finance/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/xave-finance/index.js b/projects/xave-finance/index.js index 2e432364bc44..8daa2f6d9a9a 100644 --- a/projects/xave-finance/index.js +++ b/projects/xave-finance/index.js @@ -42,7 +42,8 @@ async function tvl(api) { const data = await api.multiCall({ abi: "function liquidity() view returns (uint256 total_, uint256[] memory individual_)", calls: pools.map((v) => ({ target: v })), - }); + permitFailure: true + }) // Curve.derivatives(0) const derivatives0 = await api.multiCall({ @@ -67,6 +68,8 @@ async function tvl(api) { }); data.forEach((d, i) => { + if (!d) return + const divisor0 = ethers.parseUnits( "1", parseInt(derivatives0Decimals[i]) From ba37b96ff27d1dc1cfa870886631a302fd0bdfdd Mon Sep 17 00:00:00 2001 From: Richard Nguyen Date: Wed, 10 Jul 2024 19:28:17 +0700 Subject: [PATCH 663/855] Update Minswap V2 TVL calculation (#10944) --- projects/minswap/index.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/projects/minswap/index.js b/projects/minswap/index.js index 9867ef3f774a..3c27ddf9dafb 100644 --- a/projects/minswap/index.js +++ b/projects/minswap/index.js @@ -1,12 +1,15 @@ const { getAdaInAddress, sumTokensExport, sumTokens2 } = require("../helper/chain/cardano"); -const POOL_SCRIPT_HASH = "script1uychk9f04tqngfhx4qlqdlug5ntzen3uzc62kzj7cyesjk0d9me" -const ORDER_SCRIPT_HASH = "script15ew2tzjwn364l2pszu7j5h9w63v2crrnl97m074w9elrkxhah0e" +const V1_POOL_SCRIPT_HASH = "script1uychk9f04tqngfhx4qlqdlug5ntzen3uzc62kzj7cyesjk0d9me" +const V1_ORDER_SCRIPT_HASH = "script15ew2tzjwn364l2pszu7j5h9w63v2crrnl97m074w9elrkxhah0e" + +const V2_POOL_SCRIPT_HASH = "script1agrmwv7exgffcdu27cn5xmnuhsh0p0ukuqpkhdgm800xksw7e2w" +const V2_ORDER_SCRIPT_HASH = "script1c03gcdkrg3e3twj62menmf4xmhqhwz58d2xe7r9n497yc6r9qhd" async function tvl() { // DEX V1 - const liquidityPoolLocked = await getAdaInAddress(POOL_SCRIPT_HASH) - const batchOrderLocked = await getAdaInAddress(ORDER_SCRIPT_HASH) + const v1LiquidityPoolLocked = await getAdaInAddress(V1_POOL_SCRIPT_HASH) + const v1BatchOrderLocked = await getAdaInAddress(V1_ORDER_SCRIPT_HASH) // Stable Pools const stablePoolsLiquidity = await sumTokens2({ @@ -24,8 +27,12 @@ async function tvl() { ], }) + // DEX V2 + const v2LiquidityPoolLocked = await getAdaInAddress(V2_POOL_SCRIPT_HASH) + const v2BatchOrderLocked = await getAdaInAddress(V2_ORDER_SCRIPT_HASH) + return { - cardano: (liquidityPoolLocked * 2) + batchOrderLocked, + cardano: ((v1LiquidityPoolLocked + v2LiquidityPoolLocked) * 2) + v1BatchOrderLocked + v2BatchOrderLocked, ...stablePoolsLiquidity }; } @@ -41,5 +48,7 @@ module.exports = { }, hallmarks:[ [1647949370, "Vulnerability Found"], + [1712565661, "Stableswap Launch"], + [1720584000, "V2 Launch"] ], }; From 1dade5a0ef9807ca086a821eee6ef5ac09c653c9 Mon Sep 17 00:00:00 2001 From: Brandon Date: Wed, 10 Jul 2024 05:29:09 -0700 Subject: [PATCH 664/855] Update Bump Subgraph Endpoints (#10945) * Add telos and xlayer * Add rootstock * change id to rsk * Bump Subgraph Endpoints --- projects/steer/index.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/projects/steer/index.js b/projects/steer/index.js index 753bca2cb0b1..0f1e897d6f0d 100644 --- a/projects/steer/index.js +++ b/projects/steer/index.js @@ -6,25 +6,25 @@ const { stakings } = require("../helper/staking"); const supportedChains = [ { name: 'Polygon', - subgraphEndpoint: sdk.graph.modifyEndpoint('uQxLz6EarmJcr2ymRRmTnrRPi8cCqas4XcPQb71HBvw'), + subgraphEndpoint: 'https://api.goldsky.com/api/public/project_clohj3ta78ok12nzs5m8yag0b/subgraphs/steer-protocol-polygon/1.1.1/gn', chainId: 137, identifier: 'polygon' }, { name: 'Arbitrum', - subgraphEndpoint: sdk.graph.modifyEndpoint('HVC4Br5yprs3iK6wF8YVJXy4QZWBNXTCFp8LPe3UpcD4'), + subgraphEndpoint: 'https://api.goldsky.com/api/public/project_clohj3ta78ok12nzs5m8yag0b/subgraphs/steer-protocol-arbitrum/1.1.0/gn', chainId: 42161, identifier: 'arbitrum' }, { name: 'Optimism', - subgraphEndpoint: sdk.graph.modifyEndpoint('GgW1EwNARL3dyo3acQ3VhraQQ66MHT7QnYuGcQc5geDG'), + subgraphEndpoint: 'https://subgraph-proxy-server-xf2uthetka-as.a.run.app/gateway-arbitrum/GgW1EwNARL3dyo3acQ3VhraQQ66MHT7QnYuGcQc5geDG', chainId: 10, identifier: 'optimism' }, { name: 'Binance', - subgraphEndpoint: sdk.graph.modifyEndpoint('GLDP56fPGDz3MtmhtfTkz5CxWiqiNLACVrsJ9RqQeL4U'), + subgraphEndpoint: 'https://subgraph-proxy-server-xf2uthetka-as.a.run.app/gateway-arbitrum/GLDP56fPGDz3MtmhtfTkz5CxWiqiNLACVrsJ9RqQeL4U', chainId: 56, identifier: 'bsc' }, @@ -36,7 +36,7 @@ const supportedChains = [ }, { name: 'Avalanche', - subgraphEndpoint: sdk.graph.modifyEndpoint('GZotTj3rQJ8ZqVyodtK8TcnKcUxMgeF7mCJHGPYbu8dA'), + subgraphEndpoint: 'https://subgraph-proxy-server-xf2uthetka-as.a.run.app/gateway-arbitrum/GZotTj3rQJ8ZqVyodtK8TcnKcUxMgeF7mCJHGPYbu8dA', chainId: 43114, identifier: 'avax' }, @@ -102,7 +102,7 @@ const supportedChains = [ }, { name: 'Fantom', - subgraphEndpoint: sdk.graph.modifyEndpoint('8k6x2Uho5PEqjxHx5SeSE334MEaxSZqMZhH6p5XYvqjM'), + subgraphEndpoint: 'https://subgraph-proxy-server-xf2uthetka-as.a.run.app/gateway-arbitrum/9uyX2WDuaxmcYh11ehUhU68M9uSCp5FXVQV2w4LqbpbV', chainId: 250, identifier: 'fantom' }, @@ -151,7 +151,7 @@ const supportedChains = [ // { // name: 'Celo', - // subgraphEndpoint: sdk.graph.modifyEndpoint('DDwt4z55qLHPNmasiQXFH3nRjgCBrBhsiz3uEqKRJoa'), + // subgraphEndpoint: 'https://subgraph-proxy-server-xf2uthetka-as.a.run.app/gateway-arbitrum/BPaFHyfVrhv3pdjGodpQcWggAg1Bcrvc9SFc2t2BXeho', // chainId: 42220, // identifier: 'celo' // }, @@ -188,7 +188,8 @@ module.exports.arbitrum.staking = stakings( "0x0b619438d1E8b8c205656502de59Af2Af71C43e0", "0xaCdC6fC8F84fbA26f065489a7bf5837D7CDf546F", "0xff46e1B60dD9De89Aa04902D5c3c5ca01f8576A4", - "0x1E6a358a1721e0D2B84f39FD328FC03A1b6e863B" + "0x1E6a358a1721e0D2B84f39FD328FC03A1b6e863B", + "0x3338B85fB1607C519962571B67061e02408475Bb" ], "0x1C43D05be7E5b54D506e3DdB6f0305e8A66CD04e", "arbitrum" From 767f3a308acae8b7d1199641ed661df1f665f9b0 Mon Sep 17 00:00:00 2001 From: void Date: Wed, 10 Jul 2024 20:30:39 +0800 Subject: [PATCH 665/855] update alien adapter (#10946) --- projects/alien-finance/index.js | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/projects/alien-finance/index.js b/projects/alien-finance/index.js index 1b189a2e47bf..ba6bff29a842 100644 --- a/projects/alien-finance/index.js +++ b/projects/alien-finance/index.js @@ -1,4 +1,6 @@ -const owner = "0x50454acC07bf8fC78100619a1b68e9E8d28cE022" +const DAPP_POOL = "0x50454acC07bf8fC78100619a1b68e9E8d28cE022" +const BLAST_POOL = "0x02B7BF59e034529d90e2ae8F8d1699376Dd05ade" +const BLAST_POOL_LAUNCH = 1719390003 module.exports = { blast: { @@ -8,11 +10,22 @@ module.exports = { }; async function tvl(api) { - const tokens = await api.call({ abi: 'address[]:getAllMarkets', target: owner}) - return api.sumTokens({ owner, tokens}) + const dappPoolTokens = await api.call({ abi: 'address[]:getAllMarkets', target: DAPP_POOL}); + const blastPoolTokens = api.timestamp > BLAST_POOL_LAUNCH ? await api.call({ abi: 'address[]:getAllMarkets', target: BLAST_POOL}) : []; + + return api.sumTokens({ tokensAndOwners: [ + ...dappPoolTokens.map(token => [token, DAPP_POOL]), + ...blastPoolTokens.map(token => [token, BLAST_POOL]), + ] }) } async function borrowed(api) { - const tokens = await api.call({ abi: 'address[]:getAllMarkets', target: owner}) - const bals = await api.multiCall({ abi: 'function getTotalBorrow(address) view returns (uint256)', calls: tokens, target: owner}) - api.add(tokens, bals) -} \ No newline at end of file + const dappPoolTokens = await api.call({ abi: 'address[]:getAllMarkets', target: DAPP_POOL}); + const dappPoolBorrow = await api.multiCall({ abi: 'function getTotalBorrow(address) view returns (uint256)', calls: dappPoolTokens, target: DAPP_POOL}) + api.add(dappPoolTokens, dappPoolBorrow) + + if (api.timestamp > BLAST_POOL_LAUNCH) { + const blastPoolTokens = await api.call({ abi: 'address[]:getAllMarkets', target: BLAST_POOL}); + const blastPoolBorrow = await api.multiCall({ abi: 'function getTotalBorrow(address) view returns (uint256)', calls: blastPoolTokens, target: BLAST_POOL}) + api.add(blastPoolTokens, blastPoolBorrow) + } +} From ec1b523d2854ca49b23c25ba652438b60ef30f0b Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Wed, 10 Jul 2024 14:35:17 +0200 Subject: [PATCH 666/855] Feat:Adapter, Vnx-rwa (#10948) * feat:Adapter, vnx-rwa * add mapping --------- Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> --- projects/vnx-rwa/index.js | 112 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 projects/vnx-rwa/index.js diff --git a/projects/vnx-rwa/index.js b/projects/vnx-rwa/index.js new file mode 100644 index 000000000000..11f015f84518 --- /dev/null +++ b/projects/vnx-rwa/index.js @@ -0,0 +1,112 @@ +const { getTokenSupply } = require("../helper/solana"); +const fetch = require('node-fetch'); + +const ASSETS = { + EVM: { + ethereum: [ + "0x6d57b2e05f26c26b549231c866bdd39779e4a488", // VNXAU + "0x6bA75D640bEbfe5dA1197bb5A2aff3327789b5d3", // VEUR + "0x79d4f0232A66c4c91b89c76362016A1707CFBF4f" // VCHF + ], + polygon: [ + "0xC8bB8eDa94931cA2F20EF43eA7dBD58E68400400", // VNXAU + "0xE4095d9372E68d108225c306A4491cacfB33B097", // VEUR + "0xCdB3867935247049e87c38eA270edD305D84c9AE" // VCHF + ], + avax: [ + "0x7678e162f38ec9ef2Bfd1d0aAF9fd93355E5Fa0b", // VEUR, + "0x228a48df6819CCc2eCa01e2192ebAFfFdAD56c19" // VCHF, + ], + q: [ + "0xe4fadbbf24f118b1e63d65f1aac2a825a07f7619", // VNXAU + "0x513f99dee650f529d7c65bb5679f092b64003520", // VEUR + "0x65b9d36281e97418793f3430793f88440dab68d7" // VCHF + ] + }, + nonEVM: { + solana: [ + "9TPL8droGJ7jThsq4momaoz6uhTcvX2SeMqipoPmNa8R",// VNXAU + "C4Kkr9NZU3VbyedcgutU6LKmi6MKz81sx6gRmk5pX519",// VNXAU + "AhhdRu5YZdjVkKR3wbnUDaymVQL2ucjMQ63sZ3LFHsch" // VCHF + ], + stellar: [ + "VNXAU-GCKIYYQVIFBIFDRN7BNDNHL3UZSFHT5NHDAISG2N3MWCZY3WNXL3LXN3", // VNXAU + "VEUR-GDXLSLCOPPHTWOQXLLKSVN4VN3G67WD2ENU7UMVAROEYVJLSPSEWXIZN", // VEUR + "VCHF-GDXLSLCOPPHTWOQXLLKSVN4VN3G67WD2ENU7UMVAROEYVJLSPSEWXIZN" // VCHF + ] + } +}; + +const MAPPINGS = { + stellar: { + 'VNXAU-GCKIYYQVIFBIFDRN7BNDNHL3UZSFHT5NHDAISG2N3MWCZY3WNXL3LXN3': '0x6d57b2e05f26c26b549231c866bdd39779e4a488', + 'VEUR-GDXLSLCOPPHTWOQXLLKSVN4VN3G67WD2ENU7UMVAROEYVJLSPSEWXIZN': '0x6bA75D640bEbfe5dA1197bb5A2aff3327789b5d3', + 'VCHF-GDXLSLCOPPHTWOQXLLKSVN4VN3G67WD2ENU7UMVAROEYVJLSPSEWXIZN': '0x79d4f0232A66c4c91b89c76362016A1707CFBF4f' + }, + q: { + '0xe4fadbbf24f118b1e63d65f1aac2a825a07f7619': '0x6d57b2e05f26c26b549231c866bdd39779e4a488', + '0x513f99dee650f529d7c65bb5679f092b64003520': '0x6bA75D640bEbfe5dA1197bb5A2aff3327789b5d3', + '0x65b9d36281e97418793f3430793f88440dab68d7': '0x79d4f0232A66c4c91b89c76362016A1707CFBF4f' + } +}; + +const fetchStellarSupply = async (asset) => { + const stellarApi = `https://api.stellar.expert/explorer/public/asset/${asset}`; + const response = await fetch(stellarApi); + const { supply } = await response.json(); + return supply / 1e7 * 1e18; // supply / stellar dec * eth dec +}; + +const solanaTvl = async (api, assets) => { + const supplies = await Promise.all(assets.map(getTokenSupply)); + const scaledSupplies = supplies.map((supply) => supply * 1e9); + api.add(assets, scaledSupplies); +}; + +const stellarTvl = async (api, assets) => { + const supplies = await Promise.all(assets.map(fetchStellarSupply)); + supplies.forEach((supply, index) => { + const ethereumAsset = MAPPINGS.stellar[assets[index]]; + api.add(ethereumAsset, supply, { skipChain: true }); + }); +}; + +const evmTvl = (chain, assets) => { + return async (api) => { + const totalSupplies = await api.multiCall({ calls: assets, abi: 'erc20:totalSupply' }); + if (chain === 'q') { + totalSupplies.forEach((supply, index) => { + const ethereumAsset = MAPPINGS.q[assets[index]]; + api.add(ethereumAsset, supply, { skipChain: true }); + }); + } else { + api.add(assets, totalSupplies); + } + }; +}; + +const nonEvmTvl = (chain, assets) => { + return async (api) => { + if (chain === "solana") { + await solanaTvl(api, assets); + } else if (chain === "stellar") { + await stellarTvl(api, assets); + } + }; +}; + +const getTvlFunction = (key, chain, assets) => { + if (key === 'EVM') { + return evmTvl(chain, assets); + } else if (key === 'nonEVM') { + return nonEvmTvl(chain, assets); + } +}; + +Object.entries(ASSETS).forEach(([key, chains]) => { + Object.entries(chains).forEach(([chain, assets]) => { + module.exports[chain] = { + tvl: getTvlFunction(key, chain, assets) + }; + }); +}); From da0325e9b260e0b75074c9c5c54b59d3cc5c0da3 Mon Sep 17 00:00:00 2001 From: Stone <125890624+Stonepapa@users.noreply.github.com> Date: Thu, 11 Jul 2024 13:47:57 +0800 Subject: [PATCH 667/855] buzz farming (#10937) * Create index.js buzz farming * Update index.js --- projects/buzz-farming/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 projects/buzz-farming/index.js diff --git a/projects/buzz-farming/index.js b/projects/buzz-farming/index.js new file mode 100644 index 000000000000..158f1ddda7db --- /dev/null +++ b/projects/buzz-farming/index.js @@ -0,0 +1,22 @@ +const {sumTokensExport} = require('../helper/sumTokens'); +const ADDRESSES = require('../helper/coreAssets.json') + +const ADDRESSES_BSQUARED_BSTONE = '0x7537C1F80c9E157ED7AFD93a494be3e1f04f1462'; +const ADDRESSES_BSQUARED_FDUSD = '0xC2Fe4f673455Ef92299770a09CDB5E8756A525D5'; +const ADDRESSES_BSQUARED_MATIC = '0xc3ee2Df14B1Bc526c24ED802f1873d49664a0d5c'; +const ADDRESSES_BSQUARED_ORDI = '0xa0f4470B714677AEEcE0d20074c540b3Cf6a477E'; +const ADDRESSES_BSQUARED_SATS = '0x7eBFcE05E418C380a2b6EB0F65995cA04ef4bc00'; +const ADDRESSES_BSQUARED_FBTC = '0x5d247f32b792a61f7b4078cf7752a878aff152e2'; +const ADDRESSES_BSQUARED_UBTC = '0x796e4d53067ff374b89b2ac101ce0c1f72ccaac2'; +const ADDRESSES_BSQUARED_USDA = '0x46fecc5bef70615ee3bfdbd2b278944368b78cf5'; +const ADDRESSES_BSQUARED_ETH = '0xd48d3a551757ac47655fce25bde1b0b6b1cb2a5a'; + +const tokenList = [ADDRESSES.null, ADDRESSES.bsquared.USDT, ADDRESSES.bsquared.USDC, ADDRESSES.bsquared.WBTC, ADDRESSES_BSQUARED_BSTONE, ADDRESSES_BSQUARED_FDUSD, ADDRESSES_BSQUARED_MATIC, ADDRESSES_BSQUARED_ORDI, ADDRESSES_BSQUARED_SATS, ADDRESSES_BSQUARED_FBTC, ADDRESSES_BSQUARED_UBTC, ADDRESSES_BSQUARED_USDA, ADDRESSES_BSQUARED_ETH,]; + + +module.exports = { + hallmarks: [], + methodology: "Buzz Farming collaborates with well-known BTCFi projects such as Babylon, Lombard, and Bedrock, as well as prominent blockchains, offering users a variety of multifaceted profit strategies. Users can conveniently select and operate investment strategies through Buzz Farming.", + + bsquared: {tvl: sumTokensExport({owner: '0xe677F4B6104726D76DeBc681d7a862CE269aA8F3', tokens: tokenList})}, +} From dabd177e1cb838641004527dcf91064b97ce4f05 Mon Sep 17 00:00:00 2001 From: Martin-ryunseok <142201179+Martin-ryunseok@users.noreply.github.com> Date: Thu, 11 Jul 2024 14:52:44 +0900 Subject: [PATCH 668/855] feat: add m-btc on kroma (#10947) * feat: add m-btc on kroma * fix: fix error * revert: update m-btc address * fix: apply pr comment --- projects/free-protocol/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/free-protocol/index.js b/projects/free-protocol/index.js index 7a71b7d233e8..dafeb2b17b0c 100644 --- a/projects/free-protocol/index.js +++ b/projects/free-protocol/index.js @@ -83,4 +83,7 @@ module.exports = { ] }) }, + kroma: { + tvl: () => ({}) + } }; \ No newline at end of file From c5da4602c2b94f2f905047e6e29b96be0294fad5 Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Thu, 11 Jul 2024 08:41:31 +0200 Subject: [PATCH 669/855] fix dopex-clamm update (#10951) Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> --- projects/dopex-clamm/index.js | 153 ++++++++++++++++------------------ 1 file changed, 74 insertions(+), 79 deletions(-) diff --git a/projects/dopex-clamm/index.js b/projects/dopex-clamm/index.js index 1ef388f526a5..2c0ee7ac8663 100644 --- a/projects/dopex-clamm/index.js +++ b/projects/dopex-clamm/index.js @@ -1,94 +1,89 @@ -const { blockQuery } = require("../helper/http"); -const wildCreditABI = require('../wildcredit/abi.json'); -const { getLogs } = require('../helper/cache/getLogs') -const DopexV2ClammFeeStrategy = '0xC808AcB06077174333b31Ae123C33c6559730035' - -const query = (skip = 0, limit = 1000) => `query ($block: Int) { - strikes( - block: {number: $block} - first: ${limit} - skip: ${skip} - where: {totalLiquidity_gt: 100} - orderBy: totalLiquidity - orderDirection: desc - ) { - pool - token0 { id } - token1 { id } - tickLower - tickUpper - totalLiquidity +const { gql, request } = require('graphql-request'); + +const endpoint = 'https://api.0xgraph.xyz/subgraphs/name/dopex-v2-clamm-public'; +const abi = "function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)" + +const query = gql` + query strikes($limit: Int!, $skip: Int!) { + strikes( + first: $limit + skip: $skip + where: { totalLiquidity_gt: "100" } + orderBy: totalLiquidity + orderDirection: desc + ) { + pool + token0 {id} + token1 {id} + tickLower + tickUpper + totalLiquidity + } + } +`; + +async function fetchStrikes(limit, skip, allData = []) { + const variables = { limit, skip }; + const { strikes } = await request(endpoint, query, variables); + allData.push(...strikes); + + if (strikes.length === limit) { + return fetchStrikes(limit, skip + limit, allData); + } + + return allData; +} + +function addV3PositionBalances(strike, sqrtPricesMap) { + const tickToPrice = (tick) => 1.0001 ** tick + const token0 = strike.token0.id + const token1 = strike.token1.id + const liquidity = strike.totalLiquidity + const bottomTick = +strike.tickLower + const topTick = +strike.tickUpper + const tick = +sqrtPricesMap[strike.pool.toLowerCase()].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) } -}` + + return { token0, amount0, token1, amount1 } +} async function tvl(api) { - const allData = [] - let hasMore = true - let skip = 0 - let limit = 1000 - do { - const { strikes } = await blockQuery("http://api.0xgraph.xyz/subgraphs/name/dopex-v2-clamm-public", query(skip, limit), { api }) - skip += limit - allData.push(...strikes) - hasMore = strikes.length === limit - } while (hasMore) + const limit = 1000; + const allData = await fetchStrikes(limit, 0); let pools = allData.map(strike => strike.pool.toLowerCase()) pools = [...new Set(pools)] - const sqrtPrices = await api.multiCall({ calls: pools, abi: wildCreditABI.slot0, }) + const sqrtPrices = await api.multiCall({ calls: pools, abi }) const sqrtPricesMap = sqrtPrices.reduce((acc, item, i) => { return { ...acc, [pools[i]]: item, } }, {}); - allData.map(addV3PositionBalances) - - // const logs = await getLogs({ - // api, - // target: DopexV2ClammFeeStrategy, - // eventAbi: 'event OptionMarketRegistered (address optionMarket)', - // onlyArgs: true, - // fromBlock: 149751550, - // }) - // const markets = logs.map(log => log.optionMarket) - // const callAssets = await api.multiCall({ abi: 'address:callAsset', calls: markets }) - // const putAssets = await api.multiCall({ abi: 'address:putAsset', calls: markets }) - // const ownerTokens = markets.map((v, i) => [[callAssets[i], putAssets[i]], v]) - // return api.sumTokens({ ownerTokens}) - - return api.getBalances() - - - function addV3PositionBalances(strike) { - const tickToPrice = (tick) => 1.0001 ** tick - - const token0 = strike.token0.id - const token1 = strike.token1.id - const liquidity = strike.totalLiquidity - const bottomTick = +strike.tickLower - const topTick = +strike.tickUpper - const tick = +sqrtPricesMap[strike.pool.toLowerCase()].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) - } + allData.forEach((strike) => { + const { token0, amount0, token1, amount1 } = addV3PositionBalances(strike, sqrtPricesMap); + api.add(token0, amount0); + api.add(token1, amount1); + }); } + module.exports = { doublecounted: true, // tokens are stored in UNI-V3 pools arbitrum: { tvl, }, }; + + From 660c2ac72593195b98b51b8988f6c9ca70f93e58 Mon Sep 17 00:00:00 2001 From: satoshi-dex <174353954+satoshi-dex@users.noreply.github.com> Date: Thu, 11 Jul 2024 09:48:01 +0300 Subject: [PATCH 670/855] Satoshi dex dev (#10950) * added satoshi-dex * added methodology and timetravel exports * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/satoshi-dex/api.js | 33 +++++++++++++++++++++++++++++++++ projects/satoshi-dex/index.js | 7 +++++++ 2 files changed, 40 insertions(+) create mode 100644 projects/satoshi-dex/api.js create mode 100644 projects/satoshi-dex/index.js diff --git a/projects/satoshi-dex/api.js b/projects/satoshi-dex/api.js new file mode 100644 index 000000000000..b61497c4b9a7 --- /dev/null +++ b/projects/satoshi-dex/api.js @@ -0,0 +1,33 @@ + +const { transformDexBalances } = require('../helper/portedTokens') +const { call } = require('../helper/chain/stacks-api') + +const core = 'SP1W7FX8P1G721KQMQ2MA2G1G4WCVVPD9JZMGXK8R.univ2-core' + +async function tvl() { + const data = [] + const pairCount = +(await call({ target: core, abi: 'get-nr-pools' })).toString() + for (let i = 1; i <= pairCount; i++) { + const { + token0, token1, reserve0, reserve1, + } = await call({ target: core, abi: 'do-get-pool', inputArgs: [{ type: 'uint', value: i }] }) + data.push({ + token0: token0.value, + token1: token1.value, + token0Bal: reserve0.value, + token1Bal: reserve1.value, + }) + } + + return transformDexBalances({ chain: 'stacks', data }) +} + + +module.exports = { + stacks: { + tvl: tvl, + timetravel: false, + methodology: 'The calculated TVL is the current USD sum of all pools from core contract', + } +} + \ No newline at end of file diff --git a/projects/satoshi-dex/index.js b/projects/satoshi-dex/index.js new file mode 100644 index 000000000000..d818ec3bc5ea --- /dev/null +++ b/projects/satoshi-dex/index.js @@ -0,0 +1,7 @@ +const { getExports } = require('./helper/heroku-api') + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + ...getExports("satoshi-dex", ['stacks']), +} From b174ab35cbebeaa0c80417cf0164b085e0295f01 Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Thu, 11 Jul 2024 09:31:44 +0200 Subject: [PATCH 671/855] Fix: Cian-lst update (#10952) * Fix: Cian-lst update * use permitFailure:true --------- Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> --- projects/cian-lst/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/cian-lst/index.js b/projects/cian-lst/index.js index aba79f511887..8c63ebd9051c 100644 --- a/projects/cian-lst/index.js +++ b/projects/cian-lst/index.js @@ -3,7 +3,7 @@ const config = { "0xcDd374F491fBF3f4FcF6E9023c99043774005137", "0xB8c0c50D255B93f5276549cbA7F4bf78751A5D34", "0x88508306E43FCe43F7f2c1e7D73c88cf6a523f6C", - "0xD34f59E172cF3915f56C96A3037Ac554A7399D77", + "0xD34f59E172cF3915f56C96A3037Ac554A7399D77", // PYUSD Optimized Long-Short (variant 1) ], optimism: ["0x907883da917ca9750ad202ff6395C4C6aB14e60E"], bsc: ["0xEa5f10A0E612316A47123D818E2b597437D19a17"], @@ -19,7 +19,7 @@ module.exports = { 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, permitFailure:true }); }, }; }); From 6fe9bcb85d84ec8a21136625e9f75bd214bf21cc Mon Sep 17 00:00:00 2001 From: miler012 <124125686+miler012@users.noreply.github.com> Date: Thu, 11 Jul 2024 17:59:26 +0800 Subject: [PATCH 672/855] add new coins (#10953) --- projects/satori/index.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/projects/satori/index.js b/projects/satori/index.js index 84a21cc679c6..cd0d499a0ea2 100644 --- a/projects/satori/index.js +++ b/projects/satori/index.js @@ -2,6 +2,9 @@ const ADDRESSES = require("../helper/coreAssets.json"); const { sumTokensExport } = require("../helper/unwrapLPs"); const USDT_TOKEN_CONTRACT = ADDRESSES.astarzk.USDT; +const EZETH_BASE = "0x2416092f143378750bb29b79eD961ab195CcEea5"; +const EZETH_LINEA = "0x2416092f143378750bb29b79eD961ab195CcEea5"; +const ZK = "0x5A7d6b2F92C77FAD6CCaBd7EE0624E64907Eaf3E"; const WALLET_ADDR = [ "0x62e724cB4d6C6C7317e2FADe4A03001Fe7856940", "0xA59a2365D555b24491B19A5093D3c99b119c2aBb", @@ -21,7 +24,7 @@ module.exports = { "0x0842b33529516abe86CA8EA771aC4c84FDd0eeE0", "0x48756b37Fd643bB40F669804730024F02900C476", ], - tokens: [ADDRESSES.era.USDC], + tokens: [ADDRESSES.era.USDC, ZK], }), }, linea: { @@ -30,7 +33,7 @@ module.exports = { "0xfb371E70eEB32f4054F40514924e77213ca18425", "0xF96116e124eB3F62Ddc6a9cfbdc58d7F8A37c50A", ], - tokens: [ADDRESSES.linea.USDC], + tokens: [ADDRESSES.linea.USDC, EZETH_LINEA], }), }, scroll: { @@ -48,7 +51,7 @@ module.exports = { "0x668a9711b8d04362876dc5b6177ed362084d5aed", "0x5f075a6a11B2e25DF664Ce7419c274943017B595", ], - tokens: [ADDRESSES.base.USDC], + tokens: [ADDRESSES.base.USDC, EZETH_BASE], }), }, xlayer: { @@ -60,4 +63,4 @@ module.exports = { tokens: [ADDRESSES.xlayer.USDC], }), }, -} \ No newline at end of file +}; From 02e19e58c447fa3632fd89c67b197e8c77d05836 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 11 Jul 2024 13:14:58 +0300 Subject: [PATCH 673/855] bugfix --- projects/satoshi-dex/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/satoshi-dex/index.js b/projects/satoshi-dex/index.js index d818ec3bc5ea..695578ee07f1 100644 --- a/projects/satoshi-dex/index.js +++ b/projects/satoshi-dex/index.js @@ -1,4 +1,4 @@ -const { getExports } = require('./helper/heroku-api') +const { getExports } = require('../helper/heroku-api') module.exports = { timetravel: false, From 2a16133a71052299fe7f1e68c7a87847fee82f8f Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 11 Jul 2024 13:24:23 +0300 Subject: [PATCH 674/855] fix for aeternity --- projects/helper/portedTokens.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/helper/portedTokens.js b/projects/helper/portedTokens.js index d45aca7a97d5..1db3a4f770c1 100644 --- a/projects/helper/portedTokens.js +++ b/projects/helper/portedTokens.js @@ -104,6 +104,7 @@ async function getChainTransform(chain) { if ([...ibcChains, 'ton', 'mvc', 'defichain', 'waves'].includes(chain)) return chainStr if (chain === 'cardano' && addr === 'ADA') return 'coingecko:cardano' if (chain === 'near' && addr.endsWith('.near')) return chainStr + if (chain === 'aeternity' && addr.startsWith('ct_')) return chainStr if (chain === 'tron' && addr.startsWith('T')) return chainStr if (chain === 'stacks' && addr.startsWith('SP')) return chainStr if (chain === 'tezos' && addr.startsWith('KT1')) return chainStr From e9efb07521620a3fd448bd7fc0b3344d56fb46a9 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Thu, 11 Jul 2024 15:43:51 +0100 Subject: [PATCH 675/855] mantle uni v3 (#10958) --- projects/uniswap/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index f663be83487c..28d12b541b61 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -85,8 +85,8 @@ module.exports = { manta: { factory: "0x06D830e15081f65923674268121FF57Cc54e4e23", fromBlock: 1191705 }, avax: { factory: "0x740b1c1de25031C31FF4fC9A62f554A55cdC1baD", fromBlock: 27832972 }, taiko: { factory: "0x75FC67473A91335B5b8F8821277262a13B38c9b3", fromBlock: 961 }, - sei: { factory: "0x75FC67473A91335B5b8F8821277262a13B38c9b3", fromBlock: 79245151 } - + sei: { factory: "0x75FC67473A91335B5b8F8821277262a13B38c9b3", fromBlock: 79245151 }, + mantle: { factory: "0x0d922Fb1Bc191F64970ac40376643808b4B74Df9", fromBlock: 63795918 } }), filecoin: { tvl: filecoinTvl }, } From ba400a144d65ef58139a2234eb61d1674bde2fb9 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Thu, 11 Jul 2024 20:39:55 +0400 Subject: [PATCH 676/855] Add sei lst o accumulated finance (#10962) * add VLX token for BSC * accumulated.finance add sei lst --------- Co-authored-by: Evgeny Rozanov --- projects/accumulated-finance/index.js | 39 ++++++++++++++++----------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/projects/accumulated-finance/index.js b/projects/accumulated-finance/index.js index 48eebdbcd496..95eed412e761 100644 --- a/projects/accumulated-finance/index.js +++ b/projects/accumulated-finance/index.js @@ -37,24 +37,31 @@ const config = { } ], "zeta": [ - { - "zeta": { - "baseToken": '0xf091867ec603a6628ed83d274e835539d82e9cc8', - "LST": '0xcba2aeec821b0b119857a9ab39e09b034249681a' - } - }, - { - "bsc": { - "baseToken": "0xf091867ec603a6628ed83d274e835539d82e9cc8", - "LST": "0xcf123d8638266629fb02fc415ad47bd47de01a6b" + { + "zeta": { + "baseToken": '0xf091867ec603a6628ed83d274e835539d82e9cc8', + "LST": '0xcba2aeec821b0b119857a9ab39e09b034249681a' + } + }, + { + "bsc": { + "baseToken": "0xf091867ec603a6628ed83d274e835539d82e9cc8", + "LST": "0xcf123d8638266629fb02fc415ad47bd47de01a6b" + }, }, - }, - { - "ethereum": { - "baseToken": "0xf091867ec603a6628ed83d274e835539d82e9cc8", - "LST": "0xf38feedb0c85c1e1d6864c7513ac646d28bb0cfc" + { + "ethereum": { + "baseToken": "0xf091867ec603a6628ed83d274e835539d82e9cc8", + "LST": "0xf38feedb0c85c1e1d6864c7513ac646d28bb0cfc" + } + }, + ], + "sei": [ + { + "sei": { + "LST": "0xcba2aeec821b0b119857a9ab39e09b034249681a" + }, } - }, ] } From bed9045b8c3222bca3993f0c947446b335579ff2 Mon Sep 17 00:00:00 2001 From: MD <0xhyoga@cygnusdao.finance> Date: Thu, 11 Jul 2024 18:44:47 +0200 Subject: [PATCH 677/855] adding base chain (#10959) --- projects/impermax/impermaxHelper.js | 5 ++++- projects/impermax/index.js | 20 ++++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/projects/impermax/impermaxHelper.js b/projects/impermax/impermaxHelper.js index 1517fd2b98c7..0817f51d849b 100644 --- a/projects/impermax/impermaxHelper.js +++ b/projects/impermax/impermaxHelper.js @@ -105,6 +105,8 @@ function impermaxHelper(exportsObj, config, blacklistedPools) { case 'era': case 'fantom': case 'scroll': + case 'base': + case 'mantle': default: impermaxSymbol = 'STKD-UNI-V2' return underlyings.filter((_, i) => uSymbols[i] === impermaxSymbol) @@ -125,4 +127,5 @@ function impermaxHelper(exportsObj, config, blacklistedPools) { module.exports = { impermaxHelper -} \ No newline at end of file +} + diff --git a/projects/impermax/index.js b/projects/impermax/index.js index 2ec9d1774178..27efed1a61a1 100644 --- a/projects/impermax/index.js +++ b/projects/impermax/index.js @@ -11,12 +11,13 @@ const config = { '0xBB92270716C8c424849F17cCc12F4F24AD4064D6', '0x7F7AD5b16c97Aa9C2B0447C2676ce7D5CEFEbCd3', '0x7ED6eF7419cD9C00693d7A4F81c2a151F49c7aC2', + '0x60f57cF15a34fA0Aa25eF37eB827E1a0948966c5' ] }, arbitrum: { factories: [ '0x8C3736e2FE63cc2cD89Ee228D9dBcAb6CE5B767B', - '0x8C3736e2FE63cc2cD89Ee228D9dBcAb6CE5B767B', + '0x9708e0b216a88d38d469b255ce78c1369ad898e6', '0x97bc7fefb84a4654d4d3938751b5fe401e8771c2', ] }, @@ -54,6 +55,19 @@ const config = { '0xFBD17F3AA7d6506601D2bF7e15a6C96081296a01', // scroll stablefactory ] }, + base: { + factories: [ + '0x66ca66E002a9CEE8dEfE25dB6f0c6225117C2d9f', + '0x8aDc5F73e63b3Af3fd0648281fE451738D8B9D86', + '0x47183bB55AD0F891887E099Cec3570d3C667cD00' + ] + }, + mantle: { + factories: [ + '0x3047523D5ed0df1545B1C440BdAaB095f1f3cf5C' + ] + } + } const blacklistedPools = { @@ -96,8 +110,10 @@ const blacklistedPools = { '0xb97b6ed451480fe6466a558e9c54eaac32e6c696', // OXD-FTM ], scroll: [], + base: [], + mantle: [] } module.exports = {} -impermaxHelper(module.exports, config, blacklistedPools) \ No newline at end of file +impermaxHelper(module.exports, config, blacklistedPools) From b620e6762b2e6fde5c7f5e1277982c01fabb0c15 Mon Sep 17 00:00:00 2001 From: penpad-dev <168410560+penpad-dev@users.noreply.github.com> Date: Fri, 12 Jul 2024 00:46:24 +0800 Subject: [PATCH 678/855] add new assets (#10961) add new assets --- projects/penpad/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/projects/penpad/index.js b/projects/penpad/index.js index 4a835dafc80c..a9546f324e14 100644 --- a/projects/penpad/index.js +++ b/projects/penpad/index.js @@ -26,11 +26,19 @@ module.exports = { [ '0xcA0bFd5f735924e34Cc567146989e467fFbbCe1a', '0x25D710AC957A54bdD6578b5DC8187a355c805edb', - ], // weETH + ], // weETH (Scroll Bridged) [ '0x3C1BCa5a656e69edCD0D4E36BEbb3FcDAcA60Cf1', '0x1C04CedF3Aac5fE35A7811689Ac6Da25b01BDc81', ], // WBTC + [ + '0x01f0a31698c4d065659b9bdc21b3610292a1c506', + '0x016d036ec56eed17b5f9dfa212e27f8e260cc7d0', + ], // weETH (Stargate Bridged) + [ + '0x3ba89d490ab1c0c9cc2313385b30710e838370a4', + '0xde12ec22c5c4eeeeaf8afdc4ec735d75cf9d15a5', + ], // SolvBTC.b ], }), }, From 39043c1a863e4046603a43e271291ece12aa2005 Mon Sep 17 00:00:00 2001 From: atozICT <60227992+atozICT20@users.noreply.github.com> Date: Thu, 11 Jul 2024 15:42:16 -0400 Subject: [PATCH 679/855] [Sturdy V2]: added linea, optimism and sei networks (#10963) --- projects/sturdy-v2/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/sturdy-v2/index.js b/projects/sturdy-v2/index.js index b831810d8d3f..e525b2a71a1d 100644 --- a/projects/sturdy-v2/index.js +++ b/projects/sturdy-v2/index.js @@ -4,6 +4,9 @@ const abi = require("./abi.json"); const config = { ethereum: '0x69764E3e0671747A7768A1C1AfB7C0C39868CC9e', mode: '0xF0382A9Eca5276d7B4BbcC503e4159C046c120ec', + linea: "0xd67Da8636Ae87b0cECBDa2e66dB58d4839722B52", + optimism: "0x9dc7B2130e478C5810Dc0cDbD46B9D479b2e1aC4", + sei: "0x4534F53A81416a83F6bAF5ac63c94aEd1fea1303", } module.exports = { From d3f1af407e8a399f244cf5914b6c2d3026c37d76 Mon Sep 17 00:00:00 2001 From: LeeChunHao2000 <64617939+LeeChunHao2000@users.noreply.github.com> Date: Thu, 11 Jul 2024 21:52:45 -0700 Subject: [PATCH 680/855] Update Manta TVL for Anzen (#10966) * add Blast USDz * add Manta USDz --- projects/anzen-v2/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/projects/anzen-v2/index.js b/projects/anzen-v2/index.js index bf999d4aeae7..be764330c274 100644 --- a/projects/anzen-v2/index.js +++ b/projects/anzen-v2/index.js @@ -5,6 +5,7 @@ const sdk = require('@defillama/sdk') const USDz = '0xa469b7ee9ee773642b3e93e842e5d9b5baa10067'; const Base_USDz = '0x04d5ddf5f3a8939889f11e97f8c4bb48317f1938'; const Blast_USDz = '0x52056ed29fe015f4ba2e3b079d10c0b87f46e8c6'; +const Manta_USDz = '0x73d23f3778a90be8846e172354a115543df2a7e4'; const SPCT = '0xf30a29f1c540724fd8c5c4be1af604a6c6800d29'; // Secured collateral const mainnet_tvl = async (api) => { @@ -22,6 +23,11 @@ const blast_tvl = async (api) => { api.add(Blast_USDz, supply) } +const manta_tvl = async (api) => { + const supply = await api.call({ abi: 'erc20:totalSupply', target: Manta_USDz }) + api.add(Manta_USDz, supply) +} + const collateral_assets = async (api) => { const supply = await api.call({ abi: 'erc20:totalSupply', target: SPCT }) api.add(SPCT, supply) @@ -38,4 +44,7 @@ module.exports = { blast: { tvl: blast_tvl, }, + manta: { + tvl: manta_tvl, + }, }; From cd87a7cb97401f14d68c48ac2ee0747e32ec93c8 Mon Sep 17 00:00:00 2001 From: brightiron <95196612+brightiron@users.noreply.github.com> Date: Thu, 11 Jul 2024 23:54:25 -0500 Subject: [PATCH 681/855] [Olympus] -account for owntokens in multisig (#10965) * account for owntokens in multisig * fix formatting for diff --- projects/olympus/index.js | 152 ++++++++++++++++++++------------------ 1 file changed, 79 insertions(+), 73 deletions(-) diff --git a/projects/olympus/index.js b/projects/olympus/index.js index 1dec65c9657b..2a83b091b661 100644 --- a/projects/olympus/index.js +++ b/projects/olympus/index.js @@ -4,6 +4,7 @@ const { blockQuery } = require("../helper/http"); const { getEnv } = require("../helper/env"); const { staking } = require('../helper/staking'); const { sumTokens2 } = require("../helper/unwrapLPs"); +const { sumTokens } = require("../helper/sumTokens"); const OlympusStakings = [ // Old Staking Contract @@ -14,8 +15,15 @@ const OlympusStakings = [ ]; const OHM_V1 = "0x383518188c0c6d7730d91b2c03a03c837814a899" // this is OHM v1 -const OHM = "0x64aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5" // this is OHM v1 +const OHM = "0x64aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5" +const GOHM = "0x0ab87046fBb341D058F17CBC4c1133F25a20a52f" +const TREASURY_MULTISIG = "0x245cc372c84b3645bf0ffe6538620b04a217988b"; + +const olympusTokens = [ + GOHM, // GOHM + OHM, +]; /** Map any staked assets without price feeds to those with price feeds. * All balances are 1: 1 to their unstaked counterpart that has the price feed. **/ @@ -90,82 +98,80 @@ function sumBalancesByTokenAddress(arr) { * #3. Sum values returned ***/ function buildTvl(isOwnTokensMode = false){ -return async function tvl(api) { -const subgraphUrls = { - ethereum: `7jeChfyUTWRyp2JxPGuuzxvGt3fDKMkC9rLjm7sfLcNp`, - arbitrum: - "2XQDRQ9AXhp5us6PsNyRM5BxKWeXhy3BNQLynA6YmmjA", - fantom: - sdk.graph.modifyEndpoint('3qSJTWdWJETFzht814HVV9rVafwRLQp3k9mZhCF39bYd'), - polygon: - "JCVMW1dbqectgaSLRuKSen6FKe9RPMJRQhNYZa4iTgFb", -}; - - //filter out problematic pools that dont have a decimals function. - const poolsWithoutDecimals = ["0x88051b0eea095007d3bef21ab287be961f3d8598"]; - - const indexedBlockForEndpoint = await blockQuery( - subgraphUrls[api.chain], - getLatestBlockIndexed, - { api } - ); - const blockNum = indexedBlockForEndpoint.lastBlock[0].block; - const { tokenRecords } = await blockQuery( - subgraphUrls[api.chain], - protocolQuery(blockNum), - { api } - ); - - const filteredTokenRecords = tokenRecords.filter( - (t) => !poolsWithoutDecimals.includes(t.tokenAddress) - ); - - const aDay = 24 * 3600; - const now = Date.now() / 1e3; - if (now - blockNum[0].timestamp > 3 * aDay) { - throw new Error("outdated"); + return async function tvl(api) { + const subgraphUrls = { + ethereum: `7jeChfyUTWRyp2JxPGuuzxvGt3fDKMkC9rLjm7sfLcNp`, + arbitrum: + "2XQDRQ9AXhp5us6PsNyRM5BxKWeXhy3BNQLynA6YmmjA", + fantom: + sdk.graph.modifyEndpoint('3qSJTWdWJETFzht814HVV9rVafwRLQp3k9mZhCF39bYd'), + polygon: + "JCVMW1dbqectgaSLRuKSen6FKe9RPMJRQhNYZa4iTgFb", + }; + + //filter out problematic pools that dont have a decimals function. + const poolsWithoutDecimals = ["0x88051b0eea095007d3bef21ab287be961f3d8598"]; + + const indexedBlockForEndpoint = await blockQuery( + subgraphUrls[api.chain], + getLatestBlockIndexed, + { api } + ); + const blockNum = indexedBlockForEndpoint.lastBlock[0].block; + const { tokenRecords } = await blockQuery( + subgraphUrls[api.chain], + protocolQuery(blockNum), + { api } + ); + + const filteredTokenRecords = tokenRecords.filter( + (t) => !poolsWithoutDecimals.includes(t.tokenAddress) + ); + + const aDay = 24 * 3600; + const now = Date.now() / 1e3; + if (now - blockNum[0].timestamp > 3 * aDay) { + throw new Error("outdated"); + } + // const filteredTokenRecords = poolsOnly + // ? tokenRecords.filter((t) => t.category === "Protocol-Owned Liquidity") + // : tokenRecords; + + /** + * iterates over filtered list from subgraph and returns any addresses + * that need to be normalized for pricing . + * See addressMap above + **/ + const normalizedFilteredTokenRecords = filteredTokenRecords.map((token) => { + const normalizedAddress = addressMap[token.tokenAddress] + ? addressMap[token.tokenAddress] + : token.tokenAddress; + return { ...token, tokenAddress: normalizedAddress }; + }); + + const tokensToBalances = sumBalancesByTokenAddress( + normalizedFilteredTokenRecords + ).filter(i => { + if (api.chain !== 'arbitrum') return true; + return !['0x89dc7e71e362faf88d92288fe2311d25c6a1b5e0000200000000000000000423', '0xce6195089b302633ed60f3f427d1380f6a2bfbc7000200000000000000000424'].includes(i.tokenAddress) + }) + const tokens = tokensToBalances.map(i => i.tokenAddress) + + + const decimals = await api.multiCall({ abi: 'erc20:decimals', calls: tokens }) + const ownTokens = new Set(olympusTokens.map(i => i.toLowerCase())) + tokensToBalances.map(async (token, i) => { + if (ownTokens.has(token.tokenAddress.toLowerCase())) { + if (!isOwnTokensMode) return; + } else if (isOwnTokensMode) return; + api.add(token.tokenAddress, token.balance * 10 ** decimals[i]) + }) + return await sumTokens2({ api, resolveLP: true, }) } - // const filteredTokenRecords = poolsOnly - // ? tokenRecords.filter((t) => t.category === "Protocol-Owned Liquidity") - // : tokenRecords; - - /** - * iterates over filtered list from subgraph and returns any addresses - * that need to be normalized for pricing . - * See addressMap above - **/ - const normalizedFilteredTokenRecords = filteredTokenRecords.map((token) => { - const normalizedAddress = addressMap[token.tokenAddress] - ? addressMap[token.tokenAddress] - : token.tokenAddress; - return { ...token, tokenAddress: normalizedAddress }; - }); - - const tokensToBalances = sumBalancesByTokenAddress( - normalizedFilteredTokenRecords - ).filter(i => { - if (api.chain !== 'arbitrum') return true; - return !['0x89dc7e71e362faf88d92288fe2311d25c6a1b5e0000200000000000000000423', '0xce6195089b302633ed60f3f427d1380f6a2bfbc7000200000000000000000424'].includes(i.tokenAddress) - }) - const tokens = tokensToBalances.map(i => i.tokenAddress) - - - const decimals = await api.multiCall({ abi: 'erc20:decimals', calls: tokens }) - const ownTokens = new Set([ - '0x0ab87046fBb341D058F17CBC4c1133F25a20a52f', // GOHM - '0x64aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5', // OHM - ].map(i => i.toLowerCase())) - tokensToBalances.map(async (token, i) => { - if (ownTokens.has(token.tokenAddress.toLowerCase())) { - if (!isOwnTokensMode) return; - } else if (isOwnTokensMode) return; - api.add(token.tokenAddress, token.balance * 10 ** decimals[i]) - }) - return await sumTokens2({ api, resolveLP: true, }) -} } async function ownTokens(api) { + api.sumTokens({ owners: [TREASURY_MULTISIG], tokens: olympusTokens }) return buildTvl(true)(api); } From a87c33e4d938d4d48e84571f30d5cb183ccd02b4 Mon Sep 17 00:00:00 2001 From: Frost Date: Fri, 12 Jul 2024 13:27:12 +0800 Subject: [PATCH 682/855] feat: add yaka finance (#10968) --- projects/yakafinance/index.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 projects/yakafinance/index.js diff --git a/projects/yakafinance/index.js b/projects/yakafinance/index.js new file mode 100644 index 000000000000..aa2ce19a7ed1 --- /dev/null +++ b/projects/yakafinance/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require("../helper/unknownTokens"); + +module.exports = uniTvlExport('sei', '0xd45dAff288075952822d5323F1d571e73435E929') \ No newline at end of file From 136a095d5d760a5b1b44e04e03cc153d83458c94 Mon Sep 17 00:00:00 2001 From: hide-yoshi <107361602+hide-yoshi@users.noreply.github.com> Date: Fri, 12 Jul 2024 15:34:38 +0900 Subject: [PATCH 683/855] add palmy finance (#10967) * add palmy finance * code refactor --------- Co-authored-by: hide-yoshi Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/palmy/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 projects/palmy/index.js diff --git a/projects/palmy/index.js b/projects/palmy/index.js new file mode 100644 index 000000000000..bc3629e90212 --- /dev/null +++ b/projects/palmy/index.js @@ -0,0 +1,10 @@ +const { aaveExports, methodology, } = require("../helper/aave"); + +module.exports = { + methodology, + oas: aaveExports("oas", '0xf4A3dDC5F629d9CB14DF4e7d5f78326153eA02A3', undefined, undefined, { + abis: { + getAllATokens: "function getAllLTokens() view returns (tuple(string symbol, address tokenAddress)[])" + }, + }), +}; From ca8d461f445426d53e5c3b903cc1e3e9a61528f6 Mon Sep 17 00:00:00 2001 From: alec <75048567+ahorner2@users.noreply.github.com> Date: Fri, 12 Jul 2024 01:35:11 -0500 Subject: [PATCH 684/855] adding midas sdk (#10964) * adding midas sdk * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/midas/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/midas/index.js diff --git a/projects/midas/index.js b/projects/midas/index.js new file mode 100644 index 000000000000..bf220ae80cc9 --- /dev/null +++ b/projects/midas/index.js @@ -0,0 +1,18 @@ +async function tvl(api) { + const MTBILL_TOKEN_CONTRACT = "0xDD629E5241CbC5919847783e6C96B2De4754e438"; + const mtbillSupply = await await api.call({ abi: "erc20:totalSupply", target: MTBILL_TOKEN_CONTRACT, }); + + const rate = await api.call({ + target: "0x32d1463EB53b73C095625719Afa544D5426354cB", // IB01/USD + abi: "function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)", + }); + api.addCGToken('tether', (mtbillSupply / 1e18) * (rate.answer / 1e8)) +} + +const chains = ["ethereum"]; + +chains.forEach((chain) => { + module.exports[chain] = { tvl }; +}); + +module.exports.misrepresentedTokens = true \ No newline at end of file From b826104e7b05476376c8b0ffe1640d808fed9927 Mon Sep 17 00:00:00 2001 From: Chase Brown <54334583+chasebrownn@users.noreply.github.com> Date: Thu, 11 Jul 2024 23:35:37 -0700 Subject: [PATCH 685/855] veRWA adaptor created and data verified (#10960) * veRWA adaptor created and data verified * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/real-veRWA/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/real-veRWA/index.js diff --git a/projects/real-veRWA/index.js b/projects/real-veRWA/index.js new file mode 100644 index 000000000000..e86393a00163 --- /dev/null +++ b/projects/real-veRWA/index.js @@ -0,0 +1,11 @@ +const { staking } = require('../helper/staking') +const RWAToken = '0x4644066f535Ead0cde82D209dF78d94572fCbf14' +const veRWA = '0xa7B4E29BdFf073641991b44B283FD77be9D7c0F4' + +module.exports = { + misrepresentedTokens: true, + real: { + tvl: () => ({}), + staking: staking(veRWA, RWAToken), + } +} \ No newline at end of file From 74d778a6f427b6b6c44e534ac9eeccd00524b8e9 Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Fri, 12 Jul 2024 09:23:10 +0200 Subject: [PATCH 686/855] add Kernel adapter (#10954) * add Kernel adapter * update sdk --------- Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- package-lock.json | 6 +++--- projects/kernel/abi.js | 5 +++++ projects/kernel/index.js | 30 ++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 projects/kernel/abi.js create mode 100644 projects/kernel/index.js diff --git a/package-lock.json b/package-lock.json index 9262e7eddef6..a541388890c7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -886,9 +886,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "5.0.73", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.73.tgz", - "integrity": "sha512-uLZeOFNWPKVyZAMtO7dXSJreHKWqETHpbPMZzpNR47icGl4nS2o/SX8xW82BmdLU7cp25EG9sN/sKkht/KnWvA==", + "version": "5.0.74", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.74.tgz", + "integrity": "sha512-qk/UrP5A55Co7pnj7WE3Cloc7zZSFESUTb5fXRaowH9K5oWi/JRJ4LQZOI38sami586q9/sWLwJrKBlU+lQIVw==", "dependencies": { "@aws-sdk/client-s3": "^3.400.0", "@elastic/elasticsearch": "^8.13.1", diff --git a/projects/kernel/abi.js b/projects/kernel/abi.js new file mode 100644 index 000000000000..d70d466c834c --- /dev/null +++ b/projects/kernel/abi.js @@ -0,0 +1,5 @@ +exports.abi = { + numApprovedTokens: "function numApprovedTokens() view returns (uint256)", + approvedTokens: "function approvedTokens(uint256) view returns (address)", + tokens: "function tokens(address) view returns (address vaultToken, address rateProvider, uint256 cap, uint256 deposited, bool paused)" +}; \ No newline at end of file diff --git a/projects/kernel/index.js b/projects/kernel/index.js new file mode 100644 index 000000000000..fce117aa7b38 --- /dev/null +++ b/projects/kernel/index.js @@ -0,0 +1,30 @@ +const abi = { + tokens: "function tokens(address) view returns (address vaultToken, address rateProvider, uint256 cap, uint256 deposited, bool paused)" +} + +const ASSETS = [ + "0xf02C96DbbB92DC0325AD52B3f9F2b951f972bf00", // krETH + "0x513D27c94C0D81eeD9DC2a88b4531a69993187cF", // ksETH + "0x0bB9aB78aAF7179b7515e6753d89822b91e670C4", // kUSD +] + +const tvl = async (api) => { + const tokens = await api.fetchList({ lengthAbi: 'numApprovedTokens', itemAbi: 'approvedTokens', calls: ASSETS, groupedByInput: true, }); + const assets = [] + const balanceCalls = [] + tokens.forEach((tokens, i) => { + assets.push(...tokens) + balanceCalls.push(...tokens.map(token => ({ target: ASSETS[i], params: token }))) + }) + const balances = (await api.multiCall({ calls: balanceCalls, abi: abi.tokens })).map(i => i.deposited) + api.add(assets, balances) +}; + +module.exports = { + doublecounted: true, + methodology: 'The TVL represents the sum of each LST deposited in the protocol', + ethereum: { + tvl, + }, +}; + From c68ef0ab56aba0871359c72034a1fbb79de135c8 Mon Sep 17 00:00:00 2001 From: "BT.Wood(Tang Bo Hao)" Date: Fri, 12 Jul 2024 15:24:41 +0800 Subject: [PATCH 687/855] Add new fixes coins TVL in Fixes World (#10956) * feat: add fixes's new coins protocol * feat: remove burned LP Value * feat: update desc --- projects/fixes-coins/index.js | 91 +++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 projects/fixes-coins/index.js diff --git a/projects/fixes-coins/index.js b/projects/fixes-coins/index.js new file mode 100644 index 000000000000..4cf80a4fc277 --- /dev/null +++ b/projects/fixes-coins/index.js @@ -0,0 +1,91 @@ +// Fixes Inscription Protocol - 𝔉rc20 Treasury Pool: https://fixes.world/ +const { post } = require("../helper/http"); + +let queryTVLCode = ` +import LiquidStaking from 0xd6f80565193ad727 +import stFlowToken from 0xd6f80565193ad727 +// Fixes Imports +import FRC20AccountsPool from 0xd2abb5dbf5e08666 +import FixesFungibleTokenInterface from 0xd2abb5dbf5e08666 +import FixesTokenLockDrops from 0xd2abb5dbf5e08666 +import FixesTradablePool from 0xd2abb5dbf5e08666 +import FRC20Indexer from 0xd2abb5dbf5e08666 + +access(all) +fun main(): UFix64 { + // singleton resource and constants + let acctsPool = FRC20AccountsPool.borrowAccountsPool() + let frc20Indexer = FRC20Indexer.getIndexer() + let stFlowTokenKey = "@".concat(Type<@stFlowToken.Vault>().identifier) + + // dictionary of addresses + let addrsDict = acctsPool.getAddresses(type: FRC20AccountsPool.ChildAccountType.FungibleToken) + // dictionary of tickers and total locked token balances + let tickerTotal: {String: UFix64} = {} + // This is the soft burned LP value which is fully locked in the BlackHole Vault + var flowLockedInBondingCurve = 0.0 + addrsDict.forEachKey(fun (key: String): Bool { + if let addr = addrsDict[key] { + // sum up all locked token balances in LockDrops Pool + if let dropsPool = FixesTokenLockDrops.borrowDropsPool(addr) { + let lockedTokenSymbol = dropsPool.getLockingTokenTicker() + tickerTotal[lockedTokenSymbol] = (tickerTotal[lockedTokenSymbol] ?? 0.0) + dropsPool.getTotalLockedTokenBalance() + } + // sum up all burned LP value in Tradable Pool + if let tradablePool = FixesTradablePool.borrowTradablePool(addr) { + flowLockedInBondingCurve = flowLockedInBondingCurve + tradablePool.getFlowBalanceInPool() + } + } + return true + }) + // sum up all locked token balances in LockDrops Pool + var totalLockingTokenTVL = 0.0 + tickerTotal.forEachKey(fun (key: String): Bool { + let lockedAmount = tickerTotal[key]! + if key == "" { + // this is locked FLOW + totalLockingTokenTVL = totalLockingTokenTVL + lockedAmount + } else if key == "fixes" { + // this is locked FIXES + let price = frc20Indexer.getBenchmarkValue(tick: "fixes") + totalLockingTokenTVL = totalLockingTokenTVL + lockedAmount * price + } else if key == stFlowTokenKey { + // this is locked stFlow + totalLockingTokenTVL = totalLockingTokenTVL + LiquidStaking.calcFlowFromStFlow(stFlowAmount: lockedAmount) + } + return true + }) + return totalLockingTokenTVL + flowLockedInBondingCurve +} +`; + +const queryCodeBase64 = Buffer.from(queryTVLCode, "utf-8").toString("base64"); + +async function tvl() { + try { + const response = await post( + "https://rest-mainnet.onflow.org/v1/scripts", + { script: queryCodeBase64 }, + { + headers: { "content-type": "application/json" }, + } + ); + let resEncoded = response; + let resString = Buffer.from(resEncoded, "base64").toString("utf-8"); + let resJson = JSON.parse(resString); + let flowTokenTVL = Number(resJson.value); + + return { flow: flowTokenTVL }; + } catch (error) { + throw new Error("Couln't query scripts of Fixes coins", error); + } +} + +module.exports = { + timetravel: false, + methodology: + "Counting the $FLOW token locked in Fixes Coins' Bonding Curve, and Fixes Coins' LockDrop Pool.", + flow: { + tvl, + }, +}; From a38c1cf946c321541a91af986f038154091b2a5e Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Fri, 12 Jul 2024 10:20:55 +0200 Subject: [PATCH 688/855] add Vesu adapter (#10957) * add Vesu adapter * code refactor --------- Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/vesu/abi.js | 94 ++++++++++++++++++++++++++++++++++++++++++ projects/vesu/index.js | 39 ++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 projects/vesu/abi.js create mode 100644 projects/vesu/index.js diff --git a/projects/vesu/abi.js b/projects/vesu/abi.js new file mode 100644 index 000000000000..fbb644f722f1 --- /dev/null +++ b/projects/vesu/abi.js @@ -0,0 +1,94 @@ +const allAbi = [ + + { + type: "function", + name: "decimals", + inputs: [], + outputs: [ + { + type: "core::integer::u8", + }, + ], + state_mutability: "view", + }, + + { + "type": "function", + "name": "asset_config_unsafe", + "inputs": [ + { + "name": "pool_id", + "type": "felt" + }, + { + "name": "asset", + "type": "felt" + } + ], + "outputs": [ + { + "type": "(vesu::data_model::AssetConfig, core::integer::u256)" + } + ], + "state_mutability": "view", + "customInput": "address" + }, + { + "type": "struct", + "name": "vesu::data_model::AssetConfig", + "members": [ + { + "name": "total_collateral_shares", + "type": "core::integer::u256" + }, + { + "name": "total_nominal_debt", + "type": "core::integer::u256" + }, + { + "name": "reserve", + "type": "core::integer::u256" + }, + { + "name": "max_utilization", + "type": "core::integer::u256" + }, + { + "name": "floor", + "type": "core::integer::u256" + }, + { + "name": "scale", + "type": "core::integer::u256" + }, + { + "name": "is_legacy", + "type": "core::bool" + }, + { + "name": "last_updated", + "type": "core::integer::u64" + }, + { + "name": "last_rate_accumulator", + "type": "core::integer::u256" + }, + { + "name": "last_full_utilization_rate", + "type": "core::integer::u256" + }, + { + "name": "fee_rate", + "type": "core::integer::u256" + } + ] + }, +] + +const abi = {} +allAbi.forEach(i => abi[i.name] = i) + +module.exports = { + abi, + allAbi +} \ No newline at end of file diff --git a/projects/vesu/index.js b/projects/vesu/index.js new file mode 100644 index 000000000000..cc4652af3ee6 --- /dev/null +++ b/projects/vesu/index.js @@ -0,0 +1,39 @@ +const { multiCall, sumTokens } = require("../helper/chain/starknet"); +const { abi, allAbi } = require("./abi"); + +const poolAddress = + "0x02545b2e5d519fc230e9cd781046d3a64e092114f07e44771e0d719d148725ef"; + +const assets = [ + "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7", + "0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac", + "0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8", + "0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8", + "0x042b8f0484674ca266ac5d08e4ac6a3fe65bd3129795def2dca5c34ecc5f96d2", + "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d", +]; + +const poolId = "0x4dc4f0ca6ea4961e4c8373265bfd5317678f4fe374d76f3fd7135f57763bf28"; + +async function tvl(api) { + return sumTokens({ api, owner: poolAddress, tokens: assets }); +} + +const borrowed = async (api) => { + const debtCalls = assets.map((asset) => ({ target: poolAddress, params: [poolId, asset] })); + const debtsRes = await multiCall({ calls: debtCalls, abi: abi.asset_config_unsafe, allAbi }); + const decimals = await multiCall({ calls: assets, abi: abi.decimals }); + return debtsRes.forEach((res, index) => { + const { total_nominal_debt } = res['0'] + const adjustDebt = Number(total_nominal_debt) * 10 ** (Number(decimals[index]) - 18) + api.add(assets[index], adjustDebt); + }); +}; + +module.exports = { + starknet: { + tvl, + borrowed, + }, +}; + From 3154fe2ed19dd2ba16c91e9ba9cdcb85fb715a58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A5=D0=B0=D0=BD=D0=BA=D1=83=D0=BA=20=D1=81=D0=B0=D1=80?= =?UTF-8?q?=D0=B0=D0=BC?= <75122733+codinghistorian@users.noreply.github.com> Date: Fri, 12 Jul 2024 17:37:44 +0900 Subject: [PATCH 689/855] Fathom-CDP CGO to coreAssets, CGO vault add (#10970) * Fathom-CDP CGO to coreAssets, CGO vault add * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/fathom-CDP/index.js | 7 ++++--- projects/helper/tokenMapping.js | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/projects/fathom-CDP/index.js b/projects/fathom-CDP/index.js index d738ba16a476..3c762b4e483e 100644 --- a/projects/fathom-CDP/index.js +++ b/projects/fathom-CDP/index.js @@ -1,9 +1,10 @@ -const WXDCHolders = [ - '0x9B4aCeFE2dB986Ca080Dc01d137e6566dBE0aA3a', // CDP Vault CollateralPoolId "0x5844430000000000000000000000000000000000000000000000000000000000" +const Vaults = [ + '0x9B4aCeFE2dB986Ca080Dc01d137e6566dBE0aA3a', // CDP Vault CollateralPoolId "0x5844430000000000000000000000000000000000000000000000000000000000" XDC + '0x14F2d15cdB7255A7c96973Ce54a269Ac1988cfcf' // CDP Vault CollateralPoolId "0x43474f0000000000000000000000000000000000000000000000000000000000" CGO ]; const { sumTokensExport } = require('../helper/unwrapLPs') const ADDRESSES = require('../helper/coreAssets.json') module.exports = { - xdc: { tvl: sumTokensExport({ owners: WXDCHolders, tokens: [ADDRESSES.xdc.WXDC]}) }, + xdc: { tvl: sumTokensExport({ owners: Vaults, tokens: [ADDRESSES.xdc.WXDC, '0x8f9920283470f52128bf11b0c14e798be704fd15']}) }, } diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 15bd6e253b09..2aeabf75243d 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -40,6 +40,9 @@ const fixBalancesTokens = { ozone: { // '0x83048f0bf34feed8ced419455a4320a735a92e9d': { coingeckoId: "ozonechain", decimals: 18 }, // was mapped to wrong chain }, + xdc: { + '0x8f9920283470f52128bf11b0c14e798be704fd15': { coingeckoId: 'comtech-gold', decimals: 18 }, + }, real: { '0x4644066f535ead0cde82d209df78d94572fcbf14': { coingeckoId: 're-al', decimals: 18 }, From 6c2db9398c6a4881709c7322fe07f34b2755abe1 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 12 Jul 2024 11:43:29 +0300 Subject: [PATCH 690/855] track glyph v4 (#10971) --- projects/glyph-v4/index.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 projects/glyph-v4/index.js diff --git a/projects/glyph-v4/index.js b/projects/glyph-v4/index.js new file mode 100644 index 000000000000..1313cce07367 --- /dev/null +++ b/projects/glyph-v4/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + core: { factory: '0x74EfE55beA4988e7D92D03EFd8ddB8BF8b7bD597', fromBlock: 15770796, isAlgebra: true }, +}) \ No newline at end of file From c00fd2be651e659a9cc7389fc0fa9e6a9714593d Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Fri, 12 Jul 2024 11:26:06 +0200 Subject: [PATCH 691/855] add FranklinTempleton RWA adapter (#10918) * add FranklinTempleton RWA adapter * use toUSDTBalances() helper --------- Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> --- projects/franklinTempleton-finance/index.js | 28 +++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 projects/franklinTempleton-finance/index.js diff --git a/projects/franklinTempleton-finance/index.js b/projects/franklinTempleton-finance/index.js new file mode 100644 index 000000000000..bbbaf4b88308 --- /dev/null +++ b/projects/franklinTempleton-finance/index.js @@ -0,0 +1,28 @@ +const { toUSDTBalances } = require('../helper/balances'); + +const BENJI_STELLAR = {ticker: "BENJI", address: 'GBHNGLLIE3KWGKCHIKMHJ5HVZHYIK7WTBE4QF5PLAKL4CJGSEU7HZIW5'} +const BENJI_POLYGON = '0x408a634b8a8f0de729b48574a3a7ec3fe820b00a' + +const stellarTvl = async (api) => { + const stellarApi = `https://api.stellar.expert/explorer/public/asset/${BENJI_STELLAR.ticker}-${BENJI_STELLAR.address}` + const response = await fetch(stellarApi) + const {supply, toml_info} = await response.json() + const adjustedSupply = toUSDTBalances((supply / Math.pow(10, toml_info.decimals))) + const [[tokenAddress, tokenBalance]] = Object.entries(adjustedSupply); + return api.add(tokenAddress, tokenBalance, { skipChain: true }) +} + +const polygonTvl = async (api) => { + const [decimals, totalSupply] = await Promise.all([ + api.call({target: BENJI_POLYGON, abi:'erc20:decimals'}), + api.call({target: BENJI_POLYGON, abi:'erc20:totalSupply'}) + ]) + const adjustedSupply = toUSDTBalances((totalSupply / Math.pow(10, decimals))) + const [[tokenAddress, tokenBalance]] = Object.entries(adjustedSupply); + api.add(tokenAddress, tokenBalance, {skipChain: true} ) +} + +module.exports = { + stellar: {tvl: stellarTvl}, + polygon: {tvl: polygonTvl}, +} From e2c5c2c0ffbbb0f0f8b636fe84f844f7045b92aa Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 12 Jul 2024 14:09:57 +0300 Subject: [PATCH 692/855] track clearpool rwa --- projects/clearpool-rwa/index.js | 21 +++++++++++++++++++++ projects/clearpool/index.js | 12 +++++++++--- projects/napier/index.js | 11 +++++------ 3 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 projects/clearpool-rwa/index.js diff --git a/projects/clearpool-rwa/index.js b/projects/clearpool-rwa/index.js new file mode 100644 index 000000000000..9d2fecc999b8 --- /dev/null +++ b/projects/clearpool-rwa/index.js @@ -0,0 +1,21 @@ +const { sumTokens2 } = require("../helper/unwrapLPs") + +const config = { + ethereum: [ + '0x7a486f809c952a6f8dec8cb0ff68173f2b8ed56c', // USDX + ], + flare: [ + '0x4a771cc1a39fdd8aa08b8ea51f7fd412e73b3d2b', // USDX + ] +} + +Object.keys(config).forEach(chain => { + const tokens = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const supply = await api.multiCall({ abi: 'erc20:totalSupply', calls: tokens}) + api.add(tokens, supply) + return sumTokens2({ api }) + } + } +}) \ No newline at end of file diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index 8aa895451798..4ba744f8f8a7 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -23,6 +23,10 @@ const CHAIN = { MANTLE: "mantle", } +const blacklistedTokens = { + flare: ['0x4a771cc1a39fdd8aa08b8ea51f7fd412e73b3d2b'], +} + const config = { [CHAIN.ETHEREUM]: { dynamic: { @@ -162,7 +166,7 @@ Object.keys(config).forEach((chain) => { let allPools = [] const promiseArray = dataPerChain.map( - async ({ factory, fromBlock, abi, borrowFn, protocol }) => { + async ({ factory, fromBlock, abi, protocol }) => { const { pools, tokens } = await _getLogs( api, factory, @@ -177,7 +181,7 @@ Object.keys(config).forEach((chain) => { await Promise.all(promiseArray) - return sumTokens2({ api, tokensAndOwners2: [allTokens, allPools] }) + return sumTokens2({ api, tokensAndOwners2: [allTokens, allPools], blacklistedTokens: blacklistedTokens[chain]}) } const borrowed = async (api) => { @@ -201,7 +205,9 @@ Object.keys(config).forEach((chain) => { await Promise.all(promiseArray) api.addTokens(allTokens, balances) - return sumTokens2({ api }) + if (blacklistedTokens[chain]) { + blacklistedTokens[chain].forEach((token) => api.removeTokenBalance(token)) + } } module.exports[chain] = { tvl, borrowed } }) diff --git a/projects/napier/index.js b/projects/napier/index.js index ca2f1f0d2e15..9db00cf28f38 100644 --- a/projects/napier/index.js +++ b/projects/napier/index.js @@ -1,5 +1,5 @@ -const { getLogs } = require("../helper/cache/getLogs"); +const { getLogs2 } = require("../helper/cache/getLogs"); // https://docs.napier.finance/contract-and-integrations/deployed-contracts const config = { @@ -19,25 +19,24 @@ Object.keys(config).map((network) => { const { tranche_factory, pool_factory } = config[network]; module.exports[network] = { tvl: async (api) => { - const trancheDeployedLogs = tranche_factory.address ? await getLogs({ + const trancheDeployedLogs = tranche_factory.address ? await getLogs2({ api, target: tranche_factory.address, eventAbi: "event TrancheDeployed(uint256 indexed maturity, address indexed principalToken, address indexed yieldToken)", - onlyArgs: true, fromBlock: tranche_factory.deployedAt, - extraKey: 'fix-cache-issue' + extraKey: 'v1' }) : []; const tranches = trancheDeployedLogs.map((event) => event.principalToken); // fetch deployed pools - const poolDeployedLogs = pool_factory.address ? await getLogs({ + const poolDeployedLogs = pool_factory.address ? await getLogs2({ api, target: pool_factory.address, eventAbi: "event Deployed(address indexed basePool, address indexed underlying, address indexed pool)", - onlyArgs: true, fromBlock: pool_factory.deployedAt, + extraKey: 'v1' }) : []; const pools = poolDeployedLogs.map((event) => event.pool) From 1e1d710d8e51af55fd91586f9833d5f5c81c39eb Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 12 Jul 2024 15:59:22 +0300 Subject: [PATCH 693/855] minor fix --- projects/helper/heroku-api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/helper/heroku-api.js b/projects/helper/heroku-api.js index 57aa8cb64295..1cbe02f416ca 100644 --- a/projects/helper/heroku-api.js +++ b/projects/helper/heroku-api.js @@ -1,5 +1,5 @@ const { get } = require('./http') -const endpoint = "https://sushi-analytics.llama.fi/temp" +const endpoint = "https://sushi-analytics.llama.fi" let data async function getData() { From 97bd6de6b91c3e0192a121a37525be912da26997 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 12 Jul 2024 16:19:19 +0300 Subject: [PATCH 694/855] bugfix --- projects/satoshi-dex/api.js | 2 -- projects/satoshi-dex/index.js | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/projects/satoshi-dex/api.js b/projects/satoshi-dex/api.js index b61497c4b9a7..f1853181b203 100644 --- a/projects/satoshi-dex/api.js +++ b/projects/satoshi-dex/api.js @@ -26,8 +26,6 @@ async function tvl() { module.exports = { stacks: { tvl: tvl, - timetravel: false, - methodology: 'The calculated TVL is the current USD sum of all pools from core contract', } } \ No newline at end of file diff --git a/projects/satoshi-dex/index.js b/projects/satoshi-dex/index.js index 695578ee07f1..a5b769fc0b41 100644 --- a/projects/satoshi-dex/index.js +++ b/projects/satoshi-dex/index.js @@ -3,5 +3,6 @@ const { getExports } = require('../helper/heroku-api') module.exports = { timetravel: false, misrepresentedTokens: true, + methodology: 'The calculated TVL is the current USD sum of all pools from core contract', ...getExports("satoshi-dex", ['stacks']), } From d300d3f087930684a4381f3db2fa17d7e16848d0 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 12 Jul 2024 17:07:33 +0300 Subject: [PATCH 695/855] update splice fi --- projects/splice-fi/index.js | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/projects/splice-fi/index.js b/projects/splice-fi/index.js index 9848b6456fc9..d12f0e3d2cfc 100644 --- a/projects/splice-fi/index.js +++ b/projects/splice-fi/index.js @@ -1,31 +1,33 @@ -const { getLogs } = require("../helper/cache/getLogs"); +const { getLogs, getLogs2 } = require("../helper/cache/getLogs"); const config = { - mode: { + mode: [{ factoryV3: "0x9e6d12097339ddd5402FDD39fc0Ef86Eec54AB39", fromBlockV3: 7764229, - }, - blast: { + }], + blast: [{ factoryV3: "0x96A6C433078059577F0CEB707d596A5F81d64375", fromBlockV3: 1850297, - }, + }, { + factoryV3: "0xf87E18913f7143E7C7eFee714813ABbC8e0E34bf", + fromBlockV3: 1850297, + },], } Object.keys(config).forEach((chain) => { - const { factoryV3, fromBlockV3 } = config[chain]; + const factories = config[chain]; module.exports[chain] = { tvl: async (api) => { - const logsV3 = await getLogs({ - api, - target: factoryV3, - topic: [ - "0xae811fae25e2770b6bd1dcb1475657e8c3a976f91d1ebf081271db08eef920af", - ], - eventAbi: - "event CreateNewMarket (address indexed market, address indexed PT, int256 scalarRoot, int256 initialAnchor, uint256 lnFeeRateRoot)", - onlyArgs: true, - fromBlock: fromBlockV3, - }) + const logsV3 = (await Promise.all(factories.map(i => getLogs2({ + api, + target: i.factoryV3, + topic: [ + "0xae811fae25e2770b6bd1dcb1475657e8c3a976f91d1ebf081271db08eef920af", + ], + eventAbi: + "event CreateNewMarket (address indexed market, address indexed PT, int256 scalarRoot, int256 initialAnchor, uint256 lnFeeRateRoot)", + fromBlock: i.fromBlockV3, + })))).flat() const pt = logsV3.map((i) => i.PT) let sy = [ From d7651de6e695754bf45ade3eaa6166e917bd148e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 12 Jul 2024 17:15:40 +0300 Subject: [PATCH 696/855] fix kayen --- projects/helper/coreAssets.json | 3 ++- projects/kayen/index.js | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 0d22e9243e3b..cceb218cda6b 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1668,7 +1668,8 @@ "BLAST": "0xb1a5700fA2358173Fe465e6eA4Ff52E36e88E2ad" }, "chz": { - "WCHZ": "0x721ef6871f1c4efe730dce047d40d1743b886946" + "WCHZ": "0x721ef6871f1c4efe730dce047d40d1743b886946", + "WCHZ_1": "0x677F7e16C7Dd57be1D4C8aD1244883214953DC47" }, "bitrock": { "WBR": "0x413f0e3a440aba7a15137f4278121450416882d5", diff --git a/projects/kayen/index.js b/projects/kayen/index.js index b37cf8f7ccac..94b62888fc57 100644 --- a/projects/kayen/index.js +++ b/projects/kayen/index.js @@ -7,7 +7,6 @@ module.exports = { tvl: getUniTVL({ factory: "0xE2918AA38088878546c1A18F2F9b1BC83297fdD3", useDefaultCoreAssets: true, - fetchBalances: true, }), }, }; \ No newline at end of file From 4cb77f4270a15acd9a1fdd66b4075a709df416ca Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Sat, 13 Jul 2024 19:42:25 +0100 Subject: [PATCH 697/855] add tokens --- projects/treasury/venus.js | 69 +++++++++++++++++++++++++++++--------- 1 file changed, 54 insertions(+), 15 deletions(-) diff --git a/projects/treasury/venus.js b/projects/treasury/venus.js index e4ff6d42dead..8010e86f43da 100644 --- a/projects/treasury/venus.js +++ b/projects/treasury/venus.js @@ -1,25 +1,64 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { nullAddress,treasuryExports } = require("../helper/treasury"); +const ADDRESSES = require("../helper/coreAssets.json"); +const { nullAddress, treasuryExports } = require("../helper/treasury"); const venusTreasury = "0xF322942f644A996A617BD29c16bd7d231d9F35E9"; const XVS = "0xcf6bb5389c92bdda8a3747ddb454cb7a64626c63"; const venusBTC = "0x882C173bC7Ff3b7786CA16dfeD3DFFfb9Ee7847B"; -const VAI = "0x4BD17003473389A42DAF6a0a729f6Fdb328BbBd7" - +const VAI = "0x4BD17003473389A42DAF6a0a729f6Fdb328BbBd7"; module.exports = treasuryExports({ bsc: { - tokens: [ - nullAddress, - ADDRESSES.bsc.USDT,//bsc-usdc - ADDRESSES.bsc.USDC,//usdc - ADDRESSES.bsc.BTCB,//BTCB - '0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3',//DAI - ADDRESSES.bsc.BETH,//BETH - - ], + tokens: [ + nullAddress, + ADDRESSES.bsc.USDT, //bsc-usdc + ADDRESSES.bsc.USDC, //usdc + ADDRESSES.bsc.BTCB, //BTCB + "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3", //DAI + ADDRESSES.bsc.BETH, //BETH + ADDRESSES.bsc.WBNB, + "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82", //cake + "0xF4C8E32EaDEC4BFe97E0F595AdD0f4450a863a11", //thena + "0x4338665CBB7B2485A8855A139b75D5e34AB0DB94", //ltc + "0xfb5B838b6cfEEdC2873aB27866079AC55363D37E", //floki + "0x20eE7B720f4E4c4FFcB00C4065cdae55271aECCa", //nft + "0xBf5140A22578168FD562DCcF235E5D43A02ce9B1", //uni + "0x47BEAd2563dCBf3bF2c9407fEa4dC236fAbA485A", //sxp + "0x7083609fCE4d1d8Dc0C979AAb8c869Ea2C873402", //dot + "0x1D2F0da169ceB9fC7B3144628dB156f3F6c60dBE", //xrp + "0x3EE2200Efb3400fAbB9AacF31297cBdD1d435D47", //ada + "0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD", //link + "0xbA2aE424d960c26247Dd6c32edC70B295c744C43", //doge + "0x40af3827F39D0EAcBF4A168f8D4ee67c121D11c9", //tusd + "0x0D8Ce2A99Bb6e3B7Db580eD848240e4a0F9aE153", //fil + "0xCC42724C6683B7E57334c4E856f4c9965ED682bD", //matic + "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", //busd + "0x52F24a5e03aee338Da5fd9Df68D2b6FAe1178827", //ankrbnb + "0xCE7de646e7208a4Ef112cb6ed5038FA6cC6b12e3", //trx + "0x352Cb5E19b12FC216548a2677bD0fce83BaE434B", //btt + "0x8fF795a6F4D97E7887C79beA79aba5cc76444aDf", //bch + "0xd17479997F34dd9156Deef8F95A52D81D265be9c", //usdd + "0x302cD8973bE5CA2334B4ff7e7b01BA41455559b3", //ethw + "0x1bdd3Cf7F79cfB8EdbB955f20ad99211551BA275", //bnbx + "0x965F527D9159dCe6288a2219DB51fc6Eef120dD1", //bsw + "0xc2E9d07F66A89c44062459A47a0D2Dc038E4fb16", //stkbnb + "0xaeF0d72a118ce24feE3cD1d43d383897D05B4e99", //win + "0x0782b6d8c4551B9760e74c0545a9bCD90bdc41E5", //lisusd + "0x12BB890508c125661E03b09EC06E404bc9289040", //raca + "0x4B0F1812e5Df2A09796481Ff14017e6005508003", //twt + "0x8F0528cE5eF7B51152A59745bEfDD91D97091d2F", //alpaca + "0x12f31B73D812C6Bb0d735a218c086d44D5fe5f89", //ageur + ], owners: [venusTreasury], - ownTokens: [XVS, venusBTC, VAI], + ownTokens: [ + XVS, + venusBTC, + VAI, + "0xecA88125a5ADbe82614ffC12D0DB554E2e2867C8", // venusUSDC + "0xf508fCD89b8bd15579dc79A6827cB4686A3592c8", // venusETH + "0xfD5840Cd36d94D7229439859C0112a4185BC0255", // venusUSDT + "0xB248a295732e0225acd3337607cc01068e3b9c10", // venusXRP + "0x95c78222B3D6e262426483D42CfA53685A67Ab9D", // venusBUSD + ], }, -}) \ No newline at end of file +}); From 627f411037078772fc78c8e4a1b7809570b40dd0 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Sat, 13 Jul 2024 19:51:24 +0100 Subject: [PATCH 698/855] update token list --- projects/treasury/venus.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/projects/treasury/venus.js b/projects/treasury/venus.js index 8010e86f43da..8ef2368bb502 100644 --- a/projects/treasury/venus.js +++ b/projects/treasury/venus.js @@ -17,6 +17,12 @@ module.exports = treasuryExports({ "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3", //DAI ADDRESSES.bsc.BETH, //BETH ADDRESSES.bsc.WBNB, + venusBTC, + "0xecA88125a5ADbe82614ffC12D0DB554E2e2867C8", // venusUSDC + "0xf508fCD89b8bd15579dc79A6827cB4686A3592c8", // venusETH + "0xfD5840Cd36d94D7229439859C0112a4185BC0255", // venusUSDT + "0xB248a295732e0225acd3337607cc01068e3b9c10", // venusXRP + "0x95c78222B3D6e262426483D42CfA53685A67Ab9D", // venusBUSD "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82", //cake "0xF4C8E32EaDEC4BFe97E0F595AdD0f4450a863a11", //thena "0x4338665CBB7B2485A8855A139b75D5e34AB0DB94", //ltc @@ -50,15 +56,6 @@ module.exports = treasuryExports({ "0x12f31B73D812C6Bb0d735a218c086d44D5fe5f89", //ageur ], owners: [venusTreasury], - ownTokens: [ - XVS, - venusBTC, - VAI, - "0xecA88125a5ADbe82614ffC12D0DB554E2e2867C8", // venusUSDC - "0xf508fCD89b8bd15579dc79A6827cB4686A3592c8", // venusETH - "0xfD5840Cd36d94D7229439859C0112a4185BC0255", // venusUSDT - "0xB248a295732e0225acd3337607cc01068e3b9c10", // venusXRP - "0x95c78222B3D6e262426483D42CfA53685A67Ab9D", // venusBUSD - ], + ownTokens: [XVS, VAI], }, }); From f6fb625fc4756d626edd288c2178e49fb4fb3b3a Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Sat, 13 Jul 2024 20:06:55 +0100 Subject: [PATCH 699/855] add binance-peg eth --- projects/treasury/venus.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/treasury/venus.js b/projects/treasury/venus.js index 8ef2368bb502..6eca2ac9fc3c 100644 --- a/projects/treasury/venus.js +++ b/projects/treasury/venus.js @@ -18,6 +18,7 @@ module.exports = treasuryExports({ ADDRESSES.bsc.BETH, //BETH ADDRESSES.bsc.WBNB, venusBTC, + "0x2170Ed0880ac9A755fd29B2688956BD959F933F8", //eth "0xecA88125a5ADbe82614ffC12D0DB554E2e2867C8", // venusUSDC "0xf508fCD89b8bd15579dc79A6827cB4686A3592c8", // venusETH "0xfD5840Cd36d94D7229439859C0112a4185BC0255", // venusUSDT From 5c84e10db01583b264742f6780fbd34daa3517f1 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Sat, 13 Jul 2024 20:18:38 +0100 Subject: [PATCH 700/855] add vbnb --- projects/treasury/venus.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/treasury/venus.js b/projects/treasury/venus.js index 6eca2ac9fc3c..2098881e8064 100644 --- a/projects/treasury/venus.js +++ b/projects/treasury/venus.js @@ -24,6 +24,7 @@ module.exports = treasuryExports({ "0xfD5840Cd36d94D7229439859C0112a4185BC0255", // venusUSDT "0xB248a295732e0225acd3337607cc01068e3b9c10", // venusXRP "0x95c78222B3D6e262426483D42CfA53685A67Ab9D", // venusBUSD + "0xA07c5b74C9B40447a954e1466938b865b6BBea36", // venusBNB "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82", //cake "0xF4C8E32EaDEC4BFe97E0F595AdD0f4450a863a11", //thena "0x4338665CBB7B2485A8855A139b75D5e34AB0DB94", //ltc From 6a51b695ce520984d0c1c15950fa78f034c55e3e Mon Sep 17 00:00:00 2001 From: hamur dev <122794657+tpktpj@users.noreply.github.com> Date: Sat, 13 Jul 2024 15:23:41 -0400 Subject: [PATCH 701/855] Add: Avalon bitlayer innovation market (#10979) Co-authored-by: jsmjsm --- projects/avalon-finance/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/avalon-finance/index.js b/projects/avalon-finance/index.js index e266be25e823..2e4399c8058d 100644 --- a/projects/avalon-finance/index.js +++ b/projects/avalon-finance/index.js @@ -13,7 +13,8 @@ const mainMarket = { } const innovativeMarket = { - merlin: aaveExports('', '0x91b212e9FaF20117Eae59d6289CB38749DDFc070', undefined, ['0x883cb2E2d9c5D4D9aF5b0d37fc39Fa2284405682'],{v3: true}), + merlin: aaveExports('', '0x91b212e9FaF20117Eae59d6289CB38749DDFc070', undefined, ['0x883cb2E2d9c5D4D9aF5b0d37fc39Fa2284405682'], { v3: true }), + btr: aaveExports('', '0x90EA8C92AddE4D3f323Dad9E36f0E0395dbc929d', undefined, ['0x4c25c261Fe47bC216113D140BaF72B05E151bcE4'], { v3: true }), } module.exports = mergeExports(mainMarket, innovativeMarket) From 8b6769318d35ca43e5950fe7602086fe50f7ef73 Mon Sep 17 00:00:00 2001 From: TsimakuridzeNikolozi <100114440+TsimakuridzeNikolozi@users.noreply.github.com> Date: Sat, 13 Jul 2024 23:24:02 +0400 Subject: [PATCH 702/855] Added USD0 token to registry (#10978) --- projects/hinkal/registryTokens.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/hinkal/registryTokens.js b/projects/hinkal/registryTokens.js index 97c239cdddd6..338d3f06a32e 100644 --- a/projects/hinkal/registryTokens.js +++ b/projects/hinkal/registryTokens.js @@ -251,6 +251,7 @@ const ETHEREUM_REGISTRY_TOKENS = [ ADDRESSES.ethereum.UNI, "0xEEda34A377dD0ca676b9511EE1324974fA8d980D", "0x0d86883faf4ffd7aeb116390af37746f45b6f378", + "0x73a15fed60bf67631dc6cd7bc5b6e8da8190acf5", ]; const ARBITRUM_REGISTRY_TOKENS = [ From 9c17e30b57889ba67ff47e410dbf2b9d3783ef12 Mon Sep 17 00:00:00 2001 From: bergben Date: Sat, 13 Jul 2024 21:26:48 +0200 Subject: [PATCH 703/855] Fluid: add arbitrum (#10975) * feat(fluid): add arbitrum * fix(fluid): update abi for different resolver versions --- projects/fluid/index.js | 101 ++++++++++++++++++++++++++++------------ 1 file changed, 72 insertions(+), 29 deletions(-) diff --git a/projects/fluid/index.js b/projects/fluid/index.js index e4505e99cbfa..1f4e067c8cc9 100644 --- a/projects/fluid/index.js +++ b/projects/fluid/index.js @@ -1,36 +1,79 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const methodologies = require("../helper/methodologies") +const ADDRESSES = require("../helper/coreAssets.json"); +const methodologies = require("../helper/methodologies"); const abi = { - "getOverallTokensData": "function getOverallTokensData(address[] tokens_) view returns ((uint256 borrowRate, uint256 supplyRate, uint256 fee, uint256 lastStoredUtilization, uint256 storageUpdateThreshold, uint256 lastUpdateTimestamp, uint256 supplyExchangePrice, uint256 borrowExchangePrice, uint256 supplyRawInterest, uint256 supplyInterestFree, uint256 borrowRawInterest, uint256 borrowInterestFree, uint256 totalSupply, uint256 totalBorrow, uint256 revenue, (uint256 version, (address token, uint256 kink, uint256 rateAtUtilizationZero, uint256 rateAtUtilizationKink, uint256 rateAtUtilizationMax) rateDataV1, (address token, uint256 kink1, uint256 kink2, uint256 rateAtUtilizationZero, uint256 rateAtUtilizationKink1, uint256 rateAtUtilizationKink2, uint256 rateAtUtilizationMax) rateDataV2) rateData)[] overallTokensData_)" -} + getOverallTokensDataLegacy: + "function getOverallTokensData(address[] tokens_) view returns ((uint256 borrowRate, uint256 supplyRate, uint256 fee, uint256 lastStoredUtilization, uint256 storageUpdateThreshold, uint256 lastUpdateTimestamp, uint256 supplyExchangePrice, uint256 borrowExchangePrice, uint256 supplyRawInterest, uint256 supplyInterestFree, uint256 borrowRawInterest, uint256 borrowInterestFree, uint256 totalSupply, uint256 totalBorrow, uint256 revenue, (uint256 version, (address token, uint256 kink, uint256 rateAtUtilizationZero, uint256 rateAtUtilizationKink, uint256 rateAtUtilizationMax) rateDataV1, (address token, uint256 kink1, uint256 kink2, uint256 rateAtUtilizationZero, uint256 rateAtUtilizationKink1, uint256 rateAtUtilizationKink2, uint256 rateAtUtilizationMax) rateDataV2) rateData)[] overallTokensData_)", + getOverallTokensData: + "function getOverallTokensData(address[] tokens_) view returns ((uint256 borrowRate, uint256 supplyRate, uint256 fee, uint256 lastStoredUtilization, uint256 storageUpdateThreshold, uint256 lastUpdateTimestamp, uint256 supplyExchangePrice, uint256 borrowExchangePrice, uint256 supplyRawInterest, uint256 supplyInterestFree, uint256 borrowRawInterest, uint256 borrowInterestFree, uint256 totalSupply, uint256 totalBorrow, uint256 revenue, uint256 maxUtilization, (uint256 version, (address token, uint256 kink, uint256 rateAtUtilizationZero, uint256 rateAtUtilizationKink, uint256 rateAtUtilizationMax) rateDataV1, (address token, uint256 kink1, uint256 kink2, uint256 rateAtUtilizationZero, uint256 rateAtUtilizationKink1, uint256 rateAtUtilizationKink2, uint256 rateAtUtilizationMax) rateDataV2) rateData)[] overallTokensData_)", +}; -module.exports = { - methodology: methodologies.lendingMarket, +const config = { + liquidity: "0x52aa899454998be5b000ad077a46bbe360f4e497", ethereum: { - tvl: async (api) => { - const tokens = await api.call({ target: "0x741c2Cd25f053a55fd94afF1afAEf146523E1249", abi: "function listedTokens() public view returns (address[] memory listedTokens_)" }) - api.add("0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee", await api.call({ - target: "0xF047ab4c75cebf0eB9ed34Ae2c186f3611aEAfa6", - abi: "function balance(address, address) public view returns (uint256 balance)", - params: ["0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee", "0x52aa899454998be5b000ad077a46bbe360f4e497"] - })) - return api.sumTokens({ - owner: "0x52aa899454998be5b000ad077a46bbe360f4e497", tokens: [ - ADDRESSES.null, - ...tokens.filter(t => t.toLowerCase() !== "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee") - ] - }) + liquidityResolver: (block) => { + if (block < 19992056) { + return "0x741c2Cd25f053a55fd94afF1afAEf146523E1249"; + } + return "0xD7588F6c99605Ab274C211a0AFeC60947668A8Cb"; }, - borrowed: async (api) => { - const fluidLiquidityResolver = "0x645C84DeA082328e456892D2E68d434b61AD7dBF"; - const tokens = await api.call({ - target: "0x741c2Cd25f053a55fd94afF1afAEf146523E1249", - abi: "function listedTokens() public view returns (address[] memory listedTokens_)", - }); + weETH: "0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee", + zircuit: "0xF047ab4c75cebf0eB9ed34Ae2c186f3611aEAfa6", + }, + arbitrum: { + liquidityResolver: (block) => "0x46859d33E662d4bF18eEED88f74C36256E606e44", + }, +}; - const borrowed = await api.call({ target: fluidLiquidityResolver, abi: abi.getOverallTokensData, params: [tokens], }) - api.add(tokens, borrowed.map(x => x.totalBorrow)); - }, +async function getListedTokens(api) { + return await api.call({ + target: config[api.chain].liquidityResolver(api.block), + abi: "function listedTokens() public view returns (address[] memory listedTokens_)", + }); +} + +async function tvl(api) { + const tokens = await getListedTokens(api); + const chain = api.chain; + + if (chain == "ethereum") { + // add WeETH deployed to Zircuit + api.add( + config.ethereum.weETH, + await api.call({ + target: config.ethereum.zircuit, + abi: "function balance(address, address) public view returns (uint256 balance)", + params: [config.ethereum.weETH, config.liquidity], + }) + ); } + + return api.sumTokens({ + owner: config.liquidity, + tokens: [ + ADDRESSES.null, + ...tokens.filter( + (t) => t.toLowerCase() !== "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" + ), + ], + }); +} + +async function borrowed(api) { + const tokens = await getListedTokens(api); + const borrowed = await api.call({ + target: config[api.chain].liquidityResolver(api.block), + abi: api.block < 19992056 ? abi.getOverallTokensDataLegacy : abi.getOverallTokensData, + params: [tokens], + }); + api.add( + tokens, + borrowed.map((x) => x.totalBorrow) + ); } -// node test.js projects/fluid/index.js \ No newline at end of file + +module.exports = { + methodology: methodologies.lendingMarket, + ethereum: { tvl, borrowed }, + arbitrum: { tvl, borrowed }, +}; +// node test.js projects/fluid/index.js From b59a007f9ba1c0bf20f14a8cc4a6392e7989e643 Mon Sep 17 00:00:00 2001 From: Jatin Jain Date: Sun, 14 Jul 2024 21:08:23 +0530 Subject: [PATCH 704/855] Renzo pzeth tvl tracking (#10982) * add: base tracker for ezETH * add: pzeth tvl tracking on mainnet --- projects/renzo/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/renzo/index.js b/projects/renzo/index.js index 74f234f11f32..94b80e7611f8 100644 --- a/projects/renzo/index.js +++ b/projects/renzo/index.js @@ -2,6 +2,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const L1_EZ_ETH_ADDRESS = "0xbf5495Efe5DB9ce00f80364C8B423567e58d2110"; const L2_EZ_ETH_ADDRESS = ADDRESSES.blast.ezETH; const L1_LOCKBOX_ADDRESS = "0xC8140dA31E6bCa19b287cC35531c2212763C2059"; +const L1_PZ_ETH_ADDRESS = "0x8c9532a60E0E7C6BbD2B2c1303F63aCE1c3E9811"; async function L2Tvl(api) { return { @@ -12,7 +13,9 @@ async function L2Tvl(api) { async function ethTvl(api) { const totalTvl = await api.call({ target: L1_EZ_ETH_ADDRESS, abi: "erc20:totalSupply" }); const lockBoxBalance = await api.call({ target: L1_EZ_ETH_ADDRESS, abi: "erc20:balanceOf", params: [L1_LOCKBOX_ADDRESS] }) - api.add(L1_EZ_ETH_ADDRESS, totalTvl - lockBoxBalance) + const pzEthBalance = await api.call({target: L1_PZ_ETH_ADDRESS, abi: "erc20:totalSupply"}); + api.add(L1_EZ_ETH_ADDRESS, totalTvl - lockBoxBalance); + api.add(L1_PZ_ETH_ADDRESS, pzEthBalance); } const chains = ["mode", "blast", "bsc", "linea", "arbitrum", "base"] From 6699a17c4dd2cfcc31be34e5e4fbf8d1ca32ad38 Mon Sep 17 00:00:00 2001 From: Ss5h Date: Mon, 15 Jul 2024 16:42:58 +0900 Subject: [PATCH 705/855] add pool, update bitcoinusd (#10986) --- projects/everdex/index.js | 4 ++++ projects/helper/coreAssets.json | 3 ++- projects/helper/tokenMapping.js | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/projects/everdex/index.js b/projects/everdex/index.js index c412a4a9f8fb..cf025fc2d024 100644 --- a/projects/everdex/index.js +++ b/projects/everdex/index.js @@ -11,6 +11,10 @@ const tokensAndOwners = [ [ADDRESSES.bfc.UnifiedDAI, '0xa455434802d8B530C77d2B7547eF93C798896581'], [ADDRESSES.bfc.UnifiedUSDC, '0xa455434802d8B530C77d2B7547eF93C798896581'], [ADDRESSES.bfc.UnifiedUSDT, '0xa455434802d8B530C77d2B7547eF93C798896581'], + + // BitcoinUSD - USDC Pool + [ADDRESSES.bfc.BitcoinUSD, '0x840Cf4522ED96CBBEB0924672Ea170456eea3a4c'], + [ADDRESSES.bfc.UnifiedUSDC, '0x840Cf4522ED96CBBEB0924672Ea170456eea3a4c'] ] async function tvl() { diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index cceb218cda6b..d3d542f58c67 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1570,7 +1570,8 @@ "SAT": "0x17102AC78a02a98fC78B0c29B7b0506f035A99E5", "BIFI": "0x047938C3aD13c1eB821C8e310B2B6F889b6d0003", "WBTC": "0x7b8FAC5F29E101BaaB33c5f9c39d4F85ba2cc7C1", - "BTCB": "0xd267F821F1b8344B5A63626c8c824697194A173E" + "BTCB": "0xd267F821F1b8344B5A63626c8c824697194A173E", + "BitcoinUSD": "0x6906Ccda405926FC3f04240187dd4fAd5DF6d555" }, "scroll": { "WETH": "0x5300000000000000000000000000000000000004", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 2aeabf75243d..a61ff4c5e8e7 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -49,6 +49,9 @@ const fixBalancesTokens = { '0xaec9e50e3397f9ddc635c6c429c8c7eca418a143': { coingeckoId: 'arcana-2', decimals: 18 }, '0xce1581d7b4ba40176f0e219b2cac30088ad50c7a': { coingeckoId: 'pearl', decimals: 18 }, }, + bfc: { + '0x6906Ccda405926FC3f04240187dd4fAd5DF6d555': { coingeckoId: "bitcoin-usd-btcfi", decimals: 18, }, + }, } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) From b7bf03ef6c09542cf1b4d83cc5fd66b57bc3b2bd Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Mon, 15 Jul 2024 10:12:10 +0100 Subject: [PATCH 706/855] add bybit wallet (#10987) --- projects/bybit/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/bybit/index.js b/projects/bybit/index.js index 401232ace72b..dfbdf54ffa97 100644 --- a/projects/bybit/index.js +++ b/projects/bybit/index.js @@ -16,7 +16,9 @@ const config = { 'bc1q9w4g79ndel72lygvwtqzem67z6uqv4yncvqjz3yn8my9swnwflxsutg4cx', 'bc1qjysjfd9t9aspttpjqzv68k0ydpe7pvyd5vlyn37868473lell5tqkz456m', '1GrwDkr33gT6LuumniYjKEGjTLhsL5kmqC', - 'bc1qs5vdqkusz4v7qac8ynx0vt9jrekwuupx2fl5udp9jql3sr03z3gsr2mf0f' + 'bc1qs5vdqkusz4v7qac8ynx0vt9jrekwuupx2fl5udp9jql3sr03z3gsr2mf0f', + // added on the 15th of july 2024. + 'bc1qa2eu6p5rl9255e3xz7fcgm6snn4wl5kdfh7zpt05qp5fad9dmsys0qjg0e' ] }, bsc: { From 70be5152a44624ebf74447b179a6b265d1484048 Mon Sep 17 00:00:00 2001 From: Lor3mipsvm <52577544+Lor3mipsvm@users.noreply.github.com> Date: Mon, 15 Jul 2024 10:17:24 +0100 Subject: [PATCH 707/855] add eclp factory on gnosis chain (#10974) * add eclp factory on gnosis chain * updated chain name from gnosis to xdai --- projects/gyroscope/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/gyroscope/index.js b/projects/gyroscope/index.js index fa3a803dc369..39e7a22c3d2d 100644 --- a/projects/gyroscope/index.js +++ b/projects/gyroscope/index.js @@ -93,6 +93,13 @@ const config = { fromBlock: 5147666, }, ], + xdai: [ + { + name: "Gyro E-CLP V2 Factory", + factory: "0x5d3Be8aaE57bf0D1986Ff7766cC9607B6cC99b89", + fromBlock: 33759936, + }, + ], }; Object.keys(config).forEach((chain) => { From 435c9bbcab1120c9d1757a4f21e4487699e5898c Mon Sep 17 00:00:00 2001 From: Tuba Terminator Date: Mon, 15 Jul 2024 14:49:56 +0530 Subject: [PATCH 708/855] Added Powercity Flex Protocol on Pulsechain (#10976) --- projects/flex-powercity-io/index.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 projects/flex-powercity-io/index.js diff --git a/projects/flex-powercity-io/index.js b/projects/flex-powercity-io/index.js new file mode 100644 index 000000000000..6e6c7f8899a3 --- /dev/null +++ b/projects/flex-powercity-io/index.js @@ -0,0 +1,28 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getLiquityTvl } = require("../helper/liquity.js"); +const { sumTokensExport } = require("../helper/unknownTokens.js"); + +// TroveManager holds total system collateral (deposited HEX) +const TROVE_MANAGER_ADDRESS = "0xC2D0720721d48cE85e20Dc9E01B8449D7eDd14CE"; +const HEX_ADDRESS = ADDRESSES.pulse.HEX; + +// Staking holds LQTY tokens and receive share of protocol revenue +const STAKING_ADDRESS = "0xCeC2c718ceFdb3A515D3CC22e430b46933922CE4"; +const FLEX_ADDRESS = "0x9c6fA17D92898B684676993828143596894AA2A6"; + +const HEXDC_FARMING_ADDRESS = "0x63D134B47692d154C78053117D803e22cB1F7593"; +const LP_HEXDC_HEX_ADDRESS = "0x9756F095DfA27D4c2EAE0937a7b8a6603D99Affb"; + +const FLEX_FARMING_ADDRESS = "0x74F8A9dFefe855Dc97a4A4962b7c6cEc074aED62"; +const LP_FLEX_HEX_ADDRESS = "0x476d63aB94B4E86614Df0C3D5A27E9e22631D062"; +const lps = [LP_HEXDC_HEX_ADDRESS, LP_FLEX_HEX_ADDRESS] + +module.exports = { + start: 1714534195, + methodology: "Total Value Locked includes all Troves, Stability Pool, Staking Pool and LP Farming Pools", + pulse: { + tvl: getLiquityTvl(TROVE_MANAGER_ADDRESS, { collateralToken: HEX_ADDRESS }), + staking: sumTokensExport({ owner: STAKING_ADDRESS, tokens: [FLEX_ADDRESS], lps, useDefaultCoreAssets: true, }), + pool2: sumTokensExport({ owners: [HEXDC_FARMING_ADDRESS, FLEX_FARMING_ADDRESS], tokens: lps, useDefaultCoreAssets: true, }), + } +} \ No newline at end of file From 2cd190d5f32a6c3abb002cdc9331ca622fe8b8e0 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 15 Jul 2024 13:14:29 +0300 Subject: [PATCH 709/855] yel: track blast (#10977) --- projects/helper/cache/sumUnknownTokens.js | 3 + projects/yel/Helpers/Result.js | 23 --- projects/yel/Providers/Base/LP.js | 122 ------------ projects/yel/Providers/YelEnhancedLpFarm.js | 56 ------ .../yel/Providers/YelEnhancedSingleStake.js | 25 --- projects/yel/Providers/YelLPFarm.js | 55 ------ projects/yel/Providers/YelSingleStaking.js | 16 -- projects/yel/config/abi.json | 11 -- projects/yel/config/addresses.json | 42 ---- projects/yel/index.js | 186 ++++++------------ 10 files changed, 58 insertions(+), 481 deletions(-) delete mode 100644 projects/yel/Helpers/Result.js delete mode 100644 projects/yel/Providers/Base/LP.js delete mode 100644 projects/yel/Providers/YelEnhancedLpFarm.js delete mode 100644 projects/yel/Providers/YelEnhancedSingleStake.js delete mode 100644 projects/yel/Providers/YelLPFarm.js delete mode 100644 projects/yel/Providers/YelSingleStaking.js delete mode 100644 projects/yel/config/abi.json delete mode 100644 projects/yel/config/addresses.json diff --git a/projects/helper/cache/sumUnknownTokens.js b/projects/helper/cache/sumUnknownTokens.js index c3cdbfcdce95..b23f98858d50 100644 --- a/projects/helper/cache/sumUnknownTokens.js +++ b/projects/helper/cache/sumUnknownTokens.js @@ -365,6 +365,7 @@ async function getTokenPrices({ async function sumUnknownTokens({ api, tokensAndOwners = [], balances, coreAssets = [], owner, tokens, chain = 'ethereum', block, restrictTokenRatio, blacklist = [], skipConversion = false, onlyLPs, minLPRatio, log_coreAssetPrices = [], log_minTokenValue = 1e6, owners = [], lps = [], useDefaultCoreAssets = false, cache = {}, resolveLP = false, abis, + ownerTokens, }) { if (api) { chain = api.chain ?? chain @@ -381,6 +382,8 @@ async function sumUnknownTokens({ api, tokensAndOwners = [], balances, tokensAndOwners = owners.map(o => tokens.map(t => [t, o])).flat() else if (owner) tokensAndOwners = tokens.map(t => [t, owner]) + else if (ownerTokens.length) + ownerTokens.forEach(([tokens, owner]) => tokens.forEach(i => tokensAndOwners.push([i, owner]))) tokensAndOwners = tokensAndOwners.filter(t => !blacklist.includes(t[0])) await sumTokens2({ api, balances, chain, block, tokensAndOwners, skipFixBalances: true, resolveLP, abis }) const { updateBalances, } = await getTokenPrices({ cache, coreAssets, lps: [...tokensAndOwners.map(t => t[0]), ...lps,], chain, block, restrictTokenRatio, blacklist, log_coreAssetPrices, log_minTokenValue, minLPRatio, abis, }) diff --git a/projects/yel/Helpers/Result.js b/projects/yel/Helpers/Result.js deleted file mode 100644 index 3fe155707387..000000000000 --- a/projects/yel/Helpers/Result.js +++ /dev/null @@ -1,23 +0,0 @@ -const BigNumber = require("bignumber.js"); -module.exports = class Result { - constructor(obj) { - this.result = obj; - } - - append(obj) { - for (const key in obj) { - if (this.result.hasOwnProperty(key)) { - BigNumber.config({EXPONENTIAL_AT: 100}); - const sum = (new BigNumber(this.result[key])).plus(new BigNumber(obj[key])); - this.result[key] = sum.valueOf(); - } else { - this.result[key] = obj[key]; - } - } - return this; - } - - render() { - return this.result; - } -} diff --git a/projects/yel/Providers/Base/LP.js b/projects/yel/Providers/Base/LP.js deleted file mode 100644 index 4a827a67e9e9..000000000000 --- a/projects/yel/Providers/Base/LP.js +++ /dev/null @@ -1,122 +0,0 @@ -const sdk = require("@defillama/sdk"); -const abi = require("../../config/abi.json"); -const addr = require("../../config/addresses.json"); -const BigNumber = require("bignumber.js"); - -module.exports = class LP { - /** - * @type {"bsc"|"fantom"|"polygon"|"ethereum"} - */ - - - constructor(lpFarmingContract, network) { - this.network = "ethereum"; - this.lpFarmingContract = ""; - this.totalAmount1 = 0; - this.totalAmount0 = 0; - this.lpTokenContract = ""; - this.lpToken1 = ""; - this.lpToken0 = ""; - this.lpTotalSupply = 0; - this.fraction1 = 1; - this.fraction0 = 1; - this.totalLockedLPs = 0; - this.token1InLP = 0; - this.token0InLP = 0; - this.network = network; - this.lpFarmingContract = lpFarmingContract; - } - - async getTokensAmountInLp() { - try { - const resp = await sdk.api.abi.call({ - abi: abi.getReserves, - chain: this.network, - target: this.lpTokenContract, - }); - this.totalAmount1 = resp.output[1]; - this.totalAmount0 = resp.output[0]; - } catch (e) { - console.warn(e); - } - } - - /** - * @param {1|0}index - */ - async getLpToken(index) { - const execAbi = index === 1 ? abi.externalFarming.token1 : abi.externalFarming.token0; - try { - const resp = await sdk.api.abi.call({ - abi: execAbi, - chain: this.network, - target: this.lpTokenContract, - }); - let tokenAddr = resp.output - if (resp.output.toLocaleLowerCase() === addr.tokens.bsc.yel) { - tokenAddr = addr.tokens.ethereum.yel; - } - if (index === 0) { - this.lpToken0 = tokenAddr; - } else { - this.lpToken1 = tokenAddr; - } - } catch (e) { - console.warn(e); - } - } - - async getLPTotalSupply() { - try { - const resp = await sdk.api.abi.call({ - abi: abi.externalFarming.totalSupply, - chain: this.network, - target: this.lpTokenContract, - }); - this.lpTotalSupply = resp.output; - } catch (e) { - console.warn(e); - } - return this; - } - - getCoefToken0ToToken1() { - BigNumber.config({ EXPONENTIAL_AT: 100 }); - this.fraction1 = new BigNumber(this.totalAmount1).div(this.lpTotalSupply).toNumber(); - this.fraction0 = new BigNumber(this.totalAmount0).div(this.lpTotalSupply).toNumber(); - } - - getTotalLockedTokens() { - BigNumber.config({ EXPONENTIAL_AT: 100 }); - this.token1InLP = new BigNumber(this.totalLockedLPs) - .multipliedBy(new BigNumber(this.fraction1)) - .toFixed(0); - this.token0InLP = new BigNumber(this.totalLockedLPs) - .multipliedBy(new BigNumber(this.fraction0)) - .toFixed(0); - } - - async calculateTokensLocked() { - await this.getTokensAmountInLp(); - await Promise.all([ - this.getLpToken(1), - this.getLpToken(0) - ]) - await this.getLPTotalSupply(); - this.getCoefToken0ToToken1(); - this.getTotalLockedTokens(); - } - - getLockedTokens() { - const prefix = this.network === "ethereum" ? "" : this.network + ":"; - const result = {}; - - if (this.lpToken0.toLocaleLowerCase() !== addr.tokens.ethereum.yel.toLocaleLowerCase()) { - result[prefix + this.lpToken0] = this.token0InLP; - } - if (this.lpToken1.toLocaleLowerCase() !== addr.tokens.ethereum.yel.toLocaleLowerCase()) { - result[prefix + this.lpToken1] = this.token1InLP; - } - return result - } -} diff --git a/projects/yel/Providers/YelEnhancedLpFarm.js b/projects/yel/Providers/YelEnhancedLpFarm.js deleted file mode 100644 index 5ab3a790c448..000000000000 --- a/projects/yel/Providers/YelEnhancedLpFarm.js +++ /dev/null @@ -1,56 +0,0 @@ -const LP = require("./Base/LP"); -const sdk = require("@defillama/sdk"); -const abi = require("../config/abi.json"); - -module.exports = class YelEnhancedLpFarm extends LP { - constructor(farmingContract, network) { - super(farmingContract, network); - } - - async getLPTokenAddress() { - try { - const resp = await sdk.api.abi.call({ - abi: abi.externalFarming.lpToken, - chain: this.network, - target: this.lpFarmingContract, - }); - this.lpTokenContract = resp.output; - } catch (e) { - console.warn(e); - } - return this; - } - - async getLPTotalCount() { - try { - const resp = await sdk.api.abi.call({ - abi: abi.externalFarming.totalLP, - chain: this.network, - target: this.lpFarmingContract, - }); - this.totalLockedLPs = resp.output; - } catch (e) { - console.warn(e); - } - } - - async unwrap() { - await this.getLPTokenAddress(); - await this.getLPTotalCount(); - await this.calculateTokensLocked(); - } - - getTokensInLP() { - const prefix = this.network === "ethereum" ? "" : this.network+":" - return { - [prefix+this.lpToken0]: this.token0InLP, - [prefix+this.lpToken1]: this.token1InLP, - } - } - - static async tokensInLP(contract, network) { - const obj = new YelEnhancedLpFarm(contract, network) - await obj.unwrap(); - return obj.getTokensInLP(); - } -} diff --git a/projects/yel/Providers/YelEnhancedSingleStake.js b/projects/yel/Providers/YelEnhancedSingleStake.js deleted file mode 100644 index 644e344ab272..000000000000 --- a/projects/yel/Providers/YelEnhancedSingleStake.js +++ /dev/null @@ -1,25 +0,0 @@ -const sdk = require("@defillama/sdk"); -const abi = require("../config/abi.json"); - -module.exports = class YelEnhancedSingleStake { - static async getStakedTokens(contractAddress, network, key) { - key = key || 'stakingTokenTotalAmount'; - try { - const resp = await sdk.api.abi.call({ - abi: abi.poolInfo, - params: [0], - chain: network, - target: contractAddress, - }); - const staked = resp.output[key]; - const token = resp.output['stakingToken']; - const prefix = network === "ethereum" ? "" : network+":" - return { - [prefix + token] : staked - } - } catch (e) { - console.warn(e); - return {}; - } - } -} diff --git a/projects/yel/Providers/YelLPFarm.js b/projects/yel/Providers/YelLPFarm.js deleted file mode 100644 index d75fbec14934..000000000000 --- a/projects/yel/Providers/YelLPFarm.js +++ /dev/null @@ -1,55 +0,0 @@ -const sdk = require("@defillama/sdk"); -const abi = require("../config/abi.json"); -const LP = require("./Base/LP"); -const addr = require("../config/addresses.json"); - - -module.exports = class YelLPFarm extends LP { - constructor(farmingContract, network) { - super(farmingContract, network); - } - - async getPoolInfo() { - try { - const resp = await sdk.api.abi.call({ - abi: abi.poolInfo, - chain: this.network, - params: [1], - target: this.lpFarmingContract, - }); - this.totalLockedLPs = resp.output[1]; - this.lpTokenContract = resp.output[0]; - } catch (e) { - console.warn(e); - } - } - - async unwrap() { - await this.getPoolInfo(); - await this.calculateTokensLocked(); - } - - async getLockedYel() { - const result = {}; - - if (this.lpToken0.toLocaleLowerCase() === addr.tokens.ethereum.yel.toLocaleLowerCase()) { - result[this.lpToken0] = this.token0InLP; - } - if (this.lpToken1.toLocaleLowerCase() === addr.tokens.ethereum.yel.toLocaleLowerCase()) { - result[this.lpToken1] = this.token1InLP; - } - return result - } - - static async nonYELTokensInLP(contract, network) { - const obj = new YelLPFarm(contract, network) - await obj.unwrap(); - return obj.getLockedTokens(); - } - - static async yelTokensInLp(contract, network) { - const obj = new YelLPFarm(contract, network) - await obj.unwrap(); - return obj.getLockedYel(); - } -} diff --git a/projects/yel/Providers/YelSingleStaking.js b/projects/yel/Providers/YelSingleStaking.js deleted file mode 100644 index c12c803cc97a..000000000000 --- a/projects/yel/Providers/YelSingleStaking.js +++ /dev/null @@ -1,16 +0,0 @@ -const sdk = require("@defillama/sdk"); -const abi = require("../config/abi.json"); -const addr = require("../config/addresses.json") -module.exports = class YelSingleStaking { - static async getStakedYel(farmingContract, network) { - const resp = await sdk.api.abi.call({ - abi: abi.poolInfo, - chain: network, - params: [0], - target: farmingContract, - }) - return { - [addr.tokens.ethereum.yel]: resp.output[1] - } - } -} diff --git a/projects/yel/config/abi.json b/projects/yel/config/abi.json deleted file mode 100644 index e3893b937aaf..000000000000 --- a/projects/yel/config/abi.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "getReserves": "function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)", - "poolInfo": "function poolInfo(uint256) view returns (address stakingToken, uint256 stakingTokenTotalAmount, uint256 accYelPerShare, uint32 lastRewardTime, uint16 allocPoint)", - "externalFarming": { - "totalLP": "uint256:totalLP", - "lpToken": "address:lpToken", - "token1": "address:token1", - "token0": "address:token0", - "totalSupply": "uint256:totalSupply" - } -} \ No newline at end of file diff --git a/projects/yel/config/addresses.json b/projects/yel/config/addresses.json deleted file mode 100644 index b36487349ef3..000000000000 --- a/projects/yel/config/addresses.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "tokens": { - "ethereum" : { - "weth": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "ifarm" : "0x1571ed0bed4d987fe2b498ddbae7dfa19519f651", - "yel": "0x7815bDa662050D84718B988735218CFfd32f75ea" - }, - "bsc" : { - "wbnb" : "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", - "yel": "0xd3b71117e6c1558c1553305b44988cd944e97300" - }, - "fantom" : { - "wftm" : "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", - "yel": "0xd3b71117e6c1558c1553305b44988cd944e97300" - }, - "polygon" : { - "wmatic" : "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", - "yel": "0xd3b71117e6c1558c1553305b44988cd944e97300" - } - }, - "yelFarmingContract" : { - "ethereum" : "0xe7c8477C0c7AAaD6106EBDbbED3a5a2665b273b9", - "bsc" : "0x954b15065e4FA1243Cd45a020766511b68Ea9b6E", - "fantom" : "0x954b15065e4FA1243Cd45a020766511b68Ea9b6E", - "polygon" : "0x954b15065e4FA1243Cd45a020766511b68Ea9b6E" - }, - "yelEnhancedPools" : { - "ethereum": { - "ifarm": "0x5dD8532613B9a6162BA795208D1A01613df26dc5" - }, - "bsc": { - "bnbBanana": "0x660f09cF84F8f366Bc653942b54B114d0Ec9E8a2" - }, - "fantom": { - "ftmBoo": "0x61EB6f6bC4Ec28203e9973B44967dA263B3Ec0e3", - "anySwap": "0x3a6eE00959751A1981D731a5aC15B660a9a8BAd4" - }, - "polygon" : { - "dQuick" : "0x0379C1BbE394f835366D2EFDBf2AF09fBa0689A4" - } - } -} diff --git a/projects/yel/index.js b/projects/yel/index.js index c2fee76ff28f..2b470a01b09d 100644 --- a/projects/yel/index.js +++ b/projects/yel/index.js @@ -1,134 +1,58 @@ -const sdk = require("@defillama/sdk"); -const Result = require("./Helpers/Result"); -const YelLPFarm = require("./Providers/YelLPFarm"); -const addr = require("./config/addresses.json"); -const YelEnhancedLpFarm = require("./Providers/YelEnhancedLpFarm"); -const YelSingleStaking = require("./Providers/YelSingleStaking"); -const YelEnhancedSingleStake = require("./Providers/YelEnhancedSingleStake"); - -async function ethereumStaking() { - const [ - ifarmEnhanced, - yelSSEth, - ] = await Promise.all([ - YelEnhancedSingleStake.getStakedTokens(addr.yelEnhancedPools.ethereum.ifarm, 'ethereum'), - YelSingleStaking.getStakedYel(addr.yelFarmingContract.ethereum, 'ethereum'), - ]) - return (new Result(ifarmEnhanced)) - .append(yelSSEth) - .render(); -} - -async function bscStaking() { - return await YelSingleStaking.getStakedYel(addr.yelFarmingContract.bsc, 'bsc'); -} - -async function ftmStaking() { - const [ - anySwap, - yelSSFantom - ] = await Promise.all([ - YelEnhancedSingleStake.getStakedTokens(addr.yelEnhancedPools.fantom.anySwap, 'fantom', 2), - YelSingleStaking.getStakedYel(addr.yelFarmingContract.fantom, 'fantom'), - ]) - return (new Result(anySwap)) - .append(yelSSFantom) - .render(); -} - -async function maticStaking() { - const [ - yelInLpPolygon, - dQuick - ] = await Promise.all([ - YelEnhancedSingleStake.getStakedTokens(addr.yelEnhancedPools.polygon.dQuick, 'polygon', 2), - YelSingleStaking.getStakedYel(addr.yelFarmingContract.polygon, 'polygon'), - ]) - return (new Result(dQuick)) - .append(yelInLpPolygon) - .render(); -} - -async function ethereumPool2() { - const [ - yelInLpEth, - wethInLp, - ] = await Promise.all([ - YelLPFarm.yelTokensInLp(addr.yelFarmingContract.ethereum, 'ethereum'), - YelLPFarm.nonYELTokensInLP(addr.yelFarmingContract.ethereum, 'ethereum'), - ]) - return (new Result(yelInLpEth)) - .append(wethInLp) - .render(); -} - -async function bscPool2() { - const [ - bnbInYel, - yelInLpBsc, - bananaBnb, - ] = await Promise.all([ - YelLPFarm.nonYELTokensInLP(addr.yelFarmingContract.bsc, 'bsc'), - YelLPFarm.yelTokensInLp(addr.yelFarmingContract.bsc, 'bsc'), - YelEnhancedLpFarm.tokensInLP(addr.yelEnhancedPools.bsc.bnbBanana, 'bsc'), - ]) - return (new Result(bnbInYel)) - .append(bananaBnb) - .append(yelInLpBsc) - .render(); -} - -async function ftmPool2() { - const [ - ftmInYel, - yelInLpFantom, - ftmBoo, - ] = await Promise.all([ - YelLPFarm.nonYELTokensInLP(addr.yelFarmingContract.fantom, 'fantom'), - YelLPFarm.yelTokensInLp(addr.yelFarmingContract.fantom, 'fantom'), - YelEnhancedLpFarm.tokensInLP(addr.yelEnhancedPools.fantom.ftmBoo, 'fantom') - ]) - return (new Result(ftmInYel)) - .append(ftmBoo) - .append(yelInLpFantom) - .render(); -} - -async function maticPool2() { - const [ - maticInYel, - yelInLpPolygon, - ] = await Promise.all([ - YelLPFarm.nonYELTokensInLP(addr.yelFarmingContract.polygon, 'polygon'), - YelLPFarm.yelTokensInLp(addr.yelFarmingContract.polygon, 'polygon'), - ]) - return (new Result(maticInYel)) - .append(yelInLpPolygon) - .render(); -} - -async function tvl() { - return {}; -} - -module.exports = { - ethereum: { - staking: ethereumStaking, - pool2: ethereumPool2, - tvl, - }, - bsc: { - staking: bscStaking, - pool2: ethereumPool2 +const { sumUnknownTokens } = require('../helper/unknownTokens') +const { sumTokens2 } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') + +const config = { + ethereum: { + farms: ['0x5dD8532613B9a6162BA795208D1A01613df26dc5', '0xe7c8477C0c7AAaD6106EBDbbED3a5a2665b273b9'], lps: ['0xc83ce8612164ef7a13d17ddea4271dd8e8eebe5d'], ownTokens: ['0x7815bDa662050D84718B988735218CFfd32f75ea'] + }, + bsc: { + farms: ['0x954b15065e4FA1243Cd45a020766511b68Ea9b6E',], lps: ['0xa5ac78a856345ab1fc8a4550208f42ca34b54e56', '0x8290d3CA64f712de9FB7220353dAa55bf388F3A3'], ownTokens: ['0xd3b71117e6c1558c1553305b44988cd944e97300'] + }, + fantom: { + farms: ['0x954b15065e4FA1243Cd45a020766511b68Ea9b6E', '0x3a6eE00959751A1981D731a5aC15B660a9a8BAd4'], lps: ['0x8BFf7b8B6a14e576a3634d6c0466A19A6E9b170a'], ownTokens: ['0xd3b71117e6c1558c1553305b44988cd944e97300'] + }, + polygon: { + farms: ['0x954b15065e4FA1243Cd45a020766511b68Ea9b6E', '0x0379C1BbE394f835366D2EFDBf2AF09fBa0689A4'], lps: ['0x8bAb87ECF28Bf45507Bd745bc70532e968b5c2De'], ownTokens: ['0xd3b71117e6c1558c1553305b44988cd944e97300'] + }, + blast: { + ownTokensAndOwners: [['0x949185D3BE66775Ea648F4a306740EA9eFF9C567', '0x7d2f5881F0C4B840fcFA2c49F4052d1A004eAf0d']], + tokensAndOwners: [ + [ADDRESSES.blast.WETH, '0x795a85CD543D0E2d29F7e11e33a20a38A4b5121e'], + [ADDRESSES.blast.BLAST, '0x7D8490333315EaAa5e93F3C6983d1e8128D7f50f'], + ], + } +} + +Object.keys(config).forEach(chain => { + const { farms = [], lps = [], ownTokens = [], ownTokensAndOwners, tokensAndOwners, } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + if (api.chain === 'bsc') { + const lpStaked = await api.call({ abi: 'uint256:totalLP', target: '0x660f09cF84F8f366Bc653942b54B114d0Ec9E8a2' }) + api.add('0xF65C1C0478eFDe3c19b49EcBE7ACc57BB6B1D713', lpStaked) + } else if (api.chain === 'fantom') { + const lpStaked = await api.call({ abi: 'uint256:totalLP', target: '0x61EB6f6bC4Ec28203e9973B44967dA263B3Ec0e3' }) + api.add('0xEc7178F4C41f346b2721907F5cF7628E388A7a58', lpStaked) + } + if (farms.length) { + const res = await api.fetchList({ lengthAbi: 'poolLength', itemAbi: 'function poolInfo(uint256) view returns (address stakingToken, uint256, uint256, uint32, uint16)', calls: farms, groupedByInput: true }) + const ownerTokens = res.map((r, i) => ([r.map(i => i.stakingToken), farms[i]])) + await sumTokens2({ api, ownerTokens, blacklistedTokens: [...lps, ...ownTokens], resolveLP: true, }) + } + + if (tokensAndOwners) return api.sumTokens({ tokensAndOwners }) }, - fantom: { - staking: ftmStaking, - pool2: ftmPool2 + pool2: async (api) => { + if (farms.length && lps.length) + await sumUnknownTokens({ api, owners: farms, tokens: lps, resolveLP: true, useDefaultCoreAssets: true, lps, }) + }, - polygon: { - staking: maticStaking, - pool2: maticPool2 + staking: async (api) => { + if (farms.length && ownTokens.length) + await sumUnknownTokens({ api, owners: farms, tokens: ownTokens, useDefaultCoreAssets: true, lps, }) + + if (ownTokensAndOwners) return api.sumTokens({ tokensAndOwners: ownTokensAndOwners }) }, - methodology: "TVL is accounted from YEL liquidity mining farms, enhanced pools, partner farms and other protocols. Basically, that’s all the funds held at YEL Finance smart-contracts.", -}; -// node test.js projects/yel/index.js \ No newline at end of file + } +}) \ No newline at end of file From d77e2f97ae17de8d8b04e960d9ca674dc395101e Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Mon, 15 Jul 2024 14:14:12 +0200 Subject: [PATCH 710/855] add Usual (RWA) (#10973) * add Usual (RWA) * minor fix --------- Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/usual/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/usual/index.js diff --git a/projects/usual/index.js b/projects/usual/index.js new file mode 100644 index 000000000000..6d5c7e3c2aaa --- /dev/null +++ b/projects/usual/index.js @@ -0,0 +1,12 @@ + +const { sumTokensExport } = require('../helper/unwrapLPs') + +const USYC = '0x136471a34f6ef19fe571effc1ca711fdb8e49f2b' +const treasury = '0xdd82875f0840AAD58a455A70B88eEd9F59ceC7c7' + +module.exports = { + methodology: 'TVL represents the value in RWA held by the protocol', + ethereum: { + tvl: sumTokensExport({ token: USYC, owner: treasury}) + } +} \ No newline at end of file From 2b92ab06b791a01efe9e59e858cbdaebacae2656 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 15 Jul 2024 15:14:35 +0300 Subject: [PATCH 711/855] Kawa (#10991) * kawa adapters * minor fix --------- Co-authored-by: carrion --- projects/kawa/index.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 projects/kawa/index.js diff --git a/projects/kawa/index.js b/projects/kawa/index.js new file mode 100644 index 000000000000..37def13d6d68 --- /dev/null +++ b/projects/kawa/index.js @@ -0,0 +1,5 @@ +const { compoundExports2 } = require('../helper/compound'); + +module.exports = { + sei: compoundExports2({ comptroller: '0xD527237E176647cbF8A7c7bCeFEfBf9130Bec948', cether: '0x20E56093357d91Ce85B0E3c2f0E4bdc676E94eDB', }) +} \ No newline at end of file From 15c867468c55e1b3d06b3ef1f576ad07caf260df Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 15 Jul 2024 15:16:34 +0300 Subject: [PATCH 712/855] Kosmos (#10990) * Add Kosmos marketplace as part of Star-fleet ecosystem project based on AirDAO Network * code refactor * Update coreAssets.json --------- Co-authored-by: Andrii Rozinko --- projects/helper/coreAssets.json | 5 +++-- projects/helper/tokenMapping.js | 4 ++++ projects/kosmos/index.js | 11 +++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 projects/kosmos/index.js diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index d3d542f58c67..229aa720c8e0 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1639,7 +1639,8 @@ }, "airdao": { "SAMB": "0x2b2d892c3fe2b4113dd7ac0d2c1882af202fb28f", - "BUSD": "0x7a477aa8ed4884509387dba81ba6f2b7c97597e2" + "BUSD": "0x7a477aa8ed4884509387dba81ba6f2b7c97597e2", + "USDC": "0xFF9F502976E7bD2b4901aD7Dd1131Bb81E5567de" }, "acala": { "DOT": "0x0000000000000000000100000000000000000002", @@ -1855,4 +1856,4 @@ "WETH": "0xf037540e51d71b2d2b1120e8432ba49f29edfbd0", "USDC.e": "0xfbda5f676cb37624f28265a144a48b0d6e87d3b6" } -} \ No newline at end of file +} diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index a61ff4c5e8e7..c93b3a80d02d 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -49,6 +49,10 @@ const fixBalancesTokens = { '0xaec9e50e3397f9ddc635c6c429c8c7eca418a143': { coingeckoId: 'arcana-2', decimals: 18 }, '0xce1581d7b4ba40176f0e219b2cac30088ad50c7a': { coingeckoId: 'pearl', decimals: 18 }, }, + airdao: { + [ADDRESSES.null]: { coingeckoId: 'amber', decimals: 18 }, + [ADDRESSES.airdao.USDC]: { coingeckoId: 'usd-coin', decimals: 18 }, + }, bfc: { '0x6906Ccda405926FC3f04240187dd4fAd5DF6d555': { coingeckoId: "bitcoin-usd-btcfi", decimals: 18, }, }, diff --git a/projects/kosmos/index.js b/projects/kosmos/index.js new file mode 100644 index 000000000000..d4510b19f89d --- /dev/null +++ b/projects/kosmos/index.js @@ -0,0 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const bondTellers = ["0x04B07dFBB78d32FF500466c35B4Fe5D615cbe911", "0x8d4439F8AC1e5CCF37F9ACb527E59720E0ccA3E3"]; + +module.exports = { + airdao: { tvl: sumTokensExport({ owners: bondTellers, + tokens: [ADDRESSES.null, ADDRESSES.airdao.USDC, '0x096B5914C95C34Df19500DAff77470C845EC749D'] + }) }, + methodology: `The TVL of Kosmos is equal to the total value of underlying assets locked in the BondTellers contracts.`, +}; From c69b1b6f5c38bbddbc41969b25750efda475cd69 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 15 Jul 2024 15:21:07 +0300 Subject: [PATCH 713/855] update yieldflow (#10989) --- projects/yieldflow/index.js | 80 +++++++++++++++++++++++-------------- 1 file changed, 49 insertions(+), 31 deletions(-) diff --git a/projects/yieldflow/index.js b/projects/yieldflow/index.js index 533ea1b3ed01..867f5af47660 100644 --- a/projects/yieldflow/index.js +++ b/projects/yieldflow/index.js @@ -36,42 +36,43 @@ const managers = [ '0xCF49168017096dB97Eb14552bd0af6eE9a27e76A', '0x899DF9d131D2276Db3c5f392ce2b396d9b1BFa8c', - '0xC3ec6F076fE7395B0C263f7E37B084EC4Fd06eaF', - '0x034a5fC7518d2D1b6a8C9CaccD273ee37C669E95', - '0xE0D19D57BAFF656d2910BFFBec81E33f1368A0Ee', - '0x2de0b61a2778169f095A8a7DAD7B566A9973E977', - '0x440b228411a4D83820e0c63cD71E769a6660E037', - '0x717FADe04FF819a58128Be591caC8C801F28Cd5b', - '0x1655cfD162b4148E1715B6302DA4EF075Fa72ADf', - '0x604Ef6Dc8c7abf78008749b57a4135C87d69fc35', - '0xa63fa8FE58A5E197f092742619D8F4C7fE4924e8', + '0xC3ec6F076fE7395B0C263f7E37B084EC4Fd06eaF', + '0x034a5fC7518d2D1b6a8C9CaccD273ee37C669E95', + '0xE0D19D57BAFF656d2910BFFBec81E33f1368A0Ee', + '0x2de0b61a2778169f095A8a7DAD7B566A9973E977', + '0x440b228411a4D83820e0c63cD71E769a6660E037', + '0x717FADe04FF819a58128Be591caC8C801F28Cd5b', + '0x1655cfD162b4148E1715B6302DA4EF075Fa72ADf', + '0x604Ef6Dc8c7abf78008749b57a4135C87d69fc35', + '0xa63fa8FE58A5E197f092742619D8F4C7fE4924e8', - '0xC22c7f332cA100725Bf4eA832f2D169e471923D6', - '0x1E5F83Fc7f167fF44D58e59142DeE2358346331B', - '0x8702800D715461Fb7D9C89C74DDB7bE73F5a37C6', - '0xb6F1E82e7AE822DE9eD64967D04359Fe4D58A569', - '0xE0213546258ABd7EF0D689D26Cf6d6BCEeE20e8a', - '0xf732Fc726B3a4bE9f6c86a710Fd3367259DB456e', + '0xC22c7f332cA100725Bf4eA832f2D169e471923D6', + '0x1E5F83Fc7f167fF44D58e59142DeE2358346331B', + '0x8702800D715461Fb7D9C89C74DDB7bE73F5a37C6', + '0xb6F1E82e7AE822DE9eD64967D04359Fe4D58A569', + '0xE0213546258ABd7EF0D689D26Cf6d6BCEeE20e8a', + '0xf732Fc726B3a4bE9f6c86a710Fd3367259DB456e', - '0x16A3EBd3D55b27FF6e2839DA2078889cA148C040', - '0xf4447cCFeE677A5b0BaD6bcD5f92A1929c171b48', - '0x538A753B616F5aAD60852ca039572e5C4B72cA85', + '0x16A3EBd3D55b27FF6e2839DA2078889cA148C040', + '0xf4447cCFeE677A5b0BaD6bcD5f92A1929c171b48', + '0x538A753B616F5aAD60852ca039572e5C4B72cA85', - '0x780A252d7C797cFB255fe2EAa4E1a257a897B6ed', - '0xffF3c0063f2Fc1Af569C359480b5b62841357169', - '0xEFF4A3260263A927D0707190C931bE13292bD4Ba', + '0x780A252d7C797cFB255fe2EAa4E1a257a897B6ed', + '0xffF3c0063f2Fc1Af569C359480b5b62841357169', + '0xEFF4A3260263A927D0707190C931bE13292bD4Ba', - '0xD4c68a094De7e1336E261c6EDD595F64cd70A064', - '0x88609B69feDc0EEF4326c3390a8ae1b2073DcF03', - '0xdcC4391042d462158C847f73F4232ce47A8F999c', + '0xD4c68a094De7e1336E261c6EDD595F64cd70A064', + '0x88609B69feDc0EEF4326c3390a8ae1b2073DcF03', + '0xdcC4391042d462158C847f73F4232ce47A8F999c', ] async function tvl(api) { - const positionManagers = await api.multiCall({ abi: 'address:positionManager', calls: managers}) - const tokenIds = await api.multiCall({ abi: abi.getCurrentTokenId, calls: managers}) - const liquidities = await api.multiCall({ abi: abi.getPositions, calls: positionManagers.map((v, i) => ({ target: v, params: tokenIds[i]})) }) - const tokenAmounts = await api.multiCall({ abi: abi.getAmountsForTicks, calls: liquidities.map((v, i) => ({ target: managers[i], params: [v.tickLower, v.tickUpper, v.liquidity]})) }) - + const { managers } = config[api.chain] + const positionManagers = await api.multiCall({ abi: 'address:positionManager', calls: managers }) + const tokenIds = await api.multiCall({ abi: abi.getCurrentTokenId, calls: managers }) + const liquidities = await api.multiCall({ abi: abi.getPositions, calls: positionManagers.map((v, i) => ({ target: v, params: tokenIds[i] })) }) + const tokenAmounts = await api.multiCall({ abi: abi.getAmountsForTicks, calls: liquidities.map((v, i) => ({ target: managers[i], params: [v.tickLower, v.tickUpper, v.liquidity] })) }) + liquidities.forEach((v, i) => { api.add(v.token0, tokenAmounts[i][0]) api.add(v.token1, tokenAmounts[i][1]) @@ -81,5 +82,22 @@ async function tvl(api) { module.exports = { doublecounted: true, - arbitrum: { tvl }, -}; +} + +const config = { + arbitrum: { managers }, + ethereum: { + managers: [ + '0x65D1788F9d9A800c5Fc9b9CB8e49A1b488C736c7', + '0x01Af749E58c076c301B1F57D0BCBBf2D49B503bD', + '0x47Dd57DFe9e01616e4Adc28015243Ea6A2C09cEC', + '0x0a4a169a6b2ac75c86e2F0e42822fdEA13fB1CC8', + '0xafFA16b152232dAd8BF3AaDF6bb6F895A836F917', + '0xFB04d48e4CE9C042188Ef933ff4cf58921Ab59B8' + ] + } +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file From aef00be73af41a6cfe36d1eaa700113346ce4274 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Mon, 15 Jul 2024 16:20:47 +0100 Subject: [PATCH 714/855] update endpoint --- projects/alexar/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/alexar/index.js b/projects/alexar/index.js index d58c0311cda0..dd46a5b804f3 100644 --- a/projects/alexar/index.js +++ b/projects/alexar/index.js @@ -17,7 +17,7 @@ const chainListTotal = ['avax', 'bsc', 'moonbeam', 'polygon', 'fantom', 'arbitru chainListSupply.concat(chainListTotal).forEach(chain => { module.exports[chain] = { tvl }; async function tvl(api) { - const config = await getConfig('alexar', 'https://api.axelarscan.io/cross-chain/tvl') + const config = await getConfig('alexar', 'https://api.axelarscan.io/api/getTVL') const tokensAndOwners = [] const owners = [] const mappedChain = chainMapping[chain] || chain; From b7a51de78f1fe0d86210eaec962fb37dde9f2ba6 Mon Sep 17 00:00:00 2001 From: vvalecha519 <65174294+vvalecha519@users.noreply.github.com> Date: Mon, 15 Jul 2024 11:46:24 -0500 Subject: [PATCH 715/855] fix vault address and method (#10995) --- projects/etherfi-liquid/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/etherfi-liquid/index.js b/projects/etherfi-liquid/index.js index ba6a87b35187..2ffb2b3b8dda 100644 --- a/projects/etherfi-liquid/index.js +++ b/projects/etherfi-liquid/index.js @@ -4,8 +4,8 @@ const sdk = require('@defillama/sdk') async function tvl(api) { const optimismApi = new sdk.ChainApi({ chain: 'optimism', timestamp: api.timestamp }) const balETH = await api.call({ - abi: "uint256:totalAssets", - target: '0xea1a6307d9b18f8d1cbf1c3dd6aad8416c06a221', + abi: "uint256:totalSupply", + target: '0xf0bb20865277aBd641a307eCe5Ee04E79073416C', }); await optimismApi.getBlock() const wethBal = await optimismApi.call({ From 9d7ad6cbca8ec4dd67b252f58d8c1876a8985de5 Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Mon, 15 Jul 2024 18:47:13 +0200 Subject: [PATCH 716/855] Fix stFil update: retrieve the information from the chain rather than the outdated API (#10992) Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> --- projects/stfil/index.js | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/projects/stfil/index.js b/projects/stfil/index.js index d2a1c4f88705..2fd958767c1b 100644 --- a/projects/stfil/index.js +++ b/projects/stfil/index.js @@ -1,18 +1,16 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const {get} = require('../helper/http'); -const BN = require("bn.js"); +const ADDRESSES = require("../helper/coreAssets.json"); +const stFIL = "0x3C3501E6c353DbaEDDFA90376975Ce7aCe4Ac7a8"; +const WFIL = ADDRESSES.filecoin.WFIL; -module.exports = { - filecoin: { - tvl: async (_, _1, _2, {api}) => { - - const {data: {allMinerValue, poolStFilBalance}} = await get("https://api.stfil.io/v1/info"); - const allMinerValueBN = new BN(allMinerValue); - const poolStFilBalanceBN = new BN(poolStFilBalance); - - return api.add(ADDRESSES.null, allMinerValueBN.add(poolStFilBalanceBN)); - } - } -} +const tvl = async (api) => { + const stFILSupply = await api.call({ target: stFIL, abi: 'erc20:totalSupply' }) + api.add(WFIL, stFILSupply) +}; +module.exports = { + methodology: 'stFIL tokens are minted upon filecoin deposit at 1:1 ratio', + filecoin: { + tvl, + }, +}; From 27c252a10a1aaf2ddfa7c4e898a252d7f7041473 Mon Sep 17 00:00:00 2001 From: Lewis Freiberg <1716917+l3wi@users.noreply.github.com> Date: Mon, 15 Jul 2024 18:49:48 +0200 Subject: [PATCH 717/855] DSU: Change collateral to native USDC on Arbitrum (#10994) * Fix: Change collateral to native USDC on Arbitrum * Update index.js --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/dsu-money/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/dsu-money/index.js b/projects/dsu-money/index.js index cb047b6c10c5..9f6726577852 100644 --- a/projects/dsu-money/index.js +++ b/projects/dsu-money/index.js @@ -12,6 +12,7 @@ module.exports = { arbitrum: { tvl: sumTokensExport({ tokensAndOwners: [ [ADDRESSES.arbitrum.USDC, '0x0d49c416103cbd276d9c3cd96710db264e3a0c27'], + [ADDRESSES.arbitrum.USDC_CIRCLE, '0x0d49c416103cbd276d9c3cd96710db264e3a0c27'], ]}) } } From c7df31caf9f7046a4d4d2d22f300ffaff53c8fab Mon Sep 17 00:00:00 2001 From: 0xngmi <80541789+0xngmi@users.noreply.github.com> Date: Mon, 15 Jul 2024 17:54:29 +0100 Subject: [PATCH 718/855] morpho blue not doublecounted --- projects/morpho-blue/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/morpho-blue/index.js b/projects/morpho-blue/index.js index a06864916b6e..d6139ec2e203 100644 --- a/projects/morpho-blue/index.js +++ b/projects/morpho-blue/index.js @@ -3,7 +3,6 @@ const abi = require("../helper/abis/morpho.json"); module.exports = { methodology: `Collateral (supply minus borrows) in the balance of the Morpho contracts`, - doublecounted: true, }; const config = { From 2cbcf7297f7658fbea6e71236ce25730013d9227 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sim=C3=A3o=20Pinto?= <87367287+Sk1mer12@users.noreply.github.com> Date: Mon, 15 Jul 2024 20:02:21 +0100 Subject: [PATCH 719/855] Update Inception TVL per chain (#10421) * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js --- projects/genesis-lrt/index.js | 5 ++--- projects/inception-lrt/index.js | 7 +++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/projects/genesis-lrt/index.js b/projects/genesis-lrt/index.js index e9ad2da8098f..9f7799cc3976 100644 --- a/projects/genesis-lrt/index.js +++ b/projects/genesis-lrt/index.js @@ -1,7 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') async function tvl(api) { - if (api.timestamp > 1715181240) return {} const staked = await api.call({ abi: 'uint256:totalAssets', target: '0xf073bAC22DAb7FaF4a3Dd6c6189a70D54110525C' }) api.add(ADDRESSES.null, staked) } @@ -11,5 +10,5 @@ module.exports = { [1714953600,"Genesis Merges with InceptionLRT"] ], doublecounted: true, - ethereum: { tvl, }, -} \ No newline at end of file + ethereum: { tvl: tvl, } +} diff --git a/projects/inception-lrt/index.js b/projects/inception-lrt/index.js index ecdda208cd49..3731811b65e8 100644 --- a/projects/inception-lrt/index.js +++ b/projects/inception-lrt/index.js @@ -7,14 +7,13 @@ async function tvl_eth(api) { const strategies = await api.multiCall({ abi: 'address:strategy', calls: vaults}) const tokens = await api.multiCall({ abi: 'address:underlyingToken', calls: strategies}) // const result = total_deposited.map((deposited, index) => deposited - total_withdraw[index]); - if (api.timestamp > 1715181240) { - const staked = await api.call({ abi: 'uint256:totalAssets', target: '0xf073bAC22DAb7FaF4a3Dd6c6189a70D54110525C' }) - api.add(ADDRESSES.null, staked) - } api.add(tokens, total_deposited) } module.exports = { + hallmarks: [ + [1714953600,"Genesis Merges with InceptionLRT"] + ], doublecounted: true, ethereum: { tvl: tvl_eth, } , } From 7531ba31f458398d22f88920ea25abb6d1337f5f Mon Sep 17 00:00:00 2001 From: hoomp3 Date: Mon, 15 Jul 2024 15:14:55 -0400 Subject: [PATCH 720/855] Update Juice Finance (Blast) (#10999) * feat: add new managers * feat: add staked LP to tvl * feat: add juice pro contracts --- projects/juice-finance/index.js | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/projects/juice-finance/index.js b/projects/juice-finance/index.js index ea92ee9dbc7b..de38553ff988 100644 --- a/projects/juice-finance/index.js +++ b/projects/juice-finance/index.js @@ -4,6 +4,17 @@ const { sumTokens2 } = require("../helper/unwrapLPs"); // Tokens const EZETH = ADDRESSES.blast.ezETH; +const PRO = { + lendingPool: { + usdb: "0x788654040D7E9a8Bb583D7d8CCEA1Ebf1AE4aC06", + weth: "0x60ED5493B35f833189406dFec0b631A6B5B57f66", + }, + collateralManager: { + usdb: "0xaCe661Bf726Bd8aFE6F6594C559A5136489E64f9", + weth: "0x4dEE8034019f03F1a025dbFB4bBC159D7BaA7a0A", + }, +} + // Lending pools const LENDING_POOL_USDB = "0x4A1d9220e11a47d8Ab22Ccd82DA616740CF0920a"; const LENDING_POOL_WETH = "0x44f33bC796f7d3df55040cd3C631628B560715C2"; @@ -25,8 +36,14 @@ const wethCollateralManagers = [ COLLATERAL_MANAGER_V2, WETH_COLLATERAL_MANAGER, MUNCHABLE_WETH_COLLATERAL_MANAGER, + PRO.collateralManager.weth, ].map((a) => [ADDRESSES.blast.WETH, a]); +const usdbCollateralManagers = [ + USDB_COLLATERAL_MANAGER, + PRO.collateralManager.usdb, +].map((a) => [ADDRESSES.blast.USDB, a]); + async function tvl(api) { const thrusterV2LPs = [['0x4E4B4A3111d128628c427E78a2abAd1635fE6542', '0x4Ca392f74A4C86F5E521f1d8E915b36ed425B331']]; @@ -49,11 +66,13 @@ async function tvl(api) { stateMutability: "view", type: "function", }, - calls: [LENDING_POOL_USDB, LENDING_POOL_WETH], + calls: [LENDING_POOL_USDB, PRO.lendingPool.usdb, LENDING_POOL_WETH, PRO.lendingPool.weth], }); api.add(ADDRESSES.blast.USDB, tokens[0]); - api.add(ADDRESSES.blast.WETH, tokens[1]); + api.add(ADDRESSES.blast.USDB, tokens[1]); + api.add(ADDRESSES.blast.WETH, tokens[2]); + api.add(ADDRESSES.blast.WETH, tokens[3]); await sumTokens2({ api, @@ -61,7 +80,7 @@ async function tvl(api) { tokensAndOwners: [ [EZETH, EZETH_COLLATERAL_MANAGER], [ADDRESSES.blast.weETH, WEETH_COLLATERAL_MANAGER], - [ADDRESSES.blast.USDB, USDB_COLLATERAL_MANAGER], + ...usdbCollateralManagers, ...wethCollateralManagers, ], }); From 8868b11c0a85e8dcac263bf6f107af518aebfb95 Mon Sep 17 00:00:00 2001 From: Adolf998 <154962952+Adolf998@users.noreply.github.com> Date: Tue, 16 Jul 2024 03:43:45 +0800 Subject: [PATCH 721/855] add bouncebit-Easy projects (#10993) * update bouncebit-premium & bouncebitTvl * add bouncebit-ethena project * add bouncebit-EasyBTC projects --- projects/bouncebit-EasyBTC/index.js | 38 +++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 projects/bouncebit-EasyBTC/index.js diff --git a/projects/bouncebit-EasyBTC/index.js b/projects/bouncebit-EasyBTC/index.js new file mode 100644 index 000000000000..c6507609f9cd --- /dev/null +++ b/projects/bouncebit-EasyBTC/index.js @@ -0,0 +1,38 @@ +const { sumTokens, sumTokensExport } = require('../helper/sumTokens'); +const ADDRESSES = require('../helper/coreAssets.json') + +const ETH_EasyBTC_USD_Contract = '0xFe32277D00e57D864B8BC687d0a442D663Aa1dF6' + +const BNB_EasyBTC_USD_Contract = '0xF3FB36F32Dad91627f688e7332472d69F6C985c6' +const BNB_EasyBTC_BTC_Contract = '0x38D239a8D33BF7424A1Df6d39cb8523cCc25DE0e' + +const STAKE_ABI = + "function totalStaked() view returns (uint256)"; + +async function ETHTvl(api, ...args) { + const EasyBTC_USD_Staked = await api.call({ abi: STAKE_ABI, target: ETH_EasyBTC_USD_Contract}) + // usdt + api.add(ADDRESSES.ethereum.USDT, EasyBTC_USD_Staked) + return sumTokens({ + api + }) +} + +async function BNBTvl(api, ...args) { + const EasyBTC_USD_Staked = await api.call({ abi: STAKE_ABI, target: BNB_EasyBTC_USD_Contract}) + const EasyBTC_BTC_Staked = await api.call({ abi: STAKE_ABI, target: BNB_EasyBTC_BTC_Contract}) + // usdt + api.add(ADDRESSES.bsc.USDT, EasyBTC_USD_Staked) + // btc + api.add(ADDRESSES.bsc.BTCB, EasyBTC_BTC_Staked) + return sumTokens({ api }) +} + +module.exports = { + ethereum: { + tvl: ETHTvl, + }, + bsc: { + tvl: BNBTvl, + } +}; From 5b2cd16b3812f84f5810a72036c2090084bca575 Mon Sep 17 00:00:00 2001 From: Mateusz Date: Tue, 16 Jul 2024 01:04:46 +0100 Subject: [PATCH 722/855] Synonym Finance: pools on multiple chains (#11001) --- projects/synonym-finance/index.js | 49 +++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a/projects/synonym-finance/index.js b/projects/synonym-finance/index.js index a3ed39f2656a..75f00c60cfdc 100644 --- a/projects/synonym-finance/index.js +++ b/projects/synonym-finance/index.js @@ -1,25 +1,39 @@ +const sdk = require("@defillama/sdk"); const bytes32ToAddress = (bytes32Address) => "0x" + bytes32Address.substr(-40); const hub = '0x1e3f1f1cA8C62aABCB3B78D87223E988Dfa3780E' -async function tvl(api) { - const { tokens, tokenMappings } = await getTokenInfos(api) +async function tvl({timestamp, chain}) { + const api = new sdk.ChainApi({ timestamp, chain: 'arbitrum' }) + const { tokens, tokenMappings } = await getTokenInfos(api, chain) const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: tokens.map(token => ({ target: token, params: hub })) }) api.add(tokenMappings, bals, { skipChain: true }) return api.getBalances() } -async function borrowed(api) { - const { tokens, tokenMappings } = await getTokenInfos(api) +async function borrowed({timestamp, chain }) { + const api = new sdk.ChainApi({ timestamp, chain: 'arbitrum' }) + const { tokens, tokenMappings } = await getTokenInfos(api, chain) const bals = (await api.multiCall({ abi: "function getGlobalAmounts(address assetAddress) view returns ((uint256 deposited, uint256 borrowed))", calls: tokens, target: hub })).map(i => i.borrowed) api.add(tokenMappings, bals, { skipChain: true }) return api.getBalances() } -module.exports = { - arbitrum: { tvl, borrowed, }, -} +const chains = [ + 'arbitrum', + 'ethereum', + 'optimism', + 'base', + 'scroll', +] + +chains.forEach(chain => { + module.exports[chain] = { + tvl, + borrowed + } +}) -async function getTokenInfos(api) { +async function getTokenInfos(api, requestedChain) { const registry = await api.call({ abi: 'address:getAssetRegistry', target: hub }) const tokenBridge = await api.call({ abi: 'address:tokenBridge', target: hub }) const assets = await api.call({ abi: 'address[]:getRegisteredAssets', target: registry }) @@ -31,12 +45,18 @@ async function getTokenInfos(api) { bridgedAssets.push(asset) else arbiAssets.push(asset) - }) + + if (requestedChain === 'arbitrum') { + return { tokens: arbiAssets, tokenMappings: arbiAssets.map(asset => 'arbitrum:' + asset) } + } + const natives = await api.multiCall({ abi: 'function nativeContract() view returns (bytes32)', calls: bridgedAssets }) const chainId = await api.multiCall({ abi: 'function chainId() view returns (uint16)', calls: bridgedAssets }) - const tokens = arbiAssets - const tokenMappings = arbiAssets.map(asset => 'arbitrum:' + asset) + + const tokens = [] + const tokenMappings = [] + bridgedAssets.forEach((asset, i) => { let chain; switch (chainId[i]) { @@ -46,8 +66,11 @@ async function getTokenInfos(api) { case '34': chain = 'scroll'; break; default: console.log('Unsupported chain ' + chainId[i] + bytes32ToAddress(natives[i])); return; } - tokenMappings.push(chain + ':' + bytes32ToAddress(natives[i])) - tokens.push(asset) + + if (chain === requestedChain) { + tokens.push(asset) + tokenMappings.push(chain + ':' + bytes32ToAddress(natives[i])) + } }) return { tokens, tokenMappings } From f1fcc946d3f02dbe0a01591e5f84552db50ba492 Mon Sep 17 00:00:00 2001 From: Jinwoo Cheon Date: Mon, 15 Jul 2024 20:10:33 -0400 Subject: [PATCH 723/855] add ethereum & arbitrum to Pump Markets (#11000) --- projects/pump-markets/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/projects/pump-markets/index.js b/projects/pump-markets/index.js index 0568500afd70..0a138e98d506 100644 --- a/projects/pump-markets/index.js +++ b/projects/pump-markets/index.js @@ -8,4 +8,16 @@ module.exports = { tokens: [ADDRESSES.blast.USDB, ADDRESSES.blast.WETH], }), }, + ethereum: { + tvl: sumTokensExport({ + owner: "0x360CFF6ca6278954933A8556D1938B4cF3D747B5", + tokens: [ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.WETH], + }), + }, + arbitrum: { + tvl: sumTokensExport({ + owner: "0x360CFF6ca6278954933A8556D1938B4cF3D747B5", + tokens: [ADDRESSES.arbitrum.USDC, ADDRESSES.arbitrum.USDT, ADDRESSES.arbitrum.WETH], + }), + }, }; From 55ae0088d5b0fb1853ce0880ddf54a533cd11f65 Mon Sep 17 00:00:00 2001 From: "Guillermo M. Narvaja" Date: Tue, 16 Jul 2024 02:08:00 -0300 Subject: [PATCH 724/855] Ensuro: adds USDM as asset + new pools and premiums accounts (#10998) * Ensuro: new pools and Premiums accounts Adds new eTokens (liquidity pool) and Premiums Accounts for recently onboarded risks. * Ensuro: new pools and Premiums accounts + remove v1 Adds new eTokens (liquidity pool) and Premiums Accounts for recently onboarded risks. Also, I'm removing the code for v1 since is no longer in use. * Ensuro: adds multistrategy vault and Compound USDC reserves Adds the multistrategy vault as one of the contract that holds the assets of Ensuro and also Compound USDC as one form those reserves can take (previously was USDC and AAVE USDC). * Ensuro: adds USDM as asset + new pools and premiums accounts --- projects/ensuro/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/ensuro/index.js b/projects/ensuro/index.js index e6c1a9a1addb..47ac5caf0486 100644 --- a/projects/ensuro/index.js +++ b/projects/ensuro/index.js @@ -7,6 +7,7 @@ const addressBook = { aave_v3_usdc: "0x625E7708f30cA75bfd92586e17077590C60eb4cD", // aPolUSDC aave_v2_usdc: "0x1a13F4Ca1d028320A707D99520AbFefca3998b7F", // amUSDC compound_v3_usdc: "0xF25212E676D1F7F89Cd72fFEe66158f541246445", // Compound USDC + mountain_usdm: "0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C", // Mountain USDM reserves: [ // eTokens {name: "eToken Junior Koala", address: "0x8d2Ee82c4172B2138B06b8037d769cBfAf9C0274"}, @@ -21,6 +22,8 @@ const addressBook = { {name: "eToken Junior DLT", address: "0x9078dDdeA2F82c27791EF78A9ec9ab0f66bfb6F9"}, {name: "eToken Junior Otonomi", address: "0x32a9CBeb2cA148E55F327c6B4673351dD03eD858"}, {name: "eToken Junior Bliss", address: "0x71d390C243706b713B5D2b077E942223f7A55d00"}, + {name: "eToken Junior InsureHero", address: "0x15F76F59A29C7c12b4a67751CA525bf9167C1AaB"}, + {name: "eToken Junior Clerity", address: "0x1c7F0c8ba10Db7f2e1c7B5B0A024b66b6baceb45"}, // PremiumsAccounts {name: "PremiumsAccount Koala", address: "0xCCf5C404d32eB6E777088AB13837a1b8dCBA9328"}, {name: "PremiumsAccount Innov Zone", address: "0x4f43B8F252887F814ED689346fdb5Bd266394520"}, @@ -32,6 +35,8 @@ const addressBook = { {name: "PremiumsAccount DLT", address: "0x8908d99a4E2fF6b7Bf4563593B02AcBc7bBfaBC1"}, {name: "PremiumsAccount Otonomi", address: "0xE43587386E6e8FA127dd008770cdC07dE2Df91E9"}, {name: "PremiumsAccount Bliss", address: "0x11b490292799a0edFE37797592F77151C4483442"}, + {name: "PremiumsAccount InsureHero", address: "0x41B5a105C850014eC594879E8511994F25092460"}, + {name: "PremiumsAccount Clerity", address: "0xD26d5015C57C197AE5e7BC866B49837d22364eAB"}, // MultiStrategy Vault - Vault that aggregates assets of several reserves {name: "MultiStrategy Vault", address: "0x1EE585dcea25cbDa16BE8cfeFa381A1F32acA418"}, ], @@ -40,7 +45,7 @@ const addressBook = { async function tvl(api) { const addresses = addressBook[api.chain]; - const ownerTokens = addresses.reserves.map(i => [[addresses.usdc, addresses.aave_v3_usdc, addresses.compound_v3_usdc], i.address]) + const ownerTokens = addresses.reserves.map(i => [[addresses.usdc, addresses.aave_v3_usdc, addresses.compound_v3_usdc, addresses.mountain_usdm], i.address]) return sumTokens2({ api, ownerTokens, }); } From b13ffde1742021d56945be5a200a1af31d695233 Mon Sep 17 00:00:00 2001 From: OpalSila Date: Tue, 16 Jul 2024 15:08:04 +0700 Subject: [PATCH 725/855] Add Opal finance (#10996) * Created Opal's abi.json * Added Opal Adapeter * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/opal/index.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 projects/opal/index.js diff --git a/projects/opal/index.js b/projects/opal/index.js new file mode 100644 index 000000000000..65ba04df7f13 --- /dev/null +++ b/projects/opal/index.js @@ -0,0 +1,26 @@ + + +module.exports = { + methodology: "Compute the total TVL by summing the balances of each pool's underlying pools and multiplying by the BTP valuation", +}; + +const config = { + ethereum: [ + "0x86b130298719F753808E96cA6540b684a2d21466",// wstETH + "0xD2358c5d01065b13F2Ad1107d5a4531Cd98aC7A1",// rETH + "0x0c8e1e97d9f41a21D6Ef98E644a5516d9b7F593f",// wETH + "0x2165AEA91B33631A772d1723b88a98C1Ca820116",// weETH + "0x4aCc76B4B3E4529D7cE88Ca921D7a4112f25A6dA", // USDC + ] +} + +Object.keys(config).forEach(chain => { + const pools = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const uPools = await api.fetchList({ lengthAbi: 'getUnderlyingPoolsLength', itemAbi: 'function getUnderlyingPool(uint8) view returns (address)', targets: pools, groupedByInput: true, }) + const ownerTokens = uPools.map((tokens, i) => [tokens, pools[i]]) + return api.sumTokens({ ownerTokens }) + } + } +}) \ No newline at end of file From 5c6db630e57d324a4a602156fc3694909f886f4e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 16 Jul 2024 11:09:39 +0300 Subject: [PATCH 726/855] minor fix --- projects/opal/index.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/projects/opal/index.js b/projects/opal/index.js index 65ba04df7f13..5bc6a7b3c159 100644 --- a/projects/opal/index.js +++ b/projects/opal/index.js @@ -1,9 +1,3 @@ - - -module.exports = { - methodology: "Compute the total TVL by summing the balances of each pool's underlying pools and multiplying by the BTP valuation", -}; - const config = { ethereum: [ "0x86b130298719F753808E96cA6540b684a2d21466",// wstETH From c53b1957e6fa092243e375ebc58c10649dcbebff Mon Sep 17 00:00:00 2001 From: 0xR <99395193+0xrmvdao@users.noreply.github.com> Date: Tue, 16 Jul 2024 11:10:54 +0300 Subject: [PATCH 727/855] Add SparkDex V2 and SparkDex V3 adapters (#11003) --- projects/sparkdex-v2/index.js | 12 ++++++++++++ projects/sparkdex-v3/index.js | 6 ++++++ 2 files changed, 18 insertions(+) create mode 100644 projects/sparkdex-v2/index.js create mode 100644 projects/sparkdex-v3/index.js diff --git a/projects/sparkdex-v2/index.js b/projects/sparkdex-v2/index.js new file mode 100644 index 000000000000..15b857585c40 --- /dev/null +++ b/projects/sparkdex-v2/index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require("../helper/unknownTokens"); + +module.exports = { + misrepresentedTokens: true, + flare: { + tvl: getUniTVL({ + factory: "0x16b619B04c961E8f4F06C10B42FDAbb328980A89", + useDefaultCoreAssets: true, + fetchBalances: true, + }), + }, +}; diff --git a/projects/sparkdex-v3/index.js b/projects/sparkdex-v3/index.js new file mode 100644 index 000000000000..b97ba79390f6 --- /dev/null +++ b/projects/sparkdex-v3/index.js @@ -0,0 +1,6 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + flare: { factory: '0xb3fB4f96175f6f9D716c17744e5A6d4BA9da8176', fromBlock: + 26046709, }, +}) From 5c9aefd6e9a5948838035cf540224301c5968246 Mon Sep 17 00:00:00 2001 From: Jarekkkkk <86938582+Jarekkkkk@users.noreply.github.com> Date: Tue, 16 Jul 2024 16:13:54 +0800 Subject: [PATCH 728/855] [ TVL update ] add ST-SBUCK saving vault TVL (#11002) * feature: add strater project * feature: set the package-lock.json to the same version of original repo * feature: replace decimal.js to bignumber.js * feature: change bucketus vault id * feature: 1. add new bucketus pair ID 2. modified code of add bucketus pair value * add st-sbuck saving vault TVl --------- Co-authored-by: Dan Hsu --- projects/strater/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/projects/strater/index.js b/projects/strater/index.js index 5e92b64b0262..292c71ff13d1 100644 --- a/projects/strater/index.js +++ b/projects/strater/index.js @@ -36,6 +36,8 @@ const STAPREAL_VAULT_ID = const STAPEARL_PAIR_METADTA_ID = "0x243096d976a44de24fde33f087665f8265543a533b5cdbae60fc72a939669867"; +const ST_SBUCK_VAULT_OBJECT_ID = "0xe83e455a9e99884c086c8c79c13367e7a865de1f953e75bcf3e529cdf03c6224" + function asIntN(int, bits = 32) { return Number(BigInt.asIntN(bits, BigInt(int))); } @@ -92,8 +94,18 @@ async function tvl(api) { const stapearlUSDTAmount = (stapearlLpAmount * stapearlReserveY) / stapearlLpSupply; + // saving vault + const savingVaultcObj = await sui.getObject(ST_SBUCK_VAULT_OBJECT_ID) + let savingVaultTVL = Number(savingVaultcObj.fields.free_balance) + Number(savingVaultcObj.fields.time_locked_profit.fields.locked_balance) + Number(savingVaultcObj.fields.time_locked_profit.fields.unlocked_balance) + const strategies = savingVaultcObj.fields.strategies.fields.contents + for(const strategy of strategies){ + const botrrowedAmount = Number(strategy.fields.value.fields.borrowed) + savingVaultTVL += botrrowedAmount + } + api.add(ADDRESSES.sui.USDC, stapearlUSDCAmount); api.add(ADDRESSES.sui.USDT, stapearlUSDTAmount); + api.add(ADDRESSES.sui.BUCK, savingVaultTVL) } module.exports = { From b109704ee090fea9525f90e8579a927031aea137 Mon Sep 17 00:00:00 2001 From: santino <83203265+santinoYoung@users.noreply.github.com> Date: Tue, 16 Jul 2024 19:27:38 +0800 Subject: [PATCH 729/855] Update Desyn bitlayer chain module doublecounted (#11004) * add desyn protocol * update lpposition token * Update index.js add resolveLP * Update index.js remove resolveLP * add tvl * Update index.js update sumTokensExport * code refactor * update desyn chain * update bitlayer chain * disable merlin * add desyn hallmarks * add desyn restaking and desyn yeild Methodology * update bitlayer doublecounted is false * update bitlayer doublecounted * update bitlayer doublecounted --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/desyn-farm/index.js | 2 +- projects/desyn-farm1/index.js | 27 +++++++++++++++++++++++++++ projects/desyn/index.js | 5 +++-- 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 projects/desyn-farm1/index.js diff --git a/projects/desyn-farm/index.js b/projects/desyn-farm/index.js index 9e773382f8de..61b14391d046 100644 --- a/projects/desyn-farm/index.js +++ b/projects/desyn-farm/index.js @@ -2,7 +2,7 @@ const { getLogs } = require('../helper/cache/getLogs') module.exports = { doublecounted: true, - methodology: 'On-chain restaking', + methodology: 'Product: On-chain restaking
TVL: It includes above
Revenue: Staking rewards, management fees, performance fees', } const config = { diff --git a/projects/desyn-farm1/index.js b/projects/desyn-farm1/index.js new file mode 100644 index 000000000000..b4a4443dd293 --- /dev/null +++ b/projects/desyn-farm1/index.js @@ -0,0 +1,27 @@ +const { getLogs } = require('../helper/cache/getLogs') + +module.exports = { + methodology: 'Product: On-chain restaking
TVL: It includes above
Revenue: Staking rewards, management fees, performance fees', +} + +const config = { + btr: { factory: '0x09eFC8C8F08B810F1F76B0c926D6dCeb37409665', fromBlock: 2393247}, +} + +Object.keys(config).forEach(chain => { + const {factory, fromBlock, } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const logs = await getLogs({ + api, + target: factory, + eventAbi: 'event LOG_NEW_POOL (address indexed caller, address indexed pool)', + onlyArgs: true, + fromBlock, + }) + const pools = logs.map(i=>i.pool) + const tokens = await api.multiCall({ abi: 'address[]:getCurrentTokens', calls: pools}) + return api.sumTokens({ ownerTokens: tokens.map((tokens, i) => [tokens, pools[i]])}) + } + } +}) \ No newline at end of file diff --git a/projects/desyn/index.js b/projects/desyn/index.js index 71e81b30e9ef..77d77ba80c84 100644 --- a/projects/desyn/index.js +++ b/projects/desyn/index.js @@ -7,7 +7,7 @@ module.exports = { [1718092800, "DeSyn KelpDAO Restaking Fund Launched"], [1713340800, "Restaking Fund Series Launched"], ], - methodology: 'Liquid restaking strategies', + methodology: 'Product: Liquid restaking strategy
TVL: It includes above
Revenue: Staking rewards, management fees, performance fees', } const config = { @@ -15,7 +15,8 @@ const config = { arbitrum: { factory: '0xdE6b117384452b21F5a643E56952593B88110e78', fromBlock: 175985457}, //merlin chain is tracked under a new listing for farm // merlin: { factory: '0x790b4ee7998A93702f29e56f8b615eF35BE5af43', fromBlock: 11260440}, - btr: { factory: '0x09eFC8C8F08B810F1F76B0c926D6dCeb37409665', fromBlock: 2393247}, + //bitlayer chain is tracked under a new listing for farm + // btr: { factory: '0x09eFC8C8F08B810F1F76B0c926D6dCeb37409665', fromBlock: 2393247}, } Object.keys(config).forEach(chain => { From 96db1ea7cf293add4ea1a362e128aa75bb3d6e41 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 16 Jul 2024 14:29:11 +0300 Subject: [PATCH 730/855] desyn: fix methodology --- projects/desyn-farm/index.js | 2 +- projects/desyn-farm1/index.js | 2 +- projects/desyn/index.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/desyn-farm/index.js b/projects/desyn-farm/index.js index 61b14391d046..9e773382f8de 100644 --- a/projects/desyn-farm/index.js +++ b/projects/desyn-farm/index.js @@ -2,7 +2,7 @@ const { getLogs } = require('../helper/cache/getLogs') module.exports = { doublecounted: true, - methodology: 'Product: On-chain restaking
TVL: It includes above
Revenue: Staking rewards, management fees, performance fees', + methodology: 'On-chain restaking', } const config = { diff --git a/projects/desyn-farm1/index.js b/projects/desyn-farm1/index.js index b4a4443dd293..7b2da9ec60c0 100644 --- a/projects/desyn-farm1/index.js +++ b/projects/desyn-farm1/index.js @@ -1,7 +1,7 @@ const { getLogs } = require('../helper/cache/getLogs') module.exports = { - methodology: 'Product: On-chain restaking
TVL: It includes above
Revenue: Staking rewards, management fees, performance fees', + methodology: 'On-chain restaking', } const config = { diff --git a/projects/desyn/index.js b/projects/desyn/index.js index 77d77ba80c84..75f12cba8437 100644 --- a/projects/desyn/index.js +++ b/projects/desyn/index.js @@ -7,7 +7,7 @@ module.exports = { [1718092800, "DeSyn KelpDAO Restaking Fund Launched"], [1713340800, "Restaking Fund Series Launched"], ], - methodology: 'Product: Liquid restaking strategy
TVL: It includes above
Revenue: Staking rewards, management fees, performance fees', + methodology: 'Liquid restaking strategy', } const config = { From ae166bfc24f3d222b615237ed2b44d0ddb18b018 Mon Sep 17 00:00:00 2001 From: Aleksei Lushnikov Date: Tue, 16 Jul 2024 12:29:58 +0100 Subject: [PATCH 731/855] symbiosis adds FRAX support (#11005) --- projects/helper/coreAssets.json | 9 ++++++--- projects/symbiosis-finance/config.js | 7 ++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 229aa720c8e0..eae1534eeb70 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -151,7 +151,8 @@ "YIN": "0x794baab6b878467f93ef17e2f2851ce04e3e34c8", "BNB": "0x5c4b7ccbf908e64f32e12c6650ec0c96d717f03f", "BUSD": "0x9c9e5fd8bbc25984b178fdce6117defa39d2db39", - "WORK": "0x6002410dda2fb88b4d0dc3c1d562f7761191ea80" + "WORK": "0x6002410dda2fb88b4d0dc3c1d562f7761191ea80", + "FRAX": "0x45c32fA6DF82ead1e2EF74d17b76547EDdFaFF89" }, "xdai": { "WXDAI": "0xe91d153e0b41518a2ce8dd3d7944fa863463a97d", @@ -273,7 +274,8 @@ "GMX": "0xfc5A1A6EB076a2C7aD06eD22C90d7E710E35ad0a", "WSTETH": "0x5979D7b546E38E414F7E9822514be443A4800529", "plvGLP": "0x5326e71ff593ecc2cf7acae5fe57582d6e74cff1", - "USDe": "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34" + "USDe": "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34", + "FRAX": "0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F" }, "fuse": { "WFUSE": "0x0be9e53fd7edac9f859882afdda116645287c629", @@ -1839,7 +1841,8 @@ "WBTC": "0x03C7054BCB39f7b2e5B2c7AcB37583e32D70Cfa3" }, "fraxtal": { - "WETH": "0xA8a59D73388D0c4344a7b0Ba287ddb654227c38a" + "WETH": "0xA8a59D73388D0c4344a7b0Ba287ddb654227c38a", + "FRAX": "0xfc00000000000000000000000000000000000001" }, "aeternity": { "WAE": "ct_J3zBY8xxjsRr3QojETNw48Eb38fjvEuJKkQ6KzECvubvEcvCa", diff --git a/projects/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js index 89c49ce315b9..bc211d0e2eef 100644 --- a/projects/symbiosis-finance/config.js +++ b/projects/symbiosis-finance/config.js @@ -32,7 +32,8 @@ const TOKENS = { USDC: ADDRESSES.cronos.USDC }, fraxtal: { - WETH: ADDRESSES.fraxtal.WETH + WETH: ADDRESSES.fraxtal.WETH, + FRAX: ADDRESSES.fraxtal.FRAX } } @@ -45,6 +46,7 @@ module.exports = { ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.WETH, ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.FRAX, TOKENS.ethereum.XDAO, TOKENS.ethereum.LADYS, TOKENS.ethereum.pufETH, @@ -89,6 +91,7 @@ module.exports = { tokens: [ ADDRESSES.polygon.USDC, ADDRESSES.polygon.WETH_1, + ADDRESSES.polygon.FRAX, TOKENS.polygon.XDAO, ], holders: [ @@ -181,6 +184,7 @@ module.exports = { ADDRESSES.arbitrum.USDC, // USDC.e ADDRESSES.arbitrum.USDC_CIRCLE, ADDRESSES.arbitrum.WETH, + ADDRESSES.arbitrum.FRAX, TOKENS.arbitrum.XDAO, TOKENS.arbitrum.LADYS, ], @@ -399,6 +403,7 @@ module.exports = { name: 'fraxtal', tokens: [ TOKENS.fraxtal.WETH, + TOKENS.fraxtal.FRAX, ], holders: [ '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 From 2eae67367b56f220995192d254ea12187faf6ded Mon Sep 17 00:00:00 2001 From: External Man <157961283+externalman@users.noreply.github.com> Date: Tue, 16 Jul 2024 15:58:10 +0200 Subject: [PATCH 732/855] Feat: Add SigmaSwap Bridge (#11008) * feat: workaround using ethers * feat: change approach to use prebuilt function * Add token mapping for LUKSO --------- Co-authored-by: Szymon Paluch <12szymon.paluch34@gmail.com> Co-authored-by: mxmar --- projects/helper/tokenMapping.js | 4 ++++ projects/sigmaswap/index.js | 14 ++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 projects/sigmaswap/index.js diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index c93b3a80d02d..02a931f3a0ff 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -53,6 +53,10 @@ const fixBalancesTokens = { [ADDRESSES.null]: { coingeckoId: 'amber', decimals: 18 }, [ADDRESSES.airdao.USDC]: { coingeckoId: 'usd-coin', decimals: 18 }, }, + lukso: { + [ADDRESSES.null]: { coingeckoId: "lukso-token-2", decimals: 18 }, + [ADDRESSES.lukso.WLYX]: { coingeckoId: 'lukso-token-2', decimals: 18 }, + }, bfc: { '0x6906Ccda405926FC3f04240187dd4fAd5DF6d555': { coingeckoId: "bitcoin-usd-btcfi", decimals: 18, }, }, diff --git a/projects/sigmaswap/index.js b/projects/sigmaswap/index.js new file mode 100644 index 000000000000..4e4d03f9a65e --- /dev/null +++ b/projects/sigmaswap/index.js @@ -0,0 +1,14 @@ +const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); + +const contract = "0xE58a7D7E726CD266c103cC7C2763f4a3005d78B1"; + +async function tvl(api) { + return sumTokens2({ tokens: [nullAddress], owner: contract, api }); +} + +module.exports = { + methodology: `We count the LYX on ${contract}`, + lukso: { + tvl, + }, +}; From 499812a7d119b0569abf4048e9a5bda6a00786b3 Mon Sep 17 00:00:00 2001 From: Philip Gogolev <46344159+googolev@users.noreply.github.com> Date: Tue, 16 Jul 2024 17:00:15 +0300 Subject: [PATCH 733/855] Electrowizy (#11009) * electrowizy integration * code refactor * update electrowizy vault * Update index.js * revert change --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/electrowizy/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/electrowizy/index.js b/projects/electrowizy/index.js index 3abb551ff082..1bc784f1e6aa 100644 --- a/projects/electrowizy/index.js +++ b/projects/electrowizy/index.js @@ -2,6 +2,6 @@ const { sumERC4626VaultsExport } = require('../helper/erc4626') module.exports = { polygon: { - tvl: sumERC4626VaultsExport({ vaults: ['0x41692d4141A98401F3F0CB729D4886AcBD811a66'], balanceAbi: 'uint256:totalStaked', tokenAbi: 'address:stakingToken' }), + tvl: sumERC4626VaultsExport({ vaults: [ '0x663819aB31cB6204a2A732996549B702DeC38aa9'], balanceAbi: 'uint256:totalStaked', tokenAbi: 'address:stakingToken' }), } -} \ No newline at end of file +} From dee124abf779e7f53082c51b139cb62970f7847a Mon Sep 17 00:00:00 2001 From: Johannes <45110941+jo-es@users.noreply.github.com> Date: Tue, 16 Jul 2024 15:01:01 +0100 Subject: [PATCH 734/855] Account for accrued interest (#11010) --- projects/vesu/index.js | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/projects/vesu/index.js b/projects/vesu/index.js index cc4652af3ee6..2e85366489a4 100644 --- a/projects/vesu/index.js +++ b/projects/vesu/index.js @@ -1,10 +1,10 @@ const { multiCall, sumTokens } = require("../helper/chain/starknet"); const { abi, allAbi } = require("./abi"); -const poolAddress = - "0x02545b2e5d519fc230e9cd781046d3a64e092114f07e44771e0d719d148725ef"; - -const assets = [ +const INTERNAL_SCALE = 10 ** 18; +const SINGLETON = "0x02545b2e5d519fc230e9cd781046d3a64e092114f07e44771e0d719d148725ef"; +const POOL_ID = "0x4dc4f0ca6ea4961e4c8373265bfd5317678f4fe374d76f3fd7135f57763bf28"; +const ASSETS = [ "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7", "0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac", "0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8", @@ -13,20 +13,18 @@ const assets = [ "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d", ]; -const poolId = "0x4dc4f0ca6ea4961e4c8373265bfd5317678f4fe374d76f3fd7135f57763bf28"; - async function tvl(api) { - return sumTokens({ api, owner: poolAddress, tokens: assets }); + return sumTokens({ api, owner: SINGLETON, tokens: ASSETS }); } const borrowed = async (api) => { - const debtCalls = assets.map((asset) => ({ target: poolAddress, params: [poolId, asset] })); - const debtsRes = await multiCall({ calls: debtCalls, abi: abi.asset_config_unsafe, allAbi }); - const decimals = await multiCall({ calls: assets, abi: abi.decimals }); - return debtsRes.forEach((res, index) => { - const { total_nominal_debt } = res['0'] - const adjustDebt = Number(total_nominal_debt) * 10 ** (Number(decimals[index]) - 18) - api.add(assets[index], adjustDebt); + const calls = ASSETS.map((asset) => ({ target: SINGLETON, params: [POOL_ID, asset] })); + const assetStates = await multiCall({ calls, abi: abi.asset_config_unsafe, allAbi }); + return assetStates.forEach((res, index) => { + const { total_nominal_debt, scale, last_rate_accumulator } = res['0'] + const totalDebt = Number(total_nominal_debt) * Number(last_rate_accumulator) / INTERNAL_SCALE; + const scaledTotalDebt = totalDebt * Number(scale) / INTERNAL_SCALE; + api.add(ASSETS[index], scaledTotalDebt); }); }; @@ -36,4 +34,3 @@ module.exports = { borrowed, }, }; - From 478739d3a7e0e0e11ec9c5962a28bf7081b80f4c Mon Sep 17 00:00:00 2001 From: olenovyk <63065792+olenovyk@users.noreply.github.com> Date: Tue, 16 Jul 2024 16:06:18 +0200 Subject: [PATCH 735/855] Updating Mento Reserve addresses. Visit reserve.mento.org to verify (#11007) * Updating Mento Reserve addresses. Visit reserve.mento.org to verify * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/coreAssets.json | 4 +++- projects/mento/index.js | 10 +++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index eae1534eeb70..9fd47702a747 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -380,7 +380,9 @@ "DAI": "0x90ca507a5d4458a4c6c6249d186b6dcb02a5bccd", "NCT": "0x02de4766c272abc10bc88c220d214a26960a7e92", "cMCO2": "0x32a9fe697a32135bfd313a6ac28792dae4d9979d", - "USDT": "0x617f3112bf5397d0467d315cc709ef968d9ba546" + "USDT": "0x617f3112bf5397d0467d315cc709ef968d9ba546", + "STEUR": "0x004626A008B1aCdC4c74ab51644093b155e59A23", + "USDT_1": "0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e" }, "boba": { "WETH": "0xd203de32170130082896b4111edf825a4774c18e", diff --git a/projects/mento/index.js b/projects/mento/index.js index 264d520f0182..addb839a4b0b 100644 --- a/projects/mento/index.js +++ b/projects/mento/index.js @@ -3,18 +3,18 @@ const { nullAddress, } = require('../helper/unwrapLPs') const { sumTokensExport, } = require('../helper/sumTokens') module.exports = { - methodology: 'TVL counts Celo deposited as collateral to mint cUSD.', + methodology: 'TVL counts all assets deposited as collateral to mint Mento stablecoins.', celo: { tvl: sumTokensExport({ - owners: ['0x9380fA34Fd9e4Fd14c06305fd7B6199089eD4eb9', '0x246f4599eFD3fA67AC44335Ed5e749E518Ffd8bB', '0x298FbD6dad2Fc2cB56d7E37d8aCad8Bf07324f67',], - tokens: [nullAddress], + owners: ['0x9380fA34Fd9e4Fd14c06305fd7B6199089eD4eb9', '0x246f4599eFD3fA67AC44335Ed5e749E518Ffd8bB', '0x298FbD6dad2Fc2cB56d7E37d8aCad8Bf07324f67', '0x87647780180b8f55980c7d3ffefe08a9b29e9ae1'], + tokens: [nullAddress, ADDRESSES.celo.STEUR, ADDRESSES.celo.USDT_1], chain: 'celo', }) }, ethereum: { tvl: sumTokensExport({ - owners: ['0xe1955eA2D14e60414eBF5D649699356D8baE98eE', '0x8331C987D9Af7b649055fa9ea7731d2edbD58E6B', '0x26ac3A7b8a675b741560098fff54F94909bE5E73', '0x16B34Ce9A6a6F7FC2DD25Ba59bf7308E7B38E186', ], - tokens: [nullAddress, ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.DAI, ], + owners: ['0xe1955eA2D14e60414eBF5D649699356D8baE98eE', '0x8331C987D9Af7b649055fa9ea7731d2edbD58E6B', '0x26ac3A7b8a675b741560098fff54F94909bE5E73', '0x16B34Ce9A6a6F7FC2DD25Ba59bf7308E7B38E186', '0xd0697f70E79476195B742d5aFAb14BE50f98CC1E'], + tokens: [nullAddress, ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.DAI, ADDRESSES.ethereum.SDAI, ADDRESSES.ethereum.STETH ], chain: 'ethereum', }) }, From 5cb3ca594bb6b58e34f41bfc1cda376e9b37a841 Mon Sep 17 00:00:00 2001 From: 0xSacha <90143060+0xSacha@users.noreply.github.com> Date: Tue, 16 Jul 2024 16:08:20 +0200 Subject: [PATCH 736/855] add Nimbora yield-aggregator adapter (#10997) * add Nimbora yield-aggregator adapter * fix(api): change url * Revert "fix(api): change url" This reverts commit 98a5ccc224c8a73f4d749b045f8fe9d2da978721. * fix(aggregator): change url * Revert "fix(aggregator): change url" This reverts commit e02bcaa48b0a7ea8096f99205d548035a23f6c8d. * Update index.js --- projects/nimbora-yield-aggregator/index.js | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 projects/nimbora-yield-aggregator/index.js diff --git a/projects/nimbora-yield-aggregator/index.js b/projects/nimbora-yield-aggregator/index.js new file mode 100644 index 000000000000..fad66d945048 --- /dev/null +++ b/projects/nimbora-yield-aggregator/index.js @@ -0,0 +1,42 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { call, parseAddress } = require('../helper/chain/starknet') +const { getConfig } = require('../helper/cache') +const { get } = require('../helper/http') + +const totalAssetsAbi = { + "name": "total_assets", + "type": "function", + "inputs": [], + "outputs": [ + { + "name": "totalAssets", + "type": "Uint256" + } + ], + "stateMutability": "view" +} + +async function fetcher() { + return get('https://stats.nimbora.io/aggregator/strategies', { + headers: { + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36' + } + }) +} + +async function tvl(api) { + const strategyData = await getConfig('nimbora-yield', undefined, { fetcher }) + for (let index = 0; index < strategyData.length; index++) { + const strategyInfo = strategyData[index]; + const underlying = parseAddress(strategyInfo.underlying); + const strategyTvl = await call({ target: strategyInfo.vault, abi: totalAssetsAbi }); + api.add(underlying, strategyTvl) + } +} + +module.exports = { + methodology: 'Computed by summing the total assets held by each vault aggregator.', + starknet: { + tvl + }, +} From cf752d5c9d55d487556d4140b14fbe6676378ff1 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Tue, 16 Jul 2024 17:09:08 +0300 Subject: [PATCH 737/855] minor fix --- projects/nimbora-yield-aggregator/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/nimbora-yield-aggregator/index.js b/projects/nimbora-yield-aggregator/index.js index fad66d945048..e2b6102614e8 100644 --- a/projects/nimbora-yield-aggregator/index.js +++ b/projects/nimbora-yield-aggregator/index.js @@ -25,7 +25,7 @@ async function fetcher() { } async function tvl(api) { - const strategyData = await getConfig('nimbora-yield', undefined, { fetcher }) + const strategyData = await getConfig('nimbora-yield-aggregator', undefined, { fetcher }) for (let index = 0; index < strategyData.length; index++) { const strategyInfo = strategyData[index]; const underlying = parseAddress(strategyInfo.underlying); From 4d43cc4997a3eae1859ad0ac32a8cb4bbe6b66fe Mon Sep 17 00:00:00 2001 From: 0xngmi <80541789+0xngmi@users.noreply.github.com> Date: Tue, 16 Jul 2024 16:57:59 +0100 Subject: [PATCH 738/855] set non-vesting tvl to 0 (they were using the wrong methodology in their api) --- projects/streamflow/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/streamflow/index.js b/projects/streamflow/index.js index 95425c75a325..993db79e4731 100644 --- a/projects/streamflow/index.js +++ b/projects/streamflow/index.js @@ -33,7 +33,7 @@ async function getCachedApiRespnse() { async function tvl(api) { return { - tether: getValueForKey(await getCachedApiRespnse(), api.chain, TVL_KEY), + tether: 0 } } async function vesting(api) { From dae630ddbddc53f505490adca1d784d76a8b30d4 Mon Sep 17 00:00:00 2001 From: Andrew Zhou Date: Tue, 16 Jul 2024 23:49:00 -0700 Subject: [PATCH 739/855] term finance 0.9.0 emitter (#11015) --- projects/term-finance/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/term-finance/index.js b/projects/term-finance/index.js index 77b168a9d3b7..87415e3dec9b 100644 --- a/projects/term-finance/index.js +++ b/projects/term-finance/index.js @@ -47,6 +47,7 @@ const emitters = { "0x9D6a563cf79d47f32cE46CD7b1fb926eCd0f6160", // 0.2.4 "0xf268E547BC77719734e83d0649ffbC25a8Ff4DB3", // 0.4.1 "0xc60e0f5cD9EE7ACd22dB42F7f56A67611ab6429F", // 0.6.0 + "0x4C6Aeb4E8dBBAF53c13AF495c847D4eC68994bD4", // 0.9.0 ], "avax": [ "0xb81afB6724ba9d19a3572Fb29ed7ef633fD50093", // 0.6.0 From 08c93eed8a7f57bba511e362b4addb45a2d4d506 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 17 Jul 2024 09:52:21 +0300 Subject: [PATCH 740/855] track crust v2 (#11012) --- projects/crust-finance-v2/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 projects/crust-finance-v2/index.js diff --git a/projects/crust-finance-v2/index.js b/projects/crust-finance-v2/index.js new file mode 100644 index 000000000000..245f21840747 --- /dev/null +++ b/projects/crust-finance-v2/index.js @@ -0,0 +1,8 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + mantle: { + factory: "0xEaD128BDF9Cff441eF401Ec8D18a96b4A2d25252", + fromBlock: 62692352, + }, +}) \ No newline at end of file From 5367e62978ea284d165013ad97b6b7b809f45381 Mon Sep 17 00:00:00 2001 From: Sorta Finance Date: Wed, 17 Jul 2024 07:12:13 +0000 Subject: [PATCH 741/855] Add files via upload (#10985) * Add files via upload * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/sorta-fi/index.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 projects/sorta-fi/index.js diff --git a/projects/sorta-fi/index.js b/projects/sorta-fi/index.js new file mode 100644 index 000000000000..8b0ad4dbab83 --- /dev/null +++ b/projects/sorta-fi/index.js @@ -0,0 +1,26 @@ +const { compoundExports2 } = require("../helper/compound"); +const sdk = require('@defillama/sdk') +const { stakings } = require('../helper/staking') + +const contract = '0xE2D74A5f8101E6829409e4Fa8bBADCE2e0012C70' + +function tvl(borrowed = false) { + return async (api, ...args) => { + + const key = borrowed ? 'borrowed' : 'tvl' + const comptrollers = await api.call({ abi: 'address[]:getControllers', target: contract }) + const tvls = comptrollers.map(i => compoundExports2({ comptroller: i })[key]) + return sdk.util.sumChainTvls(tvls)(api, ...args) + } +} + +const stakingContract = '0xd828eB62B026e3eFf70b867FfD8C86C0AEA9dBd8' +const token = '0x73c36aE64842Eaf4D9209dE10fdA21017b5f0709' + +module.exports = { + arbitrum: { + tvl: tvl(), + borrowed: tvl(true), + staking: stakings([stakingContract], token), + } +} From f445ed681cfb5846a4feb433c071eef177115ba2 Mon Sep 17 00:00:00 2001 From: miffybunnyrabbit Date: Wed, 17 Jul 2024 17:15:26 +1000 Subject: [PATCH 742/855] Added $MONEY TVL for International Meme Fund (#10984) * just money --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/imf-money/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 projects/imf-money/index.js diff --git a/projects/imf-money/index.js b/projects/imf-money/index.js new file mode 100644 index 000000000000..486c45d8afed --- /dev/null +++ b/projects/imf-money/index.js @@ -0,0 +1,10 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') +const PEPE_TOKEN_CONTRACT = '0x6982508145454Ce325dDbE47a25d4ec3d2311933'; +const LOCKED_MONEY_CONTRACT = '0x30F75834cB406b7093208Fda7F689938aCBD1EeB'; //wallet that has all the locked money + +module.exports = { + methodology: 'Sums the value of deposited memes', + ethereum: { + tvl: sumTokensExport({ owner: LOCKED_MONEY_CONTRACT, token: PEPE_TOKEN_CONTRACT}), + } +}; From 15a329177e4b511c1afb1416121cd5108a18c54b Mon Sep 17 00:00:00 2001 From: leeamijo <154820412+leeamijo@users.noreply.github.com> Date: Wed, 17 Jul 2024 15:50:17 +0800 Subject: [PATCH 743/855] support mantle scroll bob chain (#11016) * feat: add support bevm chain * feat: support mantle scroll bob chain --- projects/pell/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/pell/index.js b/projects/pell/index.js index e5c090319422..1ba12511bec8 100644 --- a/projects/pell/index.js +++ b/projects/pell/index.js @@ -1,7 +1,7 @@ const { sumTokens2 } = require('../helper/unwrapLPs') const { getConfig } = require('../helper/cache') -const chains = ['merlin', 'bouncebit', 'btr', 'bsc', 'bsquared', 'core', 'bevm'] +const chains = ['merlin', 'bouncebit', 'btr', 'bsc', 'bsquared', 'core', 'bevm', 'mantle', 'scroll', 'bob'] chains.forEach(chain => { module.exports[chain] = { From 4b1944cd334673eaf06546e1610693acb7f77d94 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Wed, 17 Jul 2024 10:21:06 +0100 Subject: [PATCH 744/855] ton --- projects/tonbridge.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/projects/tonbridge.js b/projects/tonbridge.js index a7cd42ef9ee0..0c098d2c9bb1 100644 --- a/projects/tonbridge.js +++ b/projects/tonbridge.js @@ -13,13 +13,13 @@ const tokenMap = { //'f48054939064d686a9ad68d96d9ab79e409b095557c06ab7f073097dade7057f': 'dartflex', //'00ca16398f314a9b3bed582dc69582515d866ededb6c4e18190f63b305cedf91': NA 'a49cd4e158a9a15555e624759e2e4e766d22600b7800d891e46f9291f044a93d': 'everscale', - 'b2e341c01da068d43cfa0eae6dae36b12b476e55cf2c3eeb002689f44b9ddef9': 'aave', - 'bc77ba7f3cbbebcca393e85ed479ef44df63cdee4fb572c3e0f904fb9fc63e25': 'compound-governance-token', - '7dd7ae82835848dc6b490515ec4034968a8ceff893a6d5f31ab3cdfcfb79bbb6': 'curve-dao-token', - '6b2baa777b89da66dddaf9f1602142987b13ca565bbb170da929ea945f5ce9fb': 'stasis-eurs', + // 'b2e341c01da068d43cfa0eae6dae36b12b476e55cf2c3eeb002689f44b9ddef9': 'aave', + // 'bc77ba7f3cbbebcca393e85ed479ef44df63cdee4fb572c3e0f904fb9fc63e25': 'compound-governance-token', + // '7dd7ae82835848dc6b490515ec4034968a8ceff893a6d5f31ab3cdfcfb79bbb6': 'curve-dao-token', + // '6b2baa777b89da66dddaf9f1602142987b13ca565bbb170da929ea945f5ce9fb': 'stasis-eurs', //'387609364f765017fa3fa5815e08d420e054c88a86426cd6d5aaf2a1ee46ff5a': 'torn', - 'e114f1f7d21ac6566d988c983315e0cdd5bee7b43c08918537d1117dea7e4534': 'yearn-finance', - '3c66e3e0ce0a909ce8779b31509db773e544132d8fa6f6641c00bce257c79d9c': '1inch', + // 'e114f1f7d21ac6566d988c983315e0cdd5bee7b43c08918537d1117dea7e4534': 'yearn-finance', + // '3c66e3e0ce0a909ce8779b31509db773e544132d8fa6f6641c00bce257c79d9c': '1inch', //'bf1c7c0e8a187d9d5ba6069bf768b69a982df8b22ef8430b31dcc4f97263507e': 'dartflex' }; @@ -27,7 +27,14 @@ async function tvl() { const balances = {}; const tokenAddresses = Object.keys(tokenMap); for (let i = 0; i < tokenAddresses.length; i++) { - const supply = (await axios.get(burl + tokenAddresses[i])).data.totalSupply; + let a = await axios.get(burl + tokenAddresses[i]) + let supply + try { + supply = (await axios.get(burl + tokenAddresses[i])).data.totalSupply; + } catch { + let b = tokenAddresses[i] + a + } balances[tokenMap[tokenAddresses[i]]] = supply } return balances; From a57c5a31740956031fe70f57f9e14d8febe263ff Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Wed, 17 Jul 2024 10:22:20 +0100 Subject: [PATCH 745/855] remove debug --- projects/tonbridge.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/projects/tonbridge.js b/projects/tonbridge.js index 0c098d2c9bb1..730263b45cda 100644 --- a/projects/tonbridge.js +++ b/projects/tonbridge.js @@ -27,14 +27,7 @@ async function tvl() { const balances = {}; const tokenAddresses = Object.keys(tokenMap); for (let i = 0; i < tokenAddresses.length; i++) { - let a = await axios.get(burl + tokenAddresses[i]) - let supply - try { - supply = (await axios.get(burl + tokenAddresses[i])).data.totalSupply; - } catch { - let b = tokenAddresses[i] - a - } + const supply = (await axios.get(burl + tokenAddresses[i])).data.totalSupply; balances[tokenMap[tokenAddresses[i]]] = supply } return balances; From 6790b1211029e2302f1f4f1cbc27ba3ac4b0a25b Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Wed, 17 Jul 2024 10:39:46 +0100 Subject: [PATCH 746/855] binance new wallets (#11020) --- projects/binance/config.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/projects/binance/config.js b/projects/binance/config.js index 0b44ea3fd7f1..4b945b4df62a 100644 --- a/projects/binance/config.js +++ b/projects/binance/config.js @@ -463,6 +463,7 @@ const assetList = [ ['USDC', 'ARB', '0xf977814e90da44bfa03b6295a0616a897441acec'], ['USDC', 'AVAX', '0x4aefa39caeadd662ae31ab0ce7c8c2c9c0a013e8'], ['USDC', 'AVAX', '0x9f8c163cba728e99993abe7495f06c0a3c8ac8b9'], + ['AVAX', 'AVAX', '0x835678a611b28684005a5e2233695fb6cbbb0007'], ['USDC', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'], ['USDC', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'], ['USDC', 'BEP20', '0x0e4158c85ff724526233c1aeb4ff6f0c46827fbe'], @@ -593,6 +594,30 @@ const assetList = [ ['XRP', 'XRP', 'rhWj9gaovwu2hZxYW7p388P8GRbuXFLQkK'], ['XRP', 'XRP', 'rpmxpWis42eYV4oMhyxJNSzrLRdacJVooa'], ['XRP', 'XRP', 'rs8ZPbYqgecRcDzQpJYAMhSxSi5htsjnza'], + ['USDT', 'ETH', '0x835678a611b28684005a5e2233695fb6cbbb0007'], + ['ETH', 'ETH', '0x835678a611b28684005a5e2233695fb6cbbb0007'], + ['ETH', 'ARB', '0xf92402bb795fd7cd08fb83839689db79099c8c9c'], + ['AVAX', 'AVAX', '0x978b21a854dbefcd6d51dfd269875d158046240b'], + ['USDC', 'AVAX', '0x978b21a854dbefcd6d51dfd269875d158046240b'], + ['USDT', 'AVAX', '0x978b21a854dbefcd6d51dfd269875d158046240b'], + ['AVAX', 'AVAX', '0xcddc5d0ebeb71a08fff26909aa6c0d4e256b4fe1'], + ['USDC', 'AVAX', '0xcddc5d0ebeb71a08fff26909aa6c0d4e256b4fe1'], + ['USDT', 'AVAX', '0xcddc5d0ebeb71a08fff26909aa6c0d4e256b4fe1'], + ['AVAX', 'AVAX', '0x6d8be5cdf0d7dee1f04e25fd70b001ae3b907824'], + ['USDC', 'AVAX', '0x6d8be5cdf0d7dee1f04e25fd70b001ae3b907824'], + ['USDT', 'AVAX', '0x6d8be5cdf0d7dee1f04e25fd70b001ae3b907824'], + ['AVAX', 'AVAX', '0x3bce63c6c9abf7a47f52c9a3a7950867700b0158'], + ['USDC', 'AVAX', '0x3bce63c6c9abf7a47f52c9a3a7950867700b0158'], + ['USDT', 'AVAX', '0x3bce63c6c9abf7a47f52c9a3a7950867700b0158'], + ['AVAX', 'AVAX', '0xaba2d404c5c41da5964453a368aff2604ae80a14'], + ['USDC', 'AVAX', '0xaba2d404c5c41da5964453a368aff2604ae80a14'], + ['USDT', 'AVAX', '0xaba2d404c5c41da5964453a368aff2604ae80a14'], + ['ETH', 'BASE', '0x3304e22ddaa22bcdc5fca2269b418046ae7b566a'], + ['USDC', 'BASE', '0x3304e22ddaa22bcdc5fca2269b418046ae7b566a'], + ['ETH', 'ETH', '0x1b46970cfe6a271e884f636663c257a5a571fb2c'], + ['MATIC', 'MATIC', '0x505e71695e9bc45943c58adec1650577bca68fd9'], + ['USDT', 'MATIC', '0x505e71695e9bc45943c58adec1650577bca68fd9'], + ['USDT', 'TRX', 'TRGCqsUXeynKTgynp2j9g3sg7Nux2KtB3u'], ] function getAddresses(chain) { From 43750bb7a56045cd93ad5d7d60e9a9782c4cdfa8 Mon Sep 17 00:00:00 2001 From: pie Date: Wed, 17 Jul 2024 17:56:04 +0800 Subject: [PATCH 747/855] Update Cygnus Finance with adding TON TVL (#11021) * feat: add ton TVL of Cygnus Finance * feat: adjust tvl methodology --- projects/cygnus-finance/index.js | 43 +++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/projects/cygnus-finance/index.js b/projects/cygnus-finance/index.js index f8ea66b61188..a4a696fe38b8 100644 --- a/projects/cygnus-finance/index.js +++ b/projects/cygnus-finance/index.js @@ -1,14 +1,45 @@ -const CGUSD_CONTRACT = "0xCa72827a3D211CfD8F6b00Ac98824872b72CAb49"; -const START_TIME = 1708351200; +const { call } = require("../helper/chain/ton") +const { get } = require('../helper/http') -async function tvl(api) { - await api.erc4626Sum({ calls: [CGUSD_CONTRACT], balanceAbi: 'getTotalPooledAssets', tokenAbi: "asset" }); +const CGUSD_CONTRACT = "0xCa72827a3D211CfD8F6b00Ac98824872b72CAb49" +const START_TIME = 1708351200 + +async function baseTvl(api) { + await api.erc4626Sum({ calls: [CGUSD_CONTRACT], balanceAbi: 'getTotalPooledAssets', tokenAbi: "asset" }) +} + +// helper function of getting jetton metadata +async function getJettonMetadata(addr) { + const res = await get(`https://tonapi.io/v2/jettons/${addr}`) + return res +} + +async function tonTvl() { + const MINTER_ADDRESS = "EQCfvQW-thWpqKgyqtXCFbYayDlHqS0-frkyP6VD70paLFZa" + const CGUSDT_ADDRESS = 'EQBIBw3mF_TDMJqWAZihVsyUBMWpWw_deftZLiCxTmrCUOKy' + + + const minterResult = await call({ target: MINTER_ADDRESS, abi: "get_minter_data", stack: [] }) + // exchange rate from cgUSDT to USDT: decimal 9 + const cgusdtTousdt = (minterResult[5]) / 10 ** 9 + + // cgUSDT total supply: decimal 6 + const jettonResult = await getJettonMetadata(CGUSDT_ADDRESS) + const cgUsdtTotalSupply = jettonResult['total_supply'] + + // caculate tvl + const tvl = (cgUsdtTotalSupply) / 10 ** 6 * cgusdtTousdt + return { "coingecko:tether": tvl } } + module.exports = { - methodology: "Calculates the total cgUSD Supply", + methodology: "Calculates the total cgUSD and cgUSDT Supply", start: START_TIME, base: { - tvl, + tvl: baseTvl, }, + ton: { + tvl: tonTvl + } }; From 62a07493206aa1b434300f22523a20917e93081c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 17 Jul 2024 16:43:11 +0300 Subject: [PATCH 748/855] fix nexus mutual --- projects/nexus/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/nexus/index.js b/projects/nexus/index.js index 19945adcaefc..ad3ec24c10e3 100644 --- a/projects/nexus/index.js +++ b/projects/nexus/index.js @@ -13,6 +13,11 @@ async function tvl(api) { const ownerTokens = assets.map((v, i) => [v.map(i => i.assetAddress), pools[i]]) const assets2 = await api.multiCall({ abi: 'address[]:getTrackedAssets', calls: yieldPools }) assets2.forEach((v, i) => ownerTokens.push([v, yieldPools[i]])) + const MasterProxy = '0x01BFd82675DBCc7762C84019cA518e701C0cD07e' + // const bytes2 = ethers.utils.formatBytes32String('P1').slice(0, 4) // '0x5031 + const P1Address = await api.call({ abi: 'function getLatestAddress(bytes2) view returns (address)', target: MasterProxy, params: '0x5031' }) + const ethValue = await api.call({ abi: 'uint256:getPoolValueInEth', target: P1Address}) + api.addGasToken(ethValue) return sumTokens2({ api, ownerTokens, blacklistedTokens: yieldPools}) } From 1300bbccd95afd4bdc4409bb54b007134601316b Mon Sep 17 00:00:00 2001 From: Knight <74679047+Knight-101@users.noreply.github.com> Date: Wed, 17 Jul 2024 19:25:16 +0530 Subject: [PATCH 749/855] kriya clmm tvl (#11025) --- projects/kriya-clmm/index.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 projects/kriya-clmm/index.js diff --git a/projects/kriya-clmm/index.js b/projects/kriya-clmm/index.js new file mode 100644 index 000000000000..089aa59221e3 --- /dev/null +++ b/projects/kriya-clmm/index.js @@ -0,0 +1,25 @@ +const sui = require("../helper/chain/sui"); + +const EVENT_FILTER = + "0xf6c05e2d9301e6e91dc6ab6c3ca918f7d55896e1f1edd64adc0e615cde27ebf1::create_pool::PoolCreatedEvent"; + +async function kriyaTVL(api) { + const poolIds = await sui.queryEvents({ + eventType: EVENT_FILTER, + transform: (i) => i.pool_id, + }); + const pools = await sui.getObjects(poolIds); + pools.forEach((i) => { + const [token0, token1] = i.type.split("<")[1].replace(">", "").split(", "); + api.add(token0, i.fields.reserve_x); + api.add(token1, i.fields.reserve_y); + }); +} + +module.exports = { + timetravel: false, + methodology: "Collects TVL for all CLMM pools created on Kriya", + sui: { + tvl: kriyaTVL, + }, +}; From df41e1a9a9259b294b277c6bf2df9754a6f958a1 Mon Sep 17 00:00:00 2001 From: RickVM Date: Wed, 17 Jul 2024 15:59:15 +0200 Subject: [PATCH 750/855] Add Ducata project (#11023) * feat: index tvl for Ducata * refactor: clarify number * fix: improve methodology description --- projects/ducata/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/ducata/index.js diff --git a/projects/ducata/index.js b/projects/ducata/index.js new file mode 100644 index 000000000000..47b8fe04f383 --- /dev/null +++ b/projects/ducata/index.js @@ -0,0 +1,11 @@ +const { onChainTvl } = require('../helper/balancer') + +const vault = "0x25898DEe0634106C2FcBB51B3DB5b14aA1c238a4"; +const launchBlock = 230182440; + +module.exports = { + methodology: 'TVL counts the external assets deposited in the vaults', + arbitrum: { + tvl: onChainTvl(vault, launchBlock), + } + }; \ No newline at end of file From c313e406807c275fa71b7d888cd3b19ccd4f5542 Mon Sep 17 00:00:00 2001 From: Keno Dressel <765921+kenodressel@users.noreply.github.com> Date: Wed, 17 Jul 2024 15:59:51 +0200 Subject: [PATCH 751/855] adds tvl for superhero dex (#11026) --- projects/helper/env.js | 1 - projects/superhero-dex/index.js | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 projects/superhero-dex/index.js diff --git a/projects/helper/env.js b/projects/helper/env.js index efebeaec62d2..a5dd7389b105 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -23,7 +23,6 @@ const DEFAULTS = { SEI_RPC_MULTICALL: '0xcA11bde05977b3631167028862bE2a173976CA11', SEI_RPC: 'https://evm-rpc.sei-apis.com/', ETLK_RPC_MULTICALL: "0xcA11bde05977b3631167028862bE2a173976CA11", - AETERNITY_HTTP_ENDPOINT: 'https://mainnet.aeternity.io', } const ENV_KEYS = [ diff --git a/projects/superhero-dex/index.js b/projects/superhero-dex/index.js new file mode 100644 index 000000000000..1a249fb29a1b --- /dev/null +++ b/projects/superhero-dex/index.js @@ -0,0 +1,29 @@ +const { get } = require('../helper/http') +const { transformDexBalances } = require("../helper/portedTokens"); + +async function tvl(api) { + const allPools = []; + const pairs = await get('https://dex-backend-mainnet.prd.service.aepps.com/pairs') + for (const pair of pairs) { + const [pairLiquidityInfo] = await get('https://dex-backend-mainnet.prd.service.aepps.com/history?pairAddress=' + pair.address + '&limit=100&order=desc&toBlockTime=' + api.timestamp * 1000); + allPools.push({ + token0: pair.token0, + token0Bal: pairLiquidityInfo?.reserve0 || 0, + token1: pair.token1, + token1Bal: pairLiquidityInfo?.reserve1 || 0, + }) + } + + return transformDexBalances({ + chain: 'aeternity', + data: allPools, + }); +} + + +module.exports = { + methodology: 'TVL is calculated based on tokens that are locked in the Superhero DEX pools.', + aeternity: { + tvl, + }, +}; \ No newline at end of file From 2809cf274efb748c02f1ca84f71ff83eb4039e41 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 17 Jul 2024 17:00:57 +0300 Subject: [PATCH 752/855] fix superhero --- projects/superhero-dex/index.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/projects/superhero-dex/index.js b/projects/superhero-dex/index.js index 1a249fb29a1b..1578d0127e2c 100644 --- a/projects/superhero-dex/index.js +++ b/projects/superhero-dex/index.js @@ -14,14 +14,12 @@ async function tvl(api) { }) } - return transformDexBalances({ - chain: 'aeternity', - data: allPools, - }); + return transformDexBalances({ chain: 'aeternity', data: allPools, }); } module.exports = { + timetravel: false, methodology: 'TVL is calculated based on tokens that are locked in the Superhero DEX pools.', aeternity: { tvl, From 4bc0a491634317ebe29304d23354554aac6a6cac Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 17 Jul 2024 17:04:10 +0300 Subject: [PATCH 753/855] track manta stake (#11024) --- projects/manta-cedefi-stake/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/manta-cedefi-stake/index.js diff --git a/projects/manta-cedefi-stake/index.js b/projects/manta-cedefi-stake/index.js new file mode 100644 index 000000000000..103f0e0a58ec --- /dev/null +++ b/projects/manta-cedefi-stake/index.js @@ -0,0 +1,14 @@ +const { sumTokensExport } = require("../helper/unwrapLPs") + +const tokens = [ + "0x1468177DbCb2a772F3d182d2F1358d442B553089", // "mBTC" + "0xACCBC418a994a27a75644d8d591afC22FaBA594e", // "mETH" + "0x649d4524897cE85A864DC2a2D5A11Adb3044f44a", // "mUSD" +] +const mTokenStakeContract = "0x1B9bcc6644CC9b5e1F89aBaAb66904F5a562d4a1" + +module.exports = { + manta: { + tvl: sumTokensExport({ owner: mTokenStakeContract, tokens }), + }, +} \ No newline at end of file From b75b3e40d497a563fb8ee2addd242e4efcb23930 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 17 Jul 2024 17:07:29 +0300 Subject: [PATCH 754/855] update linehub (#11017) --- projects/linehub-perps/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/linehub-perps/index.js b/projects/linehub-perps/index.js index e3267bf1eec5..cf4d3d161f6c 100644 --- a/projects/linehub-perps/index.js +++ b/projects/linehub-perps/index.js @@ -4,7 +4,7 @@ const { nullAddress } = require("../helper/unwrapLPs"); async function LineaTvl(api) { const tokens = [nullAddress, ADDRESSES.linea.USDC]; - const owners = ["0xC94cFd8F4fB8Ef3EB360Ec92e2A9Ca969Cadf095"]; + const owners = ["0xC94cFd8F4fB8Ef3EB360Ec92e2A9Ca969Cadf095", "0x00744A65cFC59ACBa312Ade7ABf77379A041Ae26"]; return api.sumTokens({ owners, tokens }); } From 0d9816997407b516e396fae0ae105b763c97c64c Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Wed, 17 Jul 2024 21:44:22 +0200 Subject: [PATCH 755/855] betfolio, add soloPrediction (#11030) Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> --- projects/betfolio/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/betfolio/index.js b/projects/betfolio/index.js index c328ab6abe96..e321d4922496 100644 --- a/projects/betfolio/index.js +++ b/projects/betfolio/index.js @@ -6,8 +6,11 @@ const config = { } async function getContracts() { - const { data: { list } } = await getConfig('betfolio', 'https://api.betfolio.co/api/v1/user/predictionList?limit=1000&duration=&type=') - return list.map(i => i.contract_address) + const [list0Res, list1Res] = await Promise.all([ + getConfig('betfolio', 'https://api.betfolio.co/api/v1/user/predictionList?limit=1000&duration=&type='), + getConfig('betfolioSoloPrediction', 'https://api.betfolio.co/api/v1/user/getSoloPredictions?limit=1000&type=All&theme=All&solo_type=All') + ]); + return [...list0Res.data.list, ...list1Res.data.list].map(i => i.contract_address) } Object.keys(config).forEach(chain => { From 6641b94ee8a2d992077eabfded04f18e9fadeec6 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 17 Jul 2024 23:05:59 +0100 Subject: [PATCH 756/855] add base --- projects/alexar/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/alexar/index.js b/projects/alexar/index.js index dd46a5b804f3..4598d6754f84 100644 --- a/projects/alexar/index.js +++ b/projects/alexar/index.js @@ -11,7 +11,7 @@ const chainMapping = { }; const chainListSupply = ['juno', 'cosmos', 'comdex', 'carbon', 'crescent', 'injective', 'kujira', 'osmosis', 'persistence', 'stargaze', 'secret', 'stargaze', 'umee', 'evmos', 'terra2']; -const chainListTotal = ['avax', 'bsc', 'moonbeam', 'polygon', 'fantom', 'arbitrum', 'aurora', 'celo', 'kava', 'mantle', 'ethereum',]; +const chainListTotal = ['avax', 'bsc', 'moonbeam', 'polygon', 'fantom', 'arbitrum', 'aurora', 'celo', 'kava', 'mantle', 'ethereum', 'base']; chainListSupply.concat(chainListTotal).forEach(chain => { From 7ac6c64e5d906ec1202f20273f58fd3569f2e58a Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Thu, 18 Jul 2024 05:46:03 +0100 Subject: [PATCH 757/855] add hallmark --- projects/psyoptions/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/psyoptions/index.js b/projects/psyoptions/index.js index c77d0b9ec4ce..43371f809786 100644 --- a/projects/psyoptions/index.js +++ b/projects/psyoptions/index.js @@ -127,6 +127,9 @@ async function tvl() { module.exports = { misrepresentedTokens: true, + hallmarks: [ + [1717977600,"Withdrawal Only Mode Announced"] + ], timetravel: false, solana: { tvl, From 4a6c8540996cfc3871538d94fdd1933fb44862e0 Mon Sep 17 00:00:00 2001 From: Andrii Rozinko <31214139+AndrewAR2@users.noreply.github.com> Date: Thu, 18 Jul 2024 09:22:50 +0300 Subject: [PATCH 758/855] Add Bridge as main bridge in AirDAO Network (#11035) --- projects/airdao-bridge/index.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 projects/airdao-bridge/index.js diff --git a/projects/airdao-bridge/index.js b/projects/airdao-bridge/index.js new file mode 100644 index 000000000000..1b956ea39f8f --- /dev/null +++ b/projects/airdao-bridge/index.js @@ -0,0 +1,24 @@ +const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs"); +const ADDRESSES = require('../helper/coreAssets.json') + +const CHAINS = { + ethereum: { + locker: "0x0De2669e8A7A6F6CC0cBD3Cf2D1EEaD89e243208", + tokens: [ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.WETH] + }, + bsc: { + locker: "0x92fa52d3043725D00Eab422440C4e9ef3ba180d3", + tokens: [ADDRESSES.bsc.USDC, ADDRESSES.bsc.USDT, ADDRESSES.bsc.WBNB, ADDRESSES.bsc.BUSD] + }, +} + +module.exports = { + methodology: + "Adds up the total value locked as collateral on the Bridge platform" +} + +Object.keys(CHAINS).forEach(chain => { + module.exports[chain] = { + tvl: sumTokensExport({ owner: CHAINS[chain].locker, tokens: CHAINS[chain].tokens }) + } +}) From 00550ff2acedffb041517df3014025cd6c02c446 Mon Sep 17 00:00:00 2001 From: FedererKK Date: Thu, 18 Jul 2024 02:27:34 -0400 Subject: [PATCH 759/855] Add wonton contract to tvl calculations (#11033) * Add wonton contract to tvl calculations * merge files --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/wonton/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/wonton/index.js diff --git a/projects/wonton/index.js b/projects/wonton/index.js new file mode 100644 index 000000000000..24e0de3b7b1b --- /dev/null +++ b/projects/wonton/index.js @@ -0,0 +1,16 @@ +const ADDRESSES = require("../helper/coreAssets.json") +const { sumTokensExport } = require("../helper/chain/ton") +const HIGHLOAD_CONTRACT = "UQD8ucMJDu-VfMbemse1GaSefy8DUB18VxpvbnWiHQGlGMED" +const POOL_CONTRACT = "UQDzfsiEm9p5KCPA8xNiXHLX42WShhvXEwVadworVgFvCyV8" + +module.exports = { + methodology: + "Counts all TON sitting in pre-bonding and high-load smart contact as the TVL. ", + timetravel: false, + ton: { + tvl: sumTokensExport({ + owners: [HIGHLOAD_CONTRACT, POOL_CONTRACT], + tokens: ADDRESSES.ton.TON, + }) + }, +}; From c34862db74e5c09e3d7fa14cbcc918e4815df520 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 18 Jul 2024 11:03:36 +0300 Subject: [PATCH 760/855] fix alexar --- projects/alexar/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/alexar/index.js b/projects/alexar/index.js index 4598d6754f84..f35001a02d13 100644 --- a/projects/alexar/index.js +++ b/projects/alexar/index.js @@ -25,9 +25,12 @@ chainListSupply.concat(chainListTotal).forEach(chain => { if (!assetTvl) return; const isEVM = assetTvl.gateway_address?.startsWith('0x') + const data = assetTvl.contract_data if (isEVM) { - if (assetTvl.contract_data.symbol.startsWith('axl')) return; - tokensAndOwners.push([assetTvl.contract_data.address, assetTvl.gateway_address]) + if (data.symbol.startsWith('axl')) return; + tokensAndOwners.push([data.address, assetTvl.gateway_address]) + if (data.token_manager_address) + tokensAndOwners.push([data.address, data.token_manager_address]) } else { if (assetTvl.denom_data.symbol.startsWith('axl')) return; owners.push(...assetTvl.source_escrow_addresses) From d27110dbd7613e1518f133cecf4200deefa75b5a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 18 Jul 2024 13:42:43 +0300 Subject: [PATCH 761/855] minor fix --- projects/superhero-dex/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/superhero-dex/index.js b/projects/superhero-dex/index.js index 1578d0127e2c..e1aa3ba05f11 100644 --- a/projects/superhero-dex/index.js +++ b/projects/superhero-dex/index.js @@ -19,7 +19,6 @@ async function tvl(api) { module.exports = { - timetravel: false, methodology: 'TVL is calculated based on tokens that are locked in the Superhero DEX pools.', aeternity: { tvl, From d36b645c91c11eba9637e610f90c198678fb7d95 Mon Sep 17 00:00:00 2001 From: rudewalt Date: Thu, 18 Jul 2024 15:17:29 +0300 Subject: [PATCH 762/855] Marginly: added new pool factory (#11036) Co-authored-by: Ivan Sanin --- projects/marginly/config.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/marginly/config.js b/projects/marginly/config.js index 6b358afbed61..daaa5d6f1083 100644 --- a/projects/marginly/config.js +++ b/projects/marginly/config.js @@ -11,6 +11,11 @@ module.exports = { fromBlock: 208756175, version: "v1.5", }, + { + factory: "0x4a805A6dbaCF824D5A39b9f3559aeFb831C1df95", + fromBlock: 220673210, + version: "v1.5", + }, ], }, blast: { From 2f1298f6bdefaceae4c35bddced0caa9d00ffdeb Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Thu, 18 Jul 2024 22:48:58 +0800 Subject: [PATCH 763/855] Update fx-protocol tvl (#11038) * Add arUSD * Add Concentrator arUSD * Update arUSD * Update fx-protocol tvl --------- Co-authored-by: Andrew --- projects/fx-Protocol/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/fx-Protocol/index.js b/projects/fx-Protocol/index.js index ad6d12f9e219..a4f998796bb1 100644 --- a/projects/fx-Protocol/index.js +++ b/projects/fx-Protocol/index.js @@ -5,6 +5,7 @@ const treasuries = [ "0x781BA968d5cc0b40EB592D5c8a9a3A4000063885", "0x38965311507D4E54973F81475a149c09376e241e", "0x63Fe55B3fe3f74B42840788cFbe6229869590f83", + "0xdFac83173A96b06C5D6176638124d028269cfCd2" ]; module.exports = { From eebc267e1f8dc3921a335454781c9cda7468d05a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 18 Jul 2024 19:24:18 +0300 Subject: [PATCH 764/855] track every finance (#11039) --- projects/everyfinance/index.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 projects/everyfinance/index.js diff --git a/projects/everyfinance/index.js b/projects/everyfinance/index.js new file mode 100644 index 000000000000..d782e9014c63 --- /dev/null +++ b/projects/everyfinance/index.js @@ -0,0 +1,20 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +const config = { + ethereum: { managers: ['0xbebbaE6f1062E4Cd5652B9d8e1B8aECBEE993A9E', '0x19d6D19a034BB886507DC08dF99716f418bD61a3', '0xbE721812442C648c191Bc267659374036fd68918'] }, + bsc: { managers: ['0xbebbaE6f1062E4Cd5652B9d8e1B8aECBEE993A9E', '0x19d6D19a034BB886507DC08dF99716f418bD61a3', '0x8849FCE3fB3d82BBF14e1FC9D7E82EAfEB4b2904'] }, + polygon: { managers: ['0x8849FCE3fB3d82BBF14e1FC9D7E82EAfEB4b2904', '0xbE49a740c48F9D4347De8994c488333d492a4e19', '0x9C1A18A734dFAe6e6f89942f358e7270BecdB002'] }, +} + +Object.keys(config).forEach(chain => { + const { managers, } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const safeHouses = await api.multiCall({ abi: 'address:safeHouse', calls: managers }) + const assetBooks = await api.multiCall({ abi: 'address:assetBook', calls: safeHouses }) + const tokens = await api.fetchList({ lengthAbi: 'getAssetsListSize', itemAbi: 'assetsList', calls: assetBooks, groupedByInput: true, }) + const ownerTokens = tokens.map((t, i) => [t, safeHouses[i]]) + return sumTokens2({ api, ownerTokens, permitFailure: true }) + } + } +}) \ No newline at end of file From 8d224483b43e4eefa8094a971daa65b9f92958bb Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Thu, 18 Jul 2024 18:28:10 +0200 Subject: [PATCH 765/855] Dex_Finance_Vault (#11037) * wip dex_finance_vaults * WIP dex-finance * restore * batch fetch farm data * bugfix * feat:DexFinance-vault Adapter * revert using last logic sequential call * exclude gDEX * use addERC721Data instead of custom function * rm call tokenId from getVaultDatas since its call in addERC721Data --------- Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/agentfi/index.js | 11 +-- projects/dexfinance-vault/abi.js | 25 ++++++ projects/dexfinance-vault/index.js | 132 +++++++++++++++++++++++++++++ projects/helper/tokenMapping.js | 3 + projects/helper/unwrapLPs.js | 50 +++++++---- projects/thetanuts/index.js | 19 +++-- 6 files changed, 207 insertions(+), 33 deletions(-) create mode 100644 projects/dexfinance-vault/abi.js create mode 100644 projects/dexfinance-vault/index.js diff --git a/projects/agentfi/index.js b/projects/agentfi/index.js index 7f9e0ce4fbca..527b2990e335 100644 --- a/projects/agentfi/index.js +++ b/projects/agentfi/index.js @@ -19,10 +19,8 @@ async function tvl(api) { const blasterswapv2 = dexBalancerAgents.map(i => [uniV2Lp.blasterswap, i.agentAddress]) const ringv2 = dexBalancerAgents.map(i => [uniV2Lp.ring, i.agentAddress]) - const blasterswapV3 = concentratedLiquidityAgents.map(i => [uniV3NftManager.blasterswap, i.agentAddress]) - const blasterswap2V3 = concentratedLiquidityAgents.map(i => [uniV3NftManager.blasterswap2, i.agentAddress]) - const thrusterV3 = concentratedLiquidityAgents.map(i => [uniV3NftManager.thruster, i.agentAddress]) - + const agents = concentratedLiquidityAgents.map(i => i.agentAddress) + await sumTokens2({ api, owners: agents, uniV3ExtraConfig: { nftAddress: [uniV3NftManager.blasterswap, uniV3NftManager.blasterswap2, uniV3NftManager.thruster]}}) await getTvlForDexBalancer(dexBalancerAgents.map(i => i.agentAddress), api) await getTvlForLooperWithOrbit(looperAgentsAddresses, api) @@ -33,11 +31,6 @@ async function tvl(api) { ...blasterswapv2, ...ringv2, ], - uniV3nftsAndOwners: [ - ...blasterswapV3, - ...blasterswap2V3, - ...thrusterV3 - ], resolveLP: true, api, }) diff --git a/projects/dexfinance-vault/abi.js b/projects/dexfinance-vault/abi.js new file mode 100644 index 000000000000..079d42ce2799 --- /dev/null +++ b/projects/dexfinance-vault/abi.js @@ -0,0 +1,25 @@ +exports.abi = { + factory: { + vaultsLength: "function vaultsCount() view returns (uint256)", + vaults: "function vaults(uint256 index) view returns (address)", + farmCalculationConnector: + "function farmCalculationConnector(address) view returns (address)", + }, + vault: { + liquidity: "function liquidity(address) view returns (uint256 liquidity_)", + farmsLength: "uint256:farmsCount", + farmConnector: "function farmConnector(address) view returns (address)", + farms: + "function farms(uint256 index) view returns (tuple(address beacon, uint256 percent, bytes data))", + }, + farm: { + stakingToken: "function stakingToken() view returns (address)", + farm: "address:farm", + type: "string:stakingTokenType", + tokenId: "uint256:tokenId", + stakingTokenLiquidity: + "function stakingTokenLiquidity(uint256 tokenId_) view returns (uint256 liquidity_)", + stakingTokenData: + "function stakingTokenData() view returns ((string stakingTokenType, address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, (uint256 sqrtPriceX96LowInit, uint256 sqrtPriceX96UpInit, uint256 sqrtPriceX96LowLimit, uint256 sqrtPriceX96UpLimit, uint256 sqrtPriceX96ApproxPricePercent, uint256 sqrtPriceX96ShiftPercentLow, uint256 sqrtPriceX96ShiftPercentUp, uint256 sqrtPriceX96DefaultShiftPercentLow, uint256 sqrtPriceX96DefaultShiftPercentUp) pricesData, (address tokenIn, address tokenOut)[] swapsToken0ToNative, (address tokenIn, address tokenOut)[] swapsToken1ToNative, (address tokenIn, address tokenOut)[] swapsNativeToToken0, (address tokenIn, address tokenOut)[] swapsNativeToToken1))", + } +}; diff --git a/projects/dexfinance-vault/index.js b/projects/dexfinance-vault/index.js new file mode 100644 index 000000000000..c98ad20af55e --- /dev/null +++ b/projects/dexfinance-vault/index.js @@ -0,0 +1,132 @@ +const { sumTokens2, addUniV3LikePosition } = require("../helper/unwrapLPs"); +const { abi } = require("./abi"); + +const CONFIG = { + optimism: { + factory: "0xd4f1a99212e5be72426bde45abadef66d7d6edf3", + }, + fantom: { + factory: "0x9b7e30644a9b37eebaa7158129b03f5a3088659d", + }, + pulse: { + factory: "0xac297968C97EF5686c79640960D106f65C307a37", + USDEX_PLUS: "0xaA2C47a35C1298795B5271490971Ec4874C8e53d", + }, + base: { + factory: "0x714c94b9820d7d73e61510e4c18b91f995a895c1", + }, + arbitrum: { + factory: "0xe31fceaf93667365ce1e9edad3bed4a7dd0fc01a", + USDEX_PLUS: "0x4117EC0A779448872d3820f37bA2060Ae0B7C34B", + gDEX: "0x92a212d9f5eef0b262ac7d84aea64a0d0758b94f" + }, + avax: { + factory: "0x6b714e6296b8b977e1d5ecb595197649e10a3db1", + }, + bsc: { + factory: "0x3ace08b10b5c08a17d1c46277d65c81249e65f44", + }, + // manta: { + // factory: "0x714C94B9820D7D73e61510e4C18B91F995A895C1", + // }, +}; + +const getVaults = async (api, factory) => { + const vaults = await api.fetchList({ lengthAbi: abi.factory.vaultsLength, itemAbi: abi.factory.vaults, target: factory, }); + const farmsAll = await api.fetchList({ lengthAbi: abi.vault.farmsLength, itemAbi: abi.vault.farms, targets: vaults, groupedByInput: true }) + const items = [] + vaults.map((vault, i) => items.push(farmsAll[i].map((farm) => ({ vault, farm })))) + return items.flat() +}; + +const getVaultsConnectors = async (api, factory, vaultFarms) => { + const connectorsCalls = vaultFarms.map(({ farm, vault }) => ({ params: farm.beacon, target: vault, })); + const calculationConnectorCalls = vaultFarms.map(({ farm }) => farm.beacon); + const connectors = await api.multiCall({ abi: abi.vault.farmConnector, calls: connectorsCalls }) + const calculationConnectors = await api.multiCall({ abi: abi.factory.farmCalculationConnector, calls: calculationConnectorCalls, target: factory }) + + vaultFarms.forEach((item, i) => { + delete item.farm.data + item.connector = connectors[i] + item.calculationConnector = calculationConnectors[i] + }) +} + +const getVaultsDatas = async (api, vaultFarms) => { + const calls = vaultFarms.map(({ connector }) => connector) + const liquidityCalls = vaultFarms.map(({ calculationConnector, connector }) => ({ target: calculationConnector, params: [connector] })) + + const [types, stakingTokens, liquidities] = + await Promise.all([ + api.multiCall({ calls, abi: abi.farm.type }), + api.multiCall({ calls, abi: abi.farm.stakingToken }), + api.multiCall({ calls: liquidityCalls, abi: abi.vault.liquidity }), + ]); + + vaultFarms.forEach((item, i) => { + item.type = types[i] + item.stakingToken = stakingTokens[i] + item.liquidity = liquidities[i] + }) +}; + +const groupBy = (array, keyFn) => { + return array.reduce((acc, item) => { + const key = keyFn(item); + if (!acc[key]) { + acc[key] = []; + } + acc[key].push(item); + return acc; + }, {}); +}; + +const lpv2Balances = async (api, farms) => { + farms.forEach(({ stakingToken, liquidity }) => { + api.add(stakingToken, liquidity); + }); +}; + +async function addERC721Data(api, vaultFarms) { + const positionIds = await api.multiCall({ abi: abi.farm.tokenId, calls: vaultFarms.map(i => i.connector) }) + const nftPositionMapping = {} + vaultFarms.forEach((item, i) => { + if (!+positionIds[i]) + return; + + const nft = item.stakingToken.toLowerCase() + if (!nftPositionMapping[nft]) nftPositionMapping[nft] = [] + nftPositionMapping[nft].push(positionIds[i]) + }) + for (const [nftAddress, positionIds] of Object.entries(nftPositionMapping)) + await sumTokens2({ api, uniV3ExtraConfig: { nftAddress, positionIds, } }) +} + +const tvl = async (api) => { + const { factory, USDEX_PLUS, gDEX } = CONFIG[api.chain]; + const vaultFarms = await getVaults(api, factory); + await getVaultsConnectors(api, factory, vaultFarms); + await getVaultsDatas(api, vaultFarms); + const sortedFarms = groupBy(vaultFarms, ({ type }) => `${type}`); + + const lpv2Farms = Object.keys(sortedFarms) + .filter((key) => !key.includes("ERC721")) + .flatMap((key) => sortedFarms[key]); + + const lpv3Farms = Object.keys(sortedFarms) + .filter((key) => key.includes("ERC721")) + .flatMap((key) => sortedFarms[key]); + + await Promise.all([ + lpv2Balances(api, lpv2Farms), + addERC721Data(api, lpv3Farms) + ]) + + if (USDEX_PLUS) api.removeTokenBalance(USDEX_PLUS); + if (gDEX) api.removeTokenBalance(gDEX); + return sumTokens2({ api, resolveLP: true }); +}; + +Object.keys(CONFIG).forEach((chain) => { + module.exports[chain] = { tvl, }; +}) \ No newline at end of file diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 02a931f3a0ff..e55a3e9bd9cf 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -60,6 +60,9 @@ const fixBalancesTokens = { bfc: { '0x6906Ccda405926FC3f04240187dd4fAd5DF6d555': { coingeckoId: "bitcoin-usd-btcfi", decimals: 18, }, }, + pulse: { + '0x30fcb23a906493371b1721c8feb8815804808d74': { coingeckoId: 'savings-dai', decimals: 18 }, + } } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index dd4afd596d8e..dc96b0908fc2 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -193,6 +193,8 @@ async function sumLPWithOnlyOneTokenOtherThanKnown(balances, lpToken, owner, tok const PANCAKE_NFT_ADDRESS = '0x46A15B0b27311cedF172AB29E4f4766fbE7F4364' async function unwrapUniswapV3NFTs({ balances = {}, nftsAndOwners = [], block, chain = 'ethereum', owner, nftAddress, owners, blacklistedTokens = [], whitelistedTokens = [], uniV3ExtraConfig = {} }) { + nftAddress = nftAddress ?? uniV3ExtraConfig.nftAddress + const commonConfig = { balances, owner, owners, chain, block, blacklistedTokens, whitelistedTokens, uniV3ExtraConfig, } // https://docs.uniswap.org/contracts/v3/reference/deployments if (!nftsAndOwners.length) { if (!nftAddress) @@ -209,15 +211,13 @@ async function unwrapUniswapV3NFTs({ balances = {}, nftsAndOwners = [], block, c default: throw new Error('missing default uniswap nft address chain: ' + chain) } - if ((!owners || !owners.length) && owner) - owners = [owner] - owners = getUniqueAddresses(owners, chain) - if (Array.isArray(nftAddress)) - nftsAndOwners = nftAddress.map(nft => owners.map(o => [nft, o])).flat() - else - nftsAndOwners = owners.map(o => [nftAddress, o]) - } - await Promise.all(nftsAndOwners.map(([nftAddress, owner]) => unwrapUniswapV3NFT({ balances, owner, nftAddress, block, chain, blacklistedTokens, whitelistedTokens, uniV3ExtraConfig, }))) + if (Array.isArray(nftAddress)) { + await Promise.all(nftAddress.map((addr) => unwrapUniswapV3NFT({ ...commonConfig, nftAddress: addr, }))) + } else + await unwrapUniswapV3NFT({ ...commonConfig, nftAddress, }) + + } else + await Promise.all(nftsAndOwners.map(([nftAddress, owner]) => unwrapUniswapV3NFT({ ...commonConfig, owner, nftAddress, }))) return balances } @@ -225,23 +225,37 @@ const factories = {} const getFactoryKey = (chain, nftAddress) => `${chain}:${nftAddress}`.toLowerCase() -async function unwrapUniswapV3NFT({ balances, owner, nftAddress, block, chain = 'ethereum', blacklistedTokens = [], whitelistedTokens = [], uniV3ExtraConfig = {}, }) { +async function unwrapUniswapV3NFT({ balances, owner, owners, nftAddress, block, chain = 'ethereum', blacklistedTokens = [], whitelistedTokens = [], uniV3ExtraConfig = {}, }) { blacklistedTokens = getUniqueAddresses(blacklistedTokens, chain) whitelistedTokens = getUniqueAddresses(whitelistedTokens, chain) let nftIdFetcher = uniV3ExtraConfig.nftIdFetcher ?? nftAddress - const nftPositions = (await sdk.api.erc20.balanceOf({ target: nftIdFetcher, owner, block, chain })).output const factoryKey = getFactoryKey(chain, nftAddress) if (!factories[factoryKey]) factories[factoryKey] = sdk.api.abi.call({ target: nftAddress, abi: wildCreditABI.factory, block, chain }) let factory = (await factories[factoryKey]).output if (factory.toLowerCase() === '0xa08ae3d3f4da51c22d3c041e468bdf4c61405aab') // thruster finance has a bug where they set the pool deployer instead of the factory factory = '0x71b08f13B3c3aF35aAdEb3949AFEb1ded1016127' - const positionIds = (await sdk.api.abi.multiCall({ - block, chain, abi: wildCreditABI.tokenOfOwnerByIndex, target: nftIdFetcher, - calls: Array(Number(nftPositions)).fill(0).map((_, index) => ({ params: [owner, index] })), - })).output.map(positionIdCall => positionIdCall.output) + let positionIds = uniV3ExtraConfig.positionIds + if (!positionIds) { + if (!owners && owner) owners = [owner] + owners = getUniqueAddresses(owners, chain) + const { output: lengths } = await sdk.api.abi.multiCall({ + block, chain, abi: wildCreditABI.balanceOf, + calls: owners.map((params) => ({ target: nftIdFetcher, params, })), + }) + const positionIDCalls = [] + for (let i = 0; i < owners.length; i++) { + const length = lengths[i].output + positionIDCalls.push(...createIncrementArray(length).map(j => ({ params: [owners[i], j] }))) + } + + positionIds = (await sdk.api.abi.multiCall({ + block, chain, abi: wildCreditABI.tokenOfOwnerByIndex, target: nftIdFetcher, + calls: positionIDCalls, + })).output.map(positionIdCall => positionIdCall.output) + } const positions = (await sdk.api.abi.multiCall({ block, chain, abi: wildCreditABI.positions, target: nftAddress, @@ -846,7 +860,11 @@ async function sumTokens2({ fetchCoValentTokens = false, tokenConfig = {}, sumChunkSize = undefined, - uniV3ExtraConfig = {}, + uniV3ExtraConfig = { + // positionIds + // nftAddress + // nftIdFetcher + }, resolveICHIVault = false, solidlyVeNfts = [], }) { diff --git a/projects/thetanuts/index.js b/projects/thetanuts/index.js index 62aad31bf8b5..ecf12f8b4401 100644 --- a/projects/thetanuts/index.js +++ b/projects/thetanuts/index.js @@ -1,5 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport } = require('../helper/unwrapLPs') +const { sumTokensExport, sumTokens2 } = require('../helper/unwrapLPs') // Ethereum Vaults const ethCallVault = '0x9014f8E90423766343Ed4fe41668563526dF6715' @@ -240,11 +240,11 @@ const config = { [PTrsETH_26SEP24, aPTrsETH_26SEP24,], [PTweETH_26SEP24, aPTweETH_26SEP24,], ], - LLVOwners: [ - [univ3nft_arb, arbC_LLV,], - [univ3nft_arb, arbP_LLV,], - [univ3nft_arb, ethC_LLV,], - [univ3nft_arb, ethP_LLV,], + uniV3Owners: [ + arbC_LLV, + arbP_LLV, + ethC_LLV, + ethP_LLV, ] }, fantom: { @@ -310,8 +310,11 @@ const config = { } Object.keys(config).forEach(chain => { - const { tokensAndOwners, LLVOwners } = config[chain] + const { tokensAndOwners, uniV3Owners } = config[chain] module.exports[chain] = { - tvl: sumTokensExport({ tokensAndOwners, resolveUniV3 : LLVOwners != null && LLVOwners.length > 0 ? true : false, uniV3nftsAndOwners : LLVOwners }) + tvl: async (api) => { + if (uniV3Owners) await sumTokens2({ api, owners: uniV3Owners, resolveUniV3: true}) + return sumTokens2({ api, tokensAndOwners}) + } } }) From a7c02abdfa3b6891ba623c310cf96c18b21b7398 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 18 Jul 2024 19:33:38 +0300 Subject: [PATCH 766/855] dexfi: enable manta --- projects/dexfinance-vault/index.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/projects/dexfinance-vault/index.js b/projects/dexfinance-vault/index.js index c98ad20af55e..6132575bf44f 100644 --- a/projects/dexfinance-vault/index.js +++ b/projects/dexfinance-vault/index.js @@ -10,7 +10,7 @@ const CONFIG = { }, pulse: { factory: "0xac297968C97EF5686c79640960D106f65C307a37", - USDEX_PLUS: "0xaA2C47a35C1298795B5271490971Ec4874C8e53d", + USDEX_PLUS: "0xaa2c47a35c1298795b5271490971ec4874c8e53d", }, base: { factory: "0x714c94b9820d7d73e61510e4c18b91f995a895c1", @@ -26,9 +26,10 @@ const CONFIG = { bsc: { factory: "0x3ace08b10b5c08a17d1c46277d65c81249e65f44", }, - // manta: { - // factory: "0x714C94B9820D7D73e61510e4C18B91F995A895C1", - // }, + manta: { + factory: "0x714C94B9820D7D73e61510e4C18B91F995A895C1", + USDEX_PLUS: '0x6da9ebd271a0676f39c088a2b5fd849d5080c0af', + }, }; const getVaults = async (api, factory) => { @@ -121,10 +122,10 @@ const tvl = async (api) => { lpv2Balances(api, lpv2Farms), addERC721Data(api, lpv3Farms) ]) - + + await sumTokens2({ api, resolveLP: true }); if (USDEX_PLUS) api.removeTokenBalance(USDEX_PLUS); if (gDEX) api.removeTokenBalance(gDEX); - return sumTokens2({ api, resolveLP: true }); }; Object.keys(CONFIG).forEach((chain) => { From 42e5454ecce7b6d7fa582019a2805fa654556a29 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 18 Jul 2024 19:36:19 +0300 Subject: [PATCH 767/855] update vela (#11040) --- projects/vela-exchange/index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/projects/vela-exchange/index.js b/projects/vela-exchange/index.js index 277265bb6ee5..f1ae88d8b58c 100644 --- a/projects/vela-exchange/index.js +++ b/projects/vela-exchange/index.js @@ -5,8 +5,8 @@ const { graphQuery } = require('../helper/http') const VELA = '0x088cd8f5eF3652623c22D48b1605DCfE860Cd704' -const arbitrumEndpoint = sdk.graph.modifyEndpoint('8YXEzf1jmgVVt5d32fEo836bUzZKkCnYNcjAUXPEPhZQ') -const baseEndpoint = sdk.graph.modifyEndpoint('E2kcVHn6gD2nAs6Yf7a7REsYqBp8Pk3tnWhj8WvbVBhj') +const arbitrumEndpoint = 'https://api.goldsky.com/api/public/project_clu01p4nr68r301pze2tj4sh7/subgraphs/vela-arbitrum/mainnet/gn' +const baseEndpoint = 'https://api.goldsky.com/api/public/project_clu01p4nr68r301pze2tj4sh7/subgraphs/vela-base/mainnet/gn' async function velaStaking(api, endpoint) { const query = ` @@ -28,7 +28,7 @@ async function velaStaking(api, endpoint) { module.exports = { methodology: "Counts USDC deposited to trade and to mint VLP. Staking counts VELA and esVELA deposited to earn esVELA", arbitrum: { - tvl: staking('0xC4ABADE3a15064F9E3596943c699032748b13352', [ADDRESSES.arbitrum.USDC_CIRCLE, ADDRESSES.arbitrum.USDC]), + tvl: staking('0xC4ABADE3a15064F9E3596943c699032748b13352', [ADDRESSES.arbitrum.USDC_CIRCLE,ADDRESSES.arbitrum.USDC, "0x724dc807b04555b71ed48a6896b6f41593b8c637"]), staking: async (api) => velaStaking(api,arbitrumEndpoint) }, base: { @@ -38,6 +38,7 @@ module.exports = { }, hallmarks: [ [Math.floor(new Date('2023-04-13') / 1e3), 'Refunded tokens to VLP holders & traders'], - [1693926000, 'Launched on Base Chain'] + [1693926000, 'Launched on Base Chain'], + [1721314800, 'Implemented Aave VLP supply integration'] ], } From 75258f861f2895c36c8dd4c80fe9dd86f5e85ac5 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 18 Jul 2024 19:43:49 +0300 Subject: [PATCH 768/855] nexus: fix doublecount --- projects/nexus/index.js | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/projects/nexus/index.js b/projects/nexus/index.js index ad3ec24c10e3..7a63c3a30703 100644 --- a/projects/nexus/index.js +++ b/projects/nexus/index.js @@ -1,27 +1,14 @@ -const { sumTokens2 } = require('../helper/unwrapLPs'); - -const pools = [ - '0xcafeaBED7e0653aFe9674A3ad862b78DB3F36e60' // current pool -]; -const yieldPools = [ - '0x27f23c710dd3d878fe9393d93465fed1302f2ebd' -] -const getAssetsABI = "function getAssets() view returns (tuple(address assetAddress, bool isCoverAsset, bool isAbandoned)[])" async function tvl(api) { - const assets = await api.multiCall({ abi: getAssetsABI, calls: pools}) - const ownerTokens = assets.map((v, i) => [v.map(i => i.assetAddress), pools[i]]) - const assets2 = await api.multiCall({ abi: 'address[]:getTrackedAssets', calls: yieldPools }) - assets2.forEach((v, i) => ownerTokens.push([v, yieldPools[i]])) const MasterProxy = '0x01BFd82675DBCc7762C84019cA518e701C0cD07e' // const bytes2 = ethers.utils.formatBytes32String('P1').slice(0, 4) // '0x5031 const P1Address = await api.call({ abi: 'function getLatestAddress(bytes2) view returns (address)', target: MasterProxy, params: '0x5031' }) const ethValue = await api.call({ abi: 'uint256:getPoolValueInEth', target: P1Address}) api.addGasToken(ethValue) - return sumTokens2({ api, ownerTokens, blacklistedTokens: yieldPools}) } module.exports = { + misrepresentedTokens: true, start: 1558569600, // 05/23/2019 @ 12:00am (UTC) ethereum: { tvl } } From 8b6233b183929485d8349ba63645d3a64d64d352 Mon Sep 17 00:00:00 2001 From: 0xngmi <80541789+0xngmi@users.noreply.github.com> Date: Thu, 18 Jul 2024 22:58:30 +0100 Subject: [PATCH 769/855] add augur hallmarks --- projects/augur/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/augur/index.js b/projects/augur/index.js index b04181bee363..e270d9d8d669 100644 --- a/projects/augur/index.js +++ b/projects/augur/index.js @@ -26,4 +26,7 @@ module.exports = { ethereum: { tvl, }, + hallmarks:[ + [1613091600, "Election market resolves"] + ] } From c3c1476faa561389ea2ab9f510aafd063da03ef0 Mon Sep 17 00:00:00 2001 From: lsblk07 <154802093+lsblk07@users.noreply.github.com> Date: Fri, 19 Jul 2024 13:17:52 +0800 Subject: [PATCH 770/855] Blasterswap vaults (#11029) * blasterswap-vaults-tvl * blasterswap-vaults-tvl * blasterswap vault tvl * import * token * network * new vaults * vaults as staking * vaults as staking * vaults as staking --------- Co-authored-by: lsblk07 --- projects/blasterswap-vaults/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/projects/blasterswap-vaults/index.js b/projects/blasterswap-vaults/index.js index bc4663a084d0..e1e32df06076 100644 --- a/projects/blasterswap-vaults/index.js +++ b/projects/blasterswap-vaults/index.js @@ -1,12 +1,12 @@ -const stakingContract = '0x0464a36beCf9967111D2dCAb57CAf4a2376f6E3F' -const blast = '0xb1a5700fa2358173fe465e6ea4ff52e36e88e2ad' -const { staking } = require('../helper/staking') +const { stakings } = require("../helper/staking.js"); +const vaults = ['0x0464a36beCf9967111D2dCAb57CAf4a2376f6E3F', '0xC52fb7E613e401a0195C2fdB369618580D58C91D', '0x013249266842e078999088807033D80531A84260']; +const tokens = ['0xb1a5700fa2358173fe465e6ea4ff52e36e88e2ad', '0xd43D8aDAC6A4C7d9Aeece7c3151FcA8f23752cf8', '0x5ffd9EbD27f2fcAB044c0f0a26A45Cb62fa29c06']; module.exports = { - methodology: "BLAST can be staked in Blasterswap vault", + methodology: "Staking", blast: { - tvl: () => ({}), - staking: staking(stakingContract, blast), + tvl: (async) => ({}), + staking: stakings(vaults, tokens) }, } From 9f1af4336fee2d121b0826e21e3b9b45c3335e10 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 19 Jul 2024 08:21:03 +0300 Subject: [PATCH 771/855] minor fix --- projects/blasterswap-vaults/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/projects/blasterswap-vaults/index.js b/projects/blasterswap-vaults/index.js index e1e32df06076..236a7a7ecc61 100644 --- a/projects/blasterswap-vaults/index.js +++ b/projects/blasterswap-vaults/index.js @@ -4,9 +4,8 @@ const vaults = ['0x0464a36beCf9967111D2dCAb57CAf4a2376f6E3F', '0xC52fb7E613e401a const tokens = ['0xb1a5700fa2358173fe465e6ea4ff52e36e88e2ad', '0xd43D8aDAC6A4C7d9Aeece7c3151FcA8f23752cf8', '0x5ffd9EbD27f2fcAB044c0f0a26A45Cb62fa29c06']; module.exports = { - methodology: "Staking", blast: { - tvl: (async) => ({}), + tvl: () => ({}), staking: stakings(vaults, tokens) }, } From 2e60b7e06b3deef6d9ea269de1a14e599428c4af Mon Sep 17 00:00:00 2001 From: daedboi <87483308+daedboi@users.noreply.github.com> Date: Fri, 19 Jul 2024 08:24:14 +0300 Subject: [PATCH 772/855] [UPDATE] BMX by Morphex: Add TVL tracking for staking and Mode network; Add tracking for Freestyle on Base (#11041) * Add Mode, staking, and add Freestyle separately * Update index.js --- projects/bmx/index.js | 23 +++++++++++++++---- projects/freestyle/index.js | 46 +++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 projects/freestyle/index.js diff --git a/projects/bmx/index.js b/projects/bmx/index.js index 3be3d0e83662..727c569a4754 100644 --- a/projects/bmx/index.js +++ b/projects/bmx/index.js @@ -1,12 +1,27 @@ const { staking } = require("../helper/staking"); const { gmxExports } = require("../helper/gmx"); -const sdk = require('@defillama/sdk') -const vaultAddress = "0xec8d8D4b215727f3476FF0ab41c406FA99b4272C"; +const vaultAddresses = { + base: "0xec8d8D4b215727f3476FF0ab41c406FA99b4272C", + mode: "0xff745bdB76AfCBa9d3ACdCd71664D4250Ef1ae49" +}; +const stakingAddresses = { + base: "0x3085F25Cbb5F34531229077BAAC20B9ef2AE85CB", + mode: "0x773F34397d5F378D993F498Ee646FFe4184E00A3" +}; +const tokenAddresses = { + base: "0x548f93779fBC992010C07467cBaf329DD5F059B7", + mode: "0x66eEd5FF1701E6ed8470DC391F05e27B1d0657eb" +}; module.exports = { - methodology: "BMX liquidity is calculated by the value of tokens in the BLT pool.", + methodology: "BMX Classic liquidity is calculated by the value of tokens in the BLT/MLT pool. TVL also includes BMX staked.", base: { - tvl: gmxExports({ vault: vaultAddress }) + tvl: gmxExports({ vault: vaultAddresses.base }), + staking: staking(stakingAddresses.base, tokenAddresses.base) }, + mode: { + tvl: gmxExports({ vault: vaultAddresses.mode }), + staking: staking(stakingAddresses.mode, tokenAddresses.mode) + } }; diff --git a/projects/freestyle/index.js b/projects/freestyle/index.js new file mode 100644 index 000000000000..4aadb02a6e11 --- /dev/null +++ b/projects/freestyle/index.js @@ -0,0 +1,46 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { request, } = require("graphql-request"); + +const freestyleConfig = { + base: { + token: ADDRESSES.base.USDC, + start: 1700006400, + graphUrl: "https://api.studio.thegraph.com/query/62454/analytics_base_8_2/version/latest", + accountSource: '0x6D63921D8203044f6AbaD8F346d3AEa9A2719dDD' + }, +} + +async function tvl(api) { + const { token, graphUrl, start, accountSource } = freestyleConfig[api.chain] + + const query = ` + query stats($from: String!, $to: String!) { + dailyHistories( + where: { + timestamp_gte: $from + timestamp_lte: $to + accountSource: "${accountSource}" + } + ) { + timestamp + platformFee + accountSource + tradeVolume + deposit + withdraw + } + } + ` + const { dailyHistories } = await request(graphUrl, query, { + from: start.toString(), + to: api.timestamp.toString(), + }); + + let total = dailyHistories.reduce((acc, cur) => acc + (Number(cur.deposit) - Number(cur.withdraw)), 0); + + api.add(token, total) +} + +Object.keys(freestyleConfig).forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file From 8eec7d51375f02bcf8ff4dc4eba54b756cb764ae Mon Sep 17 00:00:00 2001 From: Antonio Viggiano Date: Fri, 19 Jul 2024 03:19:50 -0300 Subject: [PATCH 773/855] Add SizeCredit (#11013) * Add SizeCredit * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/size-credit/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/size-credit/index.js diff --git a/projects/size-credit/index.js b/projects/size-credit/index.js new file mode 100644 index 000000000000..24b220db467d --- /dev/null +++ b/projects/size-credit/index.js @@ -0,0 +1,23 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') + +const AUSDC_CONTRACT = '0x4e65fe4dba92790696d040ac24aa414708f5c0ab' +const SZDEBT_CONTRACT = '0xb0a00c4b3d77c896f46dc6b204695e22de7a185d' +const SIZE_PROXY_CONTRACT = '0xC2a429681CAd7C1ce36442fbf7A4a68B11eFF940' +const tokens = [ + ADDRESSES.base.WETH, + AUSDC_CONTRACT, +] + +async function borrowed(api) { + const totalDebt = await api.call({ abi: 'erc20:totalSupply', target: SZDEBT_CONTRACT, }); + + return api.add(ADDRESSES.base.USDbC, totalDebt) +} + +module.exports = { + base: { + tvl: sumTokensExport({ tokens, owner: SIZE_PROXY_CONTRACT }), + borrowed + } +} From 85d85b5f49fda41fb9392125274b1d47e99282aa Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 19 Jul 2024 09:44:25 +0300 Subject: [PATCH 774/855] mark projects as dead --- projects/augmented-finance/index.js | 2 +- projects/bitindi-dex/index.js | 3 +-- projects/bitindi/index.js | 3 +-- projects/phoenix/index.js | 2 +- projects/quasar-swap/index.js | 2 +- projects/rumi/index.js | 2 +- projects/yieldbank/index.js | 4 ++-- 7 files changed, 8 insertions(+), 10 deletions(-) diff --git a/projects/augmented-finance/index.js b/projects/augmented-finance/index.js index a849bc956e3a..50fd9f66764c 100644 --- a/projects/augmented-finance/index.js +++ b/projects/augmented-finance/index.js @@ -9,7 +9,7 @@ const config = { module.exports = { methodology: methodologies.lendingMarket, - // deadFrom: 2024-02-22 + deadFrom: "2024-02-22" }; Object.keys(config).forEach(chain => { diff --git a/projects/bitindi-dex/index.js b/projects/bitindi-dex/index.js index 1361308727f0..f2d20355d2a1 100644 --- a/projects/bitindi-dex/index.js +++ b/projects/bitindi-dex/index.js @@ -1,5 +1,4 @@ const { uniTvlExport } = require('../helper/unknownTokens') module.exports = uniTvlExport('bitindi', '0x87cef801D44D6eDa8106087e7676153c30e36950', true) module.exports.bitindi.tvl = () => ({}) - - // deadFrom: '2023-12-20', \ No newline at end of file +module.exports.deadFrom = '2023-12-20' \ No newline at end of file diff --git a/projects/bitindi/index.js b/projects/bitindi/index.js index 1f778d86113b..934a9979f192 100644 --- a/projects/bitindi/index.js +++ b/projects/bitindi/index.js @@ -1,4 +1,3 @@ -const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require('../helper/staking') module.exports = { @@ -11,5 +10,5 @@ module.exports = { staking: () => ({}), // staking: staking('0x140c312c8841B0a7152946C0Bc2BD343bA51bbcc', ADDRESSES.bitindi.WBNI), }, - // deadFrom: '2023-12-20', + deadFrom: '2023-12-20', }; diff --git a/projects/phoenix/index.js b/projects/phoenix/index.js index 91d4012115ab..21c4ed56d542 100644 --- a/projects/phoenix/index.js +++ b/projects/phoenix/index.js @@ -2,7 +2,7 @@ const tvl = () => ({}) module.exports = { start: 1631376000, // beijing time 2021-9-11 0:0: - // deadFrom: '2022-09-15', + deadFrom: '2022-09-15', hallmarks: [ [Math.floor(new Date('2022-09-15')/1e3), 'Project is dead: https://twitter.com/Phoenix__PHX/status/1570389804734640129'], ], diff --git a/projects/quasar-swap/index.js b/projects/quasar-swap/index.js index de27a9823122..881d4a937d72 100644 --- a/projects/quasar-swap/index.js +++ b/projects/quasar-swap/index.js @@ -31,7 +31,7 @@ module.exports = { block, }), }, */ - //deadFrom: "2024-01-01", + deadFrom: "2024-01-01", nova: { tvl: () => ({}), staking: () => ({}), diff --git a/projects/rumi/index.js b/projects/rumi/index.js index 7ace8c1690dc..737b047b6459 100644 --- a/projects/rumi/index.js +++ b/projects/rumi/index.js @@ -20,5 +20,5 @@ module.exports = { arbitrum: { tvl: () => ({}), }, - // deadFrom: '2023-12-11', + deadFrom: '2023-12-11', }; \ No newline at end of file diff --git a/projects/yieldbank/index.js b/projects/yieldbank/index.js index 3576a0da1f4b..82203489f1f0 100644 --- a/projects/yieldbank/index.js +++ b/projects/yieldbank/index.js @@ -6,7 +6,7 @@ async function tvl(api) { const tokens = await api.multiCall({ abi: 'address:want', calls: vaults }) const bals = await api.multiCall({ abi: 'uint256:balance', calls: vaults }) api.addTokens(tokens, bals) - return sumUnknownTokens({ api, resolveLP: true, useDefaultCoreAssets: false }) + return sumUnknownTokens({ api, resolveLP: true, useDefaultCoreAssets: false }) } module.exports = { @@ -16,5 +16,5 @@ module.exports = { tvl: () => ({}), staking: () => ({}) }, -// deadFrom: "2023-12-01", + deadFrom: "2023-12-01", } From c6087e22bbac25db405cc3ab06ad1d14b09e28eb Mon Sep 17 00:00:00 2001 From: yanfeizuo <69463394+yanfeizuo@users.noreply.github.com> Date: Fri, 19 Jul 2024 18:10:01 +0800 Subject: [PATCH 775/855] update sumer project:add ethereum (#11044) * update for sumer * Revert "update for sumer" This reverts commit c2d61474251f429ce5d50dc600deb5822bff4379. * add base to project sumer * add arbitrum to project sumer * config ethereum for sumer --- projects/sumer/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/sumer/index.js b/projects/sumer/index.js index 02958bea500d..aaf4cf6016e3 100644 --- a/projects/sumer/index.js +++ b/projects/sumer/index.js @@ -4,4 +4,5 @@ module.exports = { meter: compoundExports2({ comptroller: '0xcB4cdDA50C1B6B0E33F544c98420722093B7Aa88' }), base: compoundExports2({ comptroller: '0x611375907733D9576907E125Fb29704712F0BAfA' }), arbitrum: compoundExports2({ comptroller: '0xBfb69860C91A22A2287df1Ff3Cdf0476c5aab24A' }), + ethereum: compoundExports2({ comptroller: '0x60A4570bE892fb41280eDFE9DB75e1a62C70456F' }), } \ No newline at end of file From e66a296420705cf2094b5f6630aaf474f0640790 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 19 Jul 2024 14:41:14 +0300 Subject: [PATCH 776/855] update blasterswap vaults --- projects/blasterswap-vaults/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/projects/blasterswap-vaults/index.js b/projects/blasterswap-vaults/index.js index 236a7a7ecc61..8bde49169e06 100644 --- a/projects/blasterswap-vaults/index.js +++ b/projects/blasterswap-vaults/index.js @@ -1,11 +1,11 @@ -const { stakings } = require("../helper/staking.js"); +const { staking } = require("../helper/staking.js"); -const vaults = ['0x0464a36beCf9967111D2dCAb57CAf4a2376f6E3F', '0xC52fb7E613e401a0195C2fdB369618580D58C91D', '0x013249266842e078999088807033D80531A84260']; -const tokens = ['0xb1a5700fa2358173fe465e6ea4ff52e36e88e2ad', '0xd43D8aDAC6A4C7d9Aeece7c3151FcA8f23752cf8', '0x5ffd9EbD27f2fcAB044c0f0a26A45Cb62fa29c06']; +const vaults = ['0xC52fb7E613e401a0195C2fdB369618580D58C91D', '0x013249266842e078999088807033D80531A84260']; +const tokens = ['0xd43D8aDAC6A4C7d9Aeece7c3151FcA8f23752cf8', '0x5ffd9EbD27f2fcAB044c0f0a26A45Cb62fa29c06']; module.exports = { blast: { - tvl: () => ({}), - staking: stakings(vaults, tokens) + tvl: staking('0x0464a36beCf9967111D2dCAb57CAf4a2376f6E3F', '0xb1a5700fa2358173fe465e6ea4ff52e36e88e2ad'), + staking: staking(vaults, tokens) }, } From b2ec1568c111ad657c0686d1ad7e28124e9c0852 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 19 Jul 2024 15:47:43 +0300 Subject: [PATCH 777/855] refactor sol adapters --- projects/DropCopy/index.js | 29 +-- projects/allbridge/index.js | 3 +- projects/amulet-protocol/index.js | 15 +- projects/apricot.js | 45 +---- projects/asol/index.js | 7 +- projects/basis-market/index.js | 7 +- projects/cashio/index.js | 129 +----------- projects/cropper.js | 8 +- projects/dnadollar/index.js | 102 ---------- projects/frakt/index.js | 4 +- projects/helper/solana.js | 176 +++-------------- projects/invictus/index.js | 16 +- projects/kamino-lending/index.js | 4 +- projects/marinade.js | 35 ++-- projects/nirvana/index.js | 14 +- projects/oxygen/idl.js | 147 -------------- projects/oxygen/index.js | 44 +---- projects/portfinance/index.js | 53 +---- projects/rubic/index.js | 38 ---- projects/sencha/index.js | 34 ---- projects/solhero/index.js | 316 ------------------------------ projects/solyard.js | 67 +------ projects/sun/index.js | 17 -- projects/swim/config.js | 122 ------------ projects/swim/index.js | 35 ++-- 25 files changed, 100 insertions(+), 1367 deletions(-) delete mode 100644 projects/oxygen/idl.js delete mode 100644 projects/sencha/index.js delete mode 100644 projects/solhero/index.js delete mode 100644 projects/swim/config.js diff --git a/projects/DropCopy/index.js b/projects/DropCopy/index.js index 6e11175d7020..a3cd4ba31e73 100644 --- a/projects/DropCopy/index.js +++ b/projects/DropCopy/index.js @@ -1,34 +1,11 @@ -const { getOwnerAllAccount, getTokenAccountBalance,getSolBalance } = require('../helper/solana') -const ADDRESSES = require('../helper/coreAssets.json') - -const sdk = require('@defillama/sdk') -const { PublicKey } = require("@solana/web3.js") +const { sumTokens2 } = require('../helper/solana') const DROP = 'DropTpWcDmP7kVRUEoKSJaMVi62hGo9jp19Hz19JVsjh'; -const PYTH = 'HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3'; const PARIMUTUEL_WALLET = 'DCa1Xir4zDEtz78beFcXCHUNXdeBnrxBiRuuapHrBE3F'; const PARIMUTUEL_ACCOUNT = 'mD62sAqPAiVbHGPTTeEianTYa1AytkKqqcxMvQxF3S3'; -const predictionTokens = [ - DROP, - PYTH -] -async function tvl(api) { - - // get the total tokens deposited in the games - const tokensInAccount = await getOwnerAllAccount(PARIMUTUEL_WALLET); - tokensInAccount.forEach((pToken) => { - const total = pToken.uiAmount; - const tokenMint = pToken.mint; - // check to make sure it's one of the tokens used for predicting - if (predictionTokens.includes(tokenMint)) - { - //sdk.log('#found',tokenMint) - api.add(tokenMint,total); - } - }); - const sols = await getSolBalance(PARIMUTUEL_WALLET); - api.add(ADDRESSES.solana.SOL,sols); +async function tvl() { + return sumTokens2({ owner: PARIMUTUEL_WALLET, getAllTokenAccounts: true, solOwners: [PARIMUTUEL_WALLET], blacklistedTokens: [DROP]}) } module.exports = { diff --git a/projects/allbridge/index.js b/projects/allbridge/index.js index 51f32af495f6..a6225a6b1973 100644 --- a/projects/allbridge/index.js +++ b/projects/allbridge/index.js @@ -211,8 +211,7 @@ async function solanaTvl() { } async function solanaStaking() { - const balance = await solana.getTokenAccountBalance(solanaData.staking.tokenAccount); - return {allbridge: toNumber(0, balance)} + return solana.sumTokens2({ tokenAccounts: [solanaData.staking.tokenAccount] }) } async function terraTvl() { diff --git a/projects/amulet-protocol/index.js b/projects/amulet-protocol/index.js index 1f6e591836a9..58eee69a48a6 100644 --- a/projects/amulet-protocol/index.js +++ b/projects/amulet-protocol/index.js @@ -1,23 +1,16 @@ const BN = require("bn.js"); const { PublicKey } = require("@solana/web3.js") -const { getConnection } = require("../helper/solana"); +const { getConnection, sumTokens2 } = require("../helper/solana"); async function tvl() { const connection = getConnection(); const stakingInstanceState = await connection.getAccountInfo(new PublicKey("HNhPNHkp3RobeJzepNzyVyewtAaoF3QCCvtBTxKJVnRX")); const liqStakedAmtSOLAmount = stakingInstanceState.data.slice(203, 211); liqStakedAmtSOLAmount.reverse(); - - const amtsolStakedAmount = (await connection.getTokenAccountBalance(new PublicKey("BQUHYmLH8St7j9kTWExd19QjoDuxrha7Mgp32M7zvS84"))).value.amount - const pcuvAmtSOLAmount = (await connection.getTokenAccountBalance(new PublicKey("9QPcNgmkRAQncEnTBDXvWq2H7LY4VLNJfiVYD9c3eL8D"))).value.amount - - const amtSOLAmount = [new BN(liqStakedAmtSOLAmount), new BN(amtsolStakedAmount), new BN(pcuvAmtSOLAmount)] - - const tvlAmtSOL = amtSOLAmount.reduce((acc,x) => acc.add(x), new BN(0)).div(new BN(1000000000)).toNumber() - - return { - 'amulet-staked-sol': tvlAmtSOL + const balances = { + 'solana:SoLW9muuNQmEAoBws7CWfYQnXRXMVEG12cQhy6LE2Zf': new BN(liqStakedAmtSOLAmount).toString() } + return sumTokens2({ balances, tokenAccounts: ['BQUHYmLH8St7j9kTWExd19QjoDuxrha7Mgp32M7zvS84', '9QPcNgmkRAQncEnTBDXvWq2H7LY4VLNJfiVYD9c3eL8D'] }) } module.exports = { diff --git a/projects/apricot.js b/projects/apricot.js index af44d6dcffdf..3ad79d4ae27c 100644 --- a/projects/apricot.js +++ b/projects/apricot.js @@ -1,53 +1,14 @@ -const ADDRESSES = require('./helper/coreAssets.json') -const { sumTokens2, sumOrcaLPs } = require('./helper/solana') +const { sumTokens2 } = require('./helper/solana') async function tvl() { - const orcaPoolsTVL = await sumOrcaLPs([ - //usdt/usdc - ["GjpXgKwn4VW4J2pZdS3dovM58hiXWLJtopTfqG83zY2f", "7Ne6h2w3LpTNTa7CNYcUs7UkjeJT3oW7jcrXWfVScTXW"], - //SOL/USDC - ["FFdjrSvNALfdgxANNpt3x85WpeVMdQSH5SEP2poM8fcK", "7Ne6h2w3LpTNTa7CNYcUs7UkjeJT3oW7jcrXWfVScTXW"], - //ETH/USDC - ["HDP2AYFmvLz6sWpoSuNS62JjvW4HjMKp7doXucqpWN56", "7Ne6h2w3LpTNTa7CNYcUs7UkjeJT3oW7jcrXWfVScTXW"], - //SOL/USDT - ["71vZ7Jvu8fTyFzpX399dmoSovoz24rVbipLrRn2wBNzW", "7Ne6h2w3LpTNTa7CNYcUs7UkjeJT3oW7jcrXWfVScTXW"], - //ORCA/USDC - ["Gc7W5U66iuHQcC1cQyeX9hxkPF2QUVJPTf1NWbW8fNrt", "7Ne6h2w3LpTNTa7CNYcUs7UkjeJT3oW7jcrXWfVScTXW"], - //ORCA/SOL - ["B5waaKnsmtqFawPspUwcuy1cRjAC7u2LrHSwxPSxK4sZ", "7Ne6h2w3LpTNTa7CNYcUs7UkjeJT3oW7jcrXWfVScTXW"], - //mSOL/USDC[aquafarm] - ["9y3QYM5mcaB8tU7oXRzAQnzHVa75P8riDuPievLp64cY", "7Ne6h2w3LpTNTa7CNYcUs7UkjeJT3oW7jcrXWfVScTXW"], - //BTC/mSOL[aquafarm] - ["6uA1ADUJbvwYJZpzUn9z9LuyKoRVngBKcQTKdXsSivA8", "7Ne6h2w3LpTNTa7CNYcUs7UkjeJT3oW7jcrXWfVScTXW"], - //ETH/SOL - ["CGFTRh4jKLPbS9r4hZtbDfaRuC7qcA8rZpbLnVTzJBer", "7Ne6h2w3LpTNTa7CNYcUs7UkjeJT3oW7jcrXWfVScTXW"], - //mSOL/SOL[stable][aquafarm] - ["576ABEdvLG1iFU3bLC8AMJ3mo5LhfgPPhMtTeVAGG6u7", "7Ne6h2w3LpTNTa7CNYcUs7UkjeJT3oW7jcrXWfVScTXW"], - ]) - const balances = { - tether: orcaPoolsTVL - } const owner = '7Ne6h2w3LpTNTa7CNYcUs7UkjeJT3oW7jcrXWfVScTXW' - const tokens = [ - ADDRESSES.solana.USDC, - '9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E', - '2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk', - 'mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So', - ADDRESSES.solana.USDT, - '4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R', - ADDRESSES.solana.SOL, - '9vMJfxuKxXBoEa7rM12mYLMwTacLMLDJqHozw96WQL8i', - 'orcaEKTdK7LKz57vaAYr9QeNsVEPfiu6QeMU1kektZE', - ] - return sumTokens2({ balances, owner, tokens }) - + return sumTokens2({ owner, getAllTokenAccounts: true }) } module.exports = { timetravel: false, - misrepresentedTokens: true, solana: { tvl, }, - methodology: 'TVL consists of deposits made to the protocol and like other lending protocols, borrowed tokens are not counted. Coingecko is used to price tokens.', + methodology: 'TVL consists of deposits made to the protocol and like other lending protocols, borrowed tokens are not counted', } diff --git a/projects/asol/index.js b/projects/asol/index.js index 349eafd7db9b..274e66d36408 100644 --- a/projects/asol/index.js +++ b/projects/asol/index.js @@ -1,10 +1,7 @@ -const {getTokenAccountBalance} = require('../helper/solana') +const { sumTokens2 } = require('../helper/solana') async function tvl() { - return { - "solana": await getTokenAccountBalance("4Bo98VrTYkHLbE9zoXx3tCD3qEDcGZFCZFksgyYPKdG9"), - "msol": await getTokenAccountBalance("7n1AmrpywC84MdALohPBipAx1SYhjpSLjYFb2EuTV9wm"), - } + return sumTokens2({ tokenAccounts: ['4Bo98VrTYkHLbE9zoXx3tCD3qEDcGZFCZFksgyYPKdG9', '7n1AmrpywC84MdALohPBipAx1SYhjpSLjYFb2EuTV9wm'] }) } module.exports = { diff --git a/projects/basis-market/index.js b/projects/basis-market/index.js index 20c721b24edc..c7846afa9628 100644 --- a/projects/basis-market/index.js +++ b/projects/basis-market/index.js @@ -1,14 +1,11 @@ -const {getTokenAccountBalance} = require('../helper/solana') +const {sumTokens2} = require('../helper/solana') -const basis = "Basis9oJw9j8cw53oMV7iqsgo6ihi9ALw4QR31rcjUJa"; const basis_staking = "3sBX8hj4URsiBCSRV26fEHkake295fQnM44EYKKsSs51"; async function stakingTVL(){ - const stakedBasis = await getTokenAccountBalance(basis_staking) - return {"basis-markets": stakedBasis} + return sumTokens2({tokenAccounts: [basis_staking]}) } - module.exports = { methodology: `TVL for basis market is staking for now`, solana:{ diff --git a/projects/cashio/index.js b/projects/cashio/index.js index 2c3d5fb6a31f..6af54195ec66 100644 --- a/projects/cashio/index.js +++ b/projects/cashio/index.js @@ -1,133 +1,10 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const SUNNY_POOLS = [{ - "poolName": "quarry_saber_usdc_usdt", - "relevantAccounts": { - "sunnyPool": "3Zk1PhVap6mwrB9jZktucoSaMBa2whYSq8jtLew3tXbp", - "tokenAMint": ADDRESSES.solana.USDC, - "tokenBMint": ADDRESSES.solana.USDT, - "tokenAReserve": "CfWX7o2TswwbxusJ4hCaPobu2jLCb1hfXuXJQjVq3jQF", - "tokenBReserve": "EnTrdMMpdhugeH6Ban6gYZWXughWxKtVGfCwFn78ZmY3", - "lpTokenSPL": "2poo1w1DL6yd2WNTCnNTzDqkC6MBXq7axo77P16yrBuf" - }, - "tokenA": "usd-coin", - "tokenB": "tether", - "tvlReader": "sunnyQuarrySaberPoolReader" -}]; - -const { - getMultipleAccountBuffers, - getMultipleAccountsRaw, -} = require("../helper/solana"); - -const readTVL = async ({ - tokenA, - tokenB, - tokenAReserve, - tokenBReserve, - poolMint, - tokenAccounts, -}) => { - const accountData = await getMultipleAccountBuffers({ - tokenAReserve, - tokenBReserve, - poolMint, - }); - if (accountData.sunnyPool === null) { - return {}; - } - - const decimals = accountData.poolMint.readUInt8(44); - const divisor = 10 ** decimals; - - const tokenAccountsData = (await getMultipleAccountsRaw(tokenAccounts)) - .map((account) => { - if (account !== null) { - return Buffer.from(account.data[0], account.data[1]); - } - return null; - }) - .filter((d) => !!d); - const totalTokens = tokenAccountsData - .map((tad) => - // sorry, this code is a tad hacky - Number(tad.readBigUInt64LE(64)) - ) - .reduce((acc, el) => acc + el, 0); - const lpTokenTotalSupply = Number(accountData.poolMint.readBigUInt64LE(36)); - const poolShare = totalTokens / lpTokenTotalSupply; - - const reserveAAmount = - Number(accountData.tokenAReserve.readBigUInt64LE(64)) / divisor; - const reserveBAmount = - Number(accountData.tokenBReserve.readBigUInt64LE(64)) / divisor; - - const poolTvlCoins = {}; - - if (tokenA === tokenB) { - poolTvlCoins[tokenA] = - poolShare * reserveAAmount + poolShare * reserveBAmount; - } else { - poolTvlCoins[tokenA] = poolShare * reserveAAmount; - poolTvlCoins[tokenB] = poolShare * reserveBAmount; - } - - return poolTvlCoins; -}; - -async function tvl() { - // a mapping of coin name to coin amount - const tvlResult = {}; - - // contains a list of all token accounts + their associated sunny pool or coingecko ID - // more details: https://github.com/cashioapp/treasury - const cashioTreasuryAccounts = { - "sunnyPools": { - "3Zk1PhVap6mwrB9jZktucoSaMBa2whYSq8jtLew3tXbp": [ - "D67ZNjaRERdc7Ej8SjbpyGwJT4MnadgzfGnwgCmMJAa1", - "CJdU6oLxuzuDffqtrzv3YvQjdjQ7egCkuRshwmKXNYjM" - ] - } - } - - - const { sunnyPools } = cashioTreasuryAccounts; - - // Run these serially to avoid rate limiting issues - for (const [sunnyPoolKey, tokenAccounts] of Object.entries(sunnyPools)) { - const sunnyPool = SUNNY_POOLS.find( - (pool) => pool.relevantAccounts.sunnyPool === sunnyPoolKey - ); - if (!sunnyPool) { - continue; - } - - const poolTVL = await readTVL({ - tokenA: sunnyPool.tokenA, - tokenB: sunnyPool.tokenB, - tokenAReserve: sunnyPool.relevantAccounts.tokenAReserve, - tokenBReserve: sunnyPool.relevantAccounts.tokenBReserve, - poolMint: sunnyPool.relevantAccounts.lpTokenSPL, - tokenAccounts, - }); - - for (const [tokenId, amount] of Object.entries(poolTVL)) { - if (!tvlResult[tokenId]) { - tvlResult[tokenId] = amount; - } else { - tvlResult[tokenId] += amount; - } - } - } - - return tvlResult; -} - module.exports = { timetravel: false, hallmarks: [ [1647993600, "Infinite mint glitch"] -], + ], + deadFrom: 1667993600, methodology: "TVL counts LP token deposits made to Cashio and accrued reward tokens to its bank. CoinGecko is used to find the price of tokens in USD.", - solana: { tvl }, + solana: { tvl: () => ({}) }, }; diff --git a/projects/cropper.js b/projects/cropper.js index 6fa54a9d33c5..331bd193cd9e 100644 --- a/projects/cropper.js +++ b/projects/cropper.js @@ -1,11 +1,9 @@ -const { getTokenBalance, getConnection, exportDexTVL, } = require("./helper/solana"); +const { getConnection, exportDexTVL, sumTokens2, } = require("./helper/solana"); const { PublicKey } = require('@solana/web3.js') const DEX_PROGRAM_ID = 'CTMAxxk34HjKWxQ3QLZK1HpaLXmBveao3ESePXbiyfzh' async function fetchStaking() { - return { - cropperfinance: await getTokenBalance('DubwWZNWiNGMMeeQHPnMATNj77YZPZSAz2WVR5WjLJqz', '5mEH7a7abQwUEXqfusVepc3z9cHVQg8uhqTXdq47J91o') - }; + return sumTokens2({ owners: ['5mEH7a7abQwUEXqfusVepc3z9cHVQg8uhqTXdq47J91o'], getAllTokenAccounts: true }); } async function getTokenAccounts() { @@ -35,4 +33,4 @@ module.exports = { tvl: exportDexTVL(DEX_PROGRAM_ID, getTokenAccounts), staking: fetchStaking } -}; // node test.js projects/cropper.js \ No newline at end of file +} \ No newline at end of file diff --git a/projects/dnadollar/index.js b/projects/dnadollar/index.js index fa560a69958f..39a44ab4ef45 100644 --- a/projects/dnadollar/index.js +++ b/projects/dnadollar/index.js @@ -1,105 +1,3 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); - -const treasuryContract = "0x1420287565FD5Ebec8FbD720c17Cd911600449d3"; - -const FundDAO = "0x3e1Aa19FA59c9B474f6d2F37976a84DeD64af4Bf"; -const USDT = ADDRESSES.cronos.USDT; -const USDC = ADDRESSES.cronos.USDC; -const USDC_DSHARE_meerkatLP = "0xFe0F0d50175789C1F69B41dB797cc9ABd8Ab0120"; - -const DShareRewardPool = "0x1A4bb8E03C35e2B672A0fcE18cab920aa023d7FC"; -// node test.js projects/dnadollar/index.js -const stakingContracts = [ - "0xed94536A27922e2BD0eE661abF5fB030228d9D72", - FundDAO, - DShareRewardPool, -]; -const DSHARE = "0x0e98dc462ff438b802fad0d68ff7f111a0674bb5"; -const DNA = "0xcc57f84637b441127f2f74905b9d99821b47b20c"; - -async function Staking(timestamp, chainBlocks) { - const balances = {}; - - await sumTokensAndLPsSharedOwners( - balances, - [ - [DNA, false], - [DSHARE, false], - ], - stakingContracts, - chainBlocks["cronos"], - "cronos", - (addr) => `cronos:${addr}` - ); - - return balances; -} - -const pool2 = async (chainBlocks) => { - const balances = {}; - - const lpPositions = []; - for (let i = 0; i < 5; i++) { - const token = ( - await sdk.api.abi.call({ - abi: abi.poolInfo, - target: DShareRewardPool, - params: i, - chain: "cronos", - block: chainBlocks["cronos"], - }) - ).output.token; - - const getTokenBalance = ( - await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - target: token, - params: DShareRewardPool, - chain: "cronos", - block: chainBlocks["cronos"], - }) - ).output; - - lpPositions.push({ - token: token, - balance: getTokenBalance, - }); - } - - await unwrapUniswapLPs( - balances, - lpPositions, - chainBlocks["cronos"], - "cronos", - (addr) => `cronos:${addr}` - ); - - return balances; -}; - -async function cronosTvl(timestamp, chainBlocks) { - const balances = {}; - - await sumTokensAndLPsSharedOwners( - balances, - [ - [USDT, false], - [USDC, false], - [USDC_DSHARE_meerkatLP, true], - ], - [FundDAO], - chainBlocks["cronos"], - "cronos", - (addr) => `cronos:${addr}` - ); - - return balances; -} - module.exports = { misrepresentedTokens: true, cronos: { diff --git a/projects/frakt/index.js b/projects/frakt/index.js index 19e438ad8c19..6e280a96e711 100644 --- a/projects/frakt/index.js +++ b/projects/frakt/index.js @@ -1,5 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { getProvider, getSolBalances, } = require('../helper/solana') +const { getProvider, sumTokens2, } = require('../helper/solana') const { Program, } = require("@project-serum/anchor"); const { getConfig } = require('../helper/cache') @@ -18,7 +18,7 @@ async function getData() { const pbPools = await program.account.priceBasedLiquidityPool.all() const liquidityPools = await program.account.liquidityPool.all() const solOwners = [...liquidityPools.map(i => i.account.liqOwner), ...pbPools.map(i => i.account.liqOwner)].map(i => i.toString()) - const poolsTVL = (await getSolBalances(solOwners)) + const poolsTVL = (await sumTokens2({ solOwners }))['solana:' + ADDRESSES.solana.SOL] ?? 0 const loans = await program.account.loan.all() const loanSum = loans.filter(i => i.account.loanStatus.activated).reduce((a, i) => a + +i.account.originalPrice, 0) diff --git a/projects/helper/solana.js b/projects/helper/solana.js index ba993179ed7a..931bdd3a838d 100644 --- a/projects/helper/solana.js +++ b/projects/helper/solana.js @@ -53,22 +53,6 @@ function getProvider() { } -async function getSolBalances(accounts) { - const formBody = key => ({ "jsonrpc": "2.0", "id": 1, "method": "getBalance", "params": [key] }) - const tokenBalances = [] - const chunks = sliceIntoChunks(accounts, 99) - for (let chunk of chunks) { - const bal = await http.post(endpoint(), chunk.map(formBody)) - tokenBalances.push(...bal) - } - return tokenBalances.reduce((a, i) => a + i.result.value, 0) -} - -async function getSolBalance(account) { - return getSolBalances([account]) -} - -const TOKEN_LIST_URL = "https://cdn.jsdelivr.net/gh/solana-labs/token-list@main/src/tokens/solana.tokenlist.json" async function getTokenSupply(token) { const tokenSupply = await http.post(endpoint(), { @@ -80,32 +64,6 @@ async function getTokenSupply(token) { return tokenSupply.result.value.uiAmount; } -async function getGeckoSolTokens() { - const tokens = await getTokenList() - const tokenSet = new Set() - tokens.filter(i => i.extensions?.coingeckoId && i.chainId === 101).forEach(i => tokenSet.add(i.address)) - return tokenSet -} - - -async function getValidGeckoSolTokens() { - const tokens = await getTokenList() - const tokenSet = new Set() - tokens.filter(i => i.extensions?.coingeckoId && i.chainId === 101 && !i.name.includes('(Wormhole v1)')).forEach(i => tokenSet.add(i.address)) - return tokenSet -} - -async function getTokenDecimals(tokens) { - const calls = tokens => tokens.map((t, i) => ({ jsonrpc: '2.0', id: t, method: 'getTokenSupply', params: [t] })) - const res = {} - const chunks = sliceIntoChunks(tokens, 99) - for (const chunk of chunks) { - const tokenSupply = await http.post(endpoint(), calls(chunk)) - tokenSupply.forEach(({ id, result }) => res[id] = result.value.decimals) - } - return res -} - function formOwnerBalanceQuery(owner, programId = TOKEN_PROGRAM_ID) { return { jsonrpc: "2.0", @@ -118,16 +76,6 @@ function formOwnerBalanceQuery(owner, programId = TOKEN_PROGRAM_ID) { ], } } -async function getOwnerAllAccount(owner) { - const tokenBalance = await http.post(endpoint(), formOwnerBalanceQuery(owner)); - return tokenBalance.result.value.map(i => ({ - account: i.pubkey, - mint: i.account.data.parsed.info.mint, - amount: i.account.data.parsed.info.tokenAmount.amount, - uiAmount: i.account.data.parsed.info.tokenAmount.uiAmount, - decimals: i.account.data.parsed.info.tokenAmount.decimals, - })) -} function formTokenBalanceQuery(token, account, id = 1) { return { @@ -204,43 +152,6 @@ async function getTokenAccountBalances(tokenAccounts, { individual = false, chun return balances } - -async function getTokenAccountBalance(account) { - const tokenBalance = await http.post( - endpoint(), - { - jsonrpc: "2.0", - id: 1, - method: "getTokenAccountBalance", - params: [account], - }, - { - headers: { "Content-Type": "application/json" }, - } - ); - return tokenBalance.result?.value?.uiAmount; -} - -let tokenList -let _tokenList - -async function getTokenList() { - if (!_tokenList) - _tokenList = http.get(TOKEN_LIST_URL) - tokenList = (await _tokenList).tokens - return tokenList -} - -// Example: [[token1, account1], [token2, account2], ...] -async function sumTokens(tokensAndOwners, balances = {}) { - return sumTokens2({ balances, tokensAndOwners, }) -} - -// Example: [[token1, account1], [token2, account2], ...] -async function sumTokensUnknown(tokensAndOwners) { - return sumTokens2({ tokensAndOwners, }) -} - // accountsArray is an array of base58 address strings async function getMultipleAccountsRaw(accountsArray) { if ( @@ -265,54 +176,6 @@ async function getMultipleAccountsRaw(accountsArray) { return res; } -// Gets data in Buffers of all addresses, while preserving labels -// Example: labeledAddresses = { descriptiveLabel: "9xDUcgo8S6DdRjvrR6ULQ2zpgqota8ym1a4tvxiv2dH8", ... } -async function getMultipleAccountBuffers(labeledAddresses) { - let labels = []; - let addresses = []; - - for (const [label, address] of Object.entries(labeledAddresses)) { - labels.push(label); - addresses.push(address); - } - const accountsData = await getMultipleAccountsRaw(addresses); - - const results = {}; - accountsData.forEach((account, index) => { - if (account === null) { - results[labels[index]] = null; - } else { - results[labels[index]] = Buffer.from(account.data[0], account.data[1]); - } - - // Uncomment and paste into a hex editor to do some reverse engineering - }); - - return results; -} - -// Example: [[token1, account1], [token2, account2], ...] -async function sumOrcaLPs(tokensAndAccounts) { - const [tokenlist, orcaPools] = await Promise.all([ - getTokenList(), - http.get("https://api.orca.so/pools"), - ]); - let totalUsdValue = 0; - await Promise.all( - tokensAndAccounts.map(async ([token, owner]) => { - const balance = await getTokenBalance(token, owner); - const symbol = tokenlist - .find((t) => t.address === token) - ?.symbol?.replace("[stable]", ""); - const supply = await getTokenSupply(token); - const poolLiquidity = - orcaPools.find((p) => p.name2 === symbol)?.liquidity ?? 0; - totalUsdValue += (balance * poolLiquidity) / supply; - }) - ); - return totalUsdValue; -} - function exportDexTVL(DEX_PROGRAM_ID, getTokenAccounts, chain = 'solana') { return async () => { if (!getTokenAccounts) getTokenAccounts = _getTokenAccounts @@ -331,8 +194,7 @@ function exportDexTVL(DEX_PROGRAM_ID, getTokenAccounts, chain = 'solana') { data.push({ token0: tokenA.mint, token0Bal: tokenA.amount, token1: tokenB.mint, token1Bal: tokenB.amount, }) } - const coreTokens = chain === 'solana' ? await getGeckoSolTokens() : null - return transformDexBalances({ chain, data, blacklistedTokens: blacklistedTokens_default, coreTokens, }) + return transformDexBalances({ chain, data, blacklistedTokens: blacklistedTokens_default, }) } async function _getTokenAccounts() { @@ -423,6 +285,28 @@ async function sumTokens2({ }) return [...set].map(i => i.split('$')) } + + async function getOwnerAllAccount(owner) { + const tokenBalance = await http.post(endpoint(), formOwnerBalanceQuery(owner)); + return tokenBalance.result.value.map(i => ({ + account: i.pubkey, + mint: i.account.data.parsed.info.mint, + amount: i.account.data.parsed.info.tokenAmount.amount, + uiAmount: i.account.data.parsed.info.tokenAmount.uiAmount, + decimals: i.account.data.parsed.info.tokenAmount.decimals, + })) + } + + async function getSolBalances(accounts) { + const formBody = key => ({ "jsonrpc": "2.0", "id": 1, "method": "getBalance", "params": [key] }) + const tokenBalances = [] + const chunks = sliceIntoChunks(accounts, 99) + for (let chunk of chunks) { + const bal = await http.post(endpoint(), chunk.map(formBody)) + tokenBalances.push(...bal) + } + return tokenBalances.reduce((a, i) => a + i.result.value, 0) + } } async function transformBalances({ tokenBalances, balances = {}, }) { @@ -470,28 +354,14 @@ module.exports = { endpoint: endpoint(), getTokenSupply, getTokenBalance, - getTokenAccountBalance, - sumTokens, getMultipleAccountsRaw, - getMultipleAccountBuffers, - sumOrcaLPs, - getSolBalance, - sumTokensUnknown, exportDexTVL, getProvider, getConnection, sumTokens2, - getTokenBalances, transformBalances, - getSolBalances, - getTokenDecimals, - getGeckoSolTokens, - getTokenAccountBalances, - getTokenList, readBigUInt64LE, decodeAccount, - getValidGeckoSolTokens, - getOwnerAllAccount, blacklistedTokens_default, getStakedSol, getSolBalanceFromStakePool, diff --git a/projects/invictus/index.js b/projects/invictus/index.js index d1ce0d9e038e..7f4ec2f9ab9f 100644 --- a/projects/invictus/index.js +++ b/projects/invictus/index.js @@ -1,22 +1,12 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { getTokenAccountBalance, getTokenBalance } = require('../helper/solana') +const { sumTokens2 } = require('../helper/solana') async function staking() { - const stakedInv = await getTokenAccountBalance("5EZiwr4fE1rbxpzQUWQ6N9ppkEridNwbH3dU3xUf7wPZ") - return { - "invictus": stakedInv - } + return sumTokens2({tokenAccounts: ['5EZiwr4fE1rbxpzQUWQ6N9ppkEridNwbH3dU3xUf7wPZ']}) } const treasury = "6qfyGvoUqGB6AQ7xLc4pVwFNdgJSbAMkTtKkBXhLRiV1" async function tvl() { - const [usdc,] = await Promise.all([ - ADDRESSES.solana.USDC, //usdc - ].map(t => getTokenBalance(t, treasury))) - return { - "usd-coin": usdc, - } - + return sumTokens2({ owner: treasury, getAllTokenAccounts: true }) } diff --git a/projects/kamino-lending/index.js b/projects/kamino-lending/index.js index d753a48fd7db..2f1883a8b12c 100644 --- a/projects/kamino-lending/index.js +++ b/projects/kamino-lending/index.js @@ -1,5 +1,5 @@ const { PublicKey } = require('@solana/web3.js'); -const { getConnection, sumTokens } = require('../helper/solana'); +const { getConnection, sumTokens2 } = require('../helper/solana'); const { Program } = require('@project-serum/anchor'); const kaminoIdl = require('./kamino-lending-idl.json'); const { MintLayout } = require("../helper/utils/solana/layouts/mixed-layout"); @@ -37,7 +37,7 @@ async function tvl() { } } } - return sumTokens(tokensAndOwners) + return sumTokens2({ tokensAndOwners }) } async function isKToken(mint, connection) { diff --git a/projects/marinade.js b/projects/marinade.js index ad204fd662bc..18b1555992ec 100644 --- a/projects/marinade.js +++ b/projects/marinade.js @@ -1,4 +1,4 @@ -const { getProvider, getSolBalance, } = require("./helper/solana") +const { getProvider, sumTokens2, } = require("./helper/solana") const { Program, } = require("@project-serum/anchor"); async function tvl() { @@ -6,28 +6,23 @@ async function tvl() { const programId = 'MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD' const idl = await Program.fetchIdl(programId, provider) const program = new Program(idl, programId, provider) - const [ - { - account: { - validatorSystem: { totalActiveBalance }, - availableReserveBalance, - }, + const [{ + account: { + validatorSystem: { totalActiveBalance }, + availableReserveBalance, }, - ] = await program.account.state.all() - return { - solana: - (+totalActiveBalance + - +availableReserveBalance + - (await getSolBalance("UefNb6z6yvArqe4cJHTXCqStRsKmWhGxnZzuHbikP5Q"))) / // Liq Pool Sol Leg Pda - 1e9, + },] = await program.account.state.all() + const balances = { + solana: (+totalActiveBalance + +availableReserveBalance) / 1e9 } + return sumTokens2({ balances, solOwners: ['UefNb6z6yvArqe4cJHTXCqStRsKmWhGxnZzuHbikP5Q'] }) // Liq Pool Sol Leg Pda } module.exports = { - hallmarks:[ - [1667865600, "FTX collapse"] - ], - timetravel: false, - solana: { tvl }, - methodology: `We sum the amount of SOL staked, SOL in reserve address: Du3Ysj1wKbxPKkuPPnvzQLQh8oMSVifs3jGZjJWXFmHN and SOL in the Liquidity pool: UefNb6z6yvArqe4cJHTXCqStRsKmWhGxnZzuHbikP5Q`, + hallmarks: [ + [1667865600, "FTX collapse"] + ], + timetravel: false, + solana: { tvl }, + methodology: `We sum the amount of SOL staked, SOL in reserve address: Du3Ysj1wKbxPKkuPPnvzQLQh8oMSVifs3jGZjJWXFmHN and SOL in the Liquidity pool: UefNb6z6yvArqe4cJHTXCqStRsKmWhGxnZzuHbikP5Q`, } diff --git a/projects/nirvana/index.js b/projects/nirvana/index.js index e8a081314d52..8a4788dd2e7f 100644 --- a/projects/nirvana/index.js +++ b/projects/nirvana/index.js @@ -1,21 +1,18 @@ -const { getTokenBalance, getTokenAccountBalance, } = require('../helper/solana'); +const { sumTokens2 } = require('../helper/solana'); const ANA = "ANAxByE6G2WjFp7A4NqtWYXb3mgruyzZYg3spfxe6Lbo"; const stakingContract = "CxuuSEv67PzNkMxqCvHeDUr6HKaadoz8NhTfxbQSJnaG"; async function staking() { - const balance = await getTokenBalance(ANA, stakingContract); - return { 'nirvana-ana': balance }; + return sumTokens2({ tokensAndOwners: [[ANA, stakingContract]] }); } + async function tvl() { - return { - 'tether': await getTokenAccountBalance('EwQa93fpN2a6smD7EBFjQEyDt3DP8EMLHLjgAWxG9Qhj'), - 'usd-coin': await getTokenAccountBalance('6t7ViNDULtkgvmntHsmi1QV73Tez7ZcX6DJvARHkfUJZ'), - }; + return sumTokens2({ tokenAccounts: ['EwQa93fpN2a6smD7EBFjQEyDt3DP8EMLHLjgAWxG9Qhj', '6t7ViNDULtkgvmntHsmi1QV73Tez7ZcX6DJvARHkfUJZ',] }) } module.exports = { hallmarks: [ - [1659009600,"Flash-Loan & Price Manipulation Attack"] + [1659009600, "Flash-Loan & Price Manipulation Attack"] ], timetravel: false, methodology: @@ -24,4 +21,5 @@ module.exports = { tvl, staking, }, + deadFrom: 1669009600, }; \ No newline at end of file diff --git a/projects/oxygen/idl.js b/projects/oxygen/idl.js deleted file mode 100644 index 225d65a608eb..000000000000 --- a/projects/oxygen/idl.js +++ /dev/null @@ -1,147 +0,0 @@ - -module.exports = { - version: '0.0.0', - name: 'borrow_lending', - instructions: [], - accounts: [ - { - name: 'MainAccount', - type: { - kind: 'struct', - fields: [ - { - name: 'authority', - type: 'publicKey', - }, - { - name: 'tokens', - type: { - array: [ - { - defined: 'TokenData', - }, - 64, - ], - }, - }, - { - name: 'balances', - type: { - array: [ - { - defined: 'BalanceTs', - }, - 64, - ], - }, - }, - { - name: 'prices', - type: { - array: [ - { - defined: 'PriceTs', - }, - 64, - ], - }, - }, - { - name: 'signerBump', - type: 'u8', - }, - { - name: 'priceAuthority', - type: 'publicKey', - }, - { - name: 'padding', - type: { - array: [ - 'u8', - 992, - ], - }, - }, - ], - }, - }, - ], - types: [ - { - name: 'Balance', - type: { - kind: 'struct', - fields: [ - { - name: 'depositTotal', - type: 'u128', - }, - { - name: 'borrowTotal', - type: 'u128', - }, - { - name: 'depositShares', - type: 'u128', - }, - { - name: 'borrowShares', - type: 'u128', - }, - ], - }, - }, - { - name: 'BalanceTs', - type: { - kind: 'struct', - fields: [ - { - name: 'balance', - type: { - defined: 'Balance', - }, - }, - { - name: 'ts', - type: 'i64', - }, - ], - }, - }, - { - name: 'TokenData', - type: { - kind: 'struct', - fields: [ - { - name: 'mint', - type: 'publicKey', - }, - { - name: 'decimals', - type: 'u8', - }, - ], - }, - }, - { - name: 'PriceTs', - type: { - kind: 'struct', - fields: [ - { - name: 'price', - type: 'u128', - }, - { - name: 'ts', - type: 'i64', - }, - ], - }, - }, - ], - errors: [], -}; diff --git a/projects/oxygen/index.js b/projects/oxygen/index.js index 9b53ff39b7e9..c0552ea7c795 100644 --- a/projects/oxygen/index.js +++ b/projects/oxygen/index.js @@ -1,48 +1,8 @@ -const { getProvider, getTokenDecimals } = require('../helper/solana') -const { PublicKey } = require('@solana/web3.js') -const { Program, } = require("@project-serum/anchor"); -const idl = require('./idl'); +const { sumTokens2 } = require('../helper/solana') -const INTERNAL_DECIMALS = 12; - -let tokenData - -async function _getTokenData() { - const mainAccountAddress = new PublicKey('6JVfU8Cp2oAQi39YBpTSuozHiZAUa7j4t1gDyF9RDFEi') - const programId = new PublicKey('J21zqcffYQU2NUJrvAKhqpKZLQK1YaB9dY5kmcxkMQvQ') - const provider = getProvider() - const program = new Program(idl, programId, provider) - const data = await program.account.mainAccount.fetch(mainAccountAddress) - data.tokens = data.tokens.slice(0, 6) - data.balances = data.balances.slice(0, 6) - data.tokenDecimals = await getTokenDecimals(data.tokens.map(({ mint }) => mint.toBase58())) - return data -} - -async function getTokenData() { - if (!tokenData) tokenData = _getTokenData() - return tokenData -} async function tvl(api) { - const data = await getTokenData() - data.tokens.forEach(({ mint }, i) => { - const token = mint.toBase58() - const { balance: { depositTotal, borrowTotal } } = data.balances[i] - const decimals = 10 ** (data.tokenDecimals[token] - INTERNAL_DECIMALS) - api.add(token, depositTotal.toString() * decimals) - api.add(token, borrowTotal.toString() * -1 * decimals) - }) -} - -async function borrowed(api) { - const data = await getTokenData() - data.tokens.forEach(({ mint }, i) => { - const token = mint.toBase58() - const { balance: { borrowTotal } } = data.balances[i] - const decimals = 10 ** (data.tokenDecimals[token] - INTERNAL_DECIMALS) - api.add(token, borrowTotal.toString()* decimals) - }) + return sumTokens2({ owner: '4ncyWnbG22vqEmyxTfBsEdbNuQhBphaasg5q5YgoiPgq', getAllTokenAccounts: true}) } module.exports = { diff --git a/projects/portfinance/index.js b/projects/portfinance/index.js index 19362999ea2d..ce741e678695 100644 --- a/projects/portfinance/index.js +++ b/projects/portfinance/index.js @@ -1,50 +1,12 @@ -const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require('../helper/solana') async function tvl() { - - const tokensAndOwners = [ - /// Main Pool - [ADDRESSES.solana.USDC, "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], - [ADDRESSES.solana.USDT, "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], - [ADDRESSES.solana.SOL, "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], - ["Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], - ["MERt85fc5boKw3BW1eYdxonEuJNvXbiMbs6hvheau5K", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], - ["9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], - ["SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], - ["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], - [ADDRESSES.solana.pSOL, "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], - ["Saber2gLauYim4Mvftnrasomsv6NvAuncvMEZwcLpD1", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], - ["2poo1w1DL6yd2WNTCnNTzDqkC6MBXq7axo77P16yrBuf", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], - ["9vMJfxuKxXBoEa7rM12mYLMwTacLMLDJqHozw96WQL8i", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], - ["7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], - ["PoRTjZMPXb9T7dyU7tpLEZRQj7e6ssfAE62j2oQuc6y", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], - ["7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"], - - /// Hubble Innovation Zone - ["USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX", "GU1nCjN7mcLiSX1dtBw2t9agYCw3ybXfu1me41Q2tGT3"], - ["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So", "GU1nCjN7mcLiSX1dtBw2t9agYCw3ybXfu1me41Q2tGT3"], - ["Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS", "GU1nCjN7mcLiSX1dtBw2t9agYCw3ybXfu1me41Q2tGT3"], - ["9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E", "GU1nCjN7mcLiSX1dtBw2t9agYCw3ybXfu1me41Q2tGT3"], - [ADDRESSES.solana.SOL, "GU1nCjN7mcLiSX1dtBw2t9agYCw3ybXfu1me41Q2tGT3"], - - /// UXD Innovation Zone - ["7kbnvuGBxxj8AG9qp8Scn56muWGaRaFqxg1FsRp3PaFT", "Hy6gCkJyMmWMaoxLyzELRReLzdBdZ1YEjNGjQzF9LDPa"], - [ADDRESSES.solana.USDC, "Hy6gCkJyMmWMaoxLyzELRReLzdBdZ1YEjNGjQzF9LDPa"], - [ADDRESSES.solana.USDT, "Hy6gCkJyMmWMaoxLyzELRReLzdBdZ1YEjNGjQzF9LDPa"], - [ADDRESSES.solana.SOL, "Hy6gCkJyMmWMaoxLyzELRReLzdBdZ1YEjNGjQzF9LDPa"], - ["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So", "Hy6gCkJyMmWMaoxLyzELRReLzdBdZ1YEjNGjQzF9LDPa"], - - /// Hedge Innovation Zone - ["9iLH8T7zoWhY7sBmj1WK9ENbWdS1nL8n9wAxaeRitTa6", "4bf5HQQZ9qtGGCuxYNnhiTrKpTMTX6HSoLy5a7wUjCEb"], - ["9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E", "4bf5HQQZ9qtGGCuxYNnhiTrKpTMTX6HSoLy5a7wUjCEb"], - [ADDRESSES.solana.SOL, "4bf5HQQZ9qtGGCuxYNnhiTrKpTMTX6HSoLy5a7wUjCEb"], - ["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So", "4bf5HQQZ9qtGGCuxYNnhiTrKpTMTX6HSoLy5a7wUjCEb"], - - ] - - return sumTokens2({ tokensAndOwners }) - + return sumTokens2({ owners: [ + '4bf5HQQZ9qtGGCuxYNnhiTrKpTMTX6HSoLy5a7wUjCEb', // Hedge Innovation Zone + '8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ', // Main Pool + 'GU1nCjN7mcLiSX1dtBw2t9agYCw3ybXfu1me41Q2tGT3', // Hubble Innovation Zone + 'Hy6gCkJyMmWMaoxLyzELRReLzdBdZ1YEjNGjQzF9LDPa', // UXD Innovation Zone + ], getAllTokenAccounts: true, }) } module.exports = { @@ -52,7 +14,4 @@ module.exports = { solana: { tvl }, - methodology: - "To obtain the Port TVL we make on-chain calls using the function getTokenBalance() that uses the address of the token and the address of the contract where the token is located.", - }; diff --git a/projects/rubic/index.js b/projects/rubic/index.js index bc977ffa2a16..79011e5a5ff6 100644 --- a/projects/rubic/index.js +++ b/projects/rubic/index.js @@ -1,6 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); -const solana = require('../helper/solana') const { stakings } = require('../helper/staking'); const stakingContractRoundOne = '0x8d9Ae5a2Ecc16A66740A53Cc9080CcE29a7fD9F5'; @@ -50,16 +49,6 @@ function chainTvl(chain) { } } -function solanaTvl() { - return async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - const poolBalance = await solana.getTokenBalance(usdcByChain['solana'], pools['solana']); - - sdk.util.sumSingleBalance(balances, 'usd-coin', poolBalance); - - return balances; - } -} module.exports = { timetravel: false, // solana :cries: @@ -74,31 +63,4 @@ module.exports = { kava: { tvl: chainTvl('kava') } - // ethereum: { - // tvl: chainTvl('ethereum') - // }, - // polygon: { - // tvl: chainTvl('polygon') - // }, - // fantom: { - // tvl: chainTvl('fantom') - // }, - // avax:{ - // tvl: chainTvl('avax') - // }, - // harmony: { - // tvl: chainTvl('harmony') - // }, - // moonriver: { - // tvl: chainTvl('moonriver') - // }, - // arbitrum: { - // tvl: chainTvl('arbitrum') - // }, - // aurora: { - // tvl: chainTvl('aurora') - // }, - // solana: { - // tvl: solanaTvl() - // } } diff --git a/projects/sencha/index.js b/projects/sencha/index.js deleted file mode 100644 index 2eab65c5ff2a..000000000000 --- a/projects/sencha/index.js +++ /dev/null @@ -1,34 +0,0 @@ -const { getConfig } = require('../helper/cache') - -const {getTokenAccountBalance} = require('../helper/solana'); - -async function tvl() { - // this is a list of token accounts that are reserves of a swap - // more details: https://github.com/senchahq/sencha-registry - const senchaTokenAccounts= await getConfig('sencha', - "https://raw.githubusercontent.com/SenchaHQ/sencha-registry/master/data/known-accounts.json" - ); - - const tvlResult = {}; - await Promise.all( - senchaTokenAccounts.map(async ({ coingeckoId, account }) => { - const amount = await getTokenAccountBalance(account); - if (!tvlResult[coingeckoId]) { - tvlResult[coingeckoId] = amount; - } else { - tvlResult[coingeckoId] += amount; - } - }) - ); - return tvlResult; -} - -module.exports = { - timetravel: false, - methodology: - "Sencha TVL is computed by iterating each known Sencha pool, then taking the value of each of the underlying tokens. Assets not listed on Coingecko are not counted.", - solana: { - tvl, - } - -}; diff --git a/projects/solhero/index.js b/projects/solhero/index.js deleted file mode 100644 index 1a941679b168..000000000000 --- a/projects/solhero/index.js +++ /dev/null @@ -1,316 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const utils = require('../helper/utils') -const { getConnection } = require('../helper/solana') -const BigNumber = require('bignumber.js') -const { PublicKey } = require('@solana/web3.js') -const sdk = require('@defillama/sdk') - -const poolInfoKey = new PublicKey('CsMSJ2wJAsQBNZU9LuL3FAx2Do9ndY4Ae15JAXhFMc1p') - -const decimals = { - 'Hero6s7zJXsw9hfCXLVR5stLqgCok3E7CCkpQEoLAk2g': 6, // HERO - [ADDRESSES.solana.SOL]: 9, // SOL - '4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R': 6, // RAY - 'mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So': 9, // mSOL - [ADDRESSES.solana.USDC]: 6, // USDC - [ADDRESSES.solana.USDT]: 6, // USDT - 'rEmtKCiw6DQL8kAaGzhSryqnqNckYabPxTNXDdj2Jur': 6, // hero-usdc - 'Epm4KfTj4DMrvqn6Bwg2Tr2N8vhQuNbuK8bESFp4k33K': 9, // sol-usdt - '8HoQnePLqPj4M7PUDzfw8e3Ymdwgc7NLGnaTUapubyvu': 9, // sol-usdc - '89ZKE4aoyfLBe2RuV6jM3JGNhaV18Nxh8eNtjRcndBip': 6, // sol-ray -} - -const poolTypes = { - 'rEmtKCiw6DQL8kAaGzhSryqnqNckYabPxTNXDdj2Jur': 0, // hero-usdc - '8HoQnePLqPj4M7PUDzfw8e3Ymdwgc7NLGnaTUapubyvu': 0, // sol-usdc, 0: lp, 1: token - 'Epm4KfTj4DMrvqn6Bwg2Tr2N8vhQuNbuK8bESFp4k33K': 0, // sol-usdt - '89ZKE4aoyfLBe2RuV6jM3JGNhaV18Nxh8eNtjRcndBip': 0, // ray-sol -} - -const poolKeys = { - 'rEmtKCiw6DQL8kAaGzhSryqnqNckYabPxTNXDdj2Jur': { // hero-usdc - 'ammId': 'FJB4xeMJ9KoZVDZb7Pf91hggwy6hLJMQFXTMKCfugwU8', - }, - '8HoQnePLqPj4M7PUDzfw8e3Ymdwgc7NLGnaTUapubyvu': { // sol-usdc - 'ammId': '58oQChx4yWmvKdwLLZzBi4ChoCc2fqCUWBkwMihLYQo2', - }, - 'Epm4KfTj4DMrvqn6Bwg2Tr2N8vhQuNbuK8bESFp4k33K': { // sol-usdt - 'ammId': '7XawhbbxtsRcQA8KTkHT9f9nc6d69UwqCDh6U5EEbEmX', - }, - '89ZKE4aoyfLBe2RuV6jM3JGNhaV18Nxh8eNtjRcndBip': { // ray-sol - 'ammId': 'AVs9TA4nWDzfPJE9gGVNJMVhcQy3V9PGazuz33BfG2RA', - }, -} - -function isLp(token) { - const addr = token.toString() - if (poolTypes[addr] == 0) - return true - return false -} - -var priceCache = new Map() - -async function getTokenSupplyUI(mintPubkey) { - const connection = getConnection() - var supply = new BigNumber(0) - - const ret = await connection.getTokenSupply(mintPubkey) - if (ret && ret.value && ret.value.uiAmountString) - supply = new BigNumber(ret.value.uiAmountString) - - return supply -} - -async function getLpPrice(tokenPubkey) { - - if (priceCache[tokenPubkey.toString()]) - return priceCache[tokenPubkey.toString()] - - const tokenAddress = tokenPubkey.toString() - - var price = new BigNumber(1.0) - - const keys = poolKeys[tokenAddress] - if (!keys) - return price; - - const ammId = keys['ammId'] - - const prefix = 'https://api.solscan.io/amm/read?address=' - const url = prefix + ammId - - const res = await utils.fetchURL(url) - if (res && res.data && res.data.success) { - const tvl = new BigNumber(res.data.data.liquidity) - - const _tokenPubkey = new PublicKey(res.data.data.lpMint) - const supply = await getTokenSupplyUI(_tokenPubkey) - - price = tvl.div(supply) - - priceCache[tokenPubkey.toString()] = price - } else { - sdk.log(res) - } - - return price -} - - -async function getTokenPrice(tokenPubkey) { - - if (priceCache[tokenPubkey.toString()]) - return priceCache[tokenPubkey.toString()] - - var price = new BigNumber(1.0) - - const prefix = 'https://public-api.solscan.io/market/token/' - const url = prefix + tokenPubkey.toString() - - const res = await utils.fetchURL(url) - if (res && res.data && res.data.priceUsdt) { - price = new BigNumber(res.data.priceUsdt) - priceCache[tokenPubkey.toString()] = price - } - - return price -} - -async function getHeroPrice() { - - if (priceCache['Hero6s7zJXsw9hfCXLVR5stLqgCok3E7CCkpQEoLAk2g']) - return priceCache['Hero6s7zJXsw9hfCXLVR5stLqgCok3E7CCkpQEoLAk2g'] - - var price = new BigNumber(1.0) - - const url = 'https://api.solscan.io/amm/read?address=FJB4xeMJ9KoZVDZb7Pf91hggwy6hLJMQFXTMKCfugwU8' - - const res = await utils.fetchURL(url) - if (res && res.data && res.data.data && res.data.data.price) { - price = new BigNumber(res.data.data.price) - priceCache['Hero6s7zJXsw9hfCXLVR5stLqgCok3E7CCkpQEoLAk2g'] = price - } - - return price -} - -async function getHeroLp() { - var lpTvl = new BigNumber(0) - - const url = 'https://api.solscan.io/amm/read?address=FJB4xeMJ9KoZVDZb7Pf91hggwy6hLJMQFXTMKCfugwU8' - - const res = await utils.fetchURL(url) - if (res && res.data && res.data.data && res.data.data.liquidity) { - lpTvl = new BigNumber(res.data.data.liquidity) - } - - return lpTvl -} - -async function pools() { - const connection = getConnection() - const poolInfoAccount = await connection.getAccountInfo(poolInfoKey) - - const buffer = Buffer.from(poolInfoAccount.data) - const poolLength = buffer.readBigUInt64LE(0) - - var amounts = [] - - for (var i = 0; i < poolLength; i++) { - if (i == 10) - continue - - const offset = 8 + i * 104 - - const pubkey = new PublicKey(buffer.subarray(offset, offset + 32)) - const dec = new BigNumber(10).pow(decimals[pubkey.toString()]) - const amount = buffer.readBigUInt64LE(offset + 40) - - const boost = 3 - amounts.push(new BigNumber(amount).times(boost).div(dec)) - } - - return { - solana: amounts[1], - raydium: amounts[2], - 'msol': amounts[3], - 'usd-coin': amounts[4], - tether: amounts[5], - } -} - -async function staking() { - - const connection = getConnection() - const poolInfoAccount = await connection.getAccountInfo(poolInfoKey) - - const buffer = Buffer.from(poolInfoAccount.data) - - var tvl = new BigNumber(0) - - var solPrice = await getTokenPrice(ADDRESSES.solana.SOL) - - var amounts = [] - - const poolLength = buffer.readBigUInt64LE(0) - for (var i = 0; i < poolLength; i++) { - if (i != 0) - continue - - const offset = 8 + i * 104 - - const pubkey = new PublicKey(buffer.subarray(offset, offset + 32)) - const dec = new BigNumber(10).pow(decimals[pubkey.toString()]) - const amount = buffer.readBigUInt64LE(offset + 40) - - amounts.push(new BigNumber(amount).div(dec)) - - var price = new BigNumber(1.0) - if (i == 0) - price = await getHeroPrice() - else if (isLp(pubkey)) - price = await getLpPrice(pubkey) - else - price = await getTokenPrice(pubkey) - - //if (i == 1) - // solPrice = price - - const boost = 3 - const poolTvl = new BigNumber(amount).times(price).times(boost).div(dec) - tvl = tvl.plus(poolTvl) - } - - tvl = tvl.div(solPrice) - - return { - solana: tvl - } -} - -async function farmPool() { - - const connection = getConnection() - const poolInfoAccount = await connection.getAccountInfo(poolInfoKey) - - const buffer = Buffer.from(poolInfoAccount.data) - - var tvl = new BigNumber(0) - - var solPrice = await getTokenPrice(ADDRESSES.solana.SOL) - - var amounts = [] - - const poolLength = buffer.readBigUInt64LE(0) - for (var i = 0; i < poolLength; i++) { - - const offset = 8 + i * 104 - - const pubkey = new PublicKey(buffer.subarray(offset, offset + 32)) - const dec = new BigNumber(10).pow(decimals[pubkey.toString()]) - const amount = buffer.readBigUInt64LE(offset + 40) - - amounts.push(new BigNumber(amount).div(dec)) - - var price = new BigNumber(1.0) - if (i == 0) - price = await getHeroPrice() - else if (isLp(pubkey)) - price = await getLpPrice(pubkey) - else - price = await getTokenPrice(pubkey) - - if (i == 1) - solPrice = price - - const boost = 3 - const poolTvl = new BigNumber(amount).times(price).times(boost).div(dec) - tvl = tvl.plus(poolTvl) - } - - tvl = tvl.div(solPrice) - - return { - solana: tvl - } -} - -async function lpTvl() { - const connection = getConnection() - const poolInfoAccount = await connection.getAccountInfo(poolInfoKey) - - const buffer = Buffer.from(poolInfoAccount.data) - - var tvl = new BigNumber(0) - - var solPrice = await getTokenPrice(ADDRESSES.solana.SOL) - var lpTvl = await getHeroLp() - - lpTvl = lpTvl.div(solPrice) - - return { - solana: lpTvl - } -} - -async function tvl() { - const [pool, farm] = await Promise.all([ - pools(), - farmPool(), - ]); - - pool.solana = (pool.solana).plus(farm.solana) - - return pool -} - -module.exports = { - timetravel: false, - solana: { - tvl, - pool2: lpTvl, - staking, - }, - methodology: 'TVL consists of staked tokens and raydium LPs', -} diff --git a/projects/solyard.js b/projects/solyard.js index 0933d95ffddd..35400676dc0d 100644 --- a/projects/solyard.js +++ b/projects/solyard.js @@ -1,72 +1,15 @@ -const { getTokenAccountBalance } = require('./helper/solana') -const { get } = require('./helper/http') -let _lpData - -async function getLPData() { - if (!_lpData) _lpData = get("https://api.raydium.io/pairs") - return _lpData -} - -async function tvl() { - const LP_Data = await getLPData() - const pools = [ - { - name: 'RAY-USDC-V4', - mint: 'FbC6K13MzHvN42bXrtGaWsvZY9fxrackRSZcBGfjPc7m', - tokenAccount: '6v9NUn9gCziTvTepoL2fvegQFPtDPJKneybAzd6jdPDp', - }, - { - name: 'RAY-USDT', - mint: 'C3sT1R3nsw4AVdepvLTLKr5Gvszr7jufyBWUCvy4TUvT', - tokenAccount: 'HpGnoYvTDvSa7aSmnNCSGLKt56Mdd6HUe5q6Kj4kHjVV', - }, - { - name: 'RAY-SRM-V4', - mint: '7P5Thr9Egi2rvMmEuQkLn8x8e8Qro7u2U7yLD2tU2Hbe', - tokenAccount: 'DNYv74TeXvcaCBnC4f2jGFFYpc8P5ifDMbEAgEXoAc9h', - }, - { - name: 'RAY-SOL-V4', - mint: '89ZKE4aoyfLBe2RuV6jM3JGNhaV18Nxh8eNtjRcndBip', - tokenAccount: '61HZrok75Uy4FV4My6kbbW8a5WFkTNvCUemxMrfeka5W', - }, - { - name: 'RAY-ETH-V4', - mint: 'mjQH33MqZv5aKAbKHi8dG3g3qXeRQqq1GFcXceZkNSr', - tokenAccount: 'DRi5CTWMvsQpxX5twpnCDk1iJpZ2GvNj4QaFQ3dDMhkS', - } - ] - let total = 0 - for (const { mint, tokenAccount } of pools) { - const lpPrice = LP_Data.find(i => i.lp_mint === 'CGrLpJH8LhrFMEk5hb1JtKyEYz3fuEGY6oYfip2Wztq8')?.lp_price || 0 - const stakedLP = await getTokenAccountBalance('BmDzZtmp6dvjoV6GyWcUGBsEPRhJGKaExiwXq2gyJVp9') - total += lpPrice * stakedLP - } - return { - 'tether': total - }; -} - -async function pool2() { - const LP_Data = await getLPData() - const lpPrice = LP_Data.find(i => i.lp_mint === 'CGrLpJH8LhrFMEk5hb1JtKyEYz3fuEGY6oYfip2Wztq8').lp_price - const stakedLP = await getTokenAccountBalance('BmDzZtmp6dvjoV6GyWcUGBsEPRhJGKaExiwXq2gyJVp9') - return { - 'tether': lpPrice * stakedLP - }; -} +const { sumTokens2 } = require('./helper/solana') async function staking() { - return { - 'solyard-finance': await getTokenAccountBalance('Gcdr3WtnnCW1SCDoLQNWXBtmt7xt4x9GEroz3zAfMWys') - }; + return sumTokens2({ tokenAccounts: ['Gcdr3WtnnCW1SCDoLQNWXBtmt7xt4x9GEroz3zAfMWys']}) } module.exports = { + // deadFrom: '2022-06-30', timetravel: false, solana: { - tvl, + tvl: () => ({}), staking, - pool2, + pool2: () => ({}), }, } diff --git a/projects/sun/index.js b/projects/sun/index.js index eed20debbd4c..78708be7cf83 100644 --- a/projects/sun/index.js +++ b/projects/sun/index.js @@ -74,26 +74,9 @@ const ownerTokens = pools.map(({ pool, stablecoins }) => { const stakingContract = "TXbA1feyCqWAfAQgXvN1ChTg82HpBT8QPb" const sun = ADDRESSES.tron.SUN -const lpToken = 'TDQaYrhQynYV9aXTYj63nwLAafRffWSEj6' -const oldLpStaking = "TGsymdggp98tLKZWGHcGX58TjTcaQr9s4x" -const lpStaking = "TAkrcKsS5FW9f3ZfzvWy6Zvsz9uEjUxPoV" - -/* async function pool2(api) { - const [lpTokenAmount, sunInLp, trxInLp, totalSupply] = await Promise.all([ - getTokenBalance(lpToken, lpStaking), - getTokenBalance(sun, lpToken), - getTrxBalance(lpToken), - call({ target: lpToken, abi: 'totalSupply()', resTypes: ['number'] }), - ]) - api.add(sun, sunInLp * lpTokenAmount / totalSupply) - api.add(nullAddress, trxInLp * lpTokenAmount / totalSupply) -} - */ - module.exports = { tron: { tvl: sumTokensExport({ ownerTokens }), staking: sumTokensExport({ owner: stakingContract, tokens: [sun] }), - // pool2 }, } diff --git a/projects/swim/config.js b/projects/swim/config.js deleted file mode 100644 index 68dc4e772396..000000000000 --- a/projects/swim/config.js +++ /dev/null @@ -1,122 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -module.exports = { - solana: { - tvl: { - pools: [ - { - pool: 'AfhhYsLMXXyDxQ1B7tNqLTXXDHYtDxCzPcnXWXzHAvDb', // Hexapool - tokens: [ - ADDRESSES.solana.USDC, // Solana-USDC - ADDRESSES.solana.USDT, // Solana-USDT - 'A9mUU4qviSctJVPJdBJWkb28deg915LYJKrzQ19ji3FM', // Eth-USDC - 'Dn4noZ5jgGfkntzcQSUZ8czkreiZ1ForXYoV2H8Dm7S1', // Eth-USDT - ADDRESSES.solana.BUSDbs, // Bsc-BUSD - ADDRESSES.solana.USDTbs, // Bsc-USDT - ], - symbols: [ - "usd-coin", - "tether", - "usd-coin", - "tether", - "binance-usd", - "tether", - ], - }, - { - pool: 'Ha7YEA5wRWyH2htfyMXw3VfLbtBHm4UoVXMpq8Ev6zJh', // Meta Avax-USDC - tokens: [ - 'FHfba3ov5P3RjaiLVgh8FTv4oirxQDoVXuoUUDvHuXax', // Avax-USDC - ], - symbols: [ - "usd-coin", - ], - }, - { - pool: 'EpvBni7vTfbTG95zf9sNcS9To1NEKnVMpCwZdb21tKsg', // Meta Avax-USDT - tokens: [ - 'Kz1csQA91WUGcQ2TB3o5kdGmWmMGp8eJcDEyHzNDVCX', // Avax-USDT - ], - symbols: [ - "tether", - ], - }, - { - pool: '2iLTifF3JDP65AjFKZ3t4mgfJdQVSmVCiM8Zca3TgvpU', // Meta Polygon-USDC - tokens: [ - 'E2VmbootbVCBkMNNxKQgCLMS1X3NoGMaYAsufaAsf7M', // Polygon-USDC - ], - symbols: [ - "usd-coin", - ], - }, - { - pool: '3uxBU3fRZzp3V7v9MTNZiDmjxDkKh3rZutLwFtnjJ2pQ', // Meta Polygon-USDT - tokens: [ - '5goWRao6a3yNC4d6UjMdQxonkCMvKBwdpubU3qhfcdf1', // Polygon-USDT - ], - symbols: [ - "tether", - ], - }, - { - pool: '57k3vNmCivSYn7EwQNjcNFcCWAdohZ9xACfMhJGwKiBq', // GSTBNB-GSTSOL - tokens: [ - 'GDuUFXEhUm4jG71vPxYRX3VxUMJ5etGvHTR1iKwTdb6p', // GSTBNB - 'AFbX8oGjGpmVFywbVouvhQSRmiW2aR1mohfahi4Y2AdB', // GSTSOL - ], - symbols: [ - "green-satoshi-token-bsc", - "green-satoshi-token", - ] - }, - { - pool: 'HZr3bF8YEJWMV75Wi3aFEHEyLLk61VyQduXtunWtXNVQ', // GMTBNB-GMTSOL - tokens: [ - '7dzFD8xQ3FDmVLxwn75UA9WhVnBsUdRAexASVvpXX3Bo', // GMTBNB - '7i5KKsX2weiTkry7jA4ZwSuXGhs5eJBEjY8vVxR4pfRx', // GMTSOL - ], - symbols: [ - "stepn", - "stepn", - ], - }, - { - pool: 'DqTF8aZu63iHF55tBz1ePuaBKJ3F2srNVha3B4PpCT4N', // Meta Aurora-USDC - tokens: [ - '9Y8pJhF8AQGBGL5PTd12P4w82n2qAADTmWakkXSatdAu', // Aurora-USDC - ], - symbols: [ - "usd-coin", - ], - }, - { - pool: '23CU3bqMJoRTpvyti84CmPbkAyNJDnTZE7DYj6MnhGdK', // Meta Aurora-USDT - tokens: [ - 'GFhej2oJ1NPLbzSX3D3B9jzYaidff6NoBAUNmu6dLXwU', // Aurora-USDT - ], - symbols: [ - "tether", - ], - }, - { - pool: 'H7BkMwbJfLiWE9sSDATHTqXykm1xBjeRzzLDatW2QdEt', // Meta Fantom-USDC - tokens: [ - 'Dnr8fDaswHtYMSKbtR9e8D5EadyxqyJwE98xp17ZxE2E', // Fantom-USDC - ], - symbols: [ - "usd-coin", - ], - }, - { - pool: '4XQz1qHMMTkFETn5PSNyLVutYPyZ4han8RB8Mmw1G48Q', // Meta Karura-USDT - tokens: [ - 'E942z7FnS7GpswTvF5Vggvo7cMTbvZojjLbFgsrDVff1', // Karura-USDT - ], - symbols: [ - "tether", - ], - }, - ], - } - }, - } \ No newline at end of file diff --git a/projects/swim/index.js b/projects/swim/index.js index de5fa972a0d3..f690659ecd83 100644 --- a/projects/swim/index.js +++ b/projects/swim/index.js @@ -1,26 +1,21 @@ -const { sumTokensUnknown, } = require("../helper/solana") -const config = require("./config") +const { sumTokens2, } = require("../helper/solana") -const tokensAndAccounts = []; - -Object.values(config).forEach((chain) => { - Object.values(chain).forEach((tvl) => { - Object.values(tvl).forEach((pools) => { - Object.values(pools).forEach((pool) => { - Object.values(pool.tokens).forEach((token, i) => { - tokensAndAccounts.push([ - token, - pool.pool, - pool.symbols[i], - ]) - }); - }) - }) - }) -}); +const owners = [ + 'AfhhYsLMXXyDxQ1B7tNqLTXXDHYtDxCzPcnXWXzHAvDb', // Hexapool + 'Ha7YEA5wRWyH2htfyMXw3VfLbtBHm4UoVXMpq8Ev6zJh', // Meta Avax-USDC + 'EpvBni7vTfbTG95zf9sNcS9To1NEKnVMpCwZdb21tKsg', // Meta Avax-USDT + '2iLTifF3JDP65AjFKZ3t4mgfJdQVSmVCiM8Zca3TgvpU', // Meta Polygon-USDC + '3uxBU3fRZzp3V7v9MTNZiDmjxDkKh3rZutLwFtnjJ2pQ', // Meta Polygon-USDT + '57k3vNmCivSYn7EwQNjcNFcCWAdohZ9xACfMhJGwKiBq', // GSTBNB-GSTSOL + 'HZr3bF8YEJWMV75Wi3aFEHEyLLk61VyQduXtunWtXNVQ', // GMTBNB-GMTSOL + 'DqTF8aZu63iHF55tBz1ePuaBKJ3F2srNVha3B4PpCT4N', // Meta Aurora-USDC + '23CU3bqMJoRTpvyti84CmPbkAyNJDnTZE7DYj6MnhGdK', // Meta Aurora-USDT + 'H7BkMwbJfLiWE9sSDATHTqXykm1xBjeRzzLDatW2QdEt', // Meta Fantom-USDC + '4XQz1qHMMTkFETn5PSNyLVutYPyZ4han8RB8Mmw1G48Q', // Meta Karura-USDT +] async function tvl() { - return sumTokensUnknown(tokensAndAccounts); + return sumTokens2({ owners, getAllTokenAccounts: true }); } module.exports = { From 38162d6d12072a43d97a5d9cbe0551f932da3095 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Fri, 19 Jul 2024 14:07:59 +0100 Subject: [PATCH 778/855] pendle v4 factory --- projects/pendle/v2.js | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/projects/pendle/v2.js b/projects/pendle/v2.js index c14c8069ae8d..beb4e471bb99 100644 --- a/projects/pendle/v2.js +++ b/projects/pendle/v2.js @@ -9,20 +9,26 @@ const config = { ethereum: { factory: "0x27b1dacd74688af24a64bd3c9c1b143118740784", factoryV3: "0x1A6fCc85557BC4fB7B534ed835a03EF056552D52", + factoryV4: '0x3d75Bd20C983edb5fD218A1b7e0024F1056c7A2F', fromBlock: 16032059, fromBlockV3: 18669498, + fromBlockV4: 20323253 }, arbitrum: { factory: "0xf5a7de2d276dbda3eef1b62a9e718eff4d29ddc8", factoryV3: "0x2FCb47B58350cD377f94d3821e7373Df60bD9Ced", + factoryV4: '0xd9f5e9589016da862D2aBcE980A5A5B99A94f3E8', fromBlock: 62979673, - fromBlockV3: 154873897 + fromBlockV3: 154873897, + fromBlockV4: 233004891 }, bsc: { factory: "0x2bEa6BfD8fbFF45aA2a893EB3B6d85D10EFcC70E", factoryV3: "0xC40fEbF5A33b8C92B187d9be0fD3fe0ac2E4B07c", + factoryV4: '0x7D20e644D2A9e149e5be9bE9aD2aB243a7835d37', fromBlock: 34060741, fromBlockV3: 33884419, + fromBlockV4: 40539593, pts: [ "0x5eC2ae0AFDEc891E7702344dc2A31C636B3627Eb", "0x70c1138B54ba212776d3A9d29b6160C54C31cd5d", @@ -32,19 +38,23 @@ const config = { optimism: { factory: "0x17F100fB4bE2707675c6439468d38249DD993d58", factoryV3: "0x4A2B38b9cBd83c86F261a4d64c243795D4d44aBC", + factoryV4: '0x73Be47237F12F36203823BAc9A4d80dC798B7015', fromBlock: 108061448, fromBlockV3: 112783590, + fromBlockV4: 122792017 }, mantle: { factoryV3: "0xD228EC1f7D4313fe321fab511A872475D07F5bA6", + factoryV4: '0xCa274A44a52241c1a8EFb9f84Bf492D8363929FC', fromBlockV3: 61484384, + fromBlockV4: 66526601 }, }; module.exports = {}; Object.keys(config).forEach((chain) => { - const { factory, factoryV3, fromBlock, pts, fromBlockV3 } = config[chain]; + const { factory, factoryV3, factoryV4, fromBlock, pts, fromBlockV3, fromBlockV4 } = config[chain]; module.exports[chain] = { tvl: async (api) => { const logs = factory @@ -75,7 +85,21 @@ Object.keys(config).forEach((chain) => { }) : []; - const pt = logs.map((i) => i.PT).concat(logsV3.map((i) => i.PT)); + const logsV4 = factoryV4 + ? await getLogs({ + api, + target: factoryV4, + topic: [ + "0xae811fae25e2770b6bd1dcb1475657e8c3a976f91d1ebf081271db08eef920af", + ], + eventAbi: + "event CreateNewMarket (address indexed market, address indexed PT, int256 scalarRoot, int256 initialAnchor, uint256 lnFeeRateRoot)", + onlyArgs: true, + fromBlock: fromBlockV4, + }) + : []; + + const pt = logs.map((i) => i.PT).concat(logsV3.map((i) => i.PT)).concat(logsV4.map((i) => i.PT)); if (pts) pt.push(...pts); let sy = [ ...new Set( From 41d2acbf98a446f03bf84451fa5088bdfff3a96a Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Fri, 19 Jul 2024 15:10:08 +0100 Subject: [PATCH 779/855] add mantle to curve --- projects/curve/contracts.json | 5 +++++ projects/curve/index.js | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/curve/contracts.json b/projects/curve/contracts.json index 212669dc4bd6..bdbd6ed78e65 100644 --- a/projects/curve/contracts.json +++ b/projects/curve/contracts.json @@ -171,5 +171,10 @@ "gasTokenDummy": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", "metapoolBases": {}, "CurveStableswapFactoryNG": "0xd7e72f3615aa65b92a4dbdc211e296a35512988b" + }, + "mantle": { + "gasTokenDummy": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + "metapoolBases": {}, + "CurveStableswapFactoryNG": "0x5eee3091f747e60a045a2e715a4c71e600e31f6e" } } \ No newline at end of file diff --git a/projects/curve/index.js b/projects/curve/index.js index a1ca3c7a6efa..c53dc8ecc744 100644 --- a/projects/curve/index.js +++ b/projects/curve/index.js @@ -25,7 +25,8 @@ const chains = [ "base", "fraxtal", "xlayer", - "bsc" + "bsc", + "mantle" ]; // Object.keys(contracts); const registryIds = { stableswap: 0, From 3f237f0cea59347f8cbabcc943f976c3a364f9c9 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 19 Jul 2024 17:36:00 +0300 Subject: [PATCH 780/855] fix atrix --- projects/atrix.js | 282 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 278 insertions(+), 4 deletions(-) diff --git a/projects/atrix.js b/projects/atrix.js index 6c17bf09f6b1..b8839065c3b1 100644 --- a/projects/atrix.js +++ b/projects/atrix.js @@ -1,9 +1,30 @@ -const { sumTokens2 } = require('./helper/solana') -const { getConfig } = require('./helper/cache') +const { sumTokens2, getConnection , getProvider} = require('./helper/solana') +// const { getConfig } = require('./helper/cache') +// const { PublicKey, } = require("@solana/web3.js"); +// const { TokenAmountLayout, } = require("./helper/utils/solana/layouts/raydium-layout"); +// const { Program } = require('@project-serum/anchor'); async function tvl() { - const { pools } = await getConfig('atrix-v1', 'https://api.atrix.finance/api/all') - return sumTokens2({ tokenAccounts: pools.map(({ marketData: { coinVault, pcVault } }) => [coinVault, pcVault]).flat() }) + // previously we were incorrectly counting all tokens in serum pools as atrix tvl + return sumTokens2({ owner: '3uTzTX5GBSfbW7eM9R9k95H7Txe32Qw3Z25MtyD2dzwC', getAllTokenAccounts: true, }) +/* const connection = getConnection() + const provider = getProvider() + const program = new Program(idl, 'HvwYjjzPbXWpykgVZhqvvfeeaSraQVnTiQibofaFw9M7', provider) + + const acc = await program.account.poolAccount.all() + const tokenAccounts = acc.map(({ account:i}) => [i.poolCoinAccount, i.poolPcAccount, ]).flat() + + console.log(tokenAccounts, tokenAccounts.length) + return sumTokens2({ tokenAccounts }) + return {} + const auth = 'CmiPgGfWeteicRisWRuJzn7L649zWpw9Qya8g3ey9cZt' + + 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') + return {} */ + } module.exports = { @@ -14,3 +35,256 @@ module.exports = { [1667865600, "FTX collapse"] ], } +/* +const idl = { + "version": "0.0.0", + "name": "atrix", + "instructions": [], + "accounts": [ + { + "name": "ProtocolAccount", + "type": { + "kind": "struct", + "fields": [ + { + "name": "authority", + "type": "publicKey" + }, + { + "name": "bump", + "type": "u8" + }, + { + "name": "lpFeeNumerator", + "type": "u16" + }, + { + "name": "protocolFeeNumerator", + "type": "u16" + }, + { + "name": "feeDenominator", + "type": "u16" + }, + { + "name": "maxCancelPerIx", + "type": "u8" + }, + { + "name": "maxPlacePerIx", + "type": "u8" + }, + { + "name": "maxPlacePostLiq", + "type": "u8" + }, + { + "name": "orderProportionNumerators", + "type": { + "array": [ + "u16", + 12 + ] + } + }, + { + "name": "orderProportionLen", + "type": "u8" + }, + { + "name": "orderProportionDenominator", + "type": "u16" + }, + { + "name": "crankSolAccount", + "type": "publicKey" + }, + { + "name": "poolInitCrankFee", + "type": "u64" + }, + { + "name": "solBond", + "type": "u64" + } + ] + } + }, + { + "name": "PoolAccount", + "type": { + "kind": "struct", + "fields": [ + { + "name": "coinMint", + "type": "publicKey" + }, + { + "name": "pcMint", + "type": "publicKey" + }, + { + "name": "market", + "type": "publicKey" + }, + { + "name": "openOrders", + "type": "publicKey" + }, + { + "name": "poolCoinAccount", + "type": "publicKey" + }, + { + "name": "poolPcAccount", + "type": "publicKey" + }, + { + "name": "poolLpAccount", + "type": "publicKey" + }, + { + "name": "lpMint", + "type": "publicKey" + }, + { + "name": "firstPlaced", + "type": "bool" + }, + { + "name": "orderIndex", + "type": "u8" + }, + { + "name": "lpFee", + "type": "u64" + }, + { + "name": "stableFee", + "type": "u64" + }, + { + "name": "ixi", + "type": "u8" + }, + { + "name": "icx", + "type": "u8" + }, + { + "name": "clientOrderId", + "type": "u64" + }, + { + "name": "orderProportionNumerators", + "type": { + "array": [ + "u16", + 12 + ] + } + }, + { + "name": "poolType", + "type": "u8" + }, + { + "name": "stableswapAmpCoef", + "type": "u64" + }, + { + "name": "coinDecimals", + "type": "u8" + }, + { + "name": "pcDecimals", + "type": "u8" + }, + { + "name": "lastAskCoin", + "type": "u64" + }, + { + "name": "lastAskPc", + "type": "u64" + }, + { + "name": "lastBidCoin", + "type": "u64" + }, + { + "name": "lastBidPc", + "type": "u64" + }, + { + "name": "version", + "type": "u64" + }, + { + "name": "placedAsks", + "type": { + "array": [ + { + "defined": "PlacedOrder" + }, + 12 + ] + } + }, + { + "name": "placedBids", + "type": { + "array": [ + { + "defined": "PlacedOrder" + }, + 12 + ] + } + }, + { + "name": "pca", + "type": "u64" + }, + { + "name": "ppca", + "type": "u64" + }, + { + "name": "mmActive", + "type": "bool" + } + ] + } + } + ], + "types": [ + { + "name": "PlacedOrder", + "type": { + "kind": "struct", + "fields": [ + { + "name": "limitPrice", + "type": "u64" + }, + { + "name": "coinQty", + "type": "u64" + }, + { + "name": "maxNativePcQtyIncludingFees", + "type": "u64" + }, + { + "name": "clientOrderId", + "type": "u64" + } + ] + } + } + ], + "events": [], + "errors": [] +} + */ From 67763531e5988a86ce59667c4b9c932b152f7e53 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 19 Jul 2024 18:30:01 +0300 Subject: [PATCH 781/855] refactor sol adapters --- projects/DropCopy/index.js | 3 +- projects/apricot.js | 2 +- projects/atrix.js | 2 +- projects/cropper.js | 2 +- projects/drift.js | 44 ++--------- projects/flashtrade/index.js | 2 +- projects/goblingold.js | 11 +-- projects/helper/solana.js | 3 +- projects/helper/treasury.js | 1 - projects/invariant/index.js | 2 +- projects/invictus/index.js | 2 +- projects/jupiter-perpetual.js | 12 +-- projects/larix.js | 6 +- projects/oxygen/index.js | 2 +- projects/portfinance/index.js | 2 +- projects/swim/index.js | 2 +- projects/synthetify/index.js | 9 +-- projects/whales-market/index.js | 130 ++++++++++++++++---------------- 18 files changed, 92 insertions(+), 145 deletions(-) diff --git a/projects/DropCopy/index.js b/projects/DropCopy/index.js index a3cd4ba31e73..60407395971f 100644 --- a/projects/DropCopy/index.js +++ b/projects/DropCopy/index.js @@ -2,10 +2,9 @@ const { sumTokens2 } = require('../helper/solana') const DROP = 'DropTpWcDmP7kVRUEoKSJaMVi62hGo9jp19Hz19JVsjh'; const PARIMUTUEL_WALLET = 'DCa1Xir4zDEtz78beFcXCHUNXdeBnrxBiRuuapHrBE3F'; -const PARIMUTUEL_ACCOUNT = 'mD62sAqPAiVbHGPTTeEianTYa1AytkKqqcxMvQxF3S3'; async function tvl() { - return sumTokens2({ owner: PARIMUTUEL_WALLET, getAllTokenAccounts: true, solOwners: [PARIMUTUEL_WALLET], blacklistedTokens: [DROP]}) + return sumTokens2({ owner: PARIMUTUEL_WALLET, solOwners: [PARIMUTUEL_WALLET], blacklistedTokens: [DROP]}) } module.exports = { diff --git a/projects/apricot.js b/projects/apricot.js index 3ad79d4ae27c..3a17583fde63 100644 --- a/projects/apricot.js +++ b/projects/apricot.js @@ -2,7 +2,7 @@ const { sumTokens2 } = require('./helper/solana') async function tvl() { const owner = '7Ne6h2w3LpTNTa7CNYcUs7UkjeJT3oW7jcrXWfVScTXW' - return sumTokens2({ owner, getAllTokenAccounts: true }) + return sumTokens2({ owner }) } module.exports = { diff --git a/projects/atrix.js b/projects/atrix.js index b8839065c3b1..b1a9202997ad 100644 --- a/projects/atrix.js +++ b/projects/atrix.js @@ -6,7 +6,7 @@ const { sumTokens2, getConnection , getProvider} = require('./helper/solana') async function tvl() { // previously we were incorrectly counting all tokens in serum pools as atrix tvl - return sumTokens2({ owner: '3uTzTX5GBSfbW7eM9R9k95H7Txe32Qw3Z25MtyD2dzwC', getAllTokenAccounts: true, }) + return sumTokens2({ owner: '3uTzTX5GBSfbW7eM9R9k95H7Txe32Qw3Z25MtyD2dzwC', }) /* const connection = getConnection() const provider = getProvider() const program = new Program(idl, 'HvwYjjzPbXWpykgVZhqvvfeeaSraQVnTiQibofaFw9M7', provider) diff --git a/projects/cropper.js b/projects/cropper.js index 331bd193cd9e..7f4295d4ebec 100644 --- a/projects/cropper.js +++ b/projects/cropper.js @@ -3,7 +3,7 @@ const { PublicKey } = require('@solana/web3.js') const DEX_PROGRAM_ID = 'CTMAxxk34HjKWxQ3QLZK1HpaLXmBveao3ESePXbiyfzh' async function fetchStaking() { - return sumTokens2({ owners: ['5mEH7a7abQwUEXqfusVepc3z9cHVQg8uhqTXdq47J91o'], getAllTokenAccounts: true }); + return sumTokens2({ owners: ['5mEH7a7abQwUEXqfusVepc3z9cHVQg8uhqTXdq47J91o'] }); } async function getTokenAccounts() { diff --git a/projects/drift.js b/projects/drift.js index 1f560432316b..702364a68c16 100644 --- a/projects/drift.js +++ b/projects/drift.js @@ -1,8 +1,4 @@ -const { PublicKey } = require("@solana/web3.js"); -const anchor = require("@project-serum/anchor"); const { sumTokens2, } = require("./helper/solana"); -const DRIFT_PROGRAM_ID = new PublicKey('dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH') -const { getConfig } = require('./helper/cache') module.exports = { timetravel: false, @@ -12,37 +8,11 @@ module.exports = { }, }; -async function tvl(api) { - - const legacyVaults = [ - '6W9yiHDCW9EpropkFV8R3rPiL8LVWUHSiys3YeW6AT6S', // legacy usdc vault - 'Bzjkrm1bFwVXUaV9HTnwxFrPtNso7dnwPQamhqSxtuhZ', // legacy usdc insurance fund - ]; - const getSpotMarketVaultPublicKey = marketIndex => getVaultPublicKey('spot_market_vault', marketIndex) - const getInsuranceFundVaultPublicKey = marketIndex => getVaultPublicKey('insurance_fund_vault', marketIndex) - let configFile = await getConfig('drift-config', 'https://raw.githubusercontent.com/drift-labs/protocol-v2/master/sdk/src/constants/spotMarkets.ts') - const marketIndices = []; - configFile = configFile.slice(configFile.indexOf('MainnetSpotMarkets:')) - - const regex = /marketIndex:\s*(\d+),/g - let match; - while ((match = regex.exec(configFile))) { - marketIndices.push(parseInt(match[1])); - } - - const vaults = [ - ...legacyVaults, - ...marketIndices.map(getSpotMarketVaultPublicKey), - ...marketIndices.map(getInsuranceFundVaultPublicKey), - ] - - return sumTokens2({ tokenAccounts: vaults }) -} - -function getVaultPublicKey(seed, marketIndex) { - return PublicKey.findProgramAddressSync( - [ - Buffer.from(anchor.utils.bytes.utf8.encode(seed)), - new anchor.BN(marketIndex).toArrayLike(Buffer, 'le', 2), - ], DRIFT_PROGRAM_ID)[0].toBase58() +async function tvl() { + return sumTokens2({ + owners: [ + 'CU4eFxpyCGNDEXN27Jonn7RfgwBt3cnp7TcTrJF6EW9Q', // legacy + 'JCNCMFXo5M5qwUPg2Utu1u6YWp3MbygxqBsBeXXJfrw', // Drift vault + ], + }) } diff --git a/projects/flashtrade/index.js b/projects/flashtrade/index.js index 84b4135accb5..943832c20b3e 100644 --- a/projects/flashtrade/index.js +++ b/projects/flashtrade/index.js @@ -1,7 +1,7 @@ const { sumTokens2 } = require("../helper/solana"); async function tvl() { - return sumTokens2({ owner: '81xGAvJ27ZeRThU2JEfKAUeT4Fx6qCCd8WHZpujZbiiG', getAllTokenAccounts: true, }); + return sumTokens2({ owner: '81xGAvJ27ZeRThU2JEfKAUeT4Fx6qCCd8WHZpujZbiiG', }); } module.exports = { diff --git a/projects/goblingold.js b/projects/goblingold.js index c08b15095687..09d5b1905a10 100644 --- a/projects/goblingold.js +++ b/projects/goblingold.js @@ -1,5 +1,4 @@ -const { getProvider, transformBalances, } = require('./helper/solana') -const sdk = require('@defillama/sdk') +const { getProvider, } = require('./helper/solana') const { Program, } = require("@project-serum/anchor"); const vaults = { "BTC": "FvqYV2Cg7s7iWKUBTWkyybKuz1m85ny6ijDqDXEXVyNv", @@ -17,16 +16,14 @@ const vaults = { "stSOL": "47hnvWxWo4PpPNqPF78cJ4abjpT45qY9of8hokeLzEUX" } -async function tvl() { +async function tvl(api) { + const provider = getProvider() const programId = 'GGo1dnYpjKfe9omzUaFtaCyizvwpAMf3NhxSCMD61F3A' const idl = await Program.fetchIdl(programId, provider) const program = new Program(idl, programId, provider) const data = await program.account.vaultAccount.fetchMultiple(Object.values(vaults)) - const tokenBalances = {} - data.forEach((i, idx) => - sdk.util.sumSingleBalance(tokenBalances, i.inputMintPubkey.toString(), +i.currentTvl)) - return transformBalances({ tokenBalances }) + data.forEach(i => api.add(i.inputMintPubkey.toString(), i.currentTvl)) } module.exports = { diff --git a/projects/helper/solana.js b/projects/helper/solana.js index 931bdd3a838d..5ca74e49f2bb 100644 --- a/projects/helper/solana.js +++ b/projects/helper/solana.js @@ -225,14 +225,13 @@ async function sumTokens2({ solOwners = [], blacklistedTokens = [], allowError = false, - getAllTokenAccounts = false, }) { blacklistedTokens.push(...blacklistedTokens_default) if (!tokensAndOwners.length) { if (owner) tokensAndOwners = tokens.map(t => [t, owner]) if (owners.length) tokensAndOwners = tokens.map(t => owners.map(o => [t, o])).flat() } - if (!tokensAndOwners.length && !tokens.length && (owner || owners.length > 0) && getAllTokenAccounts) { + if (!tokensAndOwners.length && !tokens.length && (owner || owners.length > 0)) { const _owners = getUniqueAddresses([...owners, owner].filter(i => i), 'solana') for (const _owner of _owners) { const data = await getOwnerAllAccount(_owner) diff --git a/projects/helper/treasury.js b/projects/helper/treasury.js index 34b066260551..c5e88e809488 100644 --- a/projects/helper/treasury.js +++ b/projects/helper/treasury.js @@ -13,7 +13,6 @@ function treasuryExports(config) { const tvlConfig = { permitFailure: true, ...config[chain], } if (chain === 'solana') { tvlConfig.solOwners = owners - tvlConfig.getAllTokenAccounts = true } else if (config[chain].fetchCoValentTokens !== false) { if (ankrChainMapping[chain]) { tvlConfig.fetchCoValentTokens = true diff --git a/projects/invariant/index.js b/projects/invariant/index.js index a79b24064a0f..0098e4a90e37 100644 --- a/projects/invariant/index.js +++ b/projects/invariant/index.js @@ -1,7 +1,7 @@ const { sumTokens2 } = require('../helper/solana') async function tvl() { - return sumTokens2({ owner: 'J4uBbeoWpZE8fH58PM1Fp9n9K6f1aThyeVCyRdJbaXqt', getAllTokenAccounts: true }) + return sumTokens2({ owner: 'J4uBbeoWpZE8fH58PM1Fp9n9K6f1aThyeVCyRdJbaXqt' }) } module.exports = { diff --git a/projects/invictus/index.js b/projects/invictus/index.js index 7f4ec2f9ab9f..0d3107254104 100644 --- a/projects/invictus/index.js +++ b/projects/invictus/index.js @@ -6,7 +6,7 @@ async function staking() { const treasury = "6qfyGvoUqGB6AQ7xLc4pVwFNdgJSbAMkTtKkBXhLRiV1" async function tvl() { - return sumTokens2({ owner: treasury, getAllTokenAccounts: true }) + return sumTokens2({ owner: treasury }) } diff --git a/projects/jupiter-perpetual.js b/projects/jupiter-perpetual.js index 04278ef2bf27..c71cc67a068a 100644 --- a/projects/jupiter-perpetual.js +++ b/projects/jupiter-perpetual.js @@ -11,14 +11,6 @@ module.exports = { }, }; -async function tvl(api) { - const vaults = [ - "BUvduFTd2sWFagCunBPLupG8fBTJqweLw9DuhruNFSCm", // SOL - "WzWUoCmtVv7eqAbU3BfKPU3fhLP6CXR8NCJH78UK9VS", // USDC - "Gex24YznvguMad1mBzTQ7a64U1CJy59gvsStQmNnnwAd", // USDT - "Bgarxg65CEjN3kosjCW5Du3wEqvV3dpCGDR3a2HRQsYJ", // ETH - "FgpXg2J3TzSs7w3WGYYE7aWePdrxBVLCXSxmAKnCZNtZ", // BTC - ]; - - return sumTokens2({ tokenAccounts: vaults }); +async function tvl() { + return sumTokens2({ owner: 'AVzP2GeRmqGphJsMxWoqjpUifPpCret7LqWhD8NWQK49' }); } diff --git a/projects/larix.js b/projects/larix.js index 20f5e80b60da..631afc5ea559 100644 --- a/projects/larix.js +++ b/projects/larix.js @@ -1,4 +1,4 @@ -const { getConnection, sumTokens2, decodeAccount, } = require("./helper/solana"); +const { getConnection, decodeAccount, } = require("./helper/solana"); const { PublicKey, } = require("@solana/web3.js"); const sdk = require('@defillama/sdk'); let programs = { @@ -34,11 +34,11 @@ async function getAllData() { } const tokenAccounts = [] - data.forEach(({ liquidity: { mintPubkey, borrowedAmountWads, supplyPubkey } }) => { + data.forEach(({ liquidity: { mintPubkey, borrowedAmountWads, supplyPubkey, availableAmount, } }) => { tokenAccounts.push(supplyPubkey) + sdk.util.sumSingleBalance(balances.tvl, mintPubkey.toString(), availableAmount, 'solana') sdk.util.sumSingleBalance(balances.borrowed, mintPubkey.toString(), borrowedAmountWads / 1e18, 'solana') }) - balances.tvl = await sumTokens2({ tokenAccounts }) return balances } } diff --git a/projects/oxygen/index.js b/projects/oxygen/index.js index c0552ea7c795..01981a1a8057 100644 --- a/projects/oxygen/index.js +++ b/projects/oxygen/index.js @@ -2,7 +2,7 @@ const { sumTokens2 } = require('../helper/solana') async function tvl(api) { - return sumTokens2({ owner: '4ncyWnbG22vqEmyxTfBsEdbNuQhBphaasg5q5YgoiPgq', getAllTokenAccounts: true}) + return sumTokens2({ owner: '4ncyWnbG22vqEmyxTfBsEdbNuQhBphaasg5q5YgoiPgq'}) } module.exports = { diff --git a/projects/portfinance/index.js b/projects/portfinance/index.js index ce741e678695..f3819fc9274e 100644 --- a/projects/portfinance/index.js +++ b/projects/portfinance/index.js @@ -6,7 +6,7 @@ async function tvl() { '8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ', // Main Pool 'GU1nCjN7mcLiSX1dtBw2t9agYCw3ybXfu1me41Q2tGT3', // Hubble Innovation Zone 'Hy6gCkJyMmWMaoxLyzELRReLzdBdZ1YEjNGjQzF9LDPa', // UXD Innovation Zone - ], getAllTokenAccounts: true, }) + ], }) } module.exports = { diff --git a/projects/swim/index.js b/projects/swim/index.js index f690659ecd83..0cce916e1bdf 100644 --- a/projects/swim/index.js +++ b/projects/swim/index.js @@ -15,7 +15,7 @@ const owners = [ ] async function tvl() { - return sumTokens2({ owners, getAllTokenAccounts: true }); + return sumTokens2({ owners }); } module.exports = { diff --git a/projects/synthetify/index.js b/projects/synthetify/index.js index 79bb4c22d9d7..795e3329dc15 100644 --- a/projects/synthetify/index.js +++ b/projects/synthetify/index.js @@ -7,16 +7,9 @@ async function tvl() { const provider = getProvider() const idl = await Program.fetchIdl(programId, provider) const program = new Program(idl, programId, provider) - const assetsList = await program.account.assetsList.all() const state = await program.account.state.all() const owners = state.map(i => i.account.exchangeAuthority.toString()) - const tokens = [] - assetsList.forEach(list => { - const { headCollaterals, collaterals } = list.account - for (let i = 0; i < headCollaterals; i++) - tokens.push(collaterals[i].collateralAddress.toString()) - }) - return sumTokens2({ tokens, owners, }) + return sumTokens2({ owners, }) } module.exports = { diff --git a/projects/whales-market/index.js b/projects/whales-market/index.js index 3b1fe2e2a37e..ac9413b92f35 100644 --- a/projects/whales-market/index.js +++ b/projects/whales-market/index.js @@ -1,76 +1,74 @@ const ADDRESSES = require('../helper/coreAssets.json'); -const { sumTokens2 } = require("../helper/solana"); -const { sumTokensExport } = require('../helper/sumTokens') +const { sumTokens2 } = require("../helper/solana"); +const { sumTokensExport } = require('../helper/sumTokens') const insuranceConfig = { - ethereum: { - owner: '0x1eCdB32e59e948C010a189a0798C674a2d0c6603', - tokens: [ADDRESSES.null, ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.USDC], - }, - arbitrum: { - owner: '0x7a560269480ef38b885526c8bbecdc4686d8bf7a', - tokens: [ADDRESSES.null,ADDRESSES.arbitrum.USDC], - }, - merlin: { - owner: '0x7a560269480ef38b885526c8bbecdc4686d8bf7a', - tokens: [ADDRESSES.null], - }, - manta: { - owner: '0x7a560269480Ef38B885526C8bBecdc4686d8bF7A', - tokens: [ADDRESSES.null], - }, - starknet: { - owner: '0x04427a62f43314c0f1b171358235c04598dbc702c61a891fa1fb0cc52936cfff', - tokens: [ADDRESSES.starknet.ETH, ADDRESSES.starknet.USDC, ADDRESSES.starknet.USDT], - }, - blast: { - owner: '0x7a560269480Ef38B885526C8bBecdc4686d8bF7A', - tokens: [ADDRESSES.null], - }, - base: { - owner: '0xdf02eeaB3CdF6eFE6B7cf2EB3a354dCA92A23092', - tokens: [ADDRESSES.null], - }, - bsc: { - owner: '0x7a560269480Ef38B885526C8bBecdc4686d8bF7A', - tokens: [ADDRESSES.null], - }, - linea: { - owner: '0x7a560269480Ef38B885526C8bBecdc4686d8bF7A', - tokens: [ADDRESSES.null], - }, - mode: { - owner: '0x7a560269480Ef38B885526C8bBecdc4686d8bF7A', - tokens: [ADDRESSES.null], - }, - solana: { - owner: 'GDsMbTq82sYcxPRLdQ9RHL9ZLY3HNVpXjXtCnyxpb2rQ', - tokens: [ - ADDRESSES.solana.USDC, - ADDRESSES.solana.SOL, - ADDRESSES.solana.USDT, - 'J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn'// jito SOL - ], - }, - + ethereum: { + owner: '0x1eCdB32e59e948C010a189a0798C674a2d0c6603', + tokens: [ADDRESSES.null, ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.USDC], + }, + arbitrum: { + owner: '0x7a560269480ef38b885526c8bbecdc4686d8bf7a', + tokens: [ADDRESSES.null, ADDRESSES.arbitrum.USDC], + }, + merlin: { + owner: '0x7a560269480ef38b885526c8bbecdc4686d8bf7a', + tokens: [ADDRESSES.null], + }, + manta: { + owner: '0x7a560269480Ef38B885526C8bBecdc4686d8bF7A', + tokens: [ADDRESSES.null], + }, + starknet: { + owner: '0x04427a62f43314c0f1b171358235c04598dbc702c61a891fa1fb0cc52936cfff', + tokens: [ADDRESSES.starknet.ETH, ADDRESSES.starknet.USDC, ADDRESSES.starknet.USDT], + }, + blast: { + owner: '0x7a560269480Ef38B885526C8bBecdc4686d8bF7A', + tokens: [ADDRESSES.null], + }, + base: { + owner: '0xdf02eeaB3CdF6eFE6B7cf2EB3a354dCA92A23092', + tokens: [ADDRESSES.null], + }, + bsc: { + owner: '0x7a560269480Ef38B885526C8bBecdc4686d8bF7A', + tokens: [ADDRESSES.null], + }, + linea: { + owner: '0x7a560269480Ef38B885526C8bBecdc4686d8bF7A', + tokens: [ADDRESSES.null], + }, + mode: { + owner: '0x7a560269480Ef38B885526C8bBecdc4686d8bF7A', + tokens: [ADDRESSES.null], + }, + solana: { + owner: 'GDsMbTq82sYcxPRLdQ9RHL9ZLY3HNVpXjXtCnyxpb2rQ', + tokens: [ + ADDRESSES.solana.USDC, + ADDRESSES.solana.SOL, + ADDRESSES.solana.USDT, + 'J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn'// jito SOL + ], + }, + } async function tvl() { - return sumTokens2({ owner: insuranceConfig.solana.owner, tokens: - insuranceConfig.solana.tokens - }); + return sumTokens2({ owner: insuranceConfig.solana.owner }); } module.exports = { - ethereum: { tvl: sumTokensExport(insuranceConfig.ethereum)}, - arbitrum: { tvl: sumTokensExport(insuranceConfig.arbitrum)}, - merlin: { tvl: sumTokensExport(insuranceConfig.merlin)}, - manta: { tvl: sumTokensExport(insuranceConfig.manta)}, - blast: { tvl: sumTokensExport(insuranceConfig.blast) }, - base: { tvl: sumTokensExport(insuranceConfig.base) }, - bsc: { tvl: sumTokensExport(insuranceConfig.bsc) }, - linea: { tvl: sumTokensExport(insuranceConfig.linea) }, - mode: { tvl: sumTokensExport(insuranceConfig.mode) }, - solana: { tvl }, - starknet: { tvl: sumTokensExport(insuranceConfig.starknet)}, + ethereum: { tvl: sumTokensExport(insuranceConfig.ethereum) }, + arbitrum: { tvl: sumTokensExport(insuranceConfig.arbitrum) }, + merlin: { tvl: sumTokensExport(insuranceConfig.merlin) }, + manta: { tvl: sumTokensExport(insuranceConfig.manta) }, + blast: { tvl: sumTokensExport(insuranceConfig.blast) }, + base: { tvl: sumTokensExport(insuranceConfig.base) }, + bsc: { tvl: sumTokensExport(insuranceConfig.bsc) }, + linea: { tvl: sumTokensExport(insuranceConfig.linea) }, + mode: { tvl: sumTokensExport(insuranceConfig.mode) }, + solana: { tvl }, + starknet: { tvl: sumTokensExport(insuranceConfig.starknet) }, }; From 6fcdfdc5f6c55458651bb410db15cf367ba04c55 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 19 Jul 2024 18:30:29 +0300 Subject: [PATCH 782/855] fix limitless query --- projects/limitless/index.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/projects/limitless/index.js b/projects/limitless/index.js index 6eb7584beb92..a0edc079acc5 100644 --- a/projects/limitless/index.js +++ b/projects/limitless/index.js @@ -9,8 +9,13 @@ const config = { linea: { postionManager: '0x726e3116AE07f43A7E1921c635352B75e2DEa4Ad', factory: '0x31FAfd4889FA1269F7a13A66eE0fB458f27D72A9', limWETH: '0x5188b47Cb80D1A3E22Cc6221792F199f1Fb0DD3c', }, } const liquidityProvidedQuery = ` -query { - liquidityProvideds(first:1000 orderBy: blockTimestamp orderDirection: desc) { +query($lastId: String, $block: Int) { + liquidityProvideds( + first:1000 + block: { number: $block } + where: { id_gt: $lastId } + ) { + id pool recipient liquidity @@ -22,8 +27,13 @@ query { ` const liquidityWithdrawnQuery = ` -query { - liquidityWithdrawns(first:1000 orderBy: blockTimestamp orderDirection: desc) { +query($lastId: String, $block: Int) { + liquidityWithdrawns( + first:1000 + block: { number: $block } + where: { id_gt: $lastId } + ) { + id pool recipient liquidity From a80d41a684bf65b2e39af364788b111fa1b0b669 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Fri, 19 Jul 2024 20:06:59 +0100 Subject: [PATCH 783/855] pro-bit adapter (#11050) --- projects/probit/index.js | 61 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 projects/probit/index.js diff --git a/projects/probit/index.js b/projects/probit/index.js new file mode 100644 index 000000000000..7777210d33cd --- /dev/null +++ b/projects/probit/index.js @@ -0,0 +1,61 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x72e5263ff33d2494692d7f94a758aa9f82062f73", + "0xaD285fDEDFC0D5f944A33e478356524293c7eC68", + "0xf71afe21cd32959113fc47ae2ef886b43a9413d5" + ], + }, + bsc: { + owners: [ + "0xd6a4452eebde830888cee4a395126831ab16250c", + "0xf4be044ba7461d8444ed53f9ec7490781e08e3b7", + "0x898fce2414a1347c0e12bde6b28b75843fd9bbad" + ], + }, + bitcoin: { + owners: [ + "19EgVpboqNjortWyhJSDAGRvHDtduqiSfr", + "19AtrEvJv7UY75tvWkXMxLUAYibxpZhFfN", + "17PpCEuQUT7xxP1ocfhvFdwQyrB5dG1dQP" + ], + }, + fantom: { + owners: [ + "0xc78600a92caf0fcf6990e7ea7381bf4297054f86", + "0x06ffd89a07b078d4a1a1d9947a28e95825f9c35c", + "0x813e711993fc8ec29e9e45fb3a7e47f8c33ca64f" + ], + }, + polygon: { + owners: [ + "0xfaef9cc9bf46c386c58a3e86ffffbf77969ca149", + "0x29b6e9abf51fc7d4581f6cbd1a9d5392fa7fa78f", + "0xdba24f19bce0f32ea4273faea7c01d7f9d4f91d6" + ], + }, + tron: { + owners: [ + "TPkn5zpxXr8jaNqvgVoFanTsvXCbNXJ8GB", + "TGEwJxVErWagXnriZATPMBFFbbeuad9m3h", + "TYiFSQG4dfdWh8RWETsvJn4fvXdZ8bEL7t" + ], + }, + ripple: { + owners: [ + "rwXEHNNuf3nctzXLtvL5JnQJGMyUZYGrVc", + "rsA9ijHjo7hAkitc9GsXsiwXzqGs7eoeqr", + "rEa9cAYavjfxvmdJExr1PMGxoPYzAUZXGb" + ], + }, + solana: { + owners: [ + "BX145kKanqBmeud72ir44iMFVAfaak4y933rgbMc2H52", + "FavWP1KXVVNZLTYjfSBWPanxbVeCW4A3pJ96hn2GRWGR", + ], + }, +} + +module.exports = cexExports(config) From 1b76447441a1506e0d194642eb03f1277bcb527a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 19 Jul 2024 23:59:31 +0300 Subject: [PATCH 784/855] update fyde (#11046) --- projects/fyde/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/fyde/index.js b/projects/fyde/index.js index c099c960cd7a..ca92d3c59305 100644 --- a/projects/fyde/index.js +++ b/projects/fyde/index.js @@ -1,6 +1,8 @@ const ADDRESSES = require('../helper/coreAssets.json') + const FYDE_CONTRACT = "0x87Cc45fFF5c0933bb6aF6bAe7Fc013b7eC7df2Ee"; const RESTAKING_AGGREGATOR = "0x3f69F62e25441Cf72E362508f4d6711d53B05341"; +const DEPOSIT_ESCROW = "0x63ec950633Eb85797477166084AD0a7121910470"; const ORACLE = "0x05198327206123E89c24ABd9A482316449bD2aEe" const WETH = ADDRESSES.ethereum.WETH; @@ -33,10 +35,14 @@ async function tvl(api) { } else api.add(tokens[i], bals[i]) } + + // add assets in the deposit escrow + const tokensEscrow = await api.fetchList({ lengthAbi: 'getAssetListLength', itemAbi: 'assetList', target: DEPOSIT_ESCROW }) + return api.sumTokens({ tokens: tokensEscrow, owner: DEPOSIT_ESCROW }) } module.exports = { - methodology: 'Read out balances from internal accounting for each asset in Fyde in the YieldModule. Add ETH staked in LRT Aggregator.', + methodology: 'Read out balances from internal accounting for each asset in Fyde, the YieldModule and the DepositEscrow. Add ETH staked in LRT Aggregator.', ethereum: { tvl } From fe5409df1e9d9ea7bf0a4bb4c1c7ce74076531a3 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 20 Jul 2024 00:22:07 +0300 Subject: [PATCH 785/855] Add Shezmu (#11049) --- projects/shezmu/index.js | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 projects/shezmu/index.js diff --git a/projects/shezmu/index.js b/projects/shezmu/index.js new file mode 100644 index 000000000000..fbf30f43a06d --- /dev/null +++ b/projects/shezmu/index.js @@ -0,0 +1,42 @@ +const { staking } = require('../helper/staking') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const SHEZ = "0x5fE72ed557d8a02FFf49B3B826792c765d5cE162" +const SHEZ_ETH_LP = "0x74E6cAc32234133Fe06bD0f4D8237dEe1dedE057" + +// erc20 vaults +const vaults = [ + "0xF89127a7839Ae1918e742A99E39182adec9C7e48", // USDC_SHEZUSD_VAULT + "0xd116641185B1BD999b92B513657C95f78C8ae872", // wstETH_SHEZUSD_VAULT + "0x092dBbFCb19D1763798CD46bA1635Eaf3C9BA1cD", // wstETH_SHEZETH_VAULT + "0x5439046DC57EdE3Ff6aBA8563108326AdDE9C33b", // weETH_SHEZUSD_VAULT + "0x7648cff49EBa2631Ea4Ae8013Dc6Eb54C1c783f2", // weETH_SHEZETH_VAULT + "0x4DBBDF30BC801a65f6978ab629EAd5267Ac02497", // sUSDe_SHEZETH_VAULT + "0x8A8355317936Ef99E4515567b1c9CC8B86e52a3b", // sfrxETH_SHEZETH_VAULT + "0x84D45BF4a70605fc84D618e1809E90f73dA8f369", // ptUniETH_SHEZETH_VAULT + "0xF00A9f21a72FabCfBAeEfa70D08D947f61B2D16C", // wOETH_SHEZUSD_VAULT + "0x95D970fa98bf608862aE76b5492E53E701210E9F", // wOETH_SHEZETH_VAULT + "0x6625364D0499EcEB5C9308c90eb660B96dFd0746", // WETH_SHEZUSD_VAULT + "0x6261a4a8776343192f3bdeC04F7909591c375cfb", // WETH_SHEZETH_VAULT + "0x3d0D2bDd6f0118ad6194aab84f10Fde688502d16", // WBTC_SHEZUSD_VAULT + "0xED3529B182292f2e33988D852e1a9da0821FBC6e", // CRV_SHEZUSD_VAULT +] + +// SHEZ single staking v1 +const SHEZ_SINGLE_STAKING_V1 = "0xB775f1c426849Ba75891258abA496F69D2e6F570"; + +// SHEZ-ETH LP pool +const SHEZ_ETH_LP_POOL = "0x4574220A54b0306c2CBEc22A3B6C69158b27f1da"; + +async function tvl(api) { + const tokens = await api.multiCall({ abi: 'address:tokenContract', calls: vaults }) + return sumTokens2({ api, tokensAndOwners2: [tokens, vaults] }) +} + +module.exports = { + ethereum: { + tvl, + pool2: staking(SHEZ_ETH_LP_POOL, SHEZ_ETH_LP), + staking: staking(SHEZ_SINGLE_STAKING_V1, SHEZ), + }, +} \ No newline at end of file From 05cd12adcecc3899364ad299c7bbe164193d8302 Mon Sep 17 00:00:00 2001 From: Milan Steiner <69144826+msteiner96@users.noreply.github.com> Date: Fri, 19 Jul 2024 23:23:40 +0200 Subject: [PATCH 786/855] Phoenix DeFi Hub TVL Adapter (#11047) * Phoenix DeFi Hub TVL Adapter * Add newline to end of file --- projects/phoenix-hub/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/phoenix-hub/index.js diff --git a/projects/phoenix-hub/index.js b/projects/phoenix-hub/index.js new file mode 100644 index 000000000000..772a0bb729c1 --- /dev/null +++ b/projects/phoenix-hub/index.js @@ -0,0 +1,18 @@ +const utils = require("../helper/utils"); +const {toUSDTBalances} = require("../helper/balances"); + +async function tvl() { + // Fetch all tickers + const tickers = await utils.fetchURL("https://api-phoenix.decentrio.ventures/tickers"); + + // Sum up the tvl + const totalTVL = tickers.data.reduce((acc, t) => acc + t.liquidity_in_usd, 0); + return toUSDTBalances(totalTVL); +} + +module.exports = { + methodology: 'counts the liquidity on all Phoenix Hub AMM Pools.', + stellar: { + tvl, + } +}; From 913db8f37e15fcc44359f6a22a75ba17556b6a3d Mon Sep 17 00:00:00 2001 From: 0xChupaCabra <56636447+0xChupaCabra@users.noreply.github.com> Date: Sat, 20 Jul 2024 12:51:52 +0200 Subject: [PATCH 787/855] vfatio - Bugfix (#11051) * ignore sickles * ignore more smaller positions * remove unused code --- projects/vfat/index.js | 2 -- projects/vfat/utils.js | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/projects/vfat/index.js b/projects/vfat/index.js index e4aa86c89cbd..14f334de4a50 100644 --- a/projects/vfat/index.js +++ b/projects/vfat/index.js @@ -197,13 +197,11 @@ async function tvlBaseOptimism(api) { // TVL calculation for Arbitrum and Linea async function tvlArbitrumLinea(api) { const { factory, gaugeFactory, gaugeFactory2, voter, fromBlock, fromBlockSickle, chainName } = config[api.chain]; - const sickles = await fetchSickles(api, factory, fromBlockSickle); const gauges = await fetchGauges2(api, fromBlock, gaugeFactory, gaugeFactory2, voter, chainName); const stakingTokens = await api.multiCall({ abi: 'address:stake', calls: gauges.lp }); await sumLPBalances(api, gauges.lp, sickles, stakingTokens); - await fetchSickleNftPositions(api, sickles, config[api.chain].NonfungiblePositionManager); await fetchSickleNftPositions(api, sickles, config[api.chain].masterchefV3, true); diff --git a/projects/vfat/utils.js b/projects/vfat/utils.js index 0339c2e58325..8f02f4f39345 100644 --- a/projects/vfat/utils.js +++ b/projects/vfat/utils.js @@ -4,7 +4,7 @@ const { sumTokens2 } = require('../helper/unwrapLPs'); async function sumLPBalances(api, gauges, sickles, lpTokens) { api.log(api.chain, sickles.length, gauges.length,) lpTokens.forEach((lpToken, index) => lpTokens[index] = lpToken.toLowerCase()) - let minLPValue = 4e3 + let minLPValue = 10e3 if (lpTokens.length > 200) minLPValue = 15e3 if (lpTokens.length > 400) minLPValue = 25e3 From c26bf0b4a57173f53c40e89b81b1b2132c8a23ed Mon Sep 17 00:00:00 2001 From: 0xChupaCabra <56636447+0xChupaCabra@users.noreply.github.com> Date: Sun, 21 Jul 2024 20:56:27 +0200 Subject: [PATCH 788/855] remove wrong sickle (#11055) --- projects/vfat/index.js | 6 +++++- projects/vfat/utils.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/projects/vfat/index.js b/projects/vfat/index.js index 14f334de4a50..5fcc39dd58d1 100644 --- a/projects/vfat/index.js +++ b/projects/vfat/index.js @@ -197,7 +197,11 @@ async function tvlBaseOptimism(api) { // TVL calculation for Arbitrum and Linea async function tvlArbitrumLinea(api) { const { factory, gaugeFactory, gaugeFactory2, voter, fromBlock, fromBlockSickle, chainName } = config[api.chain]; - const sickles = await fetchSickles(api, factory, fromBlockSickle); + const blacklistedSickles = ['0x4989D5e508eBa5D4999b6A34FB30021e1f1bB4d8']; + let sickles = await fetchSickles(api, factory, fromBlockSickle); + if (chainName === 'linea') { + sickles = sickles.filter(sickle => !blacklistedSickles.includes(sickle)); + } const gauges = await fetchGauges2(api, fromBlock, gaugeFactory, gaugeFactory2, voter, chainName); const stakingTokens = await api.multiCall({ abi: 'address:stake', calls: gauges.lp }); diff --git a/projects/vfat/utils.js b/projects/vfat/utils.js index 8f02f4f39345..0339c2e58325 100644 --- a/projects/vfat/utils.js +++ b/projects/vfat/utils.js @@ -4,7 +4,7 @@ const { sumTokens2 } = require('../helper/unwrapLPs'); async function sumLPBalances(api, gauges, sickles, lpTokens) { api.log(api.chain, sickles.length, gauges.length,) lpTokens.forEach((lpToken, index) => lpTokens[index] = lpToken.toLowerCase()) - let minLPValue = 10e3 + let minLPValue = 4e3 if (lpTokens.length > 200) minLPValue = 15e3 if (lpTokens.length > 400) minLPValue = 25e3 From 86da3e2f3c54e8e677ee39ace10d5c480b827fb5 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sun, 21 Jul 2024 22:23:37 +0100 Subject: [PATCH 789/855] sanko treasury for sudo --- projects/treasury/sudoswap.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/treasury/sudoswap.js b/projects/treasury/sudoswap.js index 902d6e480c79..b1206c70d978 100644 --- a/projects/treasury/sudoswap.js +++ b/projects/treasury/sudoswap.js @@ -20,4 +20,11 @@ module.exports = treasuryExports({ "0xb23d80f5FefcDDaa212212F028021B41DEd428CF", //PRIME ], }, + sanko: { + owners: ["0x5bfe2ef160eaaaa4afa89a8fa09775b6580162c9"], + ownTokens: [], + tokens: [ + nullAddress, + ], + }, }); \ No newline at end of file From 89c9d94b51befec047ff42aa797c99d585fe2509 Mon Sep 17 00:00:00 2001 From: hamur dev <122794657+tpktpj@users.noreply.github.com> Date: Mon, 22 Jul 2024 02:15:44 -0400 Subject: [PATCH 790/855] Add Avalon finance mainnet and mantle market (#11059) * Add Avalon finance mainnet and mantle market * fix: mainnet -> ethereum --- projects/avalon-finance/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/avalon-finance/index.js b/projects/avalon-finance/index.js index 2e4399c8058d..47dc1ec950d7 100644 --- a/projects/avalon-finance/index.js +++ b/projects/avalon-finance/index.js @@ -9,7 +9,9 @@ const mainMarket = { arbitrum: aaveExports('', '0xa2ddc06baDc817C612111137c0cf6Bd43634EE1a', undefined, ['0xEc579d2cE07401258710199Ff12a5bb56e086a6F'],{v3: true}), bsc: aaveExports('', '0x5395201A4DD625a0d69b99D917282f75928416c1', undefined, ['0x672b19DdA450120C505214D149Ee7F7B6DEd8C39'],{v3: true}), core: aaveExports('', '0x410d2D3Dc79ec66A2Cfc3A4a0AD4af3a38D38bd0', undefined, ['0x802CB61844325dc9A161bC3A498E3BE1B7b6FE00'], { v3: true }), - scroll: aaveExports('', '0xFBb77A68ee35e7902F1ABE0Bd34B263023e90c70', undefined, ['0x18cbe70602Ee17f79D56971F685E9EaF49DA53F2'], { v3: true }) + scroll: aaveExports('', '0xFBb77A68ee35e7902F1ABE0Bd34B263023e90c70', undefined, ['0x18cbe70602Ee17f79D56971F685E9EaF49DA53F2'], { v3: true }), + ethereum: aaveExports('', '0xff12470a969Dd362EB6595FFB44C82c959Fe9ACc', undefined, ['0xfabb0fDca4348d5A40EB1BB74AEa86A1C4eAd7E2'], { v3: true }), + mantle: aaveExports('', '0xc6517002bE432e60DEb311c2FD264aBdC7CC74F2', undefined, ['0xc8651Bc174A1f9c29dCDc0651917379d29aBE13F'], { v3: true }), } const innovativeMarket = { From fccdec0ef56803c77a3185aa6b5df8d3d378466d Mon Sep 17 00:00:00 2001 From: Maxime Desalle <70470326+maxdesalle@users.noreply.github.com> Date: Mon, 22 Jul 2024 08:23:08 +0200 Subject: [PATCH 791/855] refactor: update sablier to v2.2 endpoints (#11058) * refactor: update sablier to v2.2 endpoints * fix: please pardon my stupidity * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/sablier-v2/index.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/projects/sablier-v2/index.js b/projects/sablier-v2/index.js index ce8929492277..5f9969312844 100644 --- a/projects/sablier-v2/index.js +++ b/projects/sablier-v2/index.js @@ -1,4 +1,3 @@ -const sdk = require("@defillama/sdk"); const { isWhitelistedToken } = require('../helper/streamingHelper') const { cachedGraphQuery } = require('../helper/cache') @@ -32,16 +31,16 @@ async function vesting(api) { const config = { ethereum: { endpoints: ['5EgaXheiBXZBCkepyGUYAu8pN31Dkbh7bpGtnLPqaT5m'], }, - arbitrum: { endpoints: ['AR77w8PwmkAG7c9DJSsfW6yTrC5UdvdQ1Hz5ZTCuaUWz'], }, + arbitrum: { endpoints: ['8BnGPBojHycDxVo83LP468pUo4xDyCQbtTpHGZXR6SiB'], }, bsc: { endpoints: ['BVyi15zcH5eUg5PPKfRDDesezMezh6cAkn8LPvh7MVAF'], }, - xdai: { endpoints: [sdk.graph.modifyEndpoint('EXhNLbhCbsewJPx4jx5tutNXpxwdgng2kmX1J7w1bFyu')], }, - optimism: { endpoints: [sdk.graph.modifyEndpoint('6e6Dvs1yDpsWDDREZRqxGi54SVdvTNzUdKpKJxniKVrp')], }, - polygon: { endpoints: ['J8XJaFtxcz7xowzVJ5LwZhi35N5Lbtwfrt4sea6G1ysJ'], }, - avax: { endpoints: [sdk.graph.modifyEndpoint('FdVwZuMV43yCb1nPmjnLQwmzS58wvKuLMPzcZ4UWgWAc')], }, - base: { endpoints: [sdk.graph.modifyEndpoint('HS6B8Wi9ZY7D9bjHEuJwDqHa5eCMX5d6H59YyGVnQ5QP')], }, - blast: { endpoints: ['https://api.studio.thegraph.com/query/57079/sablier-v2-blast/version/latest'], }, - scroll: { endpoints: [sdk.graph.modifyEndpoint('HVcngokCByfveLwguuafrBC34xB65Ne6tpGrXHmqDSrh')], }, - era: { endpoints: [sdk.graph.modifyEndpoint('GY2fGozmfZiZ3xF2MfevohLR4YGnyxGxAyxzi9zmU5bY')], }, + xdai: { endpoints: ['EXhNLbhCbsewJPx4jx5tutNXpxwdgng2kmX1J7w1bFyu'], }, + optimism: { endpoints: ['6e6Dvs1yDpsWDDREZRqxGi54SVdvTNzUdKpKJxniKVrp'], }, + polygon: { endpoints: ['CsDNYv9XPUMP8vufuwDVKQrVhsxhzzRHezjLFFKZZbrx'], }, + avax: { endpoints: ['FdVwZuMV43yCb1nPmjnLQwmzS58wvKuLMPzcZ4UWgWAc'], }, + base: { endpoints: ['3pxjsW9rbDjmZpoQWzc5CAo4vzcyYE9YQyTghntmnb1K'], }, + blast: { endpoints: ['BXoC2ToMZXnTmCjWftQRPh9zMyM7ysijMN54Nxzb2CEY'], }, + scroll: { endpoints: ['HVcngokCByfveLwguuafrBC34xB65Ne6tpGrXHmqDSrh'], }, + era: { endpoints: ['GY2fGozmfZiZ3xF2MfevohLR4YGnyxGxAyxzi9zmU5bY'], }, } Object.keys(config).forEach(chain => { From 6c654af0e5fed782c48887929dc0b2f7ca0dc884 Mon Sep 17 00:00:00 2001 From: 0xnirmal Date: Mon, 22 Jul 2024 02:44:13 -0400 Subject: [PATCH 792/855] Add Goldlink (#11053) * add goldlink * fix type error * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/goldlink/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100755 projects/goldlink/index.js diff --git a/projects/goldlink/index.js b/projects/goldlink/index.js new file mode 100755 index 000000000000..d698d4a49199 --- /dev/null +++ b/projects/goldlink/index.js @@ -0,0 +1,10 @@ +const { sumERC4626VaultsExport } = require('../helper/erc4626') + +module.exports = { + methodology: 'Delta neutral farming in GMX Vault', + start: 1716638498, + doublecounted: true, + arbitrum: { + tvl: sumERC4626VaultsExport({ vaults: ['0xd8dd54df1a7d2ea022b983756d8a481eea2a382a',], isOG4626: true, }), + }, +} \ No newline at end of file From 9014ffcc57386432f4484b8e0cf330d94c65435b Mon Sep 17 00:00:00 2001 From: ftm1337 <84405345+ftm1337@users.noreply.github.com> Date: Mon, 22 Jul 2024 02:56:57 -0400 Subject: [PATCH 793/855] Add elocks adapter (#11052) * Add elocks adapter * fix lint issues * fix lint errors * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/elocks/index.js | 23 +++++++++++++++++++++++ projects/helper/cache/sumUnknownTokens.js | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 projects/elocks/index.js diff --git a/projects/elocks/index.js b/projects/elocks/index.js new file mode 100644 index 000000000000..400caf55ffee --- /dev/null +++ b/projects/elocks/index.js @@ -0,0 +1,23 @@ +const { sumTokens2 } = require("../helper/unwrapLPs") + +const IELOCKS = { + lockedAssets: "function lockedAssets(uint) public view returns (address token, uint balance, uint)" +} + +const elocks = { + fantom: "0x2f20A659601d1c161A108E0725FEF31256a907ad" +} + +module.exports = { + misrepresentedTokens: true, +} + +Object.keys(elocks).forEach(chain => { + module.exports[chain] = { + tvl: async (api) => { + const data = await api.fetchList({ lengthAbi: 'totalSupply', itemAbi: IELOCKS.lockedAssets, target: elocks[api.chain], startFromOne: true, }) + data.forEach(i => api.addToken(i.token, i.balance)) + return sumTokens2({ api, resolveLP: true}) + }, + } +}) \ No newline at end of file diff --git a/projects/helper/cache/sumUnknownTokens.js b/projects/helper/cache/sumUnknownTokens.js index b23f98858d50..e494f6871c4d 100644 --- a/projects/helper/cache/sumUnknownTokens.js +++ b/projects/helper/cache/sumUnknownTokens.js @@ -365,7 +365,7 @@ async function getTokenPrices({ async function sumUnknownTokens({ api, tokensAndOwners = [], balances, coreAssets = [], owner, tokens, chain = 'ethereum', block, restrictTokenRatio, blacklist = [], skipConversion = false, onlyLPs, minLPRatio, log_coreAssetPrices = [], log_minTokenValue = 1e6, owners = [], lps = [], useDefaultCoreAssets = false, cache = {}, resolveLP = false, abis, - ownerTokens, + ownerTokens = [], }) { if (api) { chain = api.chain ?? chain From a08477bab76f0a0f30178baf6f5293eb56c3a9d8 Mon Sep 17 00:00:00 2001 From: santino <83203265+santinoYoung@users.noreply.github.com> Date: Mon, 22 Jul 2024 14:57:55 +0800 Subject: [PATCH 794/855] Update desyn mode chian (#11045) * add desyn protocol * update lpposition token * Update index.js add resolveLP * Update index.js remove resolveLP * add tvl * Update index.js update sumTokensExport * code refactor * update desyn chain * update bitlayer chain * disable merlin * add desyn hallmarks * add desyn restaking and desyn yeild Methodology * update bitlayer doublecounted is false * update bitlayer doublecounted * update bitlayer doublecounted * update desyn mode chain * reset methodology text --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/desyn-farm1/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/desyn-farm1/index.js b/projects/desyn-farm1/index.js index 7b2da9ec60c0..13e162927816 100644 --- a/projects/desyn-farm1/index.js +++ b/projects/desyn-farm1/index.js @@ -6,6 +6,7 @@ module.exports = { const config = { btr: { factory: '0x09eFC8C8F08B810F1F76B0c926D6dCeb37409665', fromBlock: 2393247}, + mode: { factory: '0x09Dfee598d5217da799bEAd56206beC0fDB0D17B', fromBlock: 9912410} } Object.keys(config).forEach(chain => { From 0f22a98fb8c18d08e6a1c3fe565f6e47b6915ea8 Mon Sep 17 00:00:00 2001 From: Yolley Date: Mon, 22 Jul 2024 09:24:42 +0200 Subject: [PATCH 795/855] Streamflow: return tvl by token (#11043) * streamflow: return tvl by token * return vesting tvl * bump * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/helper/streamingHelper.js | 27 +++++++++++++-- projects/streamflow/index.js | 55 ++++++++++++++++++------------ 2 files changed, 57 insertions(+), 25 deletions(-) diff --git a/projects/helper/streamingHelper.js b/projects/helper/streamingHelper.js index 82feff3b985d..441ba2ffffef 100644 --- a/projects/helper/streamingHelper.js +++ b/projects/helper/streamingHelper.js @@ -10,9 +10,12 @@ function isStableToken(symbol = '', address = '') { return stableTokenAddresses.includes(address.toLowerCase()) || stableTokens.includes(symbol.toUpperCase()) } -async function getWhitelistedTokens({ api, tokens, isVesting }) { - tokens = getUniqueAddresses(tokens) - const symbols = await api.multiCall({ abi: 'string:symbol', calls: tokens, permitFailure: true}) +async function getWhitelistedTokens({ api, tokens, isVesting }) { + tokens = getUniqueAddresses(tokens, api.chain) + let symbols = [] + if (!['solana', 'sui', 'aptos'].includes(api.chain)) { + symbols = await api.multiCall({ abi: 'string:symbol', calls: tokens, permitFailure: true}) + } tokens = tokens.filter((v, i) => isWhitelistedToken(symbols[i], v, isVesting)) return tokens } @@ -87,6 +90,24 @@ const stableTokenAddresses = [ ADDRESSES.meter.BUSD_bsc, ADDRESSES.meter.USDT_eth, '0x687A6294D0D6d63e751A059bf1ca68E4AE7B13E2', + + ADDRESSES.solana.SOL, + ADDRESSES.solana.USDC, + ADDRESSES.solana.USDT, + + ADDRESSES.sui.SUI, + ADDRESSES.sui.USDC, + ADDRESSES.sui.WETH, + ADDRESSES.sui.USDT, + + ADDRESSES.aptos.APT, + ADDRESSES.aptos.USDC, + ADDRESSES.aptos.USDC_1, + ADDRESSES.aptos.USDC_2, + ADDRESSES.aptos.USDT, + ADDRESSES.aptos.USDT_2, + + ].map(i => i.toLowerCase()) module.exports = { diff --git a/projects/streamflow/index.js b/projects/streamflow/index.js index 993db79e4731..78462852b693 100644 --- a/projects/streamflow/index.js +++ b/projects/streamflow/index.js @@ -1,9 +1,8 @@ const { getCache } = require('../helper/http') +const { getWhitelistedTokens } = require('../helper/streamingHelper') -const TVL_KEY = "tvl"; -const VESTING_KEY = "tvl_vested"; -const api = - "https://metabase.internal-streamflow.com/_public/api/v1/stats/accumulated"; +const url = + "https://metabase.internal-streamflow.com/_public/api/v1/stats/accumulated/by-token"; const chains = [ "solana", "aptos", @@ -16,37 +15,49 @@ const chainMapping = { bsc: 'bnb' }; -const getValueForKey = (arr, chain, key) => { - for (let i = 0; i < arr.length; i++) { - if (arr[i].chain.toLowerCase() === (chainMapping[chain] || chain) && arr[i][key] !== undefined) { - return arr[i][key]; - } - } - return 0; -} - async function getCachedApiRespnse() { - let apiResponse = (await getCache(api)); + let apiResponse = (await getCache(url)); return apiResponse; } -async function tvl(api) { - return { - tether: 0 +async function fetchData(api, key, isVesting) { + const tokenHoldings = await getCachedApiRespnse(); + const chain = (chainMapping[api.chain] || api.chain).toUpperCase(); + + const holdings = tokenHoldings.filter((i) => i.chain === chain); + let whitelistedTokens = [] + let allTokens = [] + if (key === "amount_locked_core") { + allTokens = holdings.filter((i) => +i[key] > 0).map((i) => i.mint); + whitelistedTokens = await getWhitelistedTokens({ api, tokens: allTokens, isVesting }) + whitelistedTokens = new Set(whitelistedTokens) + } + + + for (const tokenHolding of holdings) { + if (key === "amount_locked_core" && !whitelistedTokens.has(tokenHolding.mint)) { + continue; + } + api.add(tokenHolding.mint, tokenHolding[key]); } } + +async function tvl(api) { + await fetchData(api, "amount_locked_core", false); +} + async function vesting(api) { - return { - tether: getValueForKey(await getCachedApiRespnse(), api.chain, VESTING_KEY), - } + await fetchData(api, "amount_locked_core", true); + await fetchData(api, "amount_locked_vested"); } module.exports = { - methodology: 'Token breakdown: https://metabase.internal-streamflow.com/public/dashboard/fe3731c1-fbe4-4fb6-8960-515af1d6e72d', + methodology: 'Token breakdown: https://metabase.internal-streamflow.com/public/dashboard/fe3731c1-fbe4-4fb6-8960-515af1d6e72d', timetravel: false, - misrepresentedTokens: true, + misrepresentedTokens: false, } + chains.forEach((chain) => { module.exports[chain] = { tvl, vesting From dd0d882de6fe2c10414e531167e266e47991e758 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:44:32 +0300 Subject: [PATCH 796/855] fix nftx --- projects/elektrik/index.js | 2 +- projects/moonfarm.js | 77 ---------------------- projects/nftx/index.js | 130 ++++++------------------------------- 3 files changed, 20 insertions(+), 189 deletions(-) delete mode 100644 projects/moonfarm.js diff --git a/projects/elektrik/index.js b/projects/elektrik/index.js index 1720939bb735..c817693b4b08 100644 --- a/projects/elektrik/index.js +++ b/projects/elektrik/index.js @@ -10,7 +10,7 @@ const query = `{ }` async function tvl(api) { - const { pools } = await cachedGraphQuery('elektrik-1', 'https://subgraph.elektrik.network/subgraphs/name/ELEKTRIK-GRAPH-V2', query) + const { pools } = await cachedGraphQuery('elektrik-2', 'https://subgraph.elektrik.network/subgraphs/name/ELEKTRIK-GRAPH-V2', query) const ownerTokens = pools.map(i => [[i.token0.id, i.token1.id], i.id]) return sumTokens2({ api, ownerTokens, }) } diff --git a/projects/moonfarm.js b/projects/moonfarm.js deleted file mode 100644 index 10b404a935ca..000000000000 --- a/projects/moonfarm.js +++ /dev/null @@ -1,77 +0,0 @@ -const utils = require('./helper/utils'); -const farmDataEndpoint = "https://marketcap.moonfarm.finance/get-farms-data" - -async function fetch() { - const data = await utils.fetchURL(farmDataEndpoint) - return data.data.tvlUSD -} - -async function bsc() { - const data = await utils.fetchURL(farmDataEndpoint) - return data.data.tvlBSC -} - -async function polygon() { - const data = await utils.fetchURL(farmDataEndpoint) - return data.data.tvlPoly -} - -async function ethereum() { - const data = await utils.fetchURL(farmDataEndpoint) - return data.data.tvlETH -} - -async function kava() { - const data = await utils.fetchURL(farmDataEndpoint) - return data.data.tvlKAVA -} -async function avalanche() { - const data = await utils.fetchURL(farmDataEndpoint) - return data.data.tvlAVAX -} - -async function fantom() { - const data = await utils.fetchURL(farmDataEndpoint) - return data.data.tvlFANTOM -} - -async function terra() { - const data = await utils.fetchURL(farmDataEndpoint) - return data.data.tvlLUNA -} - -async function solana() { - const data = await utils.fetchURL(farmDataEndpoint) - return data.data.tvlSOLANA -} - -module.exports = { - bsc:{ - fetch:bsc - }, - polygon:{ - fetch: polygon - }, - ethereum:{ - fetch: ethereum - }, - kava:{ - fetch: kava - }, - avax:{ - fetch: avalanche - }, - fantom:{ - fetch: fantom - }, - terra:{ - fetch: terra - }, - solana:{ - fetch: solana - }, - fetch -}, -module.exports.hallmarks = [ - [1651881600, "UST depeg"], - ] diff --git a/projects/nftx/index.js b/projects/nftx/index.js index c1513efb18cf..b7708f1abb6d 100644 --- a/projects/nftx/index.js +++ b/projects/nftx/index.js @@ -1,119 +1,27 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { gql } = require("graphql-request"); -const { blockQuery } = require('../helper/http') -const { getTokenPrices } = require('../helper/unknownTokens') -const sdk = require('@defillama/sdk') -const { getChainTransform } = require('../helper/portedTokens') +const { getLogs2 } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') const config = { - ethereum: { - weth: ADDRESSES.ethereum.WETH, - graphUrl: 'https://graph-proxy.nftx.xyz/c/shared/subgraphs/name/nftx-project/nftx-v2-1-mainnet' - }, - arbitrum: { - weth: ADDRESSES.arbitrum.WETH, - graphUrl: 'https://graph-proxy.nftx.xyz/shared/subgraphs/name/nftx-project/nftx-v2-arbitrum' - }, + ethereum: { factory: '0xBE86f647b167567525cCAAfcd6f881F1Ee558216', fromBlock: 12675821, }, + arbitrum: { factory: '0xE77b89FEc41A7b7dC74eb33602e82F0672FbB33C', fromBlock: 12080098, }, } -function getTvl(chain) { - const { weth, graphUrl } = config[chain] - return async (api) => { - const { vaults } = await blockQuery(graphUrl, graphQuery, { api }) - const block = api.block - const LPs = new Set(vaults.map(v => v.lpStakingPool.stakingToken.id)) - const tokens = new Set(vaults.map(v => v.token.id)) - const transform = await getChainTransform(chain) - - const weth_balances = await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - calls: Array.from(LPs).map(lp => ({ - target: weth, - params: lp - })), - block, chain, - }) - - const token_balances = await sdk.api.abi.multiCall({ - abi: 'erc20:totalSupply', - calls: Array.from(tokens).map(token => ({ - target: token, - })), - block, chain, - }) - - const balances = {} - - sdk.util.sumMultiBalanceOf(balances, token_balances) - //sdk.util.sumMultiBalanceOf(balances, weth_balances) - - const lps = weth_balances.output - .filter(({ output }) => +output > 2 * 1e18) // only pick pools with minimum 2 eth in it - .map(({ input }) => input.params[0]) - - const { updateBalances, prices } = await getTokenPrices({ - block, useDefaultCoreAssets: true, lps, allLps: true, chain, - }) - - const print = [] - vaults.forEach(vault => { - const price = prices[vault.token.id] - const balance = (balances[vault.token.id] || 0) / 1e18 - if (!price || !balance) return; - const total = balance * price[1] - if (total < 50) return; - print.push({ id: vault.token.id, balance, name: vault.token.name, val: total }) - }) - print.sort((a, b) => b.val - a.val) - - updateBalances(balances) - const transformedBalances = {} - Object.entries(balances).forEach(([token, balance]) => sdk.util.sumSingleBalance(transformedBalances, transform(token), balance)) - - return transformedBalances - } -} - module.exports = { - methodology: "Counts total value of all vaults", - ethereum: { tvl: getTvl('ethereum') }, - arbitrum: { tvl: getTvl('arbitrum') }, + methodology: "Counts total value of nfts in all the vaults", } -const graphQuery = gql` -query get_vaults($block: Int) { - vaults( - first: 1000, - where: { vaultId_gte: 0 }, - block: { number: $block } - ) { - vaultId - id - is1155 - isFinalized - totalHoldings - allocTotal - token { - id - name - symbol - } - asset { - id - name - symbol - } - lpStakingPool { - stakingToken { - id - name - symbol - } - rewardToken{ - id - name - symbol - } +Object.keys(config).forEach(chain => { + const { factory, fromBlock, } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + if (chain === 'arbitrum') return {} // we dont price any token in arbitrum + const logs = await getLogs2({ + api, + factory, + eventAbi: 'event NewVault (uint256 indexed vaultId, address vaultAddress, address assetAddress)', + fromBlock, + }) + const tokensAndOwners = logs.map(log => [log.assetAddress, log.vaultAddress]) + return sumTokens2({ api, tokensAndOwners, permitFailure: true }) } } -} -` \ No newline at end of file +}) From 7011125d41cd2330c42864333b33e481b57b3205 Mon Sep 17 00:00:00 2001 From: kavsky02 <95619352+kavsky02@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:49:31 +0200 Subject: [PATCH 797/855] Add GM+ markets to Avalanche adapter (#11061) --- .../deltaprime/mappings/assetToAddressMappingAvalanche.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/deltaprime/mappings/assetToAddressMappingAvalanche.json b/projects/deltaprime/mappings/assetToAddressMappingAvalanche.json index 57f7c7368b36..3d8f262869cd 100644 --- a/projects/deltaprime/mappings/assetToAddressMappingAvalanche.json +++ b/projects/deltaprime/mappings/assetToAddressMappingAvalanche.json @@ -41,6 +41,9 @@ "GM_ETH_WETHe_USDC": "0xB7e69749E3d2EDd90ea59A4932EFEa2D41E245d7", "GM_AVAX_WAVAX_USDC": "0x913C1F46b48b3eD35E7dc3Cf754d4ae8499F31CF", "GM_SOL_SOL_USDC": "0xd2eFd1eA687CD78c41ac262B3Bc9B53889ff1F70", + "GM_BTC_BTCb": "0x3ce7BCDB37Bf587d1C17B930Fa0A7000A0648D12", + "GM_ETH_WETHe": "0x2A3Cf4ad7db715DF994393e4482D6f1e58a1b533", + "GM_AVAX_WAVAX": "0x08b25A2a89036d298D6dB8A74ace9d1ce6Db15E5", "GLP": "0x9e295B5B976a184B14aD8cd72413aD846C299660", "DAIe": "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70", "USDCe": "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664", From daa125ac3bf76a336c91f9597bc09e9fa2d106bb Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Mon, 22 Jul 2024 12:21:29 +0100 Subject: [PATCH 798/855] add wallet htx + add tokens cex helper (#11066) --- projects/helper/cex.js | 2 ++ projects/huobi/index.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/helper/cex.js b/projects/helper/cex.js index b319e478e719..def9742923a2 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -107,6 +107,8 @@ const defaultTokens = { '0x1495bc9e44af1f8bcb62278d2bec4540cf0c05ea', //deia '0x4cff49d0a19ed6ff845a9122fa912abcfb1f68a6', //wtk "0x23878914efe38d27c4d67ab83ed1b93a74d4086a", //aEthUSDT + "0x4d5f47fa6a74757f35c14fd3a6ef8e3c9bc514e8", // aEthWETH + "0x98c23e9d8f34fefb1b7bd6a91b7ff122f4e16f5c", // aEthUSDC ], tron: [ nullAddress, diff --git a/projects/huobi/index.js b/projects/huobi/index.js index ff2134e3d34b..5c5744cc79d9 100644 --- a/projects/huobi/index.js +++ b/projects/huobi/index.js @@ -60,7 +60,7 @@ const config = { '0x5c985e89dde482efe97ea9f1950ad149eb73829b', '0xe4818f8fde0c977a01da4fa467365b8bf22b071e', '0xe93381fb4c4f14bda253907b18fad305d799241a', // end add on 23/02/2024 (we defillama) - + '0x6663613FbD927cE78abBF7F5Ca7e2c3FE0d96d18', // add on 22/07/2024 ], blacklistedTokens: [ '0x0316eb71485b0ab14103307bf65a021042c6d380', // HBTC , we already track their backed BTC (1btc wallet on the list) From b962807841994cb137ce1ca78a13f18f308f9e02 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 22 Jul 2024 14:54:23 +0300 Subject: [PATCH 799/855] solana: reduce cost by using getMulitpleAccounts instead of batching token balance requests --- projects/helper/solana.js | 273 +++++++++--------- projects/helper/utils/solana/layout.js | 3 +- .../helper/utils/solana/layouts/scnSOL.js | 16 + projects/jetprotocol.js | 47 +-- projects/maple/index.js | 13 +- projects/mercurical-vaults/index.js | 8 +- projects/only1.js | 2 +- projects/saber.js | 2 - projects/sanctum/index.js | 6 +- projects/solend/index.js | 42 +-- projects/symmetry/index.js | 36 +-- 11 files changed, 192 insertions(+), 256 deletions(-) diff --git a/projects/helper/solana.js b/projects/helper/solana.js index 5ca74e49f2bb..9434a09d94fe 100644 --- a/projects/helper/solana.js +++ b/projects/helper/solana.js @@ -9,7 +9,7 @@ const { sleep, sliceIntoChunks, log, } = require('./utils') const { decodeAccount } = require('./utils/solana/layout') const sdk = require('@defillama/sdk'); -const { TOKEN_PROGRAM_ID } = require('@project-serum/anchor/dist/cjs/utils/token'); +const { TOKEN_PROGRAM_ID, ASSOCIATED_PROGRAM_ID, } = require('@project-serum/anchor/dist/cjs/utils/token'); const blacklistedTokens_default = [ 'CowKesoLUaHSbAMaUxJUj7eodHHsaLsS65cy8NFyRDGP', @@ -40,20 +40,16 @@ function getConnection(chain = 'solana') { return connection } -function getProvider() { +function getProvider(chain = 'solana') { if (!provider) { const dummy_keypair = Keypair.generate(); const wallet = new Wallet(dummy_keypair); - provider = new Provider( - getConnection(), wallet - ); + provider = new Provider(getConnection(chain), wallet) } return provider; } - - async function getTokenSupply(token) { const tokenSupply = await http.post(endpoint(), { jsonrpc: "2.0", @@ -64,116 +60,40 @@ async function getTokenSupply(token) { return tokenSupply.result.value.uiAmount; } -function formOwnerBalanceQuery(owner, programId = TOKEN_PROGRAM_ID) { - return { - jsonrpc: "2.0", - id: 1, - method: "getTokenAccountsByOwner", - params: [ - owner, - { programId: String(programId) }, - { encoding: "jsonParsed", }, - ], - } -} - -function formTokenBalanceQuery(token, account, id = 1) { - return { - jsonrpc: "2.0", - id, - method: "getTokenAccountsByOwner", - params: [ - account, - { mint: token, }, - { encoding: "jsonParsed", }, - ], - } -} -async function getTokenBalance(token, account) { - const tokenBalance = await http.post(endpoint(), formTokenBalanceQuery(token, account)); - return tokenBalance.result.value.reduce( - (total, account) => - total + account.account.data.parsed?.info.tokenAmount.uiAmount ?? 0, - 0 - ); -} - -async function getTokenBalances(tokensAndAccounts) { - const body = tokensAndAccounts.map(([token, account], i) => formTokenBalanceQuery(token, account, i)) - const tokenBalances = await http.post(endpoint(), body); - const balances = {} - // if (!tokenBalances) { - // sdk.log('missing response', tokenBalances, tokensAndAccounts) - // return balances - // } - // tokenBalances.forEach((v, i )=> { - // if (!v.result) sdk.log('missing response', v, tokensAndAccounts[i]) - // } ) - tokenBalances.forEach(({ result: { value } = {} } = {}) => { - if (!value) return; - value.forEach(({ account: { data: { parsed: { info: { mint, tokenAmount: { amount } } } } } }) => { - sdk.util.sumSingleBalance(balances, mint, amount) - }) - }) - return balances -} - -async function getTokenAccountBalances(tokenAccounts, { individual = false, chunkSize = 99, allowError = false, chain = 'solana' } = {}) { +async function getTokenAccountBalances(tokenAccounts, { individual = false, allowError = false, chain = 'solana' } = {}) { log('total token accounts: ', tokenAccounts.length) - const formBody = account => ({ method: "getAccountInfo", jsonrpc: "2.0", params: [account, { encoding: "jsonParsed", commitment: "confirmed" }], id: account }) + tokenAccounts.forEach((val, i) => { + if (typeof val === 'string') tokenAccounts[i] = new PublicKey(val) + }) + const connection = getConnection(chain) const balancesIndividual = [] const balances = {} - const chunks = sliceIntoChunks(tokenAccounts, chunkSize) - for (const chunk of chunks) { - const body = chunk.map(formBody) - const data = await http.post(endpointMap[chain](), body); - if (data.length !== chunk.length) { - throw new Error(`Mismatched returned for getTokenAccountBalances()`) + const res = await runInChunks(tokenAccounts, chunk => connection.getMultipleAccountsInfo(chunk)) + res.forEach((data, idx) => { + if (!data) { + sdk.log(`Invalid account: ${tokenAccounts[idx]}`) + if (allowError) return; + else throw new Error(`Invalid account: ${tokenAccounts[idx]}`) } - data.forEach(({ result: { value } }, i) => { - if (!value || !value.data?.parsed) { - if (tokenAccounts[i].toString() === '11111111111111111111111111111111') { - log('Null account: skipping it') - return; - } - if (allowError) return; - else throw new Error(`Invalid account: ${tokenAccounts[i]}`) - } - const { data: { parsed: { info: { mint, tokenAmount: { amount } } } } } = value - sdk.util.sumSingleBalance(balances, mint, amount) + data = decodeAccount('tokenAccount', data) + const mint = data.mint.toString() + const amount = data.amount.toString() + if (individual) balancesIndividual.push({ mint, amount }) - }) - if (chunks.length > 4) { - // log('waiting before more calls') - await sleep(400) - } - } - if (individual) return balancesIndividual - return balances -} + else + sdk.util.sumSingleBalance(balances, mint, amount) + }) -// accountsArray is an array of base58 address strings -async function getMultipleAccountsRaw(accountsArray) { - if ( - !Array.isArray(accountsArray) || - accountsArray.length === 0 || - typeof accountsArray[0] !== "string" - ) { - throw new Error("Expected accountsArray to be an array of strings"); - } - const res = [] - const chunks = sliceIntoChunks(accountsArray, 99) - for (const chunk of chunks) { - const accountsInfo = await http.post(endpoint(), { - jsonrpc: "2.0", - id: 1, - method: "getMultipleAccounts", - params: [chunk], - }) - res.push(...accountsInfo.result.value) - } + return individual ? balancesIndividual : balances +} - return res; +async function getMultipleAccounts(accountsArray) { + const connection = getConnection() + if (!accountsArray.length) return [] + accountsArray.forEach((val, i) => { + if (typeof val === 'string') accountsArray[i] = new PublicKey(val) + }) + return runInChunks(accountsArray, chunk => connection.getMultipleAccountsInfo(chunk)) } function exportDexTVL(DEX_PROGRAM_ID, getTokenAccounts, chain = 'solana') { @@ -215,6 +135,10 @@ function exportDexTVL(DEX_PROGRAM_ID, getTokenAccounts, chain = 'solana') { } } +function sumTokensExport({ tokenAccounts, owner, owners, tokens, solOwners, blacklistedTokens, allowError, tokensAndOwners, ...rest }) { + return (api) => sumTokens2({ api, chain: api.chain, tokenAccounts, owner, owners, tokens, solOwners, blacklistedTokens, allowError, tokensAndOwners, ...rest }) +} + async function sumTokens2({ balances = {}, tokensAndOwners = [], @@ -225,40 +149,41 @@ async function sumTokens2({ solOwners = [], blacklistedTokens = [], allowError = false, + computeTokenAccount = false, }) { blacklistedTokens.push(...blacklistedTokens_default) if (!tokensAndOwners.length) { if (owner) tokensAndOwners = tokens.map(t => [t, owner]) if (owners.length) tokensAndOwners = tokens.map(t => owners.map(o => [t, o])).flat() } - if (!tokensAndOwners.length && !tokens.length && (owner || owners.length > 0)) { + if (!tokensAndOwners.length) { const _owners = getUniqueAddresses([...owners, owner].filter(i => i), 'solana') - for (const _owner of _owners) { - const data = await getOwnerAllAccount(_owner) - for (const item of data) { - if (blacklistedTokens.includes(item.mint) || +item.amount < 1e6) continue; - sdk.util.sumSingleBalance(balances, 'solana:' + item.mint, item.amount) - } + + const data = await getOwnerAllAccounts(_owners) + for (const item of data) { + if (blacklistedTokens.includes(item.mint) || +item.amount < 1e6) continue; + sdk.util.sumSingleBalance(balances, 'solana:' + item.mint, item.amount) } } tokensAndOwners = tokensAndOwners.filter(([token]) => !blacklistedTokens.includes(token)) + // - if (tokensAndOwners.length) { + if (computeTokenAccount) { + const computedTokenAccounts = computeTokenAccounts(tokensAndOwners) + tokenAccounts.push(...computedTokenAccounts) + } else if (tokensAndOwners.length) { tokensAndOwners = getUnique(tokensAndOwners) log('total balance queries: ', tokensAndOwners.length) - const chunks = sliceIntoChunks(tokensAndOwners, 99) - for (const chunk of chunks) { - await _sumTokens(chunk) - if (chunks.length > 2) { - // log('waiting before more calls') - await sleep(400) - } - } + await runInChunks(tokensAndOwners, async (chunk) => { + const tokenBalances = await getTokenBalances(chunk) + transformBalances({ tokenBalances, balances, }) + }, { sleepTime: 400 }) } if (tokenAccounts.length) { tokenAccounts = getUniqueAddresses(tokenAccounts, 'solana') + const tokenBalances = await getTokenAccountBalances(tokenAccounts, { allowError }) await transformBalances({ tokenBalances, balances, }) } @@ -272,11 +197,6 @@ async function sumTokens2({ return balances - async function _sumTokens(tokensAndAccounts) { - const tokenBalances = await getTokenBalances(tokensAndAccounts) - return transformBalances({ tokenBalances, balances, }) - } - function getUnique(tokensAndOwners) { const set = new Set() tokensAndOwners.forEach(i => { @@ -285,15 +205,33 @@ async function sumTokens2({ return [...set].map(i => i.split('$')) } - async function getOwnerAllAccount(owner) { - const tokenBalance = await http.post(endpoint(), formOwnerBalanceQuery(owner)); - return tokenBalance.result.value.map(i => ({ - account: i.pubkey, - mint: i.account.data.parsed.info.mint, - amount: i.account.data.parsed.info.tokenAmount.amount, - uiAmount: i.account.data.parsed.info.tokenAmount.uiAmount, - decimals: i.account.data.parsed.info.tokenAmount.decimals, - })) + async function getOwnerAllAccounts(owners) { + console.log('fetching sol token balances for', owners.length, 'owners') + return runInChunks(owners, async (chunk) => { + const body = chunk.map(i => formOwnerBalanceQuery(i)) + const tokenBalances = await http.post(endpoint(), body) + return tokenBalances.map(i => i.result.value).flat().map(i => ({ + account: i.pubkey, + mint: i.account.data.parsed.info.mint, + amount: i.account.data.parsed.info.tokenAmount.amount, + uiAmount: i.account.data.parsed.info.tokenAmount.uiAmount, + decimals: i.account.data.parsed.info.tokenAmount.decimals, + })) + + }) + } + + function formOwnerBalanceQuery(owner, programId = TOKEN_PROGRAM_ID) { + return { + jsonrpc: "2.0", + id: 1, + method: "getTokenAccountsByOwner", + params: [ + owner, + { programId: String(programId) }, + { encoding: "jsonParsed", }, + ], + } } async function getSolBalances(accounts) { @@ -306,6 +244,46 @@ async function sumTokens2({ } return tokenBalances.reduce((a, i) => a + i.result.value, 0) } + + function computeTokenAccounts(tokensAndOwners) { + tokensAndOwners.forEach(([token, account], i) => { + if (typeof token === 'string') tokensAndOwners[i][0] = new PublicKey(token) + if (typeof account === 'string') tokensAndOwners[i][1] = new PublicKey(account) + }) + const programBuffer = TOKEN_PROGRAM_ID.toBuffer() + return tokensAndOwners.map(([mint, owner]) => { + return PublicKey.findProgramAddressSync( + [owner.toBuffer(), programBuffer, mint.toBuffer(),], + ASSOCIATED_PROGRAM_ID + )[0] + }) + } + + async function getTokenBalances(tokensAndAccounts) { + const body = tokensAndAccounts.map(([token, account], i) => formTokenBalanceQuery(token, account, i)) + const tokenBalances = await http.post(endpoint(), body); + const balances = {} + tokenBalances.forEach(({ result: { value } = {} } = {}) => { + if (!value) return; + value.forEach(({ account: { data: { parsed: { info: { mint, tokenAmount: { amount } } } } } }) => { + sdk.util.sumSingleBalance(balances, mint, amount) + }) + }) + return balances + + function formTokenBalanceQuery(token, account, id = 1) { + return { + jsonrpc: "2.0", + id, + method: "getTokenAccountsByOwner", + params: [ + account, + { mint: token, }, + { encoding: "jsonParsed", }, + ], + } + } + } } async function transformBalances({ tokenBalances, balances = {}, }) { @@ -349,15 +327,26 @@ async function getSolBalanceFromStakePool(address, api) { return api.add(ADDRESSES.solana.SOL, +deserializedAccountInfo.totalLamports) } +async function runInChunks(inputs, fn, { chunkSize = 99, sleepTime } = {}) { + const chunks = sliceIntoChunks(inputs, chunkSize) + const results = [] + for (const chunk of chunks) { + results.push(...(await fn(chunk) ?? [])) + if (sleepTime) await sleep(sleepTime) + } + + return results.flat() +} + module.exports = { endpoint: endpoint(), getTokenSupply, - getTokenBalance, - getMultipleAccountsRaw, + getMultipleAccounts, exportDexTVL, getProvider, getConnection, sumTokens2, + sumTokensExport, transformBalances, readBigUInt64LE, decodeAccount, diff --git a/projects/helper/utils/solana/layout.js b/projects/helper/utils/solana/layout.js index 9ad9a3e296cd..b7523fd96eba 100644 --- a/projects/helper/utils/solana/layout.js +++ b/projects/helper/utils/solana/layout.js @@ -6,7 +6,7 @@ const { RAYDIUM_LIQUIDITY_STATE_LAYOUT_CLMM, RAYDIUM_STABLE_STATE_LAYOUT_V1, } = const { INVESTIN_FUND_DATA, } = require('./layouts/investin-layout') const { MARKET_STATE_LAYOUT_V3, OPEN_ORDERS_LAYOUT_V2, MARKET_STATE_LAYOUT_V3_MINIMAL } = require('./layouts/openbook-layout') const { ReserveLayout, ReserveLayoutLarix, MintLayout, AccountLayout, TokenSwapLayout, ESOLStakePoolLayout, } = require('./layouts/mixed-layout'); -const { SCN_STAKE_POOL } = require("./layouts/scnSOL"); +const { SCN_STAKE_POOL, TOKEN_LAYOUT, } = require("./layouts/scnSOL"); const { SANCTUM_INFINITY } = require("./layouts/sanctum-infinity-layout"); const { parseSanctumLstStateList } = require("./layouts/sanctum-validators-lsts-layout"); const { STAKE_POOL_PARTIAL } = require("./layouts/stake-pool-partial-layout"); @@ -40,6 +40,7 @@ const defaultParseLayout = Layout => info => { } const customDecoders = { + tokenAccount: defaultParseLayout(TOKEN_LAYOUT), reserve: parseReserve, lido: parseLido, lidoValidatorList: parseLidoValidatorList, diff --git a/projects/helper/utils/solana/layouts/scnSOL.js b/projects/helper/utils/solana/layouts/scnSOL.js index cbb43310ed34..cdbbc2a24c93 100644 --- a/projects/helper/utils/solana/layouts/scnSOL.js +++ b/projects/helper/utils/solana/layouts/scnSOL.js @@ -2,6 +2,21 @@ const { struct, s32, u8, u16, seq, blob, Layout, bits, u32, publicKey, uint64, u64, uint128, u128, option, } = require('./layout-base') + +const TOKEN_LAYOUT = struct([ + publicKey('mint'), + publicKey('owner'), + uint64('amount'), + u32('delegateOption'), + publicKey('delegate'), + u8('state'), + u32('isNativeOption'), + uint64('isNative'), + uint64('delegatedAmount'), + u32('closeAuthorityOption'), + publicKey('closeAuthority') +]) + const Fee = [ u64("denominator"), u64("numerator"), @@ -43,5 +58,6 @@ const SCN_STAKE_POOL = struct([ ]); module.exports = { + TOKEN_LAYOUT, SCN_STAKE_POOL, }; \ No newline at end of file diff --git a/projects/jetprotocol.js b/projects/jetprotocol.js index 4e31993ea1f6..be8e2824f51f 100644 --- a/projects/jetprotocol.js +++ b/projects/jetprotocol.js @@ -1,40 +1,23 @@ const ADDRESSES = require('./helper/coreAssets.json') -const { getTokenBalance, sumTokens2 } = require("./helper/solana"); +const { sumTokens2 } = require("./helper/solana"); -async function borrowed() { - const [usdcAmount, ethAmount, solAmount, btcAmount] = await Promise.all([ - getTokenBalance( - "G17Yu6f4emBeRLWS1Y4cNJMTmT5LUGJH95zK6253KoAH", - "7gpj9cpzBBW9Ci1yMwWz7iGbQYpm5fZmadNQyrYsqch8" - ), - getTokenBalance( - "5v8QVtwqZjSdJxhCF2xWrAopiyhDgJTdgeQZ5aWmStnE", - "7gpj9cpzBBW9Ci1yMwWz7iGbQYpm5fZmadNQyrYsqch8" - ), - getTokenBalance( - "A9S9XVCuNXHnJGFhxBhsTmJNHa6aPccF5NCAGgE4BxGF", - "7gpj9cpzBBW9Ci1yMwWz7iGbQYpm5fZmadNQyrYsqch8" - ), - getTokenBalance( - "7SXpzVgqMvDEWkv9jtDUZVjkBPUbn8EUitKwV22WCpxt", - "7gpj9cpzBBW9Ci1yMwWz7iGbQYpm5fZmadNQyrYsqch8" - ), - ]); - return { - bitcoin: btcAmount, - "usd-coin": usdcAmount, - ethereum: ethAmount, - solana: solAmount, - }; +const debtMapping = { + 'G17Yu6f4emBeRLWS1Y4cNJMTmT5LUGJH95zK6253KoAH': ADDRESSES.solana.USDC, + '5v8QVtwqZjSdJxhCF2xWrAopiyhDgJTdgeQZ5aWmStnE': '2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk', + 'A9S9XVCuNXHnJGFhxBhsTmJNHa6aPccF5NCAGgE4BxGF': ADDRESSES.solana.SOL, + '7SXpzVgqMvDEWkv9jtDUZVjkBPUbn8EUitKwV22WCpxt': '9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E', +} + +async function borrowed(api) { + const allBals = await sumTokens2({ owner: '7gpj9cpzBBW9Ci1yMwWz7iGbQYpm5fZmadNQyrYsqch8', }) + + Object.entries(debtMapping).forEach(([key, value]) => { + api.add(value, allBals['solana:'+key] ?? 0) + }) } async function tvl() { - return sumTokens2({ owner: '7gpj9cpzBBW9Ci1yMwWz7iGbQYpm5fZmadNQyrYsqch8', tokens: [ - ADDRESSES.solana.USDC, - '2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk', - ADDRESSES.solana.SOL, - '9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E', - ]}); + return sumTokens2({ owner: '7gpj9cpzBBW9Ci1yMwWz7iGbQYpm5fZmadNQyrYsqch8', blacklistedTokens: Object.keys(debtMapping)}); } // JPv1rCqrhagNNmJVM5J1he7msQ5ybtvE1nNuHpDHMNU diff --git a/projects/maple/index.js b/projects/maple/index.js index d33340fc8b7e..e835334cd5ea 100644 --- a/projects/maple/index.js +++ b/projects/maple/index.js @@ -1,8 +1,9 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { sumTokens2 } = require("../helper/unwrapLPs"); +const { sumTokens2: sumSolana } = require("../helper/solana"); const { staking, } = require("../helper/staking") -const { getConnection, getTokenBalance } = require('../helper/solana') +const { getConnection, } = require('../helper/solana') const { PublicKey } = require('@solana/web3.js') const { getLogs } = require('../helper/cache/getLogs') @@ -15,7 +16,6 @@ const TVL_DATA_SIZE = 8; const PROGRAM_ID = "5D9yi4BKrxF8h65NkVE1raCCWFKUs5ngub2ECxhvfaZe"; let _tvl -const usdc = ADDRESSES.solana.USDC function getTvl(borrowed = false) { return async () => { @@ -42,10 +42,13 @@ async function getSolanaTVL() { for (const account of accounts) { const data = account.account.data.slice(TVL_OFFSET, TVL_OFFSET + TVL_DATA_SIZE) const poolTvl = Number(data.readBigUint64LE()) - const loanBalance = await getTokenBalance(usdc, account.pubkey.toString()) - tvlValue += loanBalance * 1e6 - borrowed += poolTvl - loanBalance * 1e6 + borrowed += poolTvl } + const usdc = ADDRESSES.solana.USDC + const tempBalances = await sumSolana({ owners: accounts.map(a => a.pubkey.toString()), tokens: [ADDRESSES.solana.USDC] }) + const usdValue = +(tempBalances['solana:'+usdc] ?? 0) + tvlValue += usdValue + borrowed -= usdValue if (borrowed < 0) borrowed = 0 return { diff --git a/projects/mercurical-vaults/index.js b/projects/mercurical-vaults/index.js index 182ac74cd414..011663b58f14 100644 --- a/projects/mercurical-vaults/index.js +++ b/projects/mercurical-vaults/index.js @@ -1,18 +1,16 @@ const { Program } = require("@project-serum/anchor"); -const { getProvider, transformBalances, } = require("../helper/solana"); +const { getProvider, } = require("../helper/solana"); const sdk = require('@defillama/sdk') const programId = '24Uqj9JCLxUeoC3hGfh5W3s9FM9uCHDS2SG3LYwBpyTi' -async function tvl() { +async function tvl(api) { const provider = getProvider() const idl = await Program.fetchIdl(programId, provider) const program = new Program(idl, programId, provider) const vaults = (await program.account.vault.all()).map(i => i.account) const tokens = vaults.map(i => i.tokenMint.toString()) - const tokenBalances = {} - vaults.forEach((i, idx) => sdk.util.sumSingleBalance(tokenBalances, tokens[idx], +i.totalAmount)) - return transformBalances({ tokenBalances }) + vaults.forEach((i, idx) => api.add(tokens[idx], +i.totalAmount)) } module.exports = { diff --git a/projects/only1.js b/projects/only1.js index 94706694f6df..a6496a5c6a77 100644 --- a/projects/only1.js +++ b/projects/only1.js @@ -5,7 +5,7 @@ async function staking() { const { data } = await getConfig('only1-solana',"https://api-edge.only1.app/staking-pools") const owners = data.map(i => i.publicKey) - return sumTokens2({ tokens: ['3bRTivrVsitbmCTGtqwp7hxXPsybkjn4XLNtPsHqa3zR'], owners, }) + return sumTokens2({ tokens: ['3bRTivrVsitbmCTGtqwp7hxXPsybkjn4XLNtPsHqa3zR'], owners, computeTokenAccount: true, }) } module.exports = { diff --git a/projects/saber.js b/projects/saber.js index 6baab67ca21a..32533eabbac6 100644 --- a/projects/saber.js +++ b/projects/saber.js @@ -51,6 +51,4 @@ module.exports = { ], timetravel: false, solana: { tvl }, - methodology: - 'To obtain the TVL of Saber we make on-chain calls using the function getTokenBalance() that uses the address of the token and the address of the contract where the tokens are found. TVL is calculated using the list of pool addresses found under the "Pools" button of the Saber App. These pools addresses are hard-coded. Making these calls returns the amount of tokens held in each contract. We then use Coingecko to get the price of each token in USD and export the sum of all tokens. "USDP" is used to price the stablecoin "PAI" since it has not been listed on Coingecko.', }; diff --git a/projects/sanctum/index.js b/projects/sanctum/index.js index a17b518c8f62..1a378e16648e 100644 --- a/projects/sanctum/index.js +++ b/projects/sanctum/index.js @@ -1,5 +1,5 @@ const { Program } = require("@project-serum/anchor"); -const { getProvider, getMultipleAccountsRaw } = require("../helper/solana"); +const { getProvider, getMultipleAccounts, } = require("../helper/solana"); const partialIdl = require("./partialIdl"); const PROGRAM_ADDR = "unpXTU2Ndrc7WWNyEhQWe4udTzSibLPi25SXv2xbCHQ"; @@ -8,11 +8,11 @@ const SOL_RESERVES = "3rBnnH9TTgd3xwu48rnzGsaQkSr1hR64nY71DrDt6VrQ"; async function tvl() { const program = new Program(partialIdl, PROGRAM_ADDR, getProvider()); - const [poolAccount, reservesAccount] = await getMultipleAccountsRaw([ + const [poolAccount, reservesAccount] = await getMultipleAccounts([ POOL_ADDR, SOL_RESERVES, ]); - const pool = program.coder.accounts.decode("pool", Buffer.from(poolAccount.data[0], poolAccount.data[1])); + const pool = program.coder.accounts.decode("pool", poolAccount.data) return { solana: (reservesAccount.lamports + pool.incomingStake.toNumber()) / 1e9, } diff --git a/projects/solend/index.js b/projects/solend/index.js index 895249b3b030..d8c495f05e37 100644 --- a/projects/solend/index.js +++ b/projects/solend/index.js @@ -1,47 +1,27 @@ -const BigNumber = require("bignumber.js"); -const { PublicKey, } = require("@solana/web3.js"); -const { sliceIntoChunks, } = require('../helper/utils') -const { transformBalances, } = require('../helper/portedTokens') -const { sumTokens, getConnection, decodeAccount, } = require("../helper/solana"); +const { sumTokens2, decodeAccount, getMultipleAccounts, } = require("../helper/solana"); const { getConfig } = require('../helper/cache') -const sdk = require('@defillama/sdk') const solendConfigEndpoint = "https://api.solend.fi/v1/markets/configs?scope=all&deployment=production"; -async function borrowed() { +async function borrowed(api) { const markets = (await getConfig('solend', solendConfigEndpoint)) - const connection = getConnection() - const balances = {}; const reserves = [] for (const market of markets) for (const reserve of market.reserves) - reserves.push(new PublicKey(reserve.address)) - - const chunks = sliceIntoChunks(reserves, 99) - for (const chunk of chunks) { - const infos = await connection.getMultipleAccountsInfo(chunk) - infos.forEach(i => { - const { info: { liquidity } } = decodeAccount('reserve', i) - const amount = new BigNumber(liquidity.borrowedAmountWads.toString() / 1e18).toFixed(0); - sdk.util.sumSingleBalance(balances, liquidity.mintPubkey.toString(), amount) - }) - } - - return transformBalances('solana', balances); + reserves.push(reserve.address) + + const infos = await getMultipleAccounts(reserves) + infos.forEach(i => { + const { info: { liquidity } } = decodeAccount('reserve', i) + const amount = liquidity.borrowedAmountWads.toString() / 1e18 + api.add(liquidity.mintPubkey.toString(), amount) + }) } async function tvl() { const markets = (await getConfig('solend', solendConfigEndpoint)) - const tokensAndOwners = [] - - for (const market of markets) { - for (const reserve of market.reserves) { - tokensAndOwners.push([reserve.liquidityToken.mint, market.authorityAddress]) - } - } - - return sumTokens(tokensAndOwners); + return sumTokens2({ owners: markets.map(i => i.authorityAddress)}); } module.exports = { diff --git a/projects/symmetry/index.js b/projects/symmetry/index.js index 2fe73c9b23fb..f7911fb920fc 100644 --- a/projects/symmetry/index.js +++ b/projects/symmetry/index.js @@ -1,41 +1,9 @@ -const { getConnection, sumTokens2 } = require("../helper/solana"); -const { PublicKey } = require('@solana/web3.js') +const { sumTokensExport } = require("../helper/solana"); const FUNDS_VAULT = 'BLBYiq48WcLQ5SxiftyKmPtmsZPUBEnDEjqEnKGAR4zx' -const TOKEN_PROGRAM_ID = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; - -async function tvl() { - const connection = getConnection(); - const filters = [ - { - dataSize: 165, - }, - { - memcmp: { - offset: 32, - bytes: FUNDS_VAULT, - } - } - ]; - const accounts = await connection.getParsedProgramAccounts( - new PublicKey(TOKEN_PROGRAM_ID), - {filters: filters} - ) - let balances = {}; - let tokenAccounts = []; - accounts.forEach((account, i) => { - const parsedAccountInfo = account.account.data; - const mintAddress = parsedAccountInfo["parsed"]["info"]["mint"]; - const tokenBalance = parsedAccountInfo["parsed"]["info"]["tokenAmount"]["uiAmount"]; - tokenAccounts.push(account.pubkey.toString()); - balances[mintAddress] = tokenBalance; - }); - let sum = await sumTokens2({ tokenAccounts }) - return sum; -} module.exports = { timetravel: false, solana: { - tvl + tvl: sumTokensExport({ owner: FUNDS_VAULT }) }, }; \ No newline at end of file From 44eca3f0e799d8a1cf053b8e4d8ea8ea375d50c0 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 22 Jul 2024 15:54:08 +0300 Subject: [PATCH 800/855] update sol adapters --- projects/01/index.js | 19 +---- projects/Solily/index.js | 1 + projects/backpack/index.js | 25 ++----- projects/beluga-protocol/index.js | 23 +----- projects/bridgers-ai/index.js | 7 +- projects/cykura/index.js | 8 +- projects/drachma-exchange/index.js | 1 + projects/dradex/index.js | 2 +- projects/helper/cex.js | 2 +- projects/helper/solana.js | 16 ++-- projects/hubble/index.js | 26 +------ projects/pole/index.js | 6 -- projects/pole/tokens.json | 116 ----------------------------- projects/ratio-finance/index.js | 1 + projects/soda-protocol/index.js | 19 +---- projects/solyard.js | 2 +- projects/upfi.js | 18 ----- 17 files changed, 32 insertions(+), 260 deletions(-) delete mode 100644 projects/pole/index.js delete mode 100644 projects/pole/tokens.json delete mode 100644 projects/upfi.js diff --git a/projects/01/index.js b/projects/01/index.js index d7c4101cef11..d51a7e9052b4 100644 --- a/projects/01/index.js +++ b/projects/01/index.js @@ -1,27 +1,12 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokens2 } = require('../helper/solana') +const { sumTokensExport } = require('../helper/solana') -async function tvl() { - const tokens = [ - ADDRESSES.solana.USDC, - ADDRESSES.solana.SOL, - ADDRESSES.solana.USDT, - "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs", - "9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E", - "mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So", - "9vMJfxuKxXBoEa7rM12mYLMwTacLMLDJqHozw96WQL8i", - ] - const owner = 'HjHSNe8hhvZ8hKCRrhKg1DGiGPd9NYQbUjT1SQRDo4kZ' - - return sumTokens2({ owner, tokens }) -} module.exports = { hallmarks:[ [1667865600, "FTX collapse"] ], timetravel: false, solana: { - tvl, + tvl: sumTokensExport({ owner: 'HjHSNe8hhvZ8hKCRrhKg1DGiGPd9NYQbUjT1SQRDo4kZ' }), }, methodology: `To obtain the tvl we're getting the vault accounts information where user deposited collateral is stored.`, } diff --git a/projects/Solily/index.js b/projects/Solily/index.js index d72e86d38b5e..e5a764f27654 100644 --- a/projects/Solily/index.js +++ b/projects/Solily/index.js @@ -5,6 +5,7 @@ module.exports = { [1655251200, "Rug Pull"] ], timetravel: false, + deadFrom: 1655251200, solana: { tvl: () => 0, }, diff --git a/projects/backpack/index.js b/projects/backpack/index.js index 5a3e8aa66f42..f41da2a4a7f8 100644 --- a/projects/backpack/index.js +++ b/projects/backpack/index.js @@ -1,26 +1,13 @@ -const ADDRESSES = require('../helper/coreAssets.json') const { cexExports } = require('../helper/cex') // https://dune.com/21co/backpack-exchange const config = { - solana: { - owners: [ - '43DbAvKxhXh1oSxkJSqGosNw3HpBnmsWiak6tB5wpecN', - 'BbHG9GvPActFGogv3iNrpDAj4qpXr8t3jF16uGxXcKci' - ], - tokens: [ - 'hntyVP6YFm1Hg25TN9WGLqM12b8TQmcknKrdu1oxWux', // HNT - 'jtojtomepa8beP8AuQc6eXt5FriJwfFMwQx2v2f9mCL', // JTO - ADDRESSES.solana.USDT, // USDT - 'HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3', // PYTH - 'rndrizKT3MK1iimdxRdWabcF7Zg7AR5T4nud4EkHBof', // RNDR - 'mb1eu7TzEc71KxDpsmsKoucSSuuoGLv1drys1oP2jh6', // MOBILE - 'EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm', // WIF - ADDRESSES.solana.BONK, // BONK - ADDRESSES.solana.USDC, // USDC - 'JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN' // JUP - ] - }, + solana: { + owners: [ + '43DbAvKxhXh1oSxkJSqGosNw3HpBnmsWiak6tB5wpecN', + 'BbHG9GvPActFGogv3iNrpDAj4qpXr8t3jF16uGxXcKci' + ], + }, } module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/beluga-protocol/index.js b/projects/beluga-protocol/index.js index 7585ba8932e9..fe04945c293c 100644 --- a/projects/beluga-protocol/index.js +++ b/projects/beluga-protocol/index.js @@ -1,27 +1,10 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokens2, } = require('../helper/solana') - -const tokens = { - usdt: ADDRESSES.solana.USDT, - usdc: ADDRESSES.solana.USDC, -} - -const pools = { - '2usd': { - owner: '37YxD3yze3v92pFdER4X5ymUbLSmRoMP99WDgA18Gt8k', - tokens: [tokens.usdc, tokens.usdt,], - } -} - -async function tvl() { - const tokensAndOwners = Object.values(pools).map(({ owner, tokens}) => tokens.map(i => ([i, owner]))).flat() - return sumTokens2({ tokensAndOwners }) -} +const { sumTokensExport, } = require('../helper/solana') module.exports = { timetravel: false, solana: { - tvl, + tvl: sumTokensExport({ owner: '37YxD3yze3v92pFdER4X5ymUbLSmRoMP99WDgA18Gt8k' }), }, + deadFrom: '2022-11-13', methodology: 'TVL consists of staked tokens', } diff --git a/projects/bridgers-ai/index.js b/projects/bridgers-ai/index.js index 69af52189ae6..c5e4cb897bb1 100644 --- a/projects/bridgers-ai/index.js +++ b/projects/bridgers-ai/index.js @@ -117,10 +117,6 @@ const tokensConf = { JST: ADDRESSES.tron.JST, }, solana: { - SOL: ADDRESSES.solana.SOL, - USDT: ADDRESSES.solana.USDT, - USDC: ADDRESSES.solana.USDC, - BONK: ADDRESSES.solana.BONK, }, base: { ETH: nullAddress, @@ -176,7 +172,8 @@ module.exports = { } for (const network of Object.keys(tokensConf)) { const owner = getBridgeContract(network) - const tokens = Object.values(tokensConf[network]) + let tokens = Object.values(tokensConf[network]) + if (network === 'solana') tokens = undefined module.exports[network] = { tvl: sumTokensExport({ owner, tokens }), }; diff --git a/projects/cykura/index.js b/projects/cykura/index.js index 7e9b3677150e..008088bde0af 100644 --- a/projects/cykura/index.js +++ b/projects/cykura/index.js @@ -91,13 +91,7 @@ async function tvl() { const provider = getProvider() const program = new Program(idl, idl.metadata.address, provider) const amms = await program.account.poolState.all() - const toa = [] - amms.forEach(amm => { - toa.push([amm.account.token0.toString(), amm.publicKey.toString()]) - toa.push([amm.account.token1.toString(), amm.publicKey.toString()]) - }) - - return sumTokens2({ tokensAndOwners: toa, }); + return sumTokens2({ owners: amms.map(i => i.publicKey.toString()), }); } module.exports = { diff --git a/projects/drachma-exchange/index.js b/projects/drachma-exchange/index.js index 13ba76064cd8..ff19803bde42 100644 --- a/projects/drachma-exchange/index.js +++ b/projects/drachma-exchange/index.js @@ -7,4 +7,5 @@ module.exports = { solana: { tvl: () => 0 }, + deadFrom: 1660392000, }; diff --git a/projects/dradex/index.js b/projects/dradex/index.js index c528127ae70b..5e9553fd8e8b 100644 --- a/projects/dradex/index.js +++ b/projects/dradex/index.js @@ -7,7 +7,7 @@ module.exports = { }, } -async function tvl(api) { +async function tvl() { const provider = getProvider() const programId = 'dp2waEWSBy5yKmq65ergoU3G6qRLmqa6K7We4rZSKph' const idl = await Program.fetchIdl(programId, provider) diff --git a/projects/helper/cex.js b/projects/helper/cex.js index def9742923a2..3c4210a714eb 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -262,7 +262,7 @@ function cexExports(config) { chains.forEach(chain => { let { tokensAndOwners, owners, tokens, blacklistedTokens, } = config[chain] - if (!tokensAndOwners && !tokens) { + if (!tokensAndOwners && !tokens && chain !== 'solana') { tokens = defaultTokens[chain] if (!tokens) { // log(chain, 'Missing default token list, counting only native token balance',) diff --git a/projects/helper/solana.js b/projects/helper/solana.js index 9434a09d94fe..04b20842c185 100644 --- a/projects/helper/solana.js +++ b/projects/helper/solana.js @@ -235,14 +235,14 @@ async function sumTokens2({ } async function getSolBalances(accounts) { - const formBody = key => ({ "jsonrpc": "2.0", "id": 1, "method": "getBalance", "params": [key] }) - const tokenBalances = [] - const chunks = sliceIntoChunks(accounts, 99) - for (let chunk of chunks) { - const bal = await http.post(endpoint(), chunk.map(formBody)) - tokenBalances.push(...bal) - } - return tokenBalances.reduce((a, i) => a + i.result.value, 0) + const connection = getConnection() + + const balances = await runInChunks(accounts, async (chunk) => { + chunk = chunk.map(i => typeof i === 'string' ? new PublicKey(i) : i) + const accountInfos = await connection.getMultipleAccountsInfo(chunk) + return accountInfos.map(account => account?.lamports ?? 0) + }) + return balances.reduce((a, b) => a + +b, 0) } function computeTokenAccounts(tokensAndOwners) { diff --git a/projects/hubble/index.js b/projects/hubble/index.js index 4ea4c00f8389..930c6414da6a 100644 --- a/projects/hubble/index.js +++ b/projects/hubble/index.js @@ -1,31 +1,9 @@ -const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require("../helper/solana"); -const ignoreBadTokens = true; - async function tvl() { - const collateralTokens = { - ETH: '7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs', - BTC: '9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E', - SRM: 'SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt', - RAY: '4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R', - FTT: 'AGFEad2et2ZJif9jaGpdMixQqvW5i81aBdvKe7PHNfz3', - WSOL: ADDRESSES.solana.SOL, - MSOL: 'mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So', - stSOL: '7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj', - LDO: 'HZRCwxP2Vq9PCpPXooayhJ2bxTpo5xfpQrwB1svh332p', - } const collateralVaultAuthority = 'HZYHFagpyCqXuQjrSCN2jWrMHTVHPf9VWP79UGyvo95L' - const collateralTokensAndOwners = Object.values(collateralTokens).map((mint) => [mint, collateralVaultAuthority]) - - const psmTokens = { - USDC: ADDRESSES.solana.USDC - } const psmVaultAuthority = '8WrqMitrgjzfqaPJ5PK6X3VT6B1Z8rDgQQny2aWwvJ8q' - const psmTokensAndOwners = Object.values(psmTokens).map((mint) => [mint, psmVaultAuthority]) - - const tokensAndOwners = [...collateralTokensAndOwners, ...psmTokensAndOwners] - return sumTokens2({ tokensAndOwners, ignoreBadTokens }) + return sumTokens2({ owners: [collateralVaultAuthority, psmVaultAuthority] }) } async function staking() { @@ -35,7 +13,7 @@ async function staking() { ] const tokensAndOwners = [hbbStakingPoolTokenAndOwner] - return sumTokens2({ tokensAndOwners, ignoreBadTokens }) + return sumTokens2({ tokensAndOwners, }) } module.exports = { diff --git a/projects/pole/index.js b/projects/pole/index.js deleted file mode 100644 index d7b4fd37add5..000000000000 --- a/projects/pole/index.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - timetravel: false, - solana: { - tvl: () => ({}) - }, -}; diff --git a/projects/pole/tokens.json b/projects/pole/tokens.json deleted file mode 100644 index aef42fd27f48..000000000000 --- a/projects/pole/tokens.json +++ /dev/null @@ -1,116 +0,0 @@ -[ - { - "chainId": 101, - "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", - "symbol": "USDC", - "name": "USD Coin", - "decimals": 6 - }, - { - "chainId": 101, - "address": "mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So", - "symbol": "mSOL", - "name": "Marinade staked SOL (mSOL)", - "decimals": 9 - }, - { - "chainId": 101, - "address": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", - "symbol": "USDT", - "name": "USDT", - "decimals": 6 - }, - { - "chainId": 101, - "address": "2poo1w1DL6yd2WNTCnNTzDqkC6MBXq7axo77P16yrBuf", - "symbol": "USDT-USDC", - "name": "Saber USDT-USDC LP", - "decimals": 6, - "coingeckoId": "tether" - }, - { - "chainId": 101, - "address": "9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E", - "symbol": "BTC", - "name": "Wrapped Bitcoin (Sollet)", - "decimals": 6 - }, - { - "chainId": 101, - "address": "7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj", - "symbol": "stSOL", - "name": "Lido Staked SOL", - "decimals": 9 - }, - { - "chainId": 101, - "address": "Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS", - "symbol": "PAI", - "name": "PAI (Parrot USD)", - "decimals": 6 - }, - { - "chainId": 101, - "address": "So11111111111111111111111111111111111111112", - "symbol": "SOL", - "name": "Wrapped SOL", - "decimals": 9 - }, - { - "chainId": 101, - "address": "9vMJfxuKxXBoEa7rM12mYLMwTacLMLDJqHozw96WQL8i", - "symbol": "UST", - "name": "UST (Portal)", - "decimals": 6 - }, - { - "chainId": 101, - "address": "MERt85fc5boKw3BW1eYdxonEuJNvXbiMbs6hvheau5K", - "symbol": "MER", - "name": "Mercurial", - "decimals": 6 - }, - { - "chainId": 101, - "address": "PoRTjZMPXb9T7dyU7tpLEZRQj7e6ssfAE62j2oQuc6y", - "symbol": "PORT", - "name": "Port Finance Token", - "decimals": 6 - }, - { - "chainId": 101, - "address": "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs", - "symbol": "ETH", - "name": "Ether (Portal)", - "decimals": 8 - }, - { - "chainId": 101, - "address": "Saber2gLauYim4Mvftnrasomsv6NvAuncvMEZwcLpD1", - "symbol": "SBR", - "name": "Saber Protocol Token", - "decimals": 6 - }, - { - "chainId": 101, - "address": "SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt", - "symbol": "SRM", - "name": "Serum", - "decimals": 6 - }, - { - "chainId": 101, - "address": "9EaLkQrbjmbbuZG9Wdpo8qfNUEjHATJFSycEmw6f1rGX", - "symbol": "pSOL", - "name": "pSOL (Parrot SOL)", - "decimals": 9, - "coingeckoId": "solana" - }, - { - "chainId": 101, - "address": "EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp", - "symbol": "FIDA", - "name": "Bonfida", - "decimals": 6 - } -] \ No newline at end of file diff --git a/projects/ratio-finance/index.js b/projects/ratio-finance/index.js index 6249585e9994..d36a3029b36a 100644 --- a/projects/ratio-finance/index.js +++ b/projects/ratio-finance/index.js @@ -11,6 +11,7 @@ module.exports = { solana: { tvl, }, + deadFrom: 1675728000, methodology: "To obtain the Ratio Finance TVL we make on-chain calls", }; diff --git a/projects/soda-protocol/index.js b/projects/soda-protocol/index.js index b9c4ae64bafb..b406eea85168 100644 --- a/projects/soda-protocol/index.js +++ b/projects/soda-protocol/index.js @@ -1,22 +1,7 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokens2 } = require('../helper/solana') - -async function tvl() { - const owner = '5cv5tMwrCMAVbwAC5icUPB5XB4qQpsaf3KaGP7Ygdomc' - const tokens = [ - "9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E", - ADDRESSES.solana.SOL, - "SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt", - ADDRESSES.solana.USDC, - ADDRESSES.solana.USDT, - "2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk", - "4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R", - ] - return sumTokens2({ tokens, owner }) -} +const { sumTokensExport } = require('../helper/solana') module.exports = { timetravel: false, - solana: { tvl, }, + solana: { tvl: sumTokensExport({ owner: '5cv5tMwrCMAVbwAC5icUPB5XB4qQpsaf3KaGP7Ygdomc'}), }, methodology: 'TVL consists of deposits made to the protocol and borrowed tokens are not counted.' } diff --git a/projects/solyard.js b/projects/solyard.js index 35400676dc0d..4d477ca31e51 100644 --- a/projects/solyard.js +++ b/projects/solyard.js @@ -5,7 +5,7 @@ async function staking() { } module.exports = { - // deadFrom: '2022-06-30', + deadFrom: '2022-06-30', timetravel: false, solana: { tvl: () => ({}), diff --git a/projects/upfi.js b/projects/upfi.js deleted file mode 100644 index b99aa7be23d7..000000000000 --- a/projects/upfi.js +++ /dev/null @@ -1,18 +0,0 @@ -const { get } = require('./helper/http') - -async function pool2() { - const response = await get("https://api.upfi.network/tvl") - return { - 'upfi-network': response.UPS_USDC, - 'usd-coin': response.USDC_UPFI + response.UPFI_3Pool, - } -} - -module.exports = { - timetravel: false, - methodology: 'TVL data is pulled from the UPFI API "https://api.upfi.network/tvl".', - solana: { - tvl: async ()=> ({}), - pool2, - } -}; From e2d527addaf2675e43a183dea82e793087761ec5 Mon Sep 17 00:00:00 2001 From: MishaShWoof Date: Mon, 22 Jul 2024 16:07:53 +0300 Subject: [PATCH 801/855] feat: update comet list (#11060) --- projects/compound-v3/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/compound-v3/index.js b/projects/compound-v3/index.js index dbaae8937bfa..dae13fed8eb2 100644 --- a/projects/compound-v3/index.js +++ b/projects/compound-v3/index.js @@ -36,6 +36,7 @@ module.exports = compoundV3Exports({ markets: [ '0x2e44e174f7D53F0212823acC11C01A11d58c5bCB', // USDC Market '0x995E394b8B2437aC8Ce61Ee0bC610D617962B214', // USDT Market + '0xE36A30D249f7761327fd973001A32010b521b6Fd', // ETH Market ], } }) From a5c2830bd7205c9a49b6ca99aaa340e7bf73a45f Mon Sep 17 00:00:00 2001 From: LeeRyanj <138840879+LeeRyanj@users.noreply.github.com> Date: Mon, 22 Jul 2024 21:08:53 +0800 Subject: [PATCH 802/855] Update index.js (#11064) --- projects/kiloex/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/kiloex/index.js b/projects/kiloex/index.js index e33d310ac219..20e21e32fe3e 100644 --- a/projects/kiloex/index.js +++ b/projects/kiloex/index.js @@ -3,8 +3,9 @@ const { sumTokensExport } = require("../helper/unwrapLPs"); const owners = ["0x1c3f35F7883fc4Ea8C4BCA1507144DC6087ad0fb", "0xfE03be1b0504031e92eDA810374222c944351356"]; const opbnb_owners = ["0xA2E2F3726DF754C1848C8fd1CbeA6aAFF84FC5B2", "0x1EbEd4024308afcb05E6938eF8Ebd1ec5d6E8C46"]; -const manta_owners = ["0xA2E2F3726DF754C1848C8fd1CbeA6aAFF84FC5B2", "0x1EbEd4024308afcb05E6938eF8Ebd1ec5d6E8C46", "0x471C5e8Cc0fEC9aeeb7ABA6697105fD6aaaDFf99"]; +const manta_owners = ["0xA2E2F3726DF754C1848C8fd1CbeA6aAFF84FC5B2", "0x1EbEd4024308afcb05E6938eF8Ebd1ec5d6E8C46", "0x471C5e8Cc0fEC9aeeb7ABA6697105fD6aaaDFf99","0xa10f74374b8bE9E9C8Fb62c1Dc17B8D4247E332A"]; const manta_stone_token = "0xEc901DA9c68E90798BbBb74c11406A32A70652C3"; +const manat_manta_token = "0x95CeF13441Be50d20cA4558CC0a27B601aC544E5"; const taiko_owners = ["0x735D00A9368164B9dcB2e008d5Cd15b367649aD5", "0x235C5C450952C12C8b815086943A7bBCF96bc619"]; module.exports = { @@ -14,7 +15,7 @@ module.exports = { tvl: sumTokensExport({ owners: opbnb_owners, tokens: [ADDRESSES.op_bnb.USDT] }) }, manta: { - tvl: sumTokensExport({ owners: manta_owners, tokens: [ADDRESSES.manta.USDT, manta_stone_token] }) + tvl: sumTokensExport({ owners: manta_owners, tokens: [ADDRESSES.manta.USDT, manta_stone_token, manat_manta_token] }) }, taiko: { tvl: sumTokensExport({ owners: taiko_owners, tokens: [ADDRESSES.taiko.USDC] }) From ed0b154800eb9990a6df9d0138e123451c406c0c Mon Sep 17 00:00:00 2001 From: LucasRamadour <72853747+LucasRamadour@users.noreply.github.com> Date: Mon, 22 Jul 2024 16:48:43 +0200 Subject: [PATCH 803/855] =?UTF-8?q?feat=20:=20=E2=9C=A8Update=20Stake=20DA?= =?UTF-8?q?O=20tvl=20with=20new=20api=20endpoints=20(#11067)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat : ✨Update Stake DAO tvl with new api endpoints * revert the veSDT addition into TVL * stakedao: bsc use multicall --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/stakedao/index.js | 324 ++++++++++++++++--------------------- 1 file changed, 135 insertions(+), 189 deletions(-) diff --git a/projects/stakedao/index.js b/projects/stakedao/index.js index 964a6ca4e14c..1b7eeede88e0 100644 --- a/projects/stakedao/index.js +++ b/projects/stakedao/index.js @@ -1,169 +1,80 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); const abi = require('./abi.json') const { sumTokens2, PANCAKE_NFT_ADDRESS } = require('../helper/unwrapLPs') const { getConfig } = require('../helper/cache'); +const { get } = require('../helper/http'); -const STRATEGIES_ENDPOINT = 'https://classic.stakedao.org/api/strategies/cache'; -const LOCKERS_ENDPOINT = 'https://classic.stakedao.org/api/lockers/cache'; +const STRATEGIES_ENDPOINT = 'https://api.stakedao.org/api/strategies'; +const LOCKERS_ENDPOINT = 'https://api.stakedao.org/api/lockers'; +const PANCAKESWAP_MASTERCHEF_V3 = '0x556B9306565093C855AEA9AE92A594704c2Cd59e' -async function strategiesCurveBalancer(timestamp, block) { +const LOCKERS = { + curve: { + 1: '0x52f541764E6e90eeBc5c21Ff570De0e2D63766B6', + 42161: '0x52f541764E6e90eeBc5c21Ff570De0e2D63766B6' + }, + balancer: { + 1: '0xea79d1A83Da6DB43a85942767C389fE0ACf336A5' + }, + pendle: { + 1: '0xD8fa8dC5aDeC503AcC5e026a98F32Ca5C1Fa289A' + }, + yearn: { + 1: '0xF750162fD81F9a436d74d737EF6eE8FC08e98220' + }, + pancakeswap: { + 1: '0xB7F79090190c297F59A2b7D51D3AEF7AAd0e9Af3', + 56: '0x1e6f87a9ddf744af31157d8daa1e3025648d042d', + 42161: '0xE5244b1A263ce45CF1E51DfA97469711E9bAD68d', + } +} + +// ----------------------------------- ETHEREUM ----------------------------------- // + +async function getLPStrategiesMainnet(timestamp, block) { const resp = await Promise.all([ - getConfig('stakedao/curve', `${STRATEGIES_ENDPOINT}/curve`), - getConfig('stakedao/balancer', `${STRATEGIES_ENDPOINT}/balancer`) + getConfig('sakedao/eth-curve', `${STRATEGIES_ENDPOINT}/curve/1.json`), + getConfig('sakedao/eth-balancer', `${STRATEGIES_ENDPOINT}/balancer/1.json`), + getConfig('sakedao/eth-pendle', `${STRATEGIES_ENDPOINT}/pendle/1.json`), + getConfig('sakedao/eth-yearn', `${STRATEGIES_ENDPOINT}/yearn/1.json`), ]); - const strats = resp[0].concat(resp[1]) - const lgv4 = strats.map((strat) => [strat.infos.protocolLiquidityGaugeV4, strat.infos.angleLocker || strat.infos.curveLocker]) + const curveStrats = resp[0].deployed.map((strat) => [strat.gaugeAddress, LOCKERS.curve[1]]) + const balancerStrats = resp[1].deployed.map((strat) => [strat.gaugeAddress, LOCKERS.balancer[1]]) + const pendleStrats = resp[2].deployed.map((strat) => [strat.lpToken.address, LOCKERS.pendle[1]]) + const yearnStrats = resp[3].deployed.map((strat) => [strat.gaugeAddress, LOCKERS.yearn[1]]) - return lgv4 + return [...curveStrats, ...balancerStrats, ...pendleStrats, ...yearnStrats] } async function tvl(api) { - let balances = {} ///////////////////////////////////////////////////////////////////// // --- STRATEGIES V2 ///////////////////////////////////////////////////////////////////// - // ==== Addresses ==== // - const crv3_vault_v2 = { - contract: '0xB17640796e4c27a39AF51887aff3F8DC0daF9567', - token: '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490', - } - const eurs_vault_v2 = { - contract: '0xCD6997334867728ba14d7922f72c893fcee70e84', - token: '0x194eBd173F6cDacE046C53eACcE9B953F28411d1', - } - const frax_vault_v2 = { - contract: '0x5af15DA84A4a6EDf2d9FA6720De921E1026E37b7', - token: '0xd632f22692FaC7611d2AA1C0D552930D43CAEd3B', - } - const frax_vault2_v2 = { - contract: '0x99780beAdd209cc3c7282536883Ef58f4ff4E52F', - token: '0xd632f22692FaC7611d2AA1C0D552930D43CAEd3B', - } - const eth_vault_v2 = { - contract: '0xa2761B0539374EB7AF2155f76eb09864af075250', - token: '0xA3D87FffcE63B53E0d54fAa1cc983B7eB0b74A9c', - } - const steth_vault_v2 = { - contract: '0xbC10c4F7B9FE0B305e8639B04c536633A3dB7065', - token: '0x06325440D014e39736583c165C2963BA99fAf14E', - } let vaults = [ - crv3_vault_v2, - eurs_vault_v2, - frax_vault_v2, - frax_vault2_v2, - eth_vault_v2, - steth_vault_v2 + '0xB17640796e4c27a39AF51887aff3F8DC0daF9567', , // crv3_vault_v2 + '0xCD6997334867728ba14d7922f72c893fcee70e84', , // eurs_vault_v2 + '0x5af15DA84A4a6EDf2d9FA6720De921E1026E37b7', , // frax_vault_v2 + '0x99780beAdd209cc3c7282536883Ef58f4ff4E52F', , // frax_vault2_v2 + '0xa2761B0539374EB7AF2155f76eb09864af075250', , // eth_vault_v2 + '0xbC10c4F7B9FE0B305e8639B04c536633A3dB7065', , // steth_vault_v2 ] - const vaultBals = await api.multiCall({ - abi: abi['balance'], - calls: vaults.map(i => i.contract), - }) - vaultBals.forEach((bal, i) => sdk.util.sumSingleBalance(balances, vaults[i].token, bal)) + await api.erc4626Sum({ calls: vaults }) ///////////////////////////////////////////////////////////////////// - // --- STRATEGIES ANGLE + // --- LP Strategies ///////////////////////////////////////////////////////////////////// - // ==== Addresses ==== // - const angle_protocol = { - stableMasteFront: '0x5adDc89785D75C86aB939E9e15bfBBb7Fc086A87', - usdcPoolManager: '0xe9f183FC656656f1F17af1F2b0dF79b8fF9ad8eD', - fraxPoolManager: '0x6b4eE7352406707003bC6f6b96595FD35925af48', - daiPoolManager: '0xc9daabC677F3d1301006e723bD21C60be57a5915', - locker: '0xD13F8C25CceD32cdfA79EB5eD654Ce3e484dCAF5', - abiCM: 'collateralMap' - } - const angle_sanUSDC_V3 = { - contract: angle_protocol.locker, - sanUsdcEurGauge: '0x51fE22abAF4a26631b2913E417c0560D547797a7', - usdcToken: ADDRESSES.ethereum.USDC, - abi: 'balanceOf', - } - const angle_sanDAI_V3 = { - contract: angle_protocol.locker, - sanDaiEurGauge: '0x8E2c0CbDa6bA7B65dbcA333798A3949B07638026', - daiToken: ADDRESSES.ethereum.DAI, - abi: 'balanceOf', - } - const angle_sanFRAX_V3 = { - contract: angle_protocol.locker, - sanFraxEurGauge: '0xb40432243E4F317cE287398e72Ab8f0312fc2FE8', - fraxToken: ADDRESSES.ethereum.FRAX, - abi: 'balanceOf', - } - const angle_sushi_agEUR_V3 = { - contract: angle_protocol.locker, - sushiAgEURGauge: '0xBa625B318483516F7483DD2c4706aC92d44dBB2B', - sushiAgEURToken: '0x1f4c763BdE1D4832B3EA0640e66Da00B98831355', - abi: 'balanceOf', - } - const angle_guni_agEUR_usdc_V3 = { - contract: angle_protocol.locker, - guniAgEURUsdcGauge: '0xEB7547a8a734b6fdDBB8Ce0C314a9E6485100a3C', - guniAgEURUsdcToken: '0xEDECB43233549c51CC3268b5dE840239787AD56c', - abi: 'balanceOf', - } - - // ==== Calls Balance ==== // - const [ - sanUsdcEurV3, - sanDaiEurV3, - sanFraxEurV3, - angleSushiAgEurV3, - angleGuniAgEurUSDCV3, - ] = await api.multiCall({ - abi: abi[angle_sanUSDC_V3.abi], calls: [ - angle_sanUSDC_V3.sanUsdcEurGauge, - angle_sanDAI_V3.sanDaiEurGauge, - angle_sanFRAX_V3.sanFraxEurGauge, - angle_sushi_agEUR_V3.sushiAgEURGauge, - angle_guni_agEUR_usdc_V3.guniAgEURUsdcGauge, - ].map(i => ({ target: i, params: angle_sanUSDC_V3.contract })) - }) - - // ==== Calls Rate ==== // - const [ - sanUsdcEurRate, - sanDaiEurRate, - sanFraxEurRate, - ] = (await api.multiCall({ - abi: abi[angle_protocol.abiCM], calls: [{ - target: angle_protocol.stableMasteFront, - params: angle_protocol.usdcPoolManager - }, { - target: angle_protocol.stableMasteFront, - params: angle_protocol.daiPoolManager - }, { - target: angle_protocol.stableMasteFront, - params: angle_protocol.fraxPoolManager - },] - })).map(i => i.sanRate) - - // ==== Map ==== // - //sdk.util.sumSingleBalance(balances, angle_sanUSDC_V2.usdcToken, ((await sanUsdcEurV2) * sanUsdcEurRate / 10**18)) - sdk.util.sumSingleBalance(balances, angle_sanUSDC_V3.usdcToken, (sanUsdcEurV3 * sanUsdcEurRate / 10 ** 18)) - sdk.util.sumSingleBalance(balances, angle_sanDAI_V3.daiToken, ((sanDaiEurV3 * sanDaiEurRate / 10 ** 18))) - sdk.util.sumSingleBalance(balances, angle_sanFRAX_V3.fraxToken, ((sanFraxEurV3 * sanFraxEurRate / 10 ** 18))) - sdk.util.sumSingleBalance(balances, angle_sushi_agEUR_V3.sushiAgEURToken, angleSushiAgEurV3) - sdk.util.sumSingleBalance(balances, angle_guni_agEUR_usdc_V3.guniAgEURUsdcToken, angleGuniAgEurUSDCV3) - - const strategies = await strategiesCurveBalancer() + const strategies = await getLPStrategiesMainnet() ///////////////////////////////////////////////////////////////////// // --- LIQUID LOCKERS ///////////////////////////////////////////////////////////////////// - const resp = await getConfig('stakedao/locker', LOCKERS_ENDPOINT) + const resp = (await get(LOCKERS_ENDPOINT)).parsed - let lockersInfos = [] - for (let i = 0; i < resp.length; ++i) { - lockersInfos.push({ contract: `${resp[i].infos.locker}`, veToken: `${resp[i].infos.ve}`, token: `${resp[i].infos.token}` }) - } + let lockersInfos = resp.filter((locker) => locker.chainId === 1).map((locker) => ({ contract: `${locker.modules.locker}`, veToken: `${locker.modules.veToken}`, token: `${locker.token.address}` })) // To deal with special vePendle case - const vePendle = "0x4f30A9D41B80ecC5B94306AB4364951AE3170210" - const veMAV = "0x4949Ac21d5b2A0cCd303C20425eeb29DCcba66D8".toLowerCase() + const vePendle = '0x4f30A9D41B80ecC5B94306AB4364951AE3170210' + const veMAV = '0x4949Ac21d5b2A0cCd303C20425eeb29DCcba66D8'.toLowerCase() const calls = [] const callsPendle = [] const callsMAV = [] @@ -187,11 +98,11 @@ async function tvl(api) { } let lockerBals = await api.multiCall({ abi: abi.locked, calls }) - let lockerPendleBal = await api.multiCall({ abi: "function positionData(address arg0) view returns (uint128 amount, uint128 end)", calls: callsPendle }) + let lockerPendleBal = await api.multiCall({ abi: 'function positionData(address arg0) view returns (uint128 amount, uint128 end)', calls: callsPendle }) let lockerMAVBal = [] for (const { contract, veToken } of callsMAV) { - const count = await api.call({ abi: 'function lockupCount(address) view returns (uint256)', target: veToken, params: contract }) + const count = await api.call({ abi: 'function lockupCount(address) view returns (uint256)', target: veToken, params: contract }) let balance = 0 for (let i = 0; i < count; i++) { const lockup = await api.call({ abi: 'function lockups(address,uint256) view returns (uint256 amount, uint256 end, uint256 points)', target: veToken, params: [contract, i] }) @@ -206,89 +117,121 @@ async function tvl(api) { amount = lockerPendleBal.shift().amount } else if (lockersInfos[i].veToken.toLowerCase() == veMAV) { amount = lockerMAVBal.shift().amount - } else { + } else { amount = lockerBals.shift().amount } - sdk.util.sumSingleBalance(balances, lockersInfos[i].token, amount) + api.add(lockersInfos[i].token, amount) } - return sumTokens2({ api, tokensAndOwners: strategies, balances, }) + return sumTokens2({ + api, + tokensAndOwners: strategies, + uniV3nftsAndOwners: [[PANCAKE_NFT_ADDRESS, LOCKERS.pancakeswap[1]]], + uniV3ExtraConfig: { nftIdFetcher: PANCAKESWAP_MASTERCHEF_V3 } + }) } -async function staking(timestamp, block) { +async function staking(api) { const sanctuary = '0xaC14864ce5A98aF3248Ffbf549441b04421247D3' const arbStrat = '0x20D1b558Ef44a6e23D9BF4bf8Db1653626e642c3' const veSdt = '0x0C30476f66034E11782938DF8e4384970B6c9e8a' const sdtToken = '0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F' return sumTokens2({ + api, owners: [sanctuary, arbStrat, veSdt,], tokens: [sdtToken] }) } async function polygon(api) { - const crv_3crv_vault_polygon = { - contract: '0x7d60F21072b585351dFd5E8b17109458D97ec120', - } - const vaultsPolygon = [ - crv_3crv_vault_polygon, - ] - return getBalances(api, vaultsPolygon) + return api.erc4626Sum({ calls: ['0x7d60F21072b585351dFd5E8b17109458D97ec120'] }) } -async function getBalances(api, vaults, { balances = {} } = {}) { - const tokens = await api.multiCall({ abi: 'address:token', calls: vaults.map(i => i.contract) }) - const bals = await api.multiCall({ abi: 'uint256:balance', calls: vaults.map(i => i.contract) }) - tokens.forEach((token, i) => sdk.util.sumSingleBalance(balances, token, bals[i], api.chain)) - return balances +async function avax(api) { + return api.erc4626Sum({ calls: ['0x0665eF3556520B21368754Fb644eD3ebF1993AD4'] }) } -async function avax(api) { - const crv_3crv_vault_avalanche = { - contract: '0x0665eF3556520B21368754Fb644eD3ebF1993AD4', - } +async function addPancakeSwapLPStrategiesBsc(api) { + const resp = await Promise.all([ + getConfig('stakedao/bsc-cake', `${STRATEGIES_ENDPOINT}/pancakeswap/56.json`), + ]); - const vaultsAvalanche = [ - crv_3crv_vault_avalanche - ] - return getBalances(api, vaultsAvalanche) -} + const strats = resp[0].deployed.filter((strat) => strat.version !== '3') + const deposits = await api.multiCall({ abi: 'uint256:totalSupply', calls: strats.map((strat) => strat.sdGauge.address) }) + const stableStrats = [] + const defaultStrats = [] + strats.forEach((strat, i) => { + strat.deposits = deposits[i] + switch (strat.version) { + case 'stable': stableStrats.push(strat); break + case '2': api.add(strat.lpToken.address, deposits[i]); break + default: defaultStrats.push(strat) + } + }) -async function bsc(api) { - // OLD STRATEGIES - const btcEPS_vault_bsc = { contract: '0xf479e1252481360f67c2b308F998395cA056a77f' } - const EPS3_vault_bsc = { contract: '0x4835BC54e87ff7722a89450dc26D9dc2d3A69F36' } - const fusdt3EPS_vault_bsc = { contract: '0x8E724986B08F2891cD98F7F71b5F52E7CFF420de' } + const stableLPsupplies = await api.multiCall({ abi: 'uint256:totalSupply', calls: stableStrats.map((strat) => strat.lpToken.address) }) + const stableToken0Bals = await api.multiCall({ abi: 'function balances(uint256) view returns(uint256)', calls: stableStrats.map((strat) => ({ target: strat.pool, params: 0})) }) + const stableToken1Bals = await api.multiCall({ abi: 'function balances(uint256) view returns(uint256)', calls: stableStrats.map((strat) => ({ target: strat.pool, params: 1})) }) + stableStrats.forEach((strat, i) => { + const ratio = strat.deposits / stableLPsupplies[i] + api.add(strat.coins[0].address, ratio * stableToken0Bals[i]) + api.add(strat.coins[1].address, ratio * stableToken1Bals[i]) + }) - const vaultsBsc = [ - btcEPS_vault_bsc, - EPS3_vault_bsc, - fusdt3EPS_vault_bsc - ].map(i => i.contract) + const dGauges = defaultStrats.map(i => i.gaugeAddress) + const dLpTokens = defaultStrats.map(i => i.lpToken.address) + const adapterAddress = await api.multiCall({ abi: 'address:adapterAddr', calls: dGauges}) + const tokenPerShares = await api.multiCall({ abi: 'function tokenPerShare() view returns(uint256 _token0PerShare, uint256 _token1PerShare)', calls: adapterAddress }) + const dLpSupplies = await api.multiCall({ abi: 'uint256:totalSupply', calls: dLpTokens }) - const [bitcoin, usdc, tether] = (await api.multiCall({ abi: abi.balance, calls: vaultsBsc })).map(i => i / 1e18) + defaultStrats.forEach((strat, i) => { + const ratio = strat.deposits / dLpSupplies[i] + api.add(strat.coins[0].address, ratio * tokenPerShares[i]._token0PerShare) + api.add(strat.coins[1].address, ratio * tokenPerShares[i]._token1PerShare) + }) +} +async function bsc(api) { // CAKE LOCKER const VE_CAKE = '0x5692DB8177a81A6c6afc8084C2976C9933EC1bAB' - const STAKE_DAO_CAKE_LOCKER = '0x1E6F87A9ddF744aF31157d8DaA1e3025648d042d' - const PANCAKESWAP_MASTERCHEF_V3 = '0x556B9306565093C855AEA9AE92A594704c2Cd59e' - const cakeLock = await api.multiCall({ abi: abi.locks, calls: [{ target: VE_CAKE, params: STAKE_DAO_CAKE_LOCKER }] }) - const cake = Number(cakeLock[0].amount) / 1e18 + const cakeLock = await api.multiCall({ abi: abi.locks, calls: [{ target: VE_CAKE, params: LOCKERS.pancakeswap[56] }] }) + api.add('0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82', cakeLock[0].amount) + - // PANCAKE STRATEGIES - const pcsStratsTvl = await sumTokens2({ + // PANCAKE LP STRATEGIES + await addPancakeSwapLPStrategiesBsc(api) + + // PANCAKE NFT STRATEGIES + return sumTokens2({ api, - uniV3nftsAndOwners: [[PANCAKE_NFT_ADDRESS, STAKE_DAO_CAKE_LOCKER]], - uniV3ExtraConfig: { nftIdFetcher: PANCAKESWAP_MASTERCHEF_V3 } + uniV3nftsAndOwners: [[PANCAKE_NFT_ADDRESS, LOCKERS.pancakeswap[56]]], + uniV3ExtraConfig: { nftIdFetcher: PANCAKESWAP_MASTERCHEF_V3 }, + resolveLP: true, }) +} - return { - bitcoin, tether, 'usd-coin': usdc, 'pancakeswap-token': cake, ...pcsStratsTvl - } +async function getLPStrategiesArbitrum(timestamp, block) { + const resp = await Promise.all([ + getConfig('sakedao/arb-curve', `${STRATEGIES_ENDPOINT}/curve/42161.json`), + ]); + + const stratsCurve = resp[0].deployed.map((strat) => [strat.gaugeAddress, LOCKERS.curve[42161]]) + + return [...stratsCurve] +} + +async function arbitrum(api) { + const strategies = await getLPStrategiesArbitrum() + const PANCAKESWAP_MASTERCHEF_V3_ARBITRUM = '0x5e09ACf80C0296740eC5d6F643005a4ef8DaA694' + return sumTokens2({ + api, + tokensAndOwners: strategies, + uniV3nftsAndOwners: [[PANCAKE_NFT_ADDRESS, LOCKERS.pancakeswap[42161]]], + uniV3ExtraConfig: { nftIdFetcher: PANCAKESWAP_MASTERCHEF_V3_ARBITRUM } + }) } -// node test.js projects/stakedao/index.js module.exports = { misrepresentedTokens: true, ethereum: { @@ -303,5 +246,8 @@ module.exports = { }, bsc: { tvl: bsc, + }, + arbitrum: { + tvl: arbitrum } } \ No newline at end of file From 549bc9c9d8025c3f40fea12c1ae6c2227d6127ff Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 22 Jul 2024 17:50:24 +0300 Subject: [PATCH 804/855] bugfix --- projects/stakedao/index.js | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/projects/stakedao/index.js b/projects/stakedao/index.js index 1b7eeede88e0..195858064345 100644 --- a/projects/stakedao/index.js +++ b/projects/stakedao/index.js @@ -28,7 +28,6 @@ const LOCKERS = { } } -// ----------------------------------- ETHEREUM ----------------------------------- // async function getLPStrategiesMainnet(timestamp, block) { const resp = await Promise.all([ @@ -47,27 +46,18 @@ async function getLPStrategiesMainnet(timestamp, block) { } async function tvl(api) { - ///////////////////////////////////////////////////////////////////// - // --- STRATEGIES V2 - ///////////////////////////////////////////////////////////////////// let vaults = [ - '0xB17640796e4c27a39AF51887aff3F8DC0daF9567', , // crv3_vault_v2 - '0xCD6997334867728ba14d7922f72c893fcee70e84', , // eurs_vault_v2 - '0x5af15DA84A4a6EDf2d9FA6720De921E1026E37b7', , // frax_vault_v2 - '0x99780beAdd209cc3c7282536883Ef58f4ff4E52F', , // frax_vault2_v2 - '0xa2761B0539374EB7AF2155f76eb09864af075250', , // eth_vault_v2 - '0xbC10c4F7B9FE0B305e8639B04c536633A3dB7065', , // steth_vault_v2 + '0xB17640796e4c27a39AF51887aff3F8DC0daF9567', // crv3_vault_v2 + '0xCD6997334867728ba14d7922f72c893fcee70e84', // eurs_vault_v2 + '0x5af15DA84A4a6EDf2d9FA6720De921E1026E37b7', // frax_vault_v2 + '0x99780beAdd209cc3c7282536883Ef58f4ff4E52F', // frax_vault2_v2 + '0xa2761B0539374EB7AF2155f76eb09864af075250', // eth_vault_v2 + '0xbC10c4F7B9FE0B305e8639B04c536633A3dB7065', // steth_vault_v2 ] await api.erc4626Sum({ calls: vaults }) - ///////////////////////////////////////////////////////////////////// - // --- LP Strategies - ///////////////////////////////////////////////////////////////////// const strategies = await getLPStrategiesMainnet() - ///////////////////////////////////////////////////////////////////// - // --- LIQUID LOCKERS - ///////////////////////////////////////////////////////////////////// const resp = (await get(LOCKERS_ENDPOINT)).parsed let lockersInfos = resp.filter((locker) => locker.chainId === 1).map((locker) => ({ contract: `${locker.modules.locker}`, veToken: `${locker.modules.veToken}`, token: `${locker.token.address}` })) From 747fa2f1aeb5774e51cdc3bdb2765a830873d07e Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Mon, 22 Jul 2024 16:52:04 +0200 Subject: [PATCH 805/855] fix sablier outdated (#11068) Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> --- projects/sablier/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/sablier/index.js b/projects/sablier/index.js index c081272f1b7e..853d27aa1a0f 100644 --- a/projects/sablier/index.js +++ b/projects/sablier/index.js @@ -15,7 +15,13 @@ async function getTokens(api, owners, isVesting) { let tokens = (await Promise.all(owners.map(i => covalentGetTokens(i, api, { onlyWhitelisted: false, })))).flat().filter(i => !blacklistedTokens.includes(i)) tokens = getUniqueAddresses(tokens) const symbols = await api.multiCall({ abi: 'erc20:symbol', calls: tokens, permitFailure: true }) - return tokens.filter((v, i) => isWhitelistedToken(symbols[i], v, isVesting)) + + const validTokens = tokens.map((token, index) => { + const symbol = symbols[index]; + return symbol ? { token, symbol } : null; + }).filter(pair => pair !== null); + + return validTokens.filter(token => isWhitelistedToken(token.symbol, token.token, isVesting)).map(token => token.token); } async function tvl(api) { From d3f4b872bc4e066900ef02fae8ab49f05454c911 Mon Sep 17 00:00:00 2001 From: Akron-admin <124675553+Akron-admin@users.noreply.github.com> Date: Tue, 23 Jul 2024 00:11:10 +0900 Subject: [PATCH 806/855] Tvl-v2 (#11056) --- projects/akronswap/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/akronswap/index.js diff --git a/projects/akronswap/index.js b/projects/akronswap/index.js new file mode 100644 index 000000000000..fea9a6e6afa7 --- /dev/null +++ b/projects/akronswap/index.js @@ -0,0 +1,17 @@ +const { getUniTVL } = require('../helper/unknownTokens'); + +module.exports = { + misrepresentedTokens: true, + ethereum:{ + tvl: getUniTVL({ factory: '0x6624Ac5F9abFA36174511607860e81C8dB9e84E9', useDefaultCoreAssets: true, fetchBalances: true, }), + }, + arbitrum:{ + tvl: getUniTVL({ factory: '0x40Cbdf84475f8Dd7C9a9c665eDE551EeaaF21F8d', useDefaultCoreAssets: true, fetchBalances: true, }), + }, + base:{ + tvl: getUniTVL({ factory: '0xD2156Bb9ed200FE88705443BfFcA788BA8b205f6', useDefaultCoreAssets: true, fetchBalances: true, }), + }, + bsc:{ + tvl: getUniTVL({ factory: '0x40Cbdf84475f8Dd7C9a9c665eDE551EeaaF21F8d', useDefaultCoreAssets: true, fetchBalances: true, }), + }, +} \ No newline at end of file From 15778e8718ef3eea6fff40d4d55de6c4d9d5f1ae Mon Sep 17 00:00:00 2001 From: follows-dev Date: Mon, 22 Jul 2024 20:43:58 +0530 Subject: [PATCH 807/855] Added follows tvl (#11069) --- projects/follows/index.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 projects/follows/index.js diff --git a/projects/follows/index.js b/projects/follows/index.js new file mode 100644 index 000000000000..6ac4ed44212e --- /dev/null +++ b/projects/follows/index.js @@ -0,0 +1,26 @@ +const { PublicKey } = require('@solana/web3.js'); +const { getConnection } = require('../helper/solana'); + +async function tvl() { + const programId = new PublicKey( + 'FoLLukXuiZ5kSq3YWCxEmRUt7yDiE9WJCnh76sdC8RTc' + ); + const connection = getConnection(); + + const accounts = await connection.getProgramAccounts(programId); + + return { + solana: accounts.reduce((tvl, { account }) => { + return tvl + account.lamports / 1e9; + }, 0), + }; +} + +module.exports = { + timetravel: false, + methodology: + 'To fetch the total supply of deposited SOL into the Follows Program', + solana: { + tvl, + }, +}; From f9f1818e66321dc1a7915c90ff1e391cf39d18c9 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 22 Jul 2024 18:33:37 +0300 Subject: [PATCH 808/855] minor fix --- projects/follows/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/follows/index.js b/projects/follows/index.js index 6ac4ed44212e..affd1f26ec5e 100644 --- a/projects/follows/index.js +++ b/projects/follows/index.js @@ -7,7 +7,12 @@ async function tvl() { ); const connection = getConnection(); - const accounts = await connection.getProgramAccounts(programId); + const accounts = await connection.getProgramAccounts(programId, { + filters: [{ + dataSize: 88 + }], + dataSlice: { offset: 0, length: 0 } + }); return { solana: accounts.reduce((tvl, { account }) => { From 5b215f6bc95a5e8a2b1412fdec1c2694f149c41b Mon Sep 17 00:00:00 2001 From: kavsky02 <95619352+kavsky02@users.noreply.github.com> Date: Mon, 22 Jul 2024 17:58:24 +0200 Subject: [PATCH 809/855] Add YY-Wombat markets to the Avalanche adapter (#11072) * Add GM+ markets to Avalanche adapter * Add YY-Wombat markets to Avalanche adapter --- projects/deltaprime/index.js | 18 ++++++++++++++++++ .../assetToAddressMappingAvalanche.json | 4 ++++ 2 files changed, 22 insertions(+) diff --git a/projects/deltaprime/index.js b/projects/deltaprime/index.js index 6799e5e6a931..649aa73e1f80 100644 --- a/projects/deltaprime/index.js +++ b/projects/deltaprime/index.js @@ -9,6 +9,11 @@ const ggAVAXBalancerBalanceAbi = "function balancerGgAvaxBalance() view returns const yyAVAXBalancerBalanceAbi = "function balancerYyAvaxBalance() view returns (uint256)" const sAVAXBalancerBalanceAbi = "function balancerSAvaxBalance() view returns (uint256)" +const yieldYakWombatAvaxBalanceInWombatAvaxSavaxLP = "function avaxBalanceAvaxSavaxYY() view returns (uint256)" +const yieldYakWombatSAvaxBalanceInWombatAvaxSavaxLP = "function sAvaxBalanceAvaxSavaxYY() view returns (uint256)" +const yieldYakWombatsAvaxBalanceInWombatAvaxGgavaxLP = "function avaxBalanceAvaxGgavaxYY() view returns (uint256)" +const yieldYakWombatsGgavaxBalanceInWombatAvaxGgavaxLP = "function ggAvaxBalanceAvaxGgavaxYY() view returns (uint256)" + const assetToAddressMappingAvalanche = require('./mappings/assetToAddressMappingAvalanche.json') const assetToAddressMappingArbitrum = require('./mappings/assetToAddressMappingArbitrum.json') @@ -76,9 +81,22 @@ async function tvlAvalanche(api) { let yyAvaxBalancerBalances = await api.multiCall({ abi: yyAVAXBalancerBalanceAbi, calls: accounts }) let sAvaxBalancerBalances = await api.multiCall({ abi: sAVAXBalancerBalanceAbi, calls: accounts }) + let avaxYYWombatAvaxSAvaxLPBalances = await api.multiCall({ abi: yieldYakWombatAvaxBalanceInWombatAvaxSavaxLP, calls: accounts }) + let savaxYYWombatAvaxSAvaxLPBalances = await api.multiCall({ abi: yieldYakWombatSAvaxBalanceInWombatAvaxSavaxLP, calls: accounts }) + let avaxYYWombatAvaxGgavaxLPBalances = await api.multiCall({ abi: yieldYakWombatsAvaxBalanceInWombatAvaxGgavaxLP, calls: accounts }) + let ggAaxYYWombatAvaxGgavaxLPBalances = await api.multiCall({ abi: yieldYakWombatsGgavaxBalanceInWombatAvaxGgavaxLP, calls: accounts }) + ggAvaxBalancerBalances.forEach(i => sdk.util.sumSingleBalance(balances, assetToAddressMappingAvalanche["BAL_ggAVAX_AVAX"], i, api.chain)) yyAvaxBalancerBalances.forEach(i => sdk.util.sumSingleBalance(balances, assetToAddressMappingAvalanche["BAL_yyAVAX_AVAX"], i, api.chain)) sAvaxBalancerBalances.forEach(i => sdk.util.sumSingleBalance(balances, assetToAddressMappingAvalanche["BAL_sAVAX_AVAX"], i, api.chain)) + + avaxYYWombatAvaxSAvaxLPBalances.forEach(i => sdk.util.sumSingleBalance(balances, assetToAddressMappingAvalanche["WOMBAT_sAVAX_AVAX_LP_AVAX"], i, api.chain)) + savaxYYWombatAvaxSAvaxLPBalances.forEach(i => sdk.util.sumSingleBalance(balances, assetToAddressMappingAvalanche["WOMBAT_sAVAX_AVAX_LP_sAVAX"], i, api.chain)) + avaxYYWombatAvaxGgavaxLPBalances.forEach(i => sdk.util.sumSingleBalance(balances, assetToAddressMappingAvalanche["WOMBAT_ggAVAX_AVAX_LP_AVAX"], i, api.chain)) + ggAaxYYWombatAvaxGgavaxLPBalances.forEach(i => sdk.util.sumSingleBalance(balances, assetToAddressMappingAvalanche["WOMBAT_ggAVAX_AVAX_LP_ggAVAX"], i, api.chain)) + + console.log(`Balances: ${JSON.stringify(balances)}`) + return balances; } diff --git a/projects/deltaprime/mappings/assetToAddressMappingAvalanche.json b/projects/deltaprime/mappings/assetToAddressMappingAvalanche.json index 3d8f262869cd..d822bd88f889 100644 --- a/projects/deltaprime/mappings/assetToAddressMappingAvalanche.json +++ b/projects/deltaprime/mappings/assetToAddressMappingAvalanche.json @@ -36,6 +36,10 @@ "YY_TJ_AVAX_USDC_LP": "0xDEf94a13fF31FB6363f1e03bF18fe0F59Db83BBC", "YY_TJ_AVAX_ETH_LP": "0x5219558ee591b030E075892acc41334A1694fd8A", "YY_TJ_AVAX_sAVAX_LP": "0x22EDe03f1115666CF05a4bAfafaEe8F43D42cD56", + "WOMBAT_ggAVAX_AVAX_LP_AVAX": "0x960c66dda302f4a496d936f693e083b1e9ace306", + "WOMBAT_ggAVAX_AVAX_LP_ggAVAX": "0x2ddfdd8e1bec473f07815fa3cfea3bba4d39f37e", + "WOMBAT_sAVAX_AVAX_LP_AVAX": "0x29eeb257a2a6ecde2984acedf80a1b687f18ec91", + "WOMBAT_sAVAX_AVAX_LP_sAVAX": "0xc096ff2606152ed2a06dd12f15a3c0466aa5a9fa", "MOO_TJ_AVAX_USDC_LP": "0x7E5bC7088aB3Da3e7fa1Aa7ceF1dC73F5B00681c", "GM_BTC_BTCb_USDC": "0xFb02132333A79C8B5Bd0b64E3AbccA5f7fAf2937", "GM_ETH_WETHe_USDC": "0xB7e69749E3d2EDd90ea59A4932EFEa2D41E245d7", From e3f4d73bbe1be9c66affb98e514019f31f152676 Mon Sep 17 00:00:00 2001 From: Kacper Bak Date: Mon, 22 Jul 2024 18:58:56 +0300 Subject: [PATCH 810/855] added Mellow, pumpBTC, and weETHs tokens to Zircuit staking (#11071) --- projects/zircuit/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/zircuit/index.js b/projects/zircuit/index.js index cab942cebb5a..dc8ef0a2ae08 100644 --- a/projects/zircuit/index.js +++ b/projects/zircuit/index.js @@ -19,7 +19,14 @@ const TOKEN_CONTRACTS = [ ADDRESSES.ethereum.STONE, // cSTONE '0xd5F7838F5C461fefF7FE49ea5ebaF7728bB0ADfa', // mETH '0xD9A442856C234a39a81a089C06451EBAa4306a72', // pufETH - '0x18f313Fc6Afc9b5FD6f0908c1b3D476E3feA1DD9' // egETH + '0x18f313Fc6Afc9b5FD6f0908c1b3D476E3feA1DD9', // egETH + '0x5fD13359Ba15A84B76f7F87568309040176167cd', // amphrETH + '0x7a4EffD87C2f3C55CA251080b1343b605f327E3a', // rstETH + '0xBEEF69Ac7870777598A04B2bd4771c71212E6aBc', // steakLRT + '0x84631c0d0081FDe56DeB72F6DE77abBbF6A9f93a', // Re7LRT + '0x8c9532a60E0E7C6BbD2B2c1303F63aCE1c3E9811', // pzETH + '0xF469fBD2abcd6B9de8E169d128226C0Fc90a012e', // pumpBTC + '0x917ceE801a67f933F2e6b33fC0cD1ED2d5909D88' // weETHs ]; module.exports = { From dffc80d383c9db2ebe48a6179bf854e9299acf46 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Mon, 22 Jul 2024 18:39:25 +0100 Subject: [PATCH 811/855] add taffy on saakuru --- projects/helper/chains.json | 1 + projects/helper/tokenMapping.js | 3 +++ projects/taffy/index.js | 3 +++ 3 files changed, 7 insertions(+) create mode 100644 projects/taffy/index.js diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 3bb62b2dc603..e813d66cb9da 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -262,6 +262,7 @@ "rsk", "rss3_vsl", "rvn", + "saakuru", "sapphire", "scroll", "secret", diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index e55a3e9bd9cf..130b6459100d 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -62,6 +62,9 @@ const fixBalancesTokens = { }, pulse: { '0x30fcb23a906493371b1721c8feb8815804808d74': { coingeckoId: 'savings-dai', decimals: 18 }, + }, + saakuru: { + '0x557a526472372f1F222EcC6af8818C1e6e78A85f': { coingeckoId: 'oasys', decimals: 18 } } } diff --git a/projects/taffy/index.js b/projects/taffy/index.js new file mode 100644 index 000000000000..30cf64f9ab3b --- /dev/null +++ b/projects/taffy/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens'); + +module.exports = uniTvlExport('saakuru', '0xb9FFd4f89A86a989069CAcaE90e9ce824D0c4971', { fetchBalances: true, }) \ No newline at end of file From ee9b82e94bdf69f0eb66a3a41be5b2c3722b4c13 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Mon, 22 Jul 2024 19:01:05 +0100 Subject: [PATCH 812/855] add saakuru usdc --- projects/helper/tokenMapping.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 130b6459100d..32ac675a4510 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -64,7 +64,8 @@ const fixBalancesTokens = { '0x30fcb23a906493371b1721c8feb8815804808d74': { coingeckoId: 'savings-dai', decimals: 18 }, }, saakuru: { - '0x557a526472372f1F222EcC6af8818C1e6e78A85f': { coingeckoId: 'oasys', decimals: 18 } + '0x557a526472372f1F222EcC6af8818C1e6e78A85f': { coingeckoId: 'oasys', decimals: 18 }, + '0x739222D8A9179fE05129C77a8fa354049c088CaA': { coingeckoId: 'usd-coin', decimals: 6 } } } From b794f9f4bc21987c23cc14038b573469ea0413e6 Mon Sep 17 00:00:00 2001 From: Kostas Tzoumpas Date: Mon, 22 Jul 2024 21:23:55 +0300 Subject: [PATCH 813/855] Valoro (#11054) * Valoro * More transparent TVL calculation * fix bug --- projects/valoro/index.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 projects/valoro/index.js diff --git a/projects/valoro/index.js b/projects/valoro/index.js new file mode 100644 index 000000000000..7956518530e5 --- /dev/null +++ b/projects/valoro/index.js @@ -0,0 +1,26 @@ +const { sumTokens } = require("../helper/chain/elrond"); +const { get } = require("../helper/http"); + +const fundsOwnerSc = + "erd1qqqqqqqqqqqqqpgqqvj2zrdfv4lsc38p8cvh4e0yd4av6njfu7zsj7ztzl"; + +async function getFunds(address) { + const fundsScs = await get(`https://api.multiversx.com/accounts/${address}/contracts`); + return fundsScs +} + +async function tvl() { + const funds = await getFunds(fundsOwnerSc); + const owners = [ + ...funds.map(fund => fund.address) + ]; + + return sumTokens({ owners }); +} + +module.exports = { + timetravel: false, + elrond: { + tvl, + }, +}; From f289f2ae260676cf2bed3e28e2d14b90bd32913b Mon Sep 17 00:00:00 2001 From: sofa-org <161308389+sofa-org@users.noreply.github.com> Date: Tue, 23 Jul 2024 14:22:10 +0800 Subject: [PATCH 814/855] add new vaults for sofa-org (#11079) * add new vaults for sofa-org * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/sofa-org/index.js | 125 ++++++++++++++++++++++++++----------- 1 file changed, 89 insertions(+), 36 deletions(-) diff --git a/projects/sofa-org/index.js b/projects/sofa-org/index.js index 14109d2f9dbe..488e83224e13 100644 --- a/projects/sofa-org/index.js +++ b/projects/sofa-org/index.js @@ -1,46 +1,90 @@ +const { staking } = require('../helper/staking') + const config = { - arbitrum: { + ethereum: { vaults: [ - "0x7ECd1b5255543F4C2D7D8E475afCd01699dBE2B0", - "0xdFEb3460771148799b2D4344c369e2b2d6C26c42", - "0x00aEca021D0f06c7dee54D58ee6Af47B5645aB19", - "0x989897f1D976EE0b59Bf0A3172C170D8f3Cb84e3", - "0x6E72C8726c71a4Cbc6e31ff7d47B399Fa983C7B8", - "0x106825b71ccE77a70B69f57A0ACf9C4a6acf292a" - ], aVaults: [ - "0x3a253838121b9ad9736fAFc030Cf4971615D68b2", - "0xD9cFF1bc89f705EaB2579fA2DC86E9a6F971370a", - "0x9C5D3C3AbD633b8eA68C5a51325f8630DC620AD9", - "0x2F1C60bA96ec6925fA9bBbFC9Eb7908bD35Bc224", - "0x72e0906558e4Ee528974cD7803bfF12d9f2869C3", - "0x9377f17ABde96887943e5Fcc92Db034c76820529", - "0x6f4DBcfC81Dd22AE3EDeC5f9724E43cba8C92E50", - "0xA8fcc1BA1D4893a4894206986B65F652D5FE04AB", - "0xA76Ee91c6E51D248782d7C81826dF91522a6EF96", - "0x7E11ce3e893081B111b720dF29669dEf14e81cDE", - "0x8E882A56604F2b5735EA979bD6fa06C064d2f3f9", - "0xf7Be091BCBbB79f3D9029A25Dc94bC8FDd134EaC" - ] + // USDT + '0x3a253838121b9ad9736fAFc030Cf4971615D68b2', + '0xD9cFF1bc89f705EaB2579fA2DC86E9a6F971370a', + '0x106825b71ccE77a70B69f57A0ACf9C4a6acf292a', + '0x5494855B98858Ea4eF54D13E1d003197A387CE34', + '0x9C5D3C3AbD633b8eA68C5a51325f8630DC620AD9', + '0x2F1C60bA96ec6925fA9bBbFC9Eb7908bD35Bc224', + // stETH + '0x141B893e4ae446e634E92116000e54d7fc72Bc65', + '0xC0f6d3B7B4073Df68DB5897C0884264D03A780C1', + '0x5bbEB889339CE028dC57a1C9A721eAa085BE2368', + '0x22D6201FF78854713CED5542658F16244335ae69', + '0xBEB059D623ac9817fc2F0414F1dCc61416da4540', + '0x4f8Abbc658338E4065acb154679931648195b793', + '0x6014784FC074706ab810130f77135bfb24463f06', + '0xD94A2BB8059E3bA3041592deeaF2B2eF4CcDec71', + '0x1361fa1398c22D6644DcC1AA619F1B84F6DB4366', + '0xB8610F07D25C3B0D7D589bDe8be1b07Ffae1A0A5', + '0x36Ac0331D03e40ab67Af564bC453314Cb58E0629', + '0x858Af7297a3D20f61E0F7A2487c686e0A3353f2C', + ], + aVaults: [ + '0x00aEca021D0f06c7dee54D58ee6Af47B5645aB19', + '0x989897f1D976EE0b59Bf0A3172C170D8f3Cb84e3', + '0x9377f17ABde96887943e5Fcc92Db034c76820529', + '0x99c59D82b10c56950F6C031946656e6D0aD509ca', + '0xF6c70b5F034070001E833C9EbC6a3A0176B683A6', + '0x62104e40fA81a19f2B7E17C78C3ffBF4aCa4F212', + '0x20A82619FCd300f3E0028db6353D38E3cC3B9E14', + '0x1F519b172917Cfd6B7A69EF9d37E13Ac7dFF5E39', + '0xF4A60252B139E29A415C341a0D21261496D27d02', + '0x50752522d249230FE60C855098BB4a7a0974E746', + '0x8Ea9638f2587b20396ec8c45dd639dEB115F5211', + '0x8F9259a355933737F8F11f95d32460eCd5ED0706', + '0x3AbC7053ec29e26c1429195fd971F280422ecA80', + '0x071E0C2BE2b16c8B00173c6535eF8331b8e1feeD', + ], }, - ethereum: { + arbitrum: { vaults: [ - "0x3a253838121b9ad9736fAFc030Cf4971615D68b2", - "0xD9cFF1bc89f705EaB2579fA2DC86E9a6F971370a", - "0x106825b71ccE77a70B69f57A0ACf9C4a6acf292a", - "0x5494855B98858Ea4eF54D13E1d003197A387CE34", - "0x9C5D3C3AbD633b8eA68C5a51325f8630DC620AD9", - "0x2F1C60bA96ec6925fA9bBbFC9Eb7908bD35Bc224" - ], aVaults: [ - "0x00aEca021D0f06c7dee54D58ee6Af47B5645aB19", - "0x989897f1D976EE0b59Bf0A3172C170D8f3Cb84e3", - "0x9377f17ABde96887943e5Fcc92Db034c76820529", - "0x99c59D82b10c56950F6C031946656e6D0aD509ca", - "0xF6c70b5F034070001E833C9EbC6a3A0176B683A6", - "0x62104e40fA81a19f2B7E17C78C3ffBF4aCa4F212" - ] + // USDT + '0x7ECd1b5255543F4C2D7D8E475afCd01699dBE2B0', + '0xdFEb3460771148799b2D4344c369e2b2d6C26c42', + '0x00aEca021D0f06c7dee54D58ee6Af47B5645aB19', + '0x989897f1D976EE0b59Bf0A3172C170D8f3Cb84e3', + '0x6E72C8726c71a4Cbc6e31ff7d47B399Fa983C7B8', + '0x106825b71ccE77a70B69f57A0ACf9C4a6acf292a', + ], + aVaults: [ + // aArbUSDT + '0x3a253838121b9ad9736fAFc030Cf4971615D68b2', + '0xD9cFF1bc89f705EaB2579fA2DC86E9a6F971370a', + '0x9C5D3C3AbD633b8eA68C5a51325f8630DC620AD9', + '0x2F1C60bA96ec6925fA9bBbFC9Eb7908bD35Bc224', + '0x72e0906558e4Ee528974cD7803bfF12d9f2869C3', + '0x9377f17ABde96887943e5Fcc92Db034c76820529', + '0xA5492Baf06692C0051D69D31458D536Bacc08651', + '0x75809d59A9a69226972DbB84cB2D1851C5cD0CbF', + '0x6f4DBcfC81Dd22AE3EDeC5f9724E43cba8C92E50', + '0xA8fcc1BA1D4893a4894206986B65F652D5FE04AB', + '0xA76Ee91c6E51D248782d7C81826dF91522a6EF96', + '0x7E11ce3e893081B111b720dF29669dEf14e81cDE', + '0x8E882A56604F2b5735EA979bD6fa06C064d2f3f9', + '0xf7Be091BCBbB79f3D9029A25Dc94bC8FDd134EaC', + // aArbUSDC + '0x8F9259a355933737F8F11f95d32460eCd5ED0706', + '0x3AbC7053ec29e26c1429195fd971F280422ecA80', + '0xDdaA9d3A83E3Db4f9A3Cb593787Db8D3063e3cC1', + '0xf82491Af99d6eEE7FB7a964bb8bF6eDc67a230f0', + '0xf1485cDEC97a334996913bE68a0563Ebe0c72ffC', + '0xBFD58c8150cF7048D5C149fA2bAdDD194b8416fe', + '0xBEFB3aAD1dfb1660444f0D76A91261EF755B2B86', + '0x1D2fAAd42cbF3Dc121659d856A9A405ED1067873', + '0xfA49f859a012e8b1795A81B23b21Db0bD40e7770', + '0x94Fe821E8Adde08aB97530D432Ff34A724FD7830', + '0x4a5B4049a4aFae31278d36768704872f73dA67D1', + '0x08c57aE48a89b6876A76dC618972Ef1602da7ED8',], } + } + Object.keys(config).forEach(chain => { const { vaults = [], aVaults = [] } = config[chain] module.exports[chain] = { @@ -52,3 +96,12 @@ Object.keys(config).forEach(chain => { } } }) + +module.exports.ethereum.staking = staking([ + '0xBEFB3aAD1dfb1660444f0D76A91261EF755B2B86', + '0xBFD58c8150cF7048D5C149fA2bAdDD194b8416fe', + '0xfA49f859a012e8b1795A81B23b21Db0bD40e7770', + '0x94Fe821E8Adde08aB97530D432Ff34A724FD7830', + '0x4a5B4049a4aFae31278d36768704872f73dA67D1', + '0x08c57aE48a89b6876A76dC618972Ef1602da7ED8', +], '0x57b96d4af698605563a4653d882635da59bf11af') From 70d6679f2d2255ea39140cbc2ac523f7b01cbc13 Mon Sep 17 00:00:00 2001 From: Jia Jian Goi Date: Tue, 23 Jul 2024 14:23:24 +0800 Subject: [PATCH 815/855] feat(bake): add new addresses (#11078) --- projects/cake-defi/index.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/projects/cake-defi/index.js b/projects/cake-defi/index.js index da5cdbe65057..8d2bcba9ddc2 100644 --- a/projects/cake-defi/index.js +++ b/projects/cake-defi/index.js @@ -3,11 +3,22 @@ const { cexExports } = require('../helper/cex') const config = { ethereum: { owners: [ + '0xc5a0a17eabbb0e64dcd567b5670c8c5d5c34128c', '0x94fa70d079d76279e1815ce403e9b985bccc82ac', + '0xb5e2d774c4672aa4297272f62d61e8a041175cb5', + '0x3ec49e613ae70beb0631d7666f46d4ff2813932e', + '0xC889Faf456439Fb932B9Ce3d4F43D8078177fD29', + '0x883C4599C455Fc337CA43BF9d63eBA45F995a769', + ], }, + polygon: { + owners: [ + '0xaa6c7eAF827E04185D7A6a6A6156195AB5BDBE4c', + ] + }, bitcoin: { - owners: ['38pZuWUti3vSQuvuFYs8Lwbyje8cmaGhrT'] + owners: ['3GcSHxkKY8ADMWRam51T1WYxYSb2vH62VL'] }, litecoin: { owners: ['MLYQxJfnUfVqRwfYXjDJfmLbyA77hqzSXE'] @@ -15,7 +26,8 @@ const config = { } module.exports = cexExports(config) -module.exports.methodology = 'As Cake DeFi is a CeDeFi platform, its assets associated to the staking nodes are not included for the purposes of the TVL calculation. In this case, there are approximately $121.4M in DFI chain (nodes), and around $24.7M in ETH chain (nodes) as of 31 March 2023. The calculation methodology are as follows: DFI: 10846 (nodes) * 20K (collateral per node) *$0.56 = $121.4M. ETH: 430 * 32 *$1800 = $24.7M, We also do not track bitcoincash and doge chain. Cake DeFi publishes information on all its nodes on its Transparency page here: https://cakedefi.com/transparency.', +module.exports.methodology = 'As Bake.io (formerly Cake DeFi) is a CeDeFi platform, its assets associated to the staking nodes are not included for the purposes of the TVL calculation. In this case, there are approximately $121.4M in DFI chain (nodes), and around $24.7M in ETH chain (nodes) as of 31 March 2023. The calculation methodology are as follows: DFI: 10846 (nodes) * 20K (collateral per node) *$0.56 = $121.4M. ETH: 430 * 32 *$1800 = $24.7M, we also do not track Bitcoin Cash and Dogecoin. Bake.io publishes information on all its nodes on its Transparency page here: https://bake.io/transparency.', module.exports.hallmarks = [ [1680516000, "Change Of Wallets"], + [1700784000, "Change Of Wallets"] ] \ No newline at end of file From fcc13c3bbb84b9565b8f5dcc54126100a63a9dcc Mon Sep 17 00:00:00 2001 From: 0xulti <125024743+tivelprotocol@users.noreply.github.com> Date: Tue, 23 Jul 2024 13:27:37 +0700 Subject: [PATCH 816/855] add scroll chain (#11076) * tivel finance v1 * code refactor * add scroll chain --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/tivel-finance/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/tivel-finance/index.js b/projects/tivel-finance/index.js index 8cff75dd4c53..42e2ab819d16 100644 --- a/projects/tivel-finance/index.js +++ b/projects/tivel-finance/index.js @@ -1,5 +1,6 @@ const config = { - era: '0x846FcA826196B3D674fd1691Bb785F3E4216bc0F' + era: '0x846FcA826196B3D674fd1691Bb785F3E4216bc0F', + scroll: '0x30e44f48c9542533cB0b6b7dA39F6d42F26D843f', } Object.keys(config).forEach(chain => { From 7b982d2e8b4794dd50cfd61561cc182e6ca25114 Mon Sep 17 00:00:00 2001 From: EdgarRBL <99257947+EdgarRBL@users.noreply.github.com> Date: Tue, 23 Jul 2024 03:42:34 -0300 Subject: [PATCH 817/855] feat: Kinetic protocol (#11074) * feat: Kinetic protocol * fix: remove cether address --- projects/kinetic/index.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 projects/kinetic/index.js diff --git a/projects/kinetic/index.js b/projects/kinetic/index.js new file mode 100644 index 000000000000..ea78e37d2f78 --- /dev/null +++ b/projects/kinetic/index.js @@ -0,0 +1,5 @@ +const { compoundExports2 } = require('../helper/compound') + +module.exports = { + flare: compoundExports2({ comptroller: '0x8041680Fb73E1Fe5F851e76233DCDfA0f2D2D7c8' }), +} From a56c4ce8cb3da0acf060b11386735b951b0fa366 Mon Sep 17 00:00:00 2001 From: shafu Date: Tue, 23 Jul 2024 14:21:23 +0300 Subject: [PATCH 818/855] remove v1 branch (#11077) --- projects/dyad/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/dyad/index.js b/projects/dyad/index.js index 95297e64b14b..ec95d77124b5 100644 --- a/projects/dyad/index.js +++ b/projects/dyad/index.js @@ -1,6 +1,5 @@ const ADDRESSES = require("../helper/coreAssets.json"); const vaults = [ - "0xcF97cEc1907CcF9d4A0DC4F492A3448eFc744F6c", "0x7aE80418051b2897729Cbdf388b07C5158C557A1", "0x4fde0131694ae08c549118c595923ce0b42f8299", "0x7e5f2b8f089a4cd27f5b6b846306020800df45bd", From 08bf79edae6b4e98dfd34bcb16fc0e103281f635 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Tue, 23 Jul 2024 15:33:40 +0100 Subject: [PATCH 819/855] add sei to definitely (#11085) --- projects/definitely/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/projects/definitely/index.js b/projects/definitely/index.js index b37d5d982f5b..206bd1e48446 100644 --- a/projects/definitely/index.js +++ b/projects/definitely/index.js @@ -1,14 +1,22 @@ const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') const contract = "0x6aB5242fCaCd0d37c39F77Ff7EabdCcac5e8D450" +const contract1 = "0x4703B92dFCb0Ad403030BF783c8EC067297B55fA" async function tvl(time, ethBlock, _b, {api}) { return sumTokens2({ tokens: [nullAddress], owner: contract, api }) } +async function tvlsei(time, ethBlock, _b, {api}) { + return sumTokens2({ tokens: [nullAddress], owner: contract1, api }) +} + module.exports = { - methodology: `We count the ETH on ${contract}`, + methodology: `We count the SEI on ${contract}`, arbitrum: { tvl + }, + sei: { + tvl:tvlsei } } \ No newline at end of file From 98b16c87b5f249ae2467a284e5965ec0fd5077de Mon Sep 17 00:00:00 2001 From: Pranav Raut Date: Tue, 23 Jul 2024 21:12:41 +0200 Subject: [PATCH 820/855] feat(defiedge): added more networks (#11087) --- projects/defiedge/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/defiedge/index.js b/projects/defiedge/index.js index 3b6dcf6465d1..b6fa4ce46e85 100644 --- a/projects/defiedge/index.js +++ b/projects/defiedge/index.js @@ -27,14 +27,19 @@ module.exports = { const config = { arbitrum: { network: "arbitrum" }, + astrzk: { network: "astarZkEVM" }, avax: { network: "avalanche" }, base: { network: "base" }, bsc: { network: "bsc" }, era: { network: "zksyncEra" }, ethereum: { network: "mainnet" }, + linea: { network: "linea" }, + mantle : { network: "mantle" }, + moonbeam: { network: "moonbeam" }, optimism: { network: "optimism" }, polygon_zkevm: { network: "zkEVM" }, polygon: { network: "polygon" }, + xlayer: { network: "xLayer" }, }; Object.keys(config).forEach((chain) => { From f9a4263d5df3c7abfa6ec8064e96d2d65e0396b0 Mon Sep 17 00:00:00 2001 From: sthitpragnya-ethosx <115890450+sthitpragnya-ethosx@users.noreply.github.com> Date: Wed, 24 Jul 2024 00:43:35 +0530 Subject: [PATCH 821/855] adding new markets (#11082) * ethosx operps tvl * added new markets --- projects/ethosx/index.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/projects/ethosx/index.js b/projects/ethosx/index.js index b6969293c407..adbad62cd45d 100644 --- a/projects/ethosx/index.js +++ b/projects/ethosx/index.js @@ -6,6 +6,22 @@ const ETH_CALL_CONTROLLER_ADDRESS = const BTC_PUT_CONTROLLER_ADDRESS = "0x3273C69432b2B0D808499F4Cc56113Be6c7A673F"; const BTC_CALL_CONTROLLER_ADDRESS = "0x18AadF2a220D3FEb958Ed161263185f0805D11a1"; +const PEPE_PUT_CONTROLLER_ADDRESS = + "0x9c50C12d3A569cD4285c62cd7A889cE7BCfC12e9"; +const PEPE_CALL_CONTROLLER_ADDRESS = + "0x176a49747a97dD0735a2186aEbe1d1400E3eBf8b"; +const WIF_PUT_CONTROLLER_ADDRESS = "0xA1269bF2F05aA11363352eA0cf4E5a071Ef9cF29"; +const WIF_CALL_CONTROLLER_ADDRESS = + "0x47D5710A4ABd8B47e9ec48f6cB04cDBcfBFCA382"; +const DOGE_PUT_CONTROLLER_ADDRESS = + "0x9c50C12d3A569cD4285c62cd7A889cE7BCfC12e9"; +const DOGE_CALL_CONTROLLER_ADDRESS = + "0x176a49747a97dD0735a2186aEbe1d1400E3eBf8b"; +const FLOKI_PUT_CONTROLLER_ADDRESS = + "0xA1269bF2F05aA11363352eA0cf4E5a071Ef9cF29"; +const FLOKI_CALL_CONTROLLER_ADDRESS = + "0x47D5710A4ABd8B47e9ec48f6cB04cDBcfBFCA382"; + const USDC_ARB_ADDRESS = ADDRESSES.arbitrum.USDC_CIRCLE; const USDC_BSC_ADDRESS = ADDRESSES.bsc.USDC; @@ -19,6 +35,10 @@ module.exports = { ETH_CALL_CONTROLLER_ADDRESS, BTC_PUT_CONTROLLER_ADDRESS, BTC_CALL_CONTROLLER_ADDRESS, + PEPE_PUT_CONTROLLER_ADDRESS, + PEPE_CALL_CONTROLLER_ADDRESS, + WIF_PUT_CONTROLLER_ADDRESS, + WIF_CALL_CONTROLLER_ADDRESS, ], tokens: [USDC_ARB_ADDRESS], }), @@ -30,6 +50,10 @@ module.exports = { ETH_CALL_CONTROLLER_ADDRESS, BTC_PUT_CONTROLLER_ADDRESS, BTC_CALL_CONTROLLER_ADDRESS, + DOGE_CALL_CONTROLLER_ADDRESS, + DOGE_PUT_CONTROLLER_ADDRESS, + FLOKI_CALL_CONTROLLER_ADDRESS, + FLOKI_PUT_CONTROLLER_ADDRESS, ], tokens: [USDC_BSC_ADDRESS], }), From d2aec23803690425df831bbadeaaa7c7f113862b Mon Sep 17 00:00:00 2001 From: mrben1 Date: Wed, 24 Jul 2024 16:52:55 +1200 Subject: [PATCH 822/855] New addresses for TVL (#11091) * Added ape.store tvm * added new router addresses --- projects/apestore/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/apestore/index.js b/projects/apestore/index.js index 1efd12a64c89..f4350642fbfb 100644 --- a/projects/apestore/index.js +++ b/projects/apestore/index.js @@ -4,7 +4,9 @@ const coreAssets = require("../helper/coreAssets.json"); const routers = [ "0xF6Af6C034E92694A4c79569B03543d580df402D7", "0x992D40d9ED8937Bb0Ad3c0Ba99713072Ae0a05b3", - "0x135De7F9223C76b7d0278FFe854eC480D37FE906" + "0x135De7F9223C76b7d0278FFe854eC480D37FE906", + "0x3ccC78545F675A188B7521F7f4b4791995752635", + "0x0bf8edd756ff6caf3f583d67a9fd8b237e40f58a" ]; const tokens = [coreAssets.null]; From 0ac31e4e3789b14cf5a81a1b2f8c1a820d33ec07 Mon Sep 17 00:00:00 2001 From: Boson Date: Wed, 24 Jul 2024 08:56:36 +0300 Subject: [PATCH 823/855] add Boson adapter (#11092) Co-authored-by: bosonfinance --- projects/boson/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/boson/index.js diff --git a/projects/boson/index.js b/projects/boson/index.js new file mode 100644 index 000000000000..73a6519fdbbf --- /dev/null +++ b/projects/boson/index.js @@ -0,0 +1,17 @@ +const { staking } = require("../helper/staking"); + +module.exports = { + ethereum: { + tvl: () => ({}), + staking: staking( + [ + "0x6244bc0d4b661526c0c62c3610571cd1ac9df2dd", + "0xbacc083795846a67b0782327a96622447ddafe6c", + "0x081a52f02e51978ad419dd7894d7ae3555f8bc26", + "0x3ed0c99c8e8eb94438837cc8a08ca3bb187424cf", + "0x3810d9d6685812af6ef4257de0542ecdba9bfd95" + ], + "0xC477D038d5420C6A9e0b031712f61c5120090de9" + ), + }, +}; From ca2269b6b00b12c90892e18bde87d570e879429a Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Wed, 24 Jul 2024 08:07:10 +0200 Subject: [PATCH 824/855] feat: Adapter Convergence-fi (#11081) * feat: Add Convergence-fi * rm abi * minor fix --------- Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/convergence-fi/index.js | 82 ++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 projects/convergence-fi/index.js diff --git a/projects/convergence-fi/index.js b/projects/convergence-fi/index.js new file mode 100644 index 000000000000..140814ebf06d --- /dev/null +++ b/projects/convergence-fi/index.js @@ -0,0 +1,82 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +const tower = "0xB0Afc8363b8F36E0ccE5D54251e20720FfaeaeE7"; +const viewer = "0xA3A8cDA21f50b6737385E46FC9495a9998B05Ff0"; +const CVG = "0x97efFB790f2fbB701D88f89DB4521348A2B77be8"; + +const stkCVGETH = "0x4b3Bd8906083bDE267A79E4131AF7a6f723960c8"; +const stkCVGCVGSDT = "0x865E59EBc3EE9EdD5656cD79b382f5153E466545"; +const cvgCVX = "0x2191DF768ad71140F9F3E96c1e4407A4aA31d082"; + +const abi = { + getSdtStakings: `function getSdtStakings(uint256 _cursorStart, uint256 _lengthDesired) view returns (tuple(address stakingContract, string stakingName)[])`, + getGlobalViewCvgSdtStaking: + "function getGlobalViewCvgSdtStaking(address _stakingContract) view returns (tuple(address cvgSdt, address stakingAddress, uint256 cvgCycle, uint256 previousTotal, uint256 actualTotal, uint256 nextTotal) globalViewCvgSdtStaking)", + staking_token: "function staking_token() view returns (address)", + token: "function token() view returns (address)", +}; + +const getSdtStakingsAddresses = async (api, tower, limit) => { + const addresses = await api.call({ + target: tower, + params: [0, limit], + abi: abi.getSdtStakings, + }); + + return addresses.map(({ stakingContract }) => stakingContract); +}; + +const getsdtStakingViews = async (api, viewer, sdtStakings) => { + const stakingdatasRes = await api.multiCall({ + target: viewer, + calls: sdtStakings, + abi: abi.getGlobalViewCvgSdtStaking, + }); + + const stakingDatas = stakingdatasRes.map(({ cvgSdt, actualTotal }) => ({ + staking: cvgSdt, + balance: actualTotal, + })); + + const stakingTokens = await api.multiCall({ + calls: stakingDatas.map(({ staking }) => ({ target: staking })), + abi: abi.staking_token, + }); + + + const deeperUnwrapTokens = await api.multiCall({ + calls: stakingTokens, + abi: abi.token, + permitFailure: true, + }); + + return deeperUnwrapTokens.map((deeperToken, index) => { + const token = deeperToken ?? stakingTokens[index]; + const balance = stakingDatas[index].balance; + api.add(token, balance); + }); +}; + +const tvl = async (api) => { + const getSdtStakings = await getSdtStakingsAddresses(api, tower, 1000); + await getsdtStakingViews(api, viewer, getSdtStakings); + api.removeTokenBalance(CVG); + return sumTokens2({ api, resolveLP: true }); +}; + +const staking = async (api) => { + return api.sumTokens({ + token: CVG, + owners: [stkCVGETH, stkCVGCVGSDT, cvgCVX], + }); +}; + +module.exports = { + doublecounted: true, + methodology: + "TVL represents the values deposited in each of the StakeDao and Convex strategies", + ethereum: { + tvl, + staking, + }, +}; From e61e695a2c13cb0e848bc15e143948fb77896086 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Wed, 24 Jul 2024 09:53:14 +0100 Subject: [PATCH 825/855] add bitfi adapter (#11094) --- projects/bitfi/index.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 projects/bitfi/index.js diff --git a/projects/bitfi/index.js b/projects/bitfi/index.js new file mode 100644 index 000000000000..4421b9d9845f --- /dev/null +++ b/projects/bitfi/index.js @@ -0,0 +1,31 @@ +const sdk = require('@defillama/sdk'); +const { sumTokensExport } = require('../helper/sumTokens'); + +const owners = [ +'1JA46eiDpfx589wawn5RvtEXgwc518QfhZ', +'368vZZKUWDFZRLWMFNRJzHo1HnibNeAJir', +'33hE9Wq65kjbiLsGD1NYwwNatP6hbsZv5H', +'32GU8Jux7SbsEbaAaLUnEQmc6JemLF6BUb', +'3CP5WJ2JSLCew7SETWUe5FxpBGrekMBiwk', +'39Fvw2Ho1fEkyDsos5sNTN5iMJZKzTL526', +'3Kptt4TZZRcjuGH8ikoQ8mV1TVxq45dnuS', +'335DRGzLLG2tu4H4PnFBHYAwcj5pvV8zei', +'3G4sMXWAAVTvTXTksr8u9zuu7W8RKsicEz', +'bc1qu4ru2sph5jatscx5xuf0ttka36yvuql7hl5h4c', +'bc1q3smt9ut40eld6tgn42sdlp9yrx98s90unqw3pl', +'bc1q3q7afjarz7l6v49538qs2prffhtawf38ss85k8', +'bc1qw4vp94e9egkaxc04qsu5z9aq5pqpku2p6pzer8', +'bc1qqg3cdyadq25zn99sdprr4lgpsxg2za998eygy8', +'bc1q6dtp7ayaj5k2zv0z5ayhkdsvmtvdqgyaa9zs53', +'bc1qaajdlp5yrj5f77wq2ndtfqnmsamvvxhpy95662zkzykn9qhvdgys580hcs', +'bc1qcmmkxfp2rawrp6yx55rez9jcqdnxtam8jhu2v2d9kz46upf948wq2usauv', +] + +module.exports = { + methodology: "BTC on btc chain", + bitcoin: { + tvl: sdk.util.sumChainTvls([ + sumTokensExport({ owners }), + ]), + }, +}; From 7a623c6e0acc8edc1b3e3c8e86a41f2e1a7cc53b Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Wed, 24 Jul 2024 10:14:47 +0100 Subject: [PATCH 826/855] move tbtc from eth to btc (#11095) --- projects/tbtc/index.js | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/projects/tbtc/index.js b/projects/tbtc/index.js index 876b5934b93f..0ac5ec61809c 100644 --- a/projects/tbtc/index.js +++ b/projects/tbtc/index.js @@ -1,13 +1,35 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require('@defillama/sdk') +const sdk = require('@defillama/sdk'); +const { sumTokensExport } = require('../helper/sumTokens'); -async function tvl(ts, block, _) { - return { - [ADDRESSES.ethereum.tBTC]: (await sdk.api.erc20.totalSupply({ target: ADDRESSES.ethereum.tBTC, block })).output - } -} +const owners = [ +'bc1ql6yu2xywnmslnameu6376wzut4nwnafdj483ez', +'bc1q7uf083n9rsn8zgds0eg9kyzugjcz7pe4sq2jzf', +'bc1ql54ftzuh6k76wcn7330vlwxahhth8lqjc55lkc', +'bc1qhq052tz9pvjp4x2vu6ndc4rlpxesc9dz37uqt5', +'bc1q3rtrkav9l6m0e5vxya77mtlvqh8rk0eyf74277', +'bc1qde4ggwj2jp5tetjztfml3peyvwzvpwtr9ng6we', +'bc1qrzk68h8l2kvkvky00l8xvwz45pr4mmtyfpf0j8', +'bc1qkza8dm07rr5pxedam5w5v5g627j0lrwwzncsvd', +'bc1qrw5tn47ea05seyetlywltrdk06rldpk746etc9', +'bc1qcwkzqwfyqc7frec2g0rmjlrsw3d8vdwxrksn62', +'bc1qpdrzltkxg742jk8tr0pe7hltkme5p25ezmllz6', +'bc1qpqrm609emjpl35v2fu3frq0r87d29vm8ffygkf', +'bc1qhqlyelhwffrwdz4xzfe5whqxxft8quzvdscc8g', +'bc1qpaz0dp264pakv6f6ljmg2f3x27xmsj6la33mhc', +'bc1q9alywjvrsxu024a2m25lltl6h070l6lqfya45c', +'bc1q8cwt90ck2uvzwqj7q3dwvwclnprz7rk4qzk05k', +'bc1q2xygt58u9r6hc32uxruh93ap8q9898rep04xdk', +'bc1q4rheadle4sgdgdatkeuqfm90qv3wpkd7q8yp0m', +'bc1qrflqxl5pwet9tgv4uex6a6srmh3u4cvefeq0h6', +'bc1qqu0nw5n5n6uvjw5m3hwh8zvzckd8cnth8nt80k', +'bc1q3las75huex5jjhunheqycegw2x8fvhc6y0q3nu', +] module.exports = { - ethereum: { tvl }, - methodology: `TVL for tBTC consists of the BTC deposits in custody that were used to mint tBTC` -} + methodology: "BTC on btc chain", + bitcoin: { + tvl: sdk.util.sumChainTvls([ + sumTokensExport({ owners }), + ]), + }, +}; From 6025488ea574923c61c86119fe443d3548a2c812 Mon Sep 17 00:00:00 2001 From: YFX <73627416+yfxcom@users.noreply.github.com> Date: Wed, 24 Jul 2024 19:09:15 +0800 Subject: [PATCH 827/855] add YFX V4 info on Base (#11093) * add YFX V4 info on Base * minor fix * minor fix --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/yfx-v4/index.js | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/projects/yfx-v4/index.js b/projects/yfx-v4/index.js index fb9094f965f1..7bca17e6ab44 100644 --- a/projects/yfx-v4/index.js +++ b/projects/yfx-v4/index.js @@ -1,15 +1,19 @@ -const manager = '0x29bd0372A8A087e4d34d4098259Cd298d554BAc4'; -const vault = '0x50b516a9DB620aB67A33d895DAF4Bd1c294b9517'; - -async function tvl(api) { - let pools = await api.call({ target: manager, abi: "address[]:getAllPools", }); - const tokens = await api.multiCall({ abi: 'address:getBaseAsset', calls: pools }) - return api.sumTokens({ owner: vault, tokens }) +const config = { + arbitrum: { manager: "0xFE1ca968afbadEd3BF2CB685451C858Deb46Ce31", vault: "0x50b516a9DB620aB67A33d895DAF4Bd1c294b9517" }, + base: { manager: "0xfD38EaD11eaa5D566dc331848fF495B3D5cfb79F", vault: "0xfcDaC5524EC86223216643384f5c59C65560d673" } } module.exports = { methodology: 'Count balance of each pool from the Vault', - arbitrum: { - tvl, - }, -} \ No newline at end of file +} + +Object.keys(config).forEach(chain => { + const { vault, manager } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + let pools = await api.call({ target: manager, abi: "address[]:getAllPools", }); + const tokens = await api.multiCall({ abi: 'address:getBaseAsset', calls: pools }) + return api.sumTokens({ owner: vault, tokens }) + } + } +}) From a5fb116c350dd2756fb2e2bd41f2f4f5b36aaa27 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Wed, 24 Jul 2024 12:36:37 +0100 Subject: [PATCH 828/855] add fjord treasury adapter (#11097) --- projects/treasury/fjord-foundry.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/treasury/fjord-foundry.js diff --git a/projects/treasury/fjord-foundry.js b/projects/treasury/fjord-foundry.js new file mode 100644 index 000000000000..df947c9c8626 --- /dev/null +++ b/projects/treasury/fjord-foundry.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { treasuryExports, nullAddress } = require("../helper/treasury"); + +const treasury = "0xcA518c4DB97ECCe85cC82DE3C2B93D8f8b536ca5" // https://x.com/dcfgod/status/1815970805878034797 + +module.exports = treasuryExports({ + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.USDT + ], + owners: [treasury], + }, + +}) \ No newline at end of file From f074fd8f95d022db7f9d72caa909c9b6f66beec5 Mon Sep 17 00:00:00 2001 From: Addis Belete Date: Wed, 24 Jul 2024 14:37:26 +0300 Subject: [PATCH 829/855] feat: view Arbitrum TVL on DefiLlama (#11096) * feat: list protocols on DefiLlama (#10) * feat: sum tvls of all protocols per chain (#11) * feat: support prime in DefiLlama (#12) * feat: init * feat: support prime * fix: fromBlock val * fix: add missed protocols perchain * feat: init * doc: add instruction to add network and protocol * chore: remove log * feat: add prime in arbitrum * doc: add new protocol and network Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Addis Belete * feat: sync --------- Signed-off-by: Addis Belete Co-authored-by: George Ciubotaru Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- projects/clearpool/index.js | 6 +++++- projects/clearpool/readme.md | 31 +++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 projects/clearpool/readme.md diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index 4ba744f8f8a7..1de97ee2fbfd 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -65,6 +65,10 @@ const config = { factory: "0x99C10A7aBd93b2db6d1a2271e69F268a2c356b80", fromBlock: 113112037, }, + prime: { + factory: "0x44fEF0fAB3A96CA34b06d5142350Ef9223F65A7e", + fromBlock: 226174706, + }, }, [CHAIN.MANTLE]: { dynamic: { @@ -212,4 +216,4 @@ Object.keys(config).forEach((chain) => { module.exports[chain] = { tvl, borrowed } }) -module.exports.ethereum.staking = stakings(singleStakingContracts, CPOOL) +module.exports.ethereum.staking = stakings(singleStakingContracts, CPOOL) \ No newline at end of file diff --git a/projects/clearpool/readme.md b/projects/clearpool/readme.md new file mode 100644 index 000000000000..3848cc0968a8 --- /dev/null +++ b/projects/clearpool/readme.md @@ -0,0 +1,31 @@ +# Add a new protocol and network + +## To add a new protocol or network +``` +1. Open https://squid.subsquid.io/cpool-squid/v/v1/graphql on browser +``` + +``` +2. Query `defillamaInfo` + +ex. query MyQuery { + defillamaInfo { + poolFactory + protocol + } +} +``` + +``` +3. Check the newly added protocols and networks, and proceed to hardcode their values in index.js, following the approach used for the existing networks and protocols. +``` +``` +4. run `npm i -f` to install dependencies. +``` + +``` +5. run `node test.js projects/clearpool/index.js` to test. +``` + + + From c55fac5fd5c87b3a1c4af5b841625d225fbf40a9 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 24 Jul 2024 15:43:33 +0100 Subject: [PATCH 830/855] add mantle --- projects/yieldyak/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/projects/yieldyak/index.js b/projects/yieldyak/index.js index be43bc712806..df2b5ef12a64 100644 --- a/projects/yieldyak/index.js +++ b/projects/yieldyak/index.js @@ -23,6 +23,15 @@ async function arbiTvl(api) { api.add(token, vals[i]) }) } +async function mantleTvl(api) { + const farms = await getConfig('yieldyak/mantle', 'https://staging-api.yieldyak.com/5000/farms') + const tokens = await api.multiCall({ abi: 'address:depositToken', calls: farms.map(i => i.address), permitFailure: true, }) + const vals = await api.multiCall({ abi: 'uint256:totalDeposits', calls: farms.map(i => i.address), permitFailure: true, }) + tokens.forEach((token, i) => { + if (!token || !vals[i]) return; + api.add(token, vals[i]) + }) +} const masterYak = "0x0cf605484A512d3F3435fed77AB5ddC0525Daf5f" const yakToken = "0x59414b3089ce2af0010e7523dea7e2b35d776ec7" @@ -33,4 +42,5 @@ module.exports = { staking: staking(masterYak, yakToken), }, arbitrum: { tvl: arbiTvl }, + mantle: { tvl: mantleTvl} } \ No newline at end of file From 191a2d2998265536a0f6a53d9bb1a9a830cd4f1b Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 24 Jul 2024 16:26:11 +0100 Subject: [PATCH 831/855] update logic for yak token --- projects/yieldyak/abi.json | 3 ++- projects/yieldyak/index.js | 46 ++++++++++++++++++++++++++++---------- 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/projects/yieldyak/abi.json b/projects/yieldyak/abi.json index c64c45205ed4..4d9b0decbe09 100644 --- a/projects/yieldyak/abi.json +++ b/projects/yieldyak/abi.json @@ -2,5 +2,6 @@ "depositToken": "address:depositToken", "totalDeposits": "uint256:totalDeposits", "token": "address:token", - "getRatio": "uint256:getRatio" + "getRatio": "uint256:getRatio", + "symbol": "string:symbol" } \ No newline at end of file diff --git a/projects/yieldyak/index.js b/projects/yieldyak/index.js index df2b5ef12a64..71a3c2c3066b 100644 --- a/projects/yieldyak/index.js +++ b/projects/yieldyak/index.js @@ -6,31 +6,53 @@ const graphUrl = sdk.graph.modifyEndpoint('7oSYYdK5RKmqggdzFyfUnojP6puDAj31C4ezD const graphQuery = `{ farms(first: 1000) { id }}`; async function tvl(api) { - const { farms } = await cachedGraphQuery('yieldyak/avax', graphUrl, graphQuery) - const tokens = await api.multiCall({ abi: 'address:depositToken', calls: farms.map(i => i.id), permitFailure: true, }) - const vals = await api.multiCall({ abi: 'uint256:totalDeposits', calls: farms.map(i => i.id), permitFailure: true, }) + const { farms } = await cachedGraphQuery('yieldyak/avax', graphUrl, graphQuery); + const tokens = await api.multiCall({ + abi: 'address:depositToken', + calls: farms.map(i => i.id), + permitFailure: true, + }); + const vals = await api.multiCall({ + abi: 'uint256:totalDeposits', + calls: farms.map(i => i.id), + permitFailure: true, + }); + const symbols = await api.multiCall({ + abi: 'string:symbol', + calls: tokens.map(token => ({ target: token })), + permitFailure: true, + }); + + const excludedAddress = '0x59414b3089ce2af0010e7523dea7e2b35d776ec7'; + const excludedSymbol = 'YAK'; + tokens.forEach((token, i) => { - if (!token || !vals[i]) return; - api.add(token, vals[i]) - }) + if (!token || !vals[i] || token === excludedAddress || symbols[i] === excludedSymbol) return; + api.add(token, vals[i]); + }); } + async function arbiTvl(api) { const farms = await getConfig('yieldyak/arbi', 'https://staging-api.yieldyak.com/42161/farms') const tokens = await api.multiCall({ abi: 'address:depositToken', calls: farms.map(i => i.address), permitFailure: true, }) const vals = await api.multiCall({ abi: 'uint256:totalDeposits', calls: farms.map(i => i.address), permitFailure: true, }) + const excludedAddress = '0x7f4dB37D7bEb31F445307782Bc3Da0F18dF13696'; + tokens.forEach((token, i) => { - if (!token || !vals[i]) return; - api.add(token, vals[i]) - }) + if (!token || !vals[i] || token === excludedAddress) return; + api.add(token, vals[i]); + }); } async function mantleTvl(api) { const farms = await getConfig('yieldyak/mantle', 'https://staging-api.yieldyak.com/5000/farms') const tokens = await api.multiCall({ abi: 'address:depositToken', calls: farms.map(i => i.address), permitFailure: true, }) const vals = await api.multiCall({ abi: 'uint256:totalDeposits', calls: farms.map(i => i.address), permitFailure: true, }) + const excludedAddress = '0x7f4dB37D7bEb31F445307782Bc3Da0F18dF13696'; + tokens.forEach((token, i) => { - if (!token || !vals[i]) return; - api.add(token, vals[i]) - }) + if (!token || !vals[i] || token === excludedAddress) return; + api.add(token, vals[i]); + }); } const masterYak = "0x0cf605484A512d3F3435fed77AB5ddC0525Daf5f" From 370a5b0c9dcc05992daac28ccf2877c78b75ab43 Mon Sep 17 00:00:00 2001 From: realdealshaman Date: Wed, 24 Jul 2024 16:41:16 +0100 Subject: [PATCH 832/855] add staking for arbitrum and mantle --- projects/yieldyak/index.js | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/projects/yieldyak/index.js b/projects/yieldyak/index.js index 71a3c2c3066b..c851ea55f7dd 100644 --- a/projects/yieldyak/index.js +++ b/projects/yieldyak/index.js @@ -5,23 +5,16 @@ const sdk = require('@defillama/sdk') const graphUrl = sdk.graph.modifyEndpoint('7oSYYdK5RKmqggdzFyfUnojP6puDAj31C4ezDGrgVfk9') const graphQuery = `{ farms(first: 1000) { id }}`; -async function tvl(api) { - const { farms } = await cachedGraphQuery('yieldyak/avax', graphUrl, graphQuery); - const tokens = await api.multiCall({ - abi: 'address:depositToken', - calls: farms.map(i => i.id), - permitFailure: true, - }); - const vals = await api.multiCall({ - abi: 'uint256:totalDeposits', - calls: farms.map(i => i.id), - permitFailure: true, - }); +async function avaxTvl(api) { + const farms = await getConfig('yieldyak/avax', 'https://staging-api.yieldyak.com/43114/farms') + const tokens = await api.multiCall({ abi: 'address:depositToken', calls: farms.map(i => i.address), permitFailure: true, }) + const vals = await api.multiCall({ abi: 'uint256:totalDeposits', calls: farms.map(i => i.address), permitFailure: true, }) const symbols = await api.multiCall({ abi: 'string:symbol', calls: tokens.map(token => ({ target: token })), permitFailure: true, }); + const excludedAddress = '0x59414b3089ce2af0010e7523dea7e2b35d776ec7'; const excludedSymbol = 'YAK'; @@ -57,12 +50,21 @@ async function mantleTvl(api) { const masterYak = "0x0cf605484A512d3F3435fed77AB5ddC0525Daf5f" const yakToken = "0x59414b3089ce2af0010e7523dea7e2b35d776ec7" +const arbiYyStaking = "0xbb82b43Bf2057B804253D5Db8c18A647fC1f3403" +const mantleYyStaking = "0xF54D65AeB65b093A6BF717b541894ee6471A6CE1" +const bridgedYakToken = "0x7f4dB37D7bEb31F445307782Bc3Da0F18dF13696" module.exports = { avax: { - tvl, + tvl:avaxTvl, staking: staking(masterYak, yakToken), }, - arbitrum: { tvl: arbiTvl }, - mantle: { tvl: mantleTvl} + arbitrum: { + tvl: arbiTvl, + staking: staking(arbiYyStaking, bridgedYakToken), + }, + mantle: { + tvl: mantleTvl, + staking: staking(mantleYyStaking, bridgedYakToken), + } } \ No newline at end of file From 6f3a66dfaf77de95f862bf0cc92cf775bd068fc5 Mon Sep 17 00:00:00 2001 From: leo-ship-it <64172050+leo-ship-it@users.noreply.github.com> Date: Wed, 24 Jul 2024 18:06:01 +0200 Subject: [PATCH 833/855] Add WaterNeuron (#11099) * init * some fixes * revert * fix lint * Update index.js --------- Co-authored-by: Pa Nayotis Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/waterneuron/index.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 projects/waterneuron/index.js diff --git a/projects/waterneuron/index.js b/projects/waterneuron/index.js new file mode 100644 index 000000000000..cb595e9f0ff3 --- /dev/null +++ b/projects/waterneuron/index.js @@ -0,0 +1,19 @@ +const { get } = require("../helper/http"); + +const url = 'https://tsbvt-pyaaa-aaaar-qafva-cai.raw.icp0.io/api/metadata'; + +async function tvl() { + const metadata = await get(url) + const staked_icp = metadata.tracked_6m_stake + metadata.neuron_8y_stake_e8s + return { + "coingecko:internet-computer": staked_icp/ 1e8 + } +} + +module.exports = { + timetravel: false, + methodology: 'Staked tokens are counted as TVL.', + icp: { + tvl, + }, +} From d782989999eabbc02c2f1be8f617c812a84437af Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Wed, 24 Jul 2024 20:54:21 +0300 Subject: [PATCH 834/855] sushi v3: track europa --- projects/sushiswap-v3/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/sushiswap-v3/index.js b/projects/sushiswap-v3/index.js index b5a00d2a66be..bf38a34abe41 100644 --- a/projects/sushiswap-v3/index.js +++ b/projects/sushiswap-v3/index.js @@ -102,7 +102,7 @@ const config = { } const query = `{ - pools { + pools(first:1000) { id token0 { id } token1 { id } @@ -122,6 +122,7 @@ Object.keys(config).forEach(chain => { const config1 = { islm: { endpoint: 'https://evm-qwhwlq6ji.sushi.com/pool/api/pools?chainIds=11235&isWhitelisted=true&orderBy=liquidityUSD&orderDir=desc&protocols=SUSHISWAP_V3' }, + europa: { endpoint: 'https://web-8ngym4vde.sushi.com/pool/api/pools?chainIds=2046399126&isWhitelisted=false&orderBy=liquidityUSD&orderDir=desc&protocols=SUSHISWAP_V3,SUSHISWAP_V2' }, } Object.keys(config1).forEach(chain => { From 1246896648b894884da465e20eb495bf42ac02e0 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 24 Jul 2024 20:43:23 +0100 Subject: [PATCH 835/855] dinero to ownTokens --- projects/treasury/redacted.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/treasury/redacted.js b/projects/treasury/redacted.js index 0dcf99dcbd17..117be4193661 100644 --- a/projects/treasury/redacted.js +++ b/projects/treasury/redacted.js @@ -8,6 +8,7 @@ const treasury4 = "0xa722ebccd25adb06e5d0190b240d1f4039839822" const treasury5OP = "0x2e33a660742e813ad948fb9f7d682fe461e5fbf3" const treasury6ARB = "0x64769c53ff91b83fe9830776a4b85a1f4e1edaad" const BTRF = "0xc55126051B22eBb829D00368f4B12Bde432de5Da" +const DINERO = "0x6DF0E641FC9847c0c6Fde39bE6253045440c14d3" module.exports = treasuryExports({ ethereum: { @@ -23,7 +24,7 @@ module.exports = treasuryExports({ "0xBCe0Cf87F513102F22232436CCa2ca49e815C3aC", ADDRESSES.ethereum.CRV, ], - ownTokens: [BTRF], + ownTokens: [BTRF, DINERO], owners: [treasury, treasury2,treasury3,treasury4], }, optimism: { From 1643dbc255da9efe5f99f634b398b23f85804398 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 25 Jul 2024 09:43:48 +0300 Subject: [PATCH 836/855] aevo: bugfix --- projects/aevo-xyz/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/aevo-xyz/index.js b/projects/aevo-xyz/index.js index 3d205334050a..5b2b9a5faefb 100644 --- a/projects/aevo-xyz/index.js +++ b/projects/aevo-xyz/index.js @@ -27,7 +27,12 @@ module.exports = { '0x7711C90bD0a148F3dd3f0e587742dc152c3E9DDB', // Native USDC '0x90bFB3C35ddfBbA42D998414F0ff1eADD430E161', // WETH ], - fetchCoValentTokens: true, + tokens: [ + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.WETH, + ADDRESSES.arbitrum.USDC_CIRCLE, + ] }) }, optimism: { From 6b7f2b87eeba85583773a5dbe265661961e3f16d Mon Sep 17 00:00:00 2001 From: Tan Phan <57738033+tanpx12@users.noreply.github.com> Date: Thu, 25 Jul 2024 13:59:43 +0700 Subject: [PATCH 837/855] update untangled tvl and borrowed (#11089) * update untangled tvl and borrowed * update borrowed amount --- projects/untangled/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/untangled/index.js b/projects/untangled/index.js index e4c3b7bf0593..e3e00334a157 100644 --- a/projects/untangled/index.js +++ b/projects/untangled/index.js @@ -1,6 +1,7 @@ const Contracts = { SecuritizationManager: "0x4DCC7a839CE7e952Cd90d03d65C70B9CCD6BA4C2", USDC: "0xcebA9300f2b948710d2653dD7B07f33A8B32118C", + SecuritizationPoolValueService: "0x8dA445046281e6FBf2aBAd56952331B9D5Ea8d45" }; async function tvl(api) { @@ -11,8 +12,8 @@ async function tvl(api) { async function borrowed(api) { const pools = await api.fetchList({ lengthAbi: 'getPoolsLength', itemAbi: 'pools', target: Contracts.SecuritizationManager}) - const reserves = await api.multiCall({ abi: 'function getReserves() external view returns (uint256, uint256)', calls: pools }) - api.add(Contracts.USDC, reserves.map(i => i[0])) + const poolDebt = await api.multiCall({target: Contracts.SecuritizationPoolValueService, abi: "function getExpectedAssetsValue(address poolAddress) external view returns (uint256)", calls:pools}) + api.add(Contracts.USDC, poolDebt) } module.exports = { From bd41de2a8fa0648d3eef6cb4b8576165dc46d369 Mon Sep 17 00:00:00 2001 From: Hannu6 Date: Thu, 25 Jul 2024 10:04:08 +0300 Subject: [PATCH 838/855] feat(benqi): Add Avalanche Ecosystem Markets (#11102) - Include new Unitroller (0xD7c4006d33DA2A0A8525791ed212bbCD7Aca763F) for Avalanche Ecosystem Markets - Update TVL and borrowed calculations to sum both Unitrollers - Maintain existing methodology and pool2 calculations --- projects/benqi/index.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/projects/benqi/index.js b/projects/benqi/index.js index 34d42abf70dc..91882701b701 100644 --- a/projects/benqi/index.js +++ b/projects/benqi/index.js @@ -1,10 +1,18 @@ -const {compoundExports} = require('../helper/compound') -const {pool2} = require('../helper/pool2') +const { compoundExports } = require('../helper/compound') +const { pool2 } = require('../helper/pool2') +const sdk = require('@defillama/sdk'); -module.exports={ - methodology: "Same as compound, we just get all the collateral (not borrowed money) on the lending markets", - avax:{ - ...compoundExports("0x486af39519b4dc9a7fccd318217352830e8ad9b4", "avax"), +module.exports = { + methodology: "Same as compound, we just get all the collateral (not borrowed money) on the lending markets", + avax: { + tvl: sdk.util.sumChainTvls([ + compoundExports("0x486af39519b4dc9a7fccd318217352830e8ad9b4", "avax").tvl, + compoundExports("0xD7c4006d33DA2A0A8525791ed212bbCD7Aca763F", "avax").tvl, + ]), + borrowed: sdk.util.sumChainTvls([ + compoundExports("0x486af39519b4dc9a7fccd318217352830e8ad9b4", "avax").borrowed, + compoundExports("0xD7c4006d33DA2A0A8525791ed212bbCD7Aca763F", "avax").borrowed, + ]), pool2: pool2("0x784da19e61cf348a8c54547531795ecfee2affd1", "0xe530dc2095ef5653205cf5ea79f8979a7028065c") } -} +} \ No newline at end of file From 5254f16e58ece7ec6ea479d0fefb8b92353144b1 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 25 Jul 2024 10:46:04 +0300 Subject: [PATCH 839/855] update sushi v3 --- projects/sushiswap-v3/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/sushiswap-v3/index.js b/projects/sushiswap-v3/index.js index bf38a34abe41..810caad4013a 100644 --- a/projects/sushiswap-v3/index.js +++ b/projects/sushiswap-v3/index.js @@ -99,6 +99,7 @@ module.exports = uniV3Export({ const config = { filecoin: { endpoint: 'https://sushi.laconic.com/subgraphs/name/sushiswap/v3-filecoin' }, + europa: { endpoint: 'https://elated-tan-skat-graph.skalenodes.com:8000/subgraphs/name/sushi/v3-skale-europa' }, } const query = `{ @@ -122,7 +123,7 @@ Object.keys(config).forEach(chain => { const config1 = { islm: { endpoint: 'https://evm-qwhwlq6ji.sushi.com/pool/api/pools?chainIds=11235&isWhitelisted=true&orderBy=liquidityUSD&orderDir=desc&protocols=SUSHISWAP_V3' }, - europa: { endpoint: 'https://web-8ngym4vde.sushi.com/pool/api/pools?chainIds=2046399126&isWhitelisted=false&orderBy=liquidityUSD&orderDir=desc&protocols=SUSHISWAP_V3,SUSHISWAP_V2' }, + // europa: { endpoint: 'https://web-8ngym4vde.sushi.com/pool/api/pools?chainIds=2046399126&isWhitelisted=true&orderBy=liquidityUSD&orderDir=desc&protocols=SUSHISWAP_V3,SUSHISWAP_V2' }, } Object.keys(config1).forEach(chain => { From 04702f475457833567853286e7fdbb8b050d69a4 Mon Sep 17 00:00:00 2001 From: leeamijo <154820412+leeamijo@users.noreply.github.com> Date: Thu, 25 Jul 2024 16:08:34 +0800 Subject: [PATCH 840/855] feat: Add bounce bit token config (#11103) --- projects/helper/tokenMapping.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 32ac675a4510..debcf551226f 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -66,6 +66,9 @@ const fixBalancesTokens = { saakuru: { '0x557a526472372f1F222EcC6af8818C1e6e78A85f': { coingeckoId: 'oasys', decimals: 18 }, '0x739222D8A9179fE05129C77a8fa354049c088CaA': { coingeckoId: 'usd-coin', decimals: 6 } + }, + bouncebit: { + '0x8f083eafcbba2e126ad9757639c3a1e25a061a08': { coingeckoId: 'bouncebit-btc', decimals: 18 } } } From 7ac2090f56c68faaea5858f8c88c4154bb3f2d09 Mon Sep 17 00:00:00 2001 From: DeKaiju Date: Thu, 25 Jul 2024 18:58:24 +0800 Subject: [PATCH 841/855] Add PumpBTC adapter (#11104) * Add PumpBTC adapter * update methodology * Update index.js --------- Co-authored-by: john-moonbox Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/pumpbtc/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/pumpbtc/index.js diff --git a/projects/pumpbtc/index.js b/projects/pumpbtc/index.js new file mode 100644 index 000000000000..bce675989a47 --- /dev/null +++ b/projects/pumpbtc/index.js @@ -0,0 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports = { + methodology: 'TVL for pumpBTC is calculated based on the total value of WBTC, FBTC, BTCB held in the contract that were utilized in the minting process of pumpBTC.', +} +const config = { + ethereum: { owners: ['0x1fCca65fb6Ae3b2758b9b2B394CB227eAE404e1E', '0x3d9bCcA8Bc7D438a4c5171435f41a0AF5d5E6083'], tokens: ['0xC96dE26018A54D51c097160568752c4E3BD6C364', ADDRESSES.ethereum.WBTC], }, + bsc: { owners: ['0x2Ee808F769AB697C477E0aF8357315069b66bCBb'], tokens: ['0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c'], }, + mantle: { owners: ['0xd6Ab15B2458B6EC3E94cE210174d860FdBdd6b96'], tokens: ['0xC96dE26018A54D51c097160568752c4E3BD6C364'], }, +} + +Object.keys(config).forEach(chain => { + const { owners, tokens, } = config[chain] + module.exports[chain] = { + tvl: async (api) => api.sumTokens({ owners, tokens }) + } +}) From ac9c9c48d471a793e37619ee675bc2bd6a2abace Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 25 Jul 2024 15:24:10 +0300 Subject: [PATCH 842/855] track ripple dex --- projects/helper/tokenMapping.js | 5 +- projects/xrpl-dex/app.js | 159 ++++++++++++++++++++++++++++ projects/xrpl-dex/index.js | 26 +++++ projects/xrpl-dex/package-lock.json | 106 +++++++++++++++++++ projects/xrpl-dex/package.json | 14 +++ projects/xrpl-dex/run.sh | 3 + 6 files changed, 312 insertions(+), 1 deletion(-) create mode 100644 projects/xrpl-dex/app.js create mode 100644 projects/xrpl-dex/index.js create mode 100644 projects/xrpl-dex/package-lock.json create mode 100644 projects/xrpl-dex/package.json create mode 100644 projects/xrpl-dex/run.sh diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index debcf551226f..6318ae76a85e 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -69,7 +69,10 @@ const fixBalancesTokens = { }, bouncebit: { '0x8f083eafcbba2e126ad9757639c3a1e25a061a08': { coingeckoId: 'bouncebit-btc', decimals: 18 } - } + }, + ripple: { + "XRP": { coingeckoId: "ripple", decimals: 6 }, + }, } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) diff --git a/projects/xrpl-dex/app.js b/projects/xrpl-dex/app.js new file mode 100644 index 000000000000..0ad1a7c50ca7 --- /dev/null +++ b/projects/xrpl-dex/app.js @@ -0,0 +1,159 @@ +const rippleCodec = require("ripple-binary-codec"); +const { PromisePool } = require("@supercharge/promise-pool"); +const { getCache, setCache } = require("../helper/cache"); +const { transformDexBalances } = require("../helper/portedTokens"); + +const NODE_URL = "https://xrplcluster.com"; + +const fetchLedgerData = async (binary, marker, atLedgerIndex) => { + const xrplResponse = await fetch(NODE_URL, { + method: "POST", + body: JSON.stringify({ + method: "ledger_data", + params: [ + { + ledger_index: atLedgerIndex ?? "validated", + binary, + type: "amm", + ...(marker && { marker: marker }), + }, + ], + }), + }); + const xrplResponseJson = await xrplResponse.json(); + return { + state: xrplResponseJson.result.state, + marker: xrplResponseJson.result.marker, + }; +}; + +const fetchPoolReserves = async (pool, atLedgerIndex) => { + const xrplResponse = await fetch(NODE_URL, { + method: "POST", + body: JSON.stringify({ + method: "amm_info", + params: [ + { + ledger_index: atLedgerIndex ?? "validated", + asset: pool.asset1, + asset2: pool.asset2, + }, + ], + }), + }); + const xrplResponseJson = await xrplResponse.json(); + return { + token0: parseReserve(xrplResponseJson.result.amm.amount), + token1: parseReserve(xrplResponseJson.result.amm.amount2), + }; +}; + +let lastPrinted = 0 +const discoverPools = async (nextMarker, isBinary, atLedgerIndex, poolsFound = []) => { + const { state, marker } = await fetchLedgerData( + isBinary, + nextMarker, + atLedgerIndex + ); + if (state && state.length != 0) { + const decodedState = isBinary + ? state.map((entry) => rippleCodec.decode(entry.data)) + : state; + poolsFound.push( + ...decodedState.map((entry) => ({ + account: entry.Account, + asset1: { + currency: entry.Asset.currency, + issuer: entry.Asset.issuer, + }, + asset2: { + currency: entry.Asset2.currency, + issuer: entry.Asset2.issuer, + }, + })) + ); + } + + if (poolsFound.length % 10 === 0 && lastPrinted !== poolsFound.length) { + console.log(new Date(), "Pools found so far ", poolsFound.length); + lastPrinted = poolsFound.length; + } + if (marker) + return discoverPools( + marker, + isBinary, + atLedgerIndex, + poolsFound + ) + return poolsFound; +}; + +const parseReserve = (reserveData) => { + const reserveIsXrp = typeof reserveData === "string"; + return { + currency: reserveIsXrp ? "XRP" : reserveData.currency, + issuer: reserveIsXrp ? null : reserveData.issuer, + amount: reserveIsXrp ? reserveData : reserveData.value, + }; +}; + +const getAllPoolsReserves = async (poolAddresses, atLedgerIndex) => { + const poolsWithReserves = []; + + const { errors } = await PromisePool.withConcurrency(14) + .for(poolAddresses) + .process(async (pool) => { + const { token0, token1 } = await fetchPoolReserves(pool, atLedgerIndex); + poolsWithReserves.push({ + pool: pool.account, + token0Reserve: token0, + token1Reserve: token1, + }); + }); + if (errors.length > 0) + throw new Error(errors) + return poolsWithReserves +} + +main().catch(console.error).then(() => { + console.log("done"); + process.exit(0) +}) + +function getTimeNow() { + return Math.floor(Date.now() / 1000); +} + +async function main() { + const timeNow = getTimeNow() + const aDayInSeconds = 60 * 60 * 24; + const projectKey = 'xrpl-dex' + const cacheKey = 'cache' + let { allPools, lastPoolUpdate, lastDataUpdate, tvl } = await getCache(projectKey, cacheKey) + if (!lastPoolUpdate || timeNow - lastPoolUpdate > aDayInSeconds) { + console.time("xrpl-dex fetch pool list"); + allPools = await discoverPools(null, 1); + console.timeEnd("xrpl-dex fetch pool list"); + lastPoolUpdate = getTimeNow(); + await setCache(projectKey, cacheKey, { allPools, lastPoolUpdate, lastDataUpdate, tvl }) + } + if (lastDataUpdate && timeNow - lastDataUpdate < 2 * 60 * 60) { + // data was updated recently, no need to update + return + } + const poolsWithReserves = await getAllPoolsReserves(allPools); + + tvl = await transformDexBalances({ + chain: 'ripple', + data: poolsWithReserves.map(i => ({ + token0: i.token0Reserve.currency, + token0Bal: i.token0Reserve.amount, + token1: i.token1Reserve.currency, + token1Bal: i.token1Reserve.amount, + })), + }) + await setCache(projectKey, cacheKey, { allPools, lastPoolUpdate, lastDataUpdate: getTimeNow(), tvl: { + ripple: tvl.ripple, + 'ripple:XRP': tvl['ripple:XRP'], + } }) +} \ No newline at end of file diff --git a/projects/xrpl-dex/index.js b/projects/xrpl-dex/index.js new file mode 100644 index 000000000000..9232ed1c37f0 --- /dev/null +++ b/projects/xrpl-dex/index.js @@ -0,0 +1,26 @@ +const { getCache, } = require("../helper/cache"); + + +module.exports = { + methodology: + "Finds all AMM pools on XRPL, checks their reserves, calculates TVL (in XRP) for each pool and sums them up.", + ripple: { + tvl, + }, +}; + +function getTimeNow() { + return Math.floor(Date.now() / 1000); +} + +async function tvl() { + const timeNow = getTimeNow() + const aDayInSeconds = 60 * 60 * 24; + const projectKey = 'xrpl-dex' + const cacheKey = 'cache' + let { lastDataUpdate, tvl } = await getCache(projectKey, cacheKey) + if (!lastDataUpdate || timeNow - lastDataUpdate > aDayInSeconds) + throw new Error("stale/missing tvl data"); + console.log(tvl) + return tvl +} \ No newline at end of file diff --git a/projects/xrpl-dex/package-lock.json b/projects/xrpl-dex/package-lock.json new file mode 100644 index 000000000000..f79d19f7835a --- /dev/null +++ b/projects/xrpl-dex/package-lock.json @@ -0,0 +1,106 @@ +{ + "name": "xrpl-dex", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "xrpl-dex", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "ripple-binary-codec": "^2.1.0" + } + }, + "node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/base": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.7.tgz", + "integrity": "sha512-PPNYBslrLNNUQ/Yad37MHYsNQtK67EhWb6WtSvNLLPo7SdVZgkUjD6Dg+5On7zNwmskf8OX7I7Nx5oN+MIWE0g==", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@xrplf/isomorphic": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@xrplf/isomorphic/-/isomorphic-1.0.1.tgz", + "integrity": "sha512-0bIpgx8PDjYdrLFeC3csF305QQ1L7sxaWnL5y71mCvhenZzJgku9QsA+9QCXBC1eNYtxWO/xR91zrXJy2T/ixg==", + "dependencies": { + "@noble/hashes": "^1.0.0", + "eventemitter3": "5.0.1", + "ws": "^8.13.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/bignumber.js": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.2.tgz", + "integrity": "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==", + "engines": { + "node": "*" + } + }, + "node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==" + }, + "node_modules/ripple-address-codec": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ripple-address-codec/-/ripple-address-codec-5.0.0.tgz", + "integrity": "sha512-de7osLRH/pt5HX2xw2TRJtbdLLWHu0RXirpQaEeCnWKY5DYHykh3ETSkofvm0aX0LJiV7kwkegJxQkmbO94gWw==", + "dependencies": { + "@scure/base": "^1.1.3", + "@xrplf/isomorphic": "^1.0.0" + }, + "engines": { + "node": ">= 16" + } + }, + "node_modules/ripple-binary-codec": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ripple-binary-codec/-/ripple-binary-codec-2.1.0.tgz", + "integrity": "sha512-q0GAx+hj3UVcDbhXVjk7qeNfgUMehlElYJwiCuIBwqs/51GVTOwLr39Ht3eNsX5ow2xPRaC5mqHwcFDvLRm6cA==", + "dependencies": { + "@xrplf/isomorphic": "^1.0.1", + "bignumber.js": "^9.0.0", + "ripple-address-codec": "^5.0.0" + }, + "engines": { + "node": ">= 16" + } + }, + "node_modules/ws": { + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + } + } +} diff --git a/projects/xrpl-dex/package.json b/projects/xrpl-dex/package.json new file mode 100644 index 000000000000..b1c75940c669 --- /dev/null +++ b/projects/xrpl-dex/package.json @@ -0,0 +1,14 @@ +{ + "name": "xrpl-dex", + "version": "1.0.0", + "main": "app.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "description": "", + "dependencies": { + "ripple-binary-codec": "^2.1.0" + } +} diff --git a/projects/xrpl-dex/run.sh b/projects/xrpl-dex/run.sh new file mode 100644 index 000000000000..83626d02a0e2 --- /dev/null +++ b/projects/xrpl-dex/run.sh @@ -0,0 +1,3 @@ +npm i +cd .. && npm i && cd xrpl-dex +node app.js \ No newline at end of file From f3a97fc9a0fa542f7e151515653e0bf46b92e1e5 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 25 Jul 2024 15:49:10 +0300 Subject: [PATCH 843/855] update cache every three days --- projects/xrpl-dex/app.js | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/projects/xrpl-dex/app.js b/projects/xrpl-dex/app.js index 0ad1a7c50ca7..4faf69b22a00 100644 --- a/projects/xrpl-dex/app.js +++ b/projects/xrpl-dex/app.js @@ -130,12 +130,16 @@ async function main() { const projectKey = 'xrpl-dex' const cacheKey = 'cache' let { allPools, lastPoolUpdate, lastDataUpdate, tvl } = await getCache(projectKey, cacheKey) - if (!lastPoolUpdate || timeNow - lastPoolUpdate > aDayInSeconds) { - console.time("xrpl-dex fetch pool list"); - allPools = await discoverPools(null, 1); - console.timeEnd("xrpl-dex fetch pool list"); - lastPoolUpdate = getTimeNow(); - await setCache(projectKey, cacheKey, { allPools, lastPoolUpdate, lastDataUpdate, tvl }) + if (!lastPoolUpdate || timeNow - lastPoolUpdate > 3 * aDayInSeconds) { + try { + console.time("xrpl-dex fetch pool list"); + allPools = await discoverPools(null, 1); + console.timeEnd("xrpl-dex fetch pool list"); + lastPoolUpdate = getTimeNow(); + await setCache(projectKey, cacheKey, { allPools, lastPoolUpdate, lastDataUpdate, tvl }) + } catch (e) { + console.error(e) + } } if (lastDataUpdate && timeNow - lastDataUpdate < 2 * 60 * 60) { // data was updated recently, no need to update @@ -152,8 +156,10 @@ async function main() { token1Bal: i.token1Reserve.amount, })), }) - await setCache(projectKey, cacheKey, { allPools, lastPoolUpdate, lastDataUpdate: getTimeNow(), tvl: { - ripple: tvl.ripple, - 'ripple:XRP': tvl['ripple:XRP'], - } }) + await setCache(projectKey, cacheKey, { + allPools, lastPoolUpdate, lastDataUpdate: getTimeNow(), tvl: { + ripple: tvl.ripple, + 'ripple:XRP': tvl['ripple:XRP'], + } + }) } \ No newline at end of file From 9f007cf8fb800bd682b29acddc0002e23b29db7e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 25 Jul 2024 16:34:52 +0300 Subject: [PATCH 844/855] fwx: track permissionless pools --- projects/fwx/index.js | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/projects/fwx/index.js b/projects/fwx/index.js index 9875315810d2..bf3ad8919dc4 100644 --- a/projects/fwx/index.js +++ b/projects/fwx/index.js @@ -1,4 +1,4 @@ -const { sumTokensExport } = require("../helper/unwrapLPs"); +const { getLogs2 } = require('../helper/cache/getLogs') const ADDRESSES = require("../helper/coreAssets.json"); const VECTOR = require("../vector/vectorContracts.json"); @@ -44,17 +44,30 @@ const tokens = { }, }; -let tokenAndOwners = []; +let tokensAndOwners = []; for (const [symbol, token] of Object.entries(tokens)) { - tokenAndOwners.push([token.contractAddr, token.pool]); - tokenAndOwners.push([token.contractAddr, coreModuleProxy]); - tokenAndOwners.push([token.contractAddr, xliplessDex]); + tokensAndOwners.push([token.contractAddr, token.pool]); + tokensAndOwners.push([token.contractAddr, coreModuleProxy]); + tokensAndOwners.push([token.contractAddr, xliplessDex]); } module.exports = { avax: { - tvl: sumTokensExport({ - tokensAndOwners: tokenAndOwners, - }), + tvl, }, }; + +async function tvl(api) { + const FACTORY_SUB_MODULE_PROXY = '0x54b048eB204B7CbBb469901fdb5BbfB80d0F0CD1' + const logs = await getLogs2({ + api, + factory: FACTORY_SUB_MODULE_PROXY, + eventAbi: "event CreateMarket(address indexed creator, address core, address collateralPool, address collateralToken, address underlyingPool, address underlyingToken, bytes32 pairbytes)", + fromBlock: 46125548, + }) + logs.forEach(i => { + tokensAndOwners.push([i.collateralToken, i.collateralPool]) + tokensAndOwners.push([i.underlyingToken, i.underlyingPool]) + }) + return api.sumTokens({ tokensAndOwners }) +} \ No newline at end of file From 0d91d59ee38b9b724f424cd0e65f5cb873119b51 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 25 Jul 2024 16:36:56 +0300 Subject: [PATCH 845/855] minor fix --- projects/xrpl-dex/index.js | 2 +- projects/xrpl-dex/package.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/xrpl-dex/index.js b/projects/xrpl-dex/index.js index 9232ed1c37f0..0de17de24ce5 100644 --- a/projects/xrpl-dex/index.js +++ b/projects/xrpl-dex/index.js @@ -7,6 +7,7 @@ module.exports = { ripple: { tvl, }, + misrepresentedTokens: true, }; function getTimeNow() { @@ -21,6 +22,5 @@ async function tvl() { let { lastDataUpdate, tvl } = await getCache(projectKey, cacheKey) if (!lastDataUpdate || timeNow - lastDataUpdate > aDayInSeconds) throw new Error("stale/missing tvl data"); - console.log(tvl) return tvl } \ No newline at end of file diff --git a/projects/xrpl-dex/package.json b/projects/xrpl-dex/package.json index b1c75940c669..a7e910c8e369 100644 --- a/projects/xrpl-dex/package.json +++ b/projects/xrpl-dex/package.json @@ -1,12 +1,12 @@ { "name": "xrpl-dex", "version": "1.0.0", - "main": "app.js", + "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", - "license": "ISC", + "license": "MIT", "description": "", "dependencies": { "ripple-binary-codec": "^2.1.0" From 60de9a1f22975020cfc8873729ac4578481e223c Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 25 Jul 2024 19:38:31 +0300 Subject: [PATCH 846/855] track dinero staking --- projects/dinero/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/projects/dinero/index.js b/projects/dinero/index.js index e5f80edc313a..31c114114ff0 100644 --- a/projects/dinero/index.js +++ b/projects/dinero/index.js @@ -1,13 +1,15 @@ const { nullAddress } = require("../helper/unwrapLPs"); +const { sumERC4626VaultsExport } = require("../helper/erc4626"); module.exports = { ethereum: { tvl: async (api) => { - const totalSupply = await api.call({ target: '0x04C154b66CB340F3Ae24111CC767e0184Ed00Cc6', abi: 'uint256:totalSupply'}); - + const totalSupply = await api.call({ target: '0x04C154b66CB340F3Ae24111CC767e0184Ed00Cc6', abi: 'uint256:totalSupply' }); + return { [nullAddress]: totalSupply }; - } + }, + staking: sumERC4626VaultsExport({ vaults: ['0x55769490c825CCb09b2A6Ae955203FaBF04857fd'], isOG4626: true, }) } }; From d7569486ee957dfd033e1061fec0467a5a6ff626 Mon Sep 17 00:00:00 2001 From: Shayne Brady Date: Fri, 26 Jul 2024 15:47:02 +1000 Subject: [PATCH 847/855] add lightlink to icecreamswap (#11111) --- projects/icecreamswap/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/icecreamswap/index.js b/projects/icecreamswap/index.js index e660e4e15883..0f5623414d40 100644 --- a/projects/icecreamswap/index.js +++ b/projects/icecreamswap/index.js @@ -3,6 +3,7 @@ const { getUniTVL, } = require('../helper/unknownTokens') const config = { shimmer_evm: '0x24cb308a4e2F3a4352F513681Bd0c31a0bd3BA31', bob: '0x7b2a5C88AB9367147F6ac384F857CbaDF5aA70a7', + lightlink_phoenix: '0xC87De04e2EC1F4282dFF2933A2D58199f688fC3d', } const chains = [...Object.keys(config), 'base', 'telos', 'core', 'dogechain', 'fuse', 'xdc', 'bitgert', 'scroll', 'neon_evm', 'blast' ] From 238529316b633cf774bdd286d40f278f7c4befd8 Mon Sep 17 00:00:00 2001 From: mantasfam <45658645+mantasfam@users.noreply.github.com> Date: Fri, 26 Jul 2024 08:48:15 +0300 Subject: [PATCH 848/855] Create index.js (#11110) --- projects/open-ticketing-ecosystem/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/open-ticketing-ecosystem/index.js diff --git a/projects/open-ticketing-ecosystem/index.js b/projects/open-ticketing-ecosystem/index.js new file mode 100644 index 000000000000..ed1af17aa653 --- /dev/null +++ b/projects/open-ticketing-ecosystem/index.js @@ -0,0 +1,17 @@ +const { staking } = require("../helper/staking"); + +const stakingContractEthereum = "0x686e8500B6bE8812EB198aAbbbFA14C95c03fC88"; +const openTokenEthereum = "0xc28eb2250d1ae32c7e74cfb6d6b86afc9beb6509"; +const stakingContractPolygon = "0x686e8500B6bE8812EB198aAbbbFA14C95c03fC88"; +const openTokenAddressPolygon = "0x7844F79FC841E4F92d974C417031c76F8578c2D5"; + +module.exports = { + ethereum: { + tvl: () => ({}), + staking: staking(stakingContractEthereum, openTokenEthereum), + }, + polygon: { + tvl: () => ({}), + staking: staking(stakingContractPolygon, openTokenAddressPolygon), + }, +}; From 1966a7636d8fb4ced491b4fde2e44c1cae407da0 Mon Sep 17 00:00:00 2001 From: Surfa Rosa <78686465+surfarosa@users.noreply.github.com> Date: Fri, 26 Jul 2024 12:50:59 +0700 Subject: [PATCH 849/855] add SpaceWhaleDEX (#11109) add SpaceWhaleDEX spacewhale.ai --- projects/spacewhale/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/spacewhale/index.js diff --git a/projects/spacewhale/index.js b/projects/spacewhale/index.js new file mode 100644 index 000000000000..4d7113270456 --- /dev/null +++ b/projects/spacewhale/index.js @@ -0,0 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs') + +const fundStore = "0xb7884D6bc7361EcbacAfAbBd949DE7D47B2a0e27"; // FundStore +const SPACEWHALE = "0xf5961a2441fC68E38300cd8ae8d6a172b12D7E7A"; // SPACEWHALE +const assets = [nullAddress, ADDRESSES.arbitrum.USDC_CIRCLE] // ETH, USDC + +module.exports = { + start: 1712109600, + arbitrum: { + tvl: sumTokensExport({ owners: [fundStore], tokens: assets }), + staking: sumTokensExport({ owners: [fundStore], tokens: [SPACEWHALE] }), + }, +} \ No newline at end of file From 7dad2215ea622c708c77ed40627935e582231dc2 Mon Sep 17 00:00:00 2001 From: maxwell-1999 <124770082+maxwell-1999@users.noreply.github.com> Date: Fri, 26 Jul 2024 13:18:37 +0530 Subject: [PATCH 850/855] Added USDC_V5 pool (#11115) --- projects/buffer/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/buffer/index.js b/projects/buffer/index.js index 0384e3b2d19a..f5195dea68bb 100644 --- a/projects/buffer/index.js +++ b/projects/buffer/index.js @@ -5,6 +5,7 @@ const { sumTokensExport } = require("../helper/unwrapLPs"); const tokens = { BFR: "0x1A5B0aaF478bf1FDA7b934c76E7692D722982a6D", USDC_ARB: ADDRESSES.arbitrum.USDC, + USDC_CIRCLE: ADDRESSES.arbitrum.USDC_CIRCLE, USDC_POLY: ADDRESSES.polygon.USDC, ARB: ADDRESSES.arbitrum.ARB, }; @@ -16,6 +17,7 @@ const contracts = { USDC_POOL_V4: "0xfD9f8841C471Fcc55f5c09B8ad868BdC9eDeBDE1", POLY_POOL_V1: "0x6FD5B386d8bed29b3b62C0856250cdD849b3564d", ARB_POOL_V1: "0xaE0628C88EC6C418B3F5C005f804E905f8123833", + USDC_POOL_V5: "0x9501a00d7d4BC7558196B2e4d61c0ec5D16dEfb2", BFR_STAKING: "0x173817F33f1C09bCb0df436c2f327B9504d6e067", }; @@ -23,13 +25,14 @@ module.exports = { arbitrum: { staking: staking(contracts.BFR_STAKING, tokens.BFR), tvl: sumTokensExport({ - tokens: [tokens.USDC_ARB, tokens.ARB], + tokens: [tokens.USDC_ARB, tokens.ARB, tokens.USDC_CIRCLE], owners: [ contracts.USDC_POOL_V1, contracts.USDC_POOL_V2, contracts.USDC_POOL_V3, contracts.ARB_POOL_V1, contracts.USDC_POOL_V4, + contracts.USDC_POOL_V5, ], }), }, @@ -53,5 +56,7 @@ module.exports = { ], [Math.floor(new Date("2023-09-01") / 1e3), "Debuted Version 2.5"], [Math.floor(new Date("2024-01-03") / 1e3), "Launched above/below options"], + [Math.floor(new Date("2024-05-30") / 1e3), "Debuted Version 2.6"], + ], }; From 29a77f1743d5f52d78db59e97799c63f2ac95c07 Mon Sep 17 00:00:00 2001 From: lanford33 Date: Fri, 26 Jul 2024 15:58:29 +0800 Subject: [PATCH 851/855] feat: add bigone (#11105) --- projects/bigone/index.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 projects/bigone/index.js diff --git a/projects/bigone/index.js b/projects/bigone/index.js new file mode 100644 index 000000000000..08ad8d687432 --- /dev/null +++ b/projects/bigone/index.js @@ -0,0 +1,29 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + '0xd4dcd2459bb78d7a645aa7e196857d421b10d93f', + '0x88e343f4599292c2cffe683c1bb93cd3480bdbab', + '0xa30d8157911ef23c46c0eb71889efe6a648a41f7' + ], + }, + bitcoin: { + owners: [ + 'bc1qu02z43yduyjx6saeea4l54qqulvz568qnzgaes', + '1L5D4Eq2RkEKuN717Gc817MH1Sxs5WwMQh' + ] + }, + solana: { + owners: [ + '7BCp5XUXtKzZWYCvGR2fzFqoyKiJ7ozN8eCEHscpSMnB' + ] + }, + tron: { + owners: [ + 'TNrPUjc47JU1fgaQZPa1odQnD5RTdH3NSu' + ] + }, +} + +module.exports = cexExports(config) \ No newline at end of file From f203c6016966892a7344f494a34fb5953947e3c8 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 26 Jul 2024 10:59:00 +0300 Subject: [PATCH 852/855] update deri v4 --- package-lock.json | 6 +++--- projects/deri-v4/index.js | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index a541388890c7..cce95c611905 100644 --- a/package-lock.json +++ b/package-lock.json @@ -886,9 +886,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "5.0.74", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.74.tgz", - "integrity": "sha512-qk/UrP5A55Co7pnj7WE3Cloc7zZSFESUTb5fXRaowH9K5oWi/JRJ4LQZOI38sami586q9/sWLwJrKBlU+lQIVw==", + "version": "5.0.76", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.76.tgz", + "integrity": "sha512-9aU+dFZjtWpkq9ESn84jg2C5QZDYd7lSyh49IKzWqVt065XIsOiUPm4BiF3htr0e8AzsWFlkUwvqYCr0z32oqA==", "dependencies": { "@aws-sdk/client-s3": "^3.400.0", "@elastic/elasticsearch": "^8.13.1", diff --git a/projects/deri-v4/index.js b/projects/deri-v4/index.js index adca15cd19fa..2107b324e619 100644 --- a/projects/deri-v4/index.js +++ b/projects/deri-v4/index.js @@ -28,6 +28,9 @@ const config = { scroll: { fromBlock: 1384607, factory: '0x7B56Af65Da221A40B48bEDcCb67410D6C0bE771D', }, manta: { fromBlock: 1132047, factory: '0xc8fa78f6b68ab22239222b4249b1ff968d154ae9', }, polygon_zkevm: { fromBlock: 8978690, factory: '0xc7e484c20d5dc5d33299afb430bfb5d17085ee98', }, + taiko: { fromBlock: 130174, factory: '0xd4E08C940dDeC162c2D8f3034c75c3e08f1f6032', }, + bsc: { fromBlock: 37069498, factory: '0x2c2E1eE20C633EAe18239c0BF59cEf1FC44939aC', }, + blast: { fromBlock: 2304573, factory: '0x60138081198b75aAF15ACA3A17Ec7f5Ffc5D4605', }, } Object.keys(config).forEach(chain => { From 54821dedbf5188923da28bb1bdb43e21f6f75092 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Fri, 26 Jul 2024 13:29:59 +0100 Subject: [PATCH 853/855] add duckduck (#11119) --- projects/duckgang/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/duckgang/index.js diff --git a/projects/duckgang/index.js b/projects/duckgang/index.js new file mode 100644 index 000000000000..d7d52600eecc --- /dev/null +++ b/projects/duckgang/index.js @@ -0,0 +1,17 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs') + +module.exports = { + methodology: 'SEI in vaults', + sei: { + tvl: sumTokensExport({ owners: + [ + "0x325a0E5C84B4d961B19161956f57Ae8bA5Bb3c26", //No lock-up + "0x4F636e75B0b56DF397c8a7E47041e1E6b9738a4e", // 30 days + "0xE4c779eDD8FE0e232d460273945b6b7A8c097EA2", // 60 days + "0x3D75916B2d8279282C5e25A24fe2Ed57111C22ed", // 90 days + ], tokens: [ + nullAddress + ]}), + } +}; \ No newline at end of file From d4bb44a8ff37351a9763e2a107c5dd5bd4024395 Mon Sep 17 00:00:00 2001 From: idea2409 <60475612+idea2409@users.noreply.github.com> Date: Fri, 26 Jul 2024 20:12:05 +0700 Subject: [PATCH 854/855] update TVL of FWX (#11106) * add xlipless dex * update tvl * update tvl(2) * update tvl(3) * cache api call --------- Co-authored-by: ideapacito Co-authored-by: ideapacito Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/fwx/index.js | 68 ++++++++++--------------------------------- 1 file changed, 16 insertions(+), 52 deletions(-) diff --git a/projects/fwx/index.js b/projects/fwx/index.js index bf3ad8919dc4..20fe4a4eaa7d 100644 --- a/projects/fwx/index.js +++ b/projects/fwx/index.js @@ -1,63 +1,27 @@ const { getLogs2 } = require('../helper/cache/getLogs') -const ADDRESSES = require("../helper/coreAssets.json"); -const VECTOR = require("../vector/vectorContracts.json"); +const { getConfig } = require('../helper/cache') -const coreModuleProxy = "0xceE74C8c242047c85e6833633AbB7A4Cd8465757"; -const xliplessDex = "0x82E90fB94fd9a5C19Bf38648DD2C9639Bde67c74"; - -const tokens = { - USDC: { - pool: "0x94732A5319e1feAcc7d08e08Fdc4C2c7f5123143", - contractAddr: ADDRESSES.avax.USDC, - }, - WAVAX: { - pool: "0x7F91272ff1A0114743D2df95F5905F9613Fd92b3", - contractAddr: ADDRESSES.avax.WAVAX, - }, - SAVAX: { - pool: "0xe57a4042eA63Df072B2cf6352F9779E4D2445A92", - contractAddr: VECTOR.tokens.SAVAX.address, - }, - WETH_e: { - pool: "0xcc7BcEf73d2e57d80d0F42D41088dB2A4C1F9146", - contractAddr: ADDRESSES.avax.WETH_e, - }, - COQ: { - pool: "0xc97d9B3971BfE1B8Ac8EA7f990Df721d8f695223", - contractAddr: "0x420FcA0121DC28039145009570975747295f2329", - }, - QI: { - pool: "0xCfc3d8465cfde6747B8b94968e1893F6E5680045", - contractAddr: "0x8729438EB15e2C8B576fCc6AeCdA6A148776C0F5", - }, - JOE: { - pool: "0xCB4bd69524A1a398e2112Dc22593F18eD5B3eCD6", - contractAddr: ADDRESSES.avax.JOE, - }, - GMX: { - pool: "0xDBbA61EE0770c99Adc9150c1C98cbd4DEA2F925A", - contractAddr: "0x62edc0692BD897D2295872a9FFCac5425011c661", - }, - PNG: { - pool: "0x0599C838422Ed46681C41b563AAf179a24316F09", - contractAddr: "0x60781C2586D68229fde47564546784ab3fACA982", - }, -}; - -let tokensAndOwners = []; -for (const [symbol, token] of Object.entries(tokens)) { - tokensAndOwners.push([token.contractAddr, token.pool]); - tokensAndOwners.push([token.contractAddr, coreModuleProxy]); - tokensAndOwners.push([token.contractAddr, xliplessDex]); -} +const xliplessDex = "0x82E90fB94fd9a5C19Bf38648DD2C9639Bde67c74" module.exports = { avax: { tvl, }, -}; +} async function tvl(api) { + const { assets } = await getConfig('fwx/'+api.chain, "https://app.fwx.finance/api/v2/assets?chain_id=43114") + + let tokensAndOwners = []; + for (let i = 0; i < assets.length; i++) { + const asset = assets[i] + tokensAndOwners.push( + [asset.token_address, asset.pool_address], + [asset.token_address, asset.core_address], + [asset.token_address, xliplessDex], + ); + } + const FACTORY_SUB_MODULE_PROXY = '0x54b048eB204B7CbBb469901fdb5BbfB80d0F0CD1' const logs = await getLogs2({ api, @@ -70,4 +34,4 @@ async function tvl(api) { tokensAndOwners.push([i.underlyingToken, i.underlyingPool]) }) return api.sumTokens({ tokensAndOwners }) -} \ No newline at end of file +} From 2a0420efb28781906432b93a403a2f140dd38a4f Mon Sep 17 00:00:00 2001 From: joshuamind <124139705+joshuamind@users.noreply.github.com> Date: Fri, 26 Jul 2024 21:37:57 +0800 Subject: [PATCH 855/855] Mind restake add bsc chain (#11117) * add mind restake * minor fix * add bsc chain --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/mind-restake/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/mind-restake/index.js b/projects/mind-restake/index.js index ede72d4bf6ca..f9890c22c08b 100644 --- a/projects/mind-restake/index.js +++ b/projects/mind-restake/index.js @@ -1,6 +1,7 @@ const config = { ethereum: "0x6a5D488EC17d6a7a1872AaB88feC90c1B2Df4196", - scroll: "0xea3E87699D11B77Fba754Bf0257a25664B97437d" + scroll: "0xea3E87699D11B77Fba754Bf0257a25664B97437d", + bsc: "0x6a5D488EC17d6a7a1872AaB88feC90c1B2Df4196", }; module.exports = {