diff --git a/projects/aave/v3.js b/projects/aave/v3.js index 302270d49b43..02f47848d7cd 100644 --- a/projects/aave/v3.js +++ b/projects/aave/v3.js @@ -18,6 +18,8 @@ function v3(chain) { params = ['0xFBedc64AeE24921cb43004312B9eF367a4162b57', undefined, ['0xa99F4E69acF23C6838DE90dD1B5c02EA928A53ee']] else if (chain === 'bsc') params = ['0x117684358D990E42Eb1649E7e8C4691951dc1E71', undefined, ['0x41585C50524fb8c3899B43D7D797d9486AAc94DB']] + else if (chain === 'era') + params = ['0x0753E3637ddC6efc40759D9c347251046644F25F', undefined, ['0x48B96565291d1B23a014bb9f68E07F4B2bb3Cd6D']] const section = borrowed => aaveChainTvl(chain, ...params, borrowed, true); return { tvl: section(false), @@ -28,13 +30,14 @@ function v3(chain) { module.exports = mergeExports({ methodology: methodologies.lendingMarket, avax: v3("avax"), - ...["optimism", "fantom", "harmony", "arbitrum", "polygon", "ethereum", "metis", "base", "xdai", "scroll", "bsc"].reduce((t, c) => ({ ...t, [c]: v3(c) }), {}), - hallmarks: [ - [1659630089, "Start OP Rewards"], - [1650471689, "Start AVAX Rewards"] - ], + ...["optimism", "fantom", "harmony", "arbitrum", "polygon", "ethereum", "metis", "base", "xdai", "scroll", "bsc", "era"].reduce((t, c) => ({ ...t, [c]: v3(c) }), {}), }, { // Lido pool ethereum: aaveExports(undefined, "0x770ef9f4fe897e59daCc474EF11238303F9552b6", undefined, ["0xa3206d66cF94AA1e93B21a9D8d409d6375309F4A"], { v3: true, }), }); + +module.exports.hallmarks = [ + [1659630089, "Start OP Rewards"], + [1650471689, "Start AVAX Rewards"] +] // node test.js projects/aave/index.js diff --git a/projects/ampleswap/index.js b/projects/ampleswap/index.js index 77bd25892b4d..085021d75d10 100644 --- a/projects/ampleswap/index.js +++ b/projects/ampleswap/index.js @@ -12,5 +12,6 @@ module.exports = { staking: staking(MasterChefContract, AMPLE), }, alv: { tvl: getUniTVL({ factory: '0x01dC97C89DF7d3C616a696dD53F600aB3FF12983', useDefaultCoreAssets: true }), }, - dsc: { tvl: getUniTVL({ factory: '0x232Ba9f3B3643ab28d28ED7ee18600708D60E5fe', useDefaultCoreAssets: true, }), }, + dsc: { tvl: () => ({}) } + // dsc: { tvl: getUniTVL({ factory: '0x232Ba9f3B3643ab28d28ED7ee18600708D60E5fe', useDefaultCoreAssets: true, }), }, }; diff --git a/projects/awaken/index.js b/projects/awaken/index.js index b40ea52d2cc8..94db172ccbff 100644 --- a/projects/awaken/index.js +++ b/projects/awaken/index.js @@ -2,7 +2,7 @@ const { request, gql } = require("graphql-request"); const { toUSDTBalances } = require("../helper/balances"); const GRAPH_QUERY = gql` - query get_tvl($dto: GetTotalValueLockedDto) { + query get_tvl($dto: GetTotalValueLockedDto!) { totalValueLocked(dto: $dto) { value } @@ -32,7 +32,7 @@ function getChainTvl(graphUrls) { } const v2graph = getChainTvl({ - aelf: "https://dapp.awaken.finance/AElfIndexer_Swap/SwapIndexerSchema/graphql", + aelf: "https://app.aefinder.io/awaken/995f8e7e957d43d6b1706a4e351e2e47/graphql", }); module.exports = { diff --git a/projects/cybro/index.js b/projects/cybro/index.js index 58ffec4009df..7611d32485dc 100644 --- a/projects/cybro/index.js +++ b/projects/cybro/index.js @@ -16,6 +16,8 @@ const vaults = [ '0x9cc62ef691e869c05fd2ec41839889d4e74c3a3f', '0x3500e1d4e93c9f45aa8198efda16842cb73fa1bc', '0x6654cddf2a14a06307af6a8d7731dd4e059962a1', + '0xdb5e7d5ac4e09206fed80efd7abd9976357e1c03', + '0x3db2bd838c2bed431dcfa012c3419b7e94d78456', ] async function tvl(api) { diff --git a/projects/darkcrypto/farm-utils.js b/projects/darkcrypto/farm-utils.js index 22195222b33e..c6e9c7371172 100644 --- a/projects/darkcrypto/farm-utils.js +++ b/projects/darkcrypto/farm-utils.js @@ -1,90 +1,38 @@ -const sdk = require('@defillama/sdk'); -const BigNumber = require('bignumber.js'); -const farmCronos = require('./farm-cronos.json'); +const abi = { + getReserves: "function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)", + poolInfo: "function poolInfo(uint256) view returns (address token, uint256 allocPoint, uint256 lastRewardTime, uint256 accSkyPerShare, bool isStarted)" +} -const farmLPBalance = async ( - chain, - block, - masterChef, - lpToken, - token0, - token1, -) => { - const balances = ( - await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - calls: [ - { - target: token0, - params: [lpToken], - }, - { - target: token1, - params: [lpToken], - }, - { - target: lpToken, - params: [masterChef], - }, - ], - block, - chain: chain, - }) - ).output; - - const lpTotalSuply = ( - await sdk.api.abi.call({ - target: lpToken, - abi: 'erc20:totalSupply', - chain: chain, - block, - }) - ).output; - const token0Locked = (balances[2].output * balances[0].output) / lpTotalSuply; - const token1Locked = (balances[2].output * balances[1].output) / lpTotalSuply; - return [ - { token: `${chain}:${token0}`, locked: token0Locked }, - { token: `${chain}:${token1}`, locked: token1Locked }, - ]; -}; +const pool2Balances = async (api, masterChef) => { + const calls = Array.from({ length: 9 }, (_, i) => ({ target: masterChef, params: [i] })); + const poolsInfos = await api.multiCall({ calls, abi: abi.poolInfo }) + const pools = poolsInfos.map(({ token }) => token) + const [token0s, token1s, balances, reserves, supplies] = await Promise.all([ + api.multiCall({ calls: pools.map((p) => ({ target: p })), abi: 'address:token0', permitFailure: true }), + api.multiCall({ calls: pools.map((p) => ({ target: p })), abi: 'address:token1', permitFailure: true }), + api.multiCall({ calls: pools.map((p) => ({ target: p, params: [masterChef] })), abi: 'erc20:balanceOf', permitFailure:true }), + api.multiCall({ calls: pools.map((p) => ({ target: p })), abi: abi.getReserves, permitFailure:true }), + api.multiCall({ calls: pools.map((p) => ({ target: p })), abi: 'erc20:totalSupply', permitFailure:true }) + ]) -const farmLocked = async (block) => { - const balances = {}; - const tokens = farmCronos.tokens; + pools.forEach((_, i) => { + const token0 = token0s[i] + const token1 = token1s[i] + const balance = balances[i] + const reserve = reserves[i] + const supply = supplies[i] + if (!token0 || !token1 || !balance || !reserve || !supply) return - const allPools = farmCronos.farms - .map((t) => { - return t.pools.map((pool) => { - return Object.assign(pool, { - masterChef: t.masterChef, - }); - }); - }) - .reduce((acc, current) => [...acc, ...current], []); - const promises = allPools.map((item) => { - return farmLPBalance( - 'cronos', - block, - item.masterChef, - item.lpToken, - tokens[item.token0], - tokens[item.token1], - ); - }); + const _balance0 = Math.round(reserve[0] * balance / supply) + const _balance1 = Math.round(reserve[1] * balance / supply) - const data = await Promise.all(promises); - data.forEach((farm) => { - farm.forEach((item) => { - balances[item.token] = new BigNumber(balances[item.token] || 0) - .plus(item.locked || 0) - .toFixed(0); - }); - }); + api.add(token0, _balance0) + api.add(token1, _balance1) + }) +} - return balances; -}; module.exports = { - farmLocked, -}; + pool2Balances +} \ No newline at end of file diff --git a/projects/darkcrypto/index.js b/projects/darkcrypto/index.js index 9dc85c189b27..895db318fdb2 100644 --- a/projects/darkcrypto/index.js +++ b/projects/darkcrypto/index.js @@ -1,34 +1,10 @@ -const ADDRESSES = require('../helper/coreAssets.json') const { stakingUnknownPricedLP } = require("../helper/staking"); -const farmUtils = require("./farm-utils"); const vaultUtils = require("./vault-utils") +const { pool2Balances } = require("./farm-utils"); -const sdk = require("@defillama/sdk"); const sky = "0x9D3BBb0e988D9Fb2d55d07Fe471Be2266AD9c81c"; const boardroom = "0x2e7d17ABCb9a2a40ec482B2ac9a9F811c12Bf630"; - - -async function pool2(timestamp, block, chainBlocks) { - // SKY POOL - const farmTvl = await farmUtils.farmLocked(chainBlocks["cronos"]); - let balances = {}; - - //add CRO balance in LP pool - sdk.util.sumSingleBalance( - balances, - "cronos:" + ADDRESSES.cronos.WCRO_1, - farmTvl["cronos:" + ADDRESSES.cronos.WCRO_1] - ); - - //add Dark and Sky balance in LP pool - sdk.util.sumSingleBalance( - balances, - "cronos:" + ADDRESSES.cronos.WCRO_1, - farmTvl["cronos:" + ADDRESSES.cronos.WCRO_1], - ); - - return balances; -} +const masterChef = "0x42B652A523367e7407Fb4BF2fA1F430781e7db8C" async function vault(api){ return vaultUtils.vaultLocked(api) @@ -38,13 +14,12 @@ module.exports = { doublecounted: true, cronos: { tvl:vault, - pool2, + pool2: (api) => pool2Balances(api, masterChef), staking: stakingUnknownPricedLP( boardroom, sky, "cronos", "0xaA0845EE17e4f1D4F3A8c22cB1e8102baCf56a77" ), - }, }; diff --git a/projects/eris-protocol/index.js b/projects/eris-protocol/index.js index 2d68297c92d8..1f60b22d8e8d 100644 --- a/projects/eris-protocol/index.js +++ b/projects/eris-protocol/index.js @@ -172,6 +172,10 @@ const config = { coinGeckoId: "chihuahua-token", hub: "chihuahua1nktfhalzvtx82kyn4dh6l8htcl0prfpnu380a39zj52nzu3j467qqg23ry", }, + nibiru: { + coinGeckoId: "nibiru", + hub: "nibi1udqqx30cw8nwjxtl4l28ym9hhrp933zlq8dqxfjzcdhvl8y24zcqpzmh8m", + }, }; let assetDecimals = { @@ -399,7 +403,7 @@ async function productsTvl(chain) { module.exports = { timetravel: false, - methodology: "Liquid Staking and Arbitrage Protocol", + methodology: "Liquid Staking and Arbitrage Protocol", terra2: { tvl: () => productsTvl("terra2") }, terra: { tvl: () => productsTvl("terra") }, kujira: { tvl: () => productsTvl("kujira") }, @@ -411,4 +415,5 @@ module.exports = { chihuahua: { tvl: () => productsTvl("chihuahua") }, archway: { tvl: () => productsTvl("archway") }, sei: { tvl: () => productsTvl("sei") }, + nibiru: { tvl: () => productsTvl("nibiru") }, }; diff --git a/projects/evaa/index.js b/projects/evaa/index.js index 1913a9c2142f..2616a62cc1b0 100644 --- a/projects/evaa/index.js +++ b/projects/evaa/index.js @@ -1,11 +1,12 @@ const { sumTokensExport } = require("../helper/chain/ton"); const ADDRESSES = require("../helper/coreAssets.json"); -const evaaScAddr = "EQC8rUZqR_pWV1BylWUlPNBzyiTYVoBEmQkMIQDZXICfnuRr" +const evaaMainPool = "EQC8rUZqR_pWV1BylWUlPNBzyiTYVoBEmQkMIQDZXICfnuRr" +const evaaLpPool = "EQBIlZX2URWkXCSg3QF2MJZU-wC5XkBoLww-hdWk2G37Jc6N" module.exports = { methodology: 'Counts EVAA smartcontract balance as TVL.', ton: { - tvl: sumTokensExport({ owner: evaaScAddr, tokens: [ADDRESSES.null]}), + tvl: sumTokensExport({ owners: [evaaMainPool, evaaLpPool], tokens: [ADDRESSES.null]}), } } diff --git a/projects/filament/index.js b/projects/filament/index.js new file mode 100644 index 000000000000..e4970b23ae65 --- /dev/null +++ b/projects/filament/index.js @@ -0,0 +1,10 @@ +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const USDC_CONTRACT = '0x3894085Ef7Ff0f0aeDf52E2A2704928d1Ec074F1'; +const FILAMENT_VAULT_CONTRACT = '0xbeB6A6273c073815eBe288d2dF4e5E8bc027DA11'; + +module.exports = { + sei: { + tvl: sumTokensExport({ owner: FILAMENT_VAULT_CONTRACT, tokens: [USDC_CONTRACT] }), + }, +} diff --git a/projects/four-meme/index.js b/projects/four-meme/index.js new file mode 100644 index 000000000000..aade92ebd33c --- /dev/null +++ b/projects/four-meme/index.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json'); +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const config = { + bsc: { + owners: Object.values({ + tokenManager: "0xEC4549caDcE5DA21Df6E6422d448034B5233bFbC", + tokenManager2: "0x5c952063c7fc8610FFDB798152D69F0B9550762b", + }), + tokens: [ADDRESSES.null, ADDRESSES.bsc.USDT,], + }, +}; + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl: sumTokensExport(config[chain]) } +}) \ No newline at end of file diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index ede91a25a178..07d985fc41aa 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -40,105 +40,19 @@ const fixBalancesTokens = { ozone: { // '0x83048f0bf34feed8ced419455a4320a735a92e9d': { coingeckoId: "ozonechain", decimals: 18 }, // was mapped to wrong chain }, - chainflip: { - Dot: { coingeckoId: 'polkadot', decimals: 10 }, - Usdc: { coingeckoId: 'usd-coin', decimals: 6 }, - Flip: { coingeckoId: 'chainflip', decimals: 18 }, - Btc: { coingeckoId: 'bitcoin', decimals: 8 }, - Eth: { coingeckoId: 'ethereum', decimals: 18 }, - Usdt: { coingeckoId: 'tether', decimals: 6 }, - ArbEth: { coingeckoId: 'ethereum', decimals: 18 }, - ArbUsdc: { coingeckoId: 'usd-coin', decimals: 6 }, - }, - thundercore: { - [ADDRESSES.thundercore.veTT]: { coingeckoId: 'thunder-token', decimals: 18 }, - }, - oasis: { - [ADDRESSES.null]: { coingeckoId: 'oasis-network', decimals: 18 }, - }, heco: { [ADDRESSES.heco.WHT]: { coingeckoId: 'huobi-token', decimals: 18 }, }, base: { [ADDRESSES.base.rETH]: { coingeckoId: 'rocket-pool-eth', decimals: 18 }, }, - ftn: { - [ADDRESSES.ftn.stFTN]: { coingeckoId: 'lolik-staked-ftn', decimals: 18 }, - [ADDRESSES.ftn.mUSDC]: { coingeckoId: 'usd-coin', decimals: 6 }, - [ADDRESSES.ftn.mUSDT]: { coingeckoId: 'tether', decimals: 6 }, - }, op_bnb: { [ADDRESSES.defiverse.USDC]: { coingeckoId: 'binance-bitcoin', decimals: 18 }, - [ADDRESSES.op_bnb.ETH]: { coingeckoId: 'ethereum', decimals: 18 }, - [ADDRESSES.base.DAI]: { coingeckoId: 'first-digital-usd', decimals: 18 }, - }, - optimism: { - [ADDRESSES.optimism.weETH]: { coingeckoId: 'wrapped-eeth', decimals: 18 }, - [ADDRESSES.optimism.ezETH]: { coingeckoId: "renzo-restaked-eth", decimals: 18 }, - }, - moonriver: { - [ADDRESSES.moonriver.ETH]: { coingeckoId: 'ethereum', decimals: 18 }, - }, - zircuit: { - [ADDRESSES.null]: { coingeckoId: 'ethereum', decimals: 18 }, - }, - islm: { - [ADDRESSES.islm.USDC]: { coingeckoId: 'usd-coin', decimals: 6 }, - }, - cronos_zkevm: { - [ADDRESSES.cronos_zkevm.wzkCRO]: { coingeckoId: 'crypto-com-chain', decimals: 18 }, - [ADDRESSES.cronos_zkevm.ETH]: { coingeckoId: 'ethereum', decimals: 18 }, }, lac: { [ADDRESSES.null]: { coingeckoId: "la-coin", decimals: 18 }, [ADDRESSES.lac.LAC]: { coingeckoId: "la-coin", decimals: 18 }, - [ADDRESSES.lac.WETH]: { coingeckoId: "ethereum", decimals: 18 }, - [ADDRESSES.lac.WBTC]: { coingeckoId: "wrapped-bitcoin", decimals: 8 }, - }, - blast: { - '0xf8a5d147a3a3416ab151758d969eff15c27ab743': { coingeckoId: "blast:0x59c159e5a4f4d1c86f7abdc94b7907b7473477f6", decimals: 0 }, - }, - noble: { - [ADDRESSES.noble.USDC]: { coingeckoId: "usd-coin", decimals: 6 }, - [ADDRESSES.noble.USDY]: { coingeckoId: "ondo-us-dollar-yield", decimals: 18 }, - }, - q: { - [ADDRESSES.q.WQ]: { coingeckoId: "q-protocol", decimals: 18 }, - }, - taiko: { - [ADDRESSES.taiko.DAI]: { coingeckoId: "dai", decimals: 18 }, - }, - neox: { - [ADDRESSES.null]: { coingeckoId: "gas", decimals: 18 }, - [ADDRESSES.neox.WGAS]: { coingeckoId: "gas", decimals: 18 }, - [ADDRESSES.neox.WGAS_1]: { coingeckoId: "gas", decimals: 18 }, - }, - aura: { - [ADDRESSES.null]: { coingeckoId: "aura-network", decimals: 18 }, - '0xDE47A655a5d9904BD3F7e1A536D8323fBD99993A': { coingeckoId: "aura-network", decimals: 18 }, - [ADDRESSES.functionx.WFX]: { coingeckoId: "tether", decimals: 6 }, - }, - gravity: { - [ADDRESSES.null]: { coingeckoId: "g-token", decimals: 18 }, - [ADDRESSES.gravity.wG]: { coingeckoId: "g-token", decimals: 18 }, - [ADDRESSES.gravity.WETH]: { coingeckoId: "ethereum", decimals: 18 }, - [ADDRESSES.rari.USDC_e]: { coingeckoId: "usd-coin", decimals: 6 }, - }, - idex: { - [ADDRESSES.rari.USDC_e]: { coingeckoId: "usd-coin", decimals: 6 }, - }, - xdai: { - '0x6c76971f98945ae98dd7d4dfca8711ebea946ea6': { coingeckoId: "wrapped-steth", decimals: 18 }, - [ADDRESSES.xdai.SDAI]: { coingeckoId: "savings-dai", decimals: 18 }, - }, - etn: { - [ADDRESSES.etn.WETN]: { coingeckoId: "electroneum", decimals: 18 } }, - polynomial: { - [ADDRESSES.polynomial.USDC]: { coingeckoId: "usd-coin", decimals: 6 }, - [ADDRESSES.polynomial.SDAI]: { coingeckoId: "savings-dai", decimals: 18 }, - [ADDRESSES.polynomial.sUSDe]: { coingeckoId: "ethena-staked-usde", decimals: 18 }, - } } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) diff --git a/projects/helper/utils/solana/layout.js b/projects/helper/utils/solana/layout.js index b7523fd96eba..42e27acd27d9 100644 --- a/projects/helper/utils/solana/layout.js +++ b/projects/helper/utils/solana/layout.js @@ -5,7 +5,7 @@ const { parsePhoenix } = require('./layouts/phoenix-dex') const { RAYDIUM_LIQUIDITY_STATE_LAYOUT_CLMM, RAYDIUM_STABLE_STATE_LAYOUT_V1, } = require('./layouts/raydium-layout') 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 { ReserveLayout, ReserveLayoutLarix, MintLayout, AccountLayout, TokenSwapLayout, ESOLStakePoolLayout, PARLAY_LAYOUT_PARTIAL, HH_PARI_LAYOUT_PARTIAL, } = require('./layouts/mixed-layout'); 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"); @@ -63,6 +63,8 @@ const customDecoders = { sanctumValidatorLsts: parseSanctumLstStateList, stakePoolPartial: defaultParseLayout(STAKE_POOL_PARTIAL), stakePool: defaultParseLayout(STAKE_POOL_LAYOUT), + hhParlay: defaultParseLayout(PARLAY_LAYOUT_PARTIAL), + hhPari: defaultParseLayout(HH_PARI_LAYOUT_PARTIAL), } function decodeAccount(layout, accountInfo) { diff --git a/projects/helper/utils/solana/layouts/mixed-layout.js b/projects/helper/utils/solana/layouts/mixed-layout.js index 77e760154d53..53962af37c5f 100644 --- a/projects/helper/utils/solana/layouts/mixed-layout.js +++ b/projects/helper/utils/solana/layouts/mixed-layout.js @@ -250,7 +250,27 @@ const ESOLStakePoolLayout = BufferLayout.struct([ u32("maxValidatorYieldPerEpochNumerator") ]); + +const PARLAY_LAYOUT_PARTIAL = BufferLayout.struct([ + publicKey('mint'), + u32("entryCount"), + u64('entryCost'), +]); + +const HH_PARI_LAYOUT_PARTIAL = BufferLayout.struct([ + publicKey('mint'), + u64("closeTimestamp"), + u64("resolveTimestamp"), + u64("outcomeTimestamp"), + u16("creatorFee"), + u16("platformFee"), + u8('state'), + u8('outcome'), + BufferLayout.seq(u64(), u8().span, 'amounts'), +]); + module.exports = { - ReserveLayout, ReserveLayoutLarix, MintLayout, AccountLayout, TokenSwapLayout, ESOLStakePoolLayout, + ReserveLayout, ReserveLayoutLarix, MintLayout, AccountLayout, TokenSwapLayout, ESOLStakePoolLayout, + PARLAY_LAYOUT_PARTIAL, HH_PARI_LAYOUT_PARTIAL, } diff --git a/projects/imbtc.js b/projects/imbtc.js index 7d80f59ec1a1..65dbf6ae6dc2 100644 --- a/projects/imbtc.js +++ b/projects/imbtc.js @@ -1,11 +1,14 @@ - -async function tvl(api) { - const imBTC = '0x3212b29E33587A00FB1C83346f5dBFA69A458923' - const supply = await api.call({ abi: 'erc20:totalSupply', target: imBTC }) - api.add(imBTC, supply) -} +const { sumTokens } = require('./helper/chain/bitcoin') module.exports = { - ethereum: { tvl }, - methodology: `TVL for imBTC consists of the BTC deposits in custody that were used to mint imBTC` + ethereum: { tvl: () => ({}) }, + bitcoin: { + tvl: () => sumTokens({ + owners: ['3JMjHDTJjKPnrvS7DycPAgYcA6HrHRk8UG', '3GH4EhMi1MG8rxSiAWqfoiUCMLaWPTCxuy'], + }) + }, + methodology: `TVL for imBTC consists of the BTC deposits in custody that were used to mint imBTC`, + hallmarks: [ + [Math.floor(new Date('2024-01-31') / 1e3), 'Project ceases operation'], + ], } diff --git a/projects/karak/index.js b/projects/karak/index.js index 4596dcbd6e4d..3cd0de8cf00b 100644 --- a/projects/karak/index.js +++ b/projects/karak/index.js @@ -7,6 +7,7 @@ const config = { mantle: { factory: '0x4a2b015CcB8658998692Db9eD4522B8e846962eD', }, bsc: { factory: '0x4a2b015CcB8658998692Db9eD4522B8e846962eD', }, blast: { factory: '0x58b5dc145ca2BE84fe087614CFe36055be609BB3', }, + fraxtal: { factory: '0xdF922c74CC0dc394022ea002Af5aFaa32348670e', }, } Object.keys(config).forEach(chain => { diff --git a/projects/knitfinance/index.js b/projects/knitfinance/index.js index c3adaaece5f2..81226c1fbcb0 100644 --- a/projects/knitfinance/index.js +++ b/projects/knitfinance/index.js @@ -51,6 +51,7 @@ module.exports = { }; function addChain(chain) { + module.exports.deadFrom = "2023-02-01" module.exports[chain] = { tvl: async () => { const balances = {} diff --git a/projects/kriya-dex-earn/index.js b/projects/kriya-dex-earn/index.js index f96382b54907..60cbaecb1fe4 100644 --- a/projects/kriya-dex-earn/index.js +++ b/projects/kriya-dex-earn/index.js @@ -1,11 +1,14 @@ const { fetchURL } = require("../helper/utils"); const sui = require("../helper/chain/sui"); -const vaultUrl = +const clmmVaultUrl = "https://88ob93rfva.execute-api.ap-southeast-1.amazonaws.com/release/vaults"; -async function vaultTVL(api) { - const vaults = (await fetchURL(vaultUrl))?.data; +const llVaultUrl = + "https://4sacq88271.execute-api.ap-southeast-1.amazonaws.com/release/vaults"; + +async function clmmVaultTVL(api) { + const vaults = (await fetchURL(clmmVaultUrl))?.data; for (const vault of vaults) { const tokenX = Number(vault?.coinA); const tokenY = Number(vault?.coinB); @@ -15,12 +18,26 @@ async function vaultTVL(api) { } } +async function llVaultTVL(api) { + const vaults = (await fetchURL(llVaultUrl))?.data; + for (const vault of vaults) { + const aumBaseTokenReserve = Number(vault?.aumInBaseToken); + + api.add(vault?.pool?.tokenXType, aumBaseTokenReserve); + } +} + +async function vaultsTVL(api) { + await llVaultTVL(api); + await clmmVaultTVL(api); +} + module.exports = { timetravel: true, misrepresentedTokens: false, methodology: "Collets all the TVL from the KriyaDEX vaults. The TVL is denominated in USD.", sui: { - tvl: vaultTVL, + tvl: vaultsTVL, }, }; diff --git a/projects/multibit/index.js b/projects/multibit/index.js index a5b461cea9f3..1ccc38fcc2b7 100644 --- a/projects/multibit/index.js +++ b/projects/multibit/index.js @@ -7,9 +7,10 @@ const BRIDGE_TOKENS = "https://api.multibit.exchange/support/token"; const config = { // https://app.multibit.exchange/staking - ethereum: { stakingPool: "0x2EDfFbc62C3dfFD2a8FbAE3cd83A986B5bbB5495", tokens: [ADDRESSES.null, ADDRESSES.ethereum.USDT] }, + ethereum: { stakingPool: "0x2EDfFbc62C3dfFD2a8FbAE3cd83A986B5bbB5495", tokens: [ADDRESSES.null, ADDRESSES.ethereum.USDT], chainKey: 'eth' }, bsc: {}, polygon: {}, + bouncebit: { chainKey: 'bb'}, } module.exports = { methodology: `Tokens bridged via MultiBit are counted as TVL`, @@ -20,18 +21,17 @@ module.exports = { 'bc1pyyms2ssr0hagy5j50r5n689e6ye0626v3c98j5fw0jk6tz3vrgts7nt56g', // cold wallet 'bc1qmcrpqanjnrw58y0fvq08fqchgxv5aylctew7vxlkalfns3rpedxsx4hxpu', // cold wallet ], - blacklistedTokens: ['MUBI', 'BSSB'] + blacklistedTokens: ['MUBI', 'BSSB', 'savm'] // more SAVM is bridged than circulating supply according to coingecko & etherscan }), }, } Object.keys(config).forEach(chain => { - const { stakingPool, tokens = [ADDRESSES.null] } = config[chain] + const { stakingPool, tokens = [ADDRESSES.null], chainKey = chain } = config[chain] module.exports[chain] = { tvl: async (api) => { const data = await getConfig('multibit', BRIDGE_TOKENS) - const key = chain === 'ethereum' ? 'eth': chain - const owner = data.find(v => v.chain === key)?.real?.contract + const owner = data.find(v => v.chain === chainKey)?.real?.contract if (!owner) return {} return api.sumTokens({ owner, tokens, }) } diff --git a/projects/navi/index.js b/projects/navi/index.js index 24a12baa10c0..d5e81b6c81f0 100644 --- a/projects/navi/index.js +++ b/projects/navi/index.js @@ -5,6 +5,7 @@ const decimalShift = { [ADDRESSES.sui.USDC]: -3, // USDC [ADDRESSES.sui.USDT]: -3, // USDT [ADDRESSES.sui.WETH]: -1, // WETH + ["0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD"]: -3, } const storageId = "0xbb4e2f4b6205c2e2a2db47aeb4f830796ec7c005f88537ee775986639bc442fe" diff --git a/projects/rumpel/index.js b/projects/rumpel/index.js new file mode 100644 index 000000000000..27c6607c6c28 --- /dev/null +++ b/projects/rumpel/index.js @@ -0,0 +1,117 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getLogs2 } = require("../helper/cache/getLogs") + +const CONTRACTS = { + RUMEPL_POINT_TOKENIZATION_VAULT: "0xe47F9Dbbfe98d6930562017ee212C1A1Ae45ba61", + RUMPEL_WALLET_FACTORY: "0x5774abcf415f34592514698eb075051e97db2937", + ETHENA_LP_STAKING: "0x8707f238936c12c309bfc2B9959C35828AcFc512", + MORPHO_BLUE: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb", + ZIRCUIT_RESTAKING_POOL: "0xF047ab4c75cebf0eB9ed34Ae2c186f3611aEAfa6", +}; + +const DEPLOYMENT = { + RUMPEL_WALLET_FACTORY: { + block: 20696108, + timestamp: 1725680627000, + }, +}; + +const TOKENS = { + AGETH: "0xe1B4d34E8754600962Cd944B535180Bd758E6c2e", + SUSDE: ADDRESSES.ethereum.sUSDe, + USDE: ADDRESSES.ethereum.USDe, + WSTETH: ADDRESSES.ethereum.WSTETH, + WEETH: "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee", + WEETHS: "0x917ceE801a67f933F2e6b33fC0cD1ED2d5909D88", + MSTETH: "0x49446A0874197839D15395B908328a74ccc96Bc0", + STETH: ADDRESSES.ethereum.STETH, + RSUSDE: "0x82f5104b23FF2FA54C2345F821dAc9369e9E0B26", + RSTETH: "0x7a4effd87c2f3c55ca251080b1343b605f327e3a", + KUSDE: "0xBE3cA34D0E877A1Fc889BD5231D65477779AFf4e", + KWEETH: "0x2DABcea55a12d73191AeCe59F508b191Fb68AdaC", + DC_WSTETH_COLLATERAL: "0xC329400492c6ff2438472D4651Ad17389fCb843a", + DC_SUSDE_COLLATERAL: "0x19d0D8e6294B7a04a2733FE433444704B791939A", +}; + +const MORPHO_SUSDE_MARKET_ID = + "0x39d11026eae1c6ec02aa4c0910778664089cdd97c3fd23f68f7cd05e2e95af48"; + +async function tvl(api) { + const owners = await getOwners(api); + + await Promise.all([sumBaseTokens, handleLockedUSDE, handleMorphoSuppliedSUSDE, handleZircuitAssets, handleStrategyTokenBalances].map(async (fn) => fn())); + + async function sumBaseTokens() { + return api.sumTokens({ + owners, tokens: [TOKENS.AGETH, TOKENS.WEETH, TOKENS.USDE, TOKENS.SUSDE, TOKENS.MSTETH, TOKENS.WSTETH, TOKENS.STETH,] + }) + } + + + async function handleLockedUSDE() { + const stakes = await api.multiCall({ + target: CONTRACTS.ETHENA_LP_STAKING, + abi: "function stakes(address,address) view returns (uint256 amount,uint152,uint104)", + calls: owners.map((owner) => ({ params: [owner, TOKENS.USDE] })), + }); + api.add(TOKENS.USDE, stakes.map(i => i.amount)) + } + + async function handleMorphoSuppliedSUSDE() { + const positions = await api.multiCall({ + target: CONTRACTS.MORPHO_BLUE, + abi: "function position(bytes32,address) view returns (uint256,uint128,uint128 amount)", + calls: owners.map((owner) => ({ params: [MORPHO_SUSDE_MARKET_ID, owner] })), + }); + api.add(TOKENS.USDE, positions.map(i => i.amount)) + } + + async function handleZircuitAssets() { + const assets = [TOKENS.WEETH, TOKENS.WEETHS, TOKENS.USDE, TOKENS.MSTETH] + const calls = [] + for (const asset of assets) + for (const owner of owners) + calls.push({ params: [asset, owner] }) + const tokens = calls.map(i => i.params[0]) + const bals = await api.multiCall({ target: CONTRACTS.ZIRCUIT_RESTAKING_POOL, abi: "function balance(address,address) view returns (uint256)", calls, }); + api.add(tokens, bals) + } + + async function handleStrategyTokenBalances() { + const tokens = [ + TOKENS.KWEETH, + TOKENS.KUSDE, + TOKENS.DC_WSTETH_COLLATERAL, + TOKENS.DC_SUSDE_COLLATERAL, + TOKENS.MSTETH, + TOKENS.RSUSDE, + TOKENS.RSTETH, + ] + return api.sumTokens({ owners, tokens }) + } +} + +async function getOwners(api) { + const logs = await getLogs2({ + api, + target: CONTRACTS.RUMPEL_WALLET_FACTORY, + topic: "SafeCreated(address,address[],uint256)", + eventAbi: + "event SafeCreated(address indexed safe, address[] indexed owners, uint256 threshold)", + fromBlock: DEPLOYMENT.RUMPEL_WALLET_FACTORY.block, + }); + return logs + .map((log) => log.safe) + .concat(CONTRACTS.RUMEPL_POINT_TOKENIZATION_VAULT); +} + + + +module.exports = { + methodology: + "Sums up the supported tokens in Rumpel Wallets + Deposits in the Rumpel Point Tokenization Vault", + start: DEPLOYMENT.RUMPEL_WALLET_FACTORY.timestamp, + ethereum: { + tvl, + }, +}; diff --git a/projects/stargatefinance/index.js b/projects/stargatefinance/index.js index 3abc684a85e3..273babb7ad32 100644 --- a/projects/stargatefinance/index.js +++ b/projects/stargatefinance/index.js @@ -63,11 +63,12 @@ const CONFIG = { module.exports = { goerli: { - tvl: async (api) => { - return { - [ADDRESSES.ethereum.WETH]: await api.call({ abi: 'erc20:balanceOf', target: '0xdD69DB25F6D620A7baD3023c5d32761D353D3De9', params: ['0x88124ef4a9ec47e691f254f2e8e348fd1e341e9b'], }), - } - }, + tvl: () => ({}) + // tvl: async (api) => { + // return { + // [ADDRESSES.ethereum.WETH]: await api.call({ abi: 'erc20:balanceOf', target: '0xdD69DB25F6D620A7baD3023c5d32761D353D3De9', params: ['0x88124ef4a9ec47e691f254f2e8e348fd1e341e9b'], }), + // } + // }, }, } diff --git a/projects/treasury/k9finance.js b/projects/treasury/k9finance.js new file mode 100644 index 000000000000..2622ebfd217f --- /dev/null +++ b/projects/treasury/k9finance.js @@ -0,0 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xDA4Df6E2121eDaB7c33Ed7FE0f109350939eDA84"; +const shibtreasury = "0x5C3d21D406226F17a06510F1CB9157BD9e751416" + +module.exports = treasuryExports({ + ethereum: { + tokens: [nullAddress], + owners: [treasury], + ownTokens: ["0x91fbb2503ac69702061f1ac6885759fc853e6eae"] + }, + shibarium: { + tokens: [nullAddress,ADDRESSES.shibarium.BONE_5], + owners: [shibtreasury], + ownTokens: ["0x91fbB2503AC69702061f1AC6885759Fc853e6EaE"] + }, +}) \ No newline at end of file diff --git a/projects/wise-lending-v2/index.js b/projects/wise-lending-v2/index.js index bb9c6732625c..9d6c1503e4e4 100644 --- a/projects/wise-lending-v2/index.js +++ b/projects/wise-lending-v2/index.js @@ -1,4 +1,4 @@ -const ADDRESSES = require('../helper/coreAssets.json') +const ADDRESSES = require('../helper/coreAssets.json'); async function tvl(api) { const { lending: lendingContract, tvlAddresses } = config[api.chain]; @@ -12,9 +12,9 @@ async function borrowed(api) { abi: 'function getPseudoTotalBorrowAmount(address) view returns (uint256)', target: lendingContract, calls: borrowAddresses - }) + }); - api.add(borrowAddresses, borrowAmounts) + api.add(borrowAddresses, borrowAmounts); } const aavePools = [ @@ -25,6 +25,16 @@ const aavePools = [ "0x6ab707Aca953eDAeFBc4fD23bA73294241490620", ]; +const wisePools = [ + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.WSTETH, +]; + + const config = { arbitrum: { lending: '0x9034a49587bD2c1Af27598E0f04F30Db66C87Ebf', @@ -32,6 +42,12 @@ const config = { tvlAddresses: aavePools, borrowAddresses: aavePools }, + ethereum: { + lending: '0x78190e4c7C7B2c2C3b0562F1f155a1FC2F5160CA', + feeManager: '0x0bc24e61daad6293a1b3b53a7d01086bff0ea6e5', + tvlAddresses: wisePools, + borrowAddresses: wisePools + }, }; Object.keys(config).forEach(chain => { diff --git a/projects/yieldflow/index.js b/projects/yieldflow/index.js index 54a830821b3c..41088f514c31 100644 --- a/projects/yieldflow/index.js +++ b/projects/yieldflow/index.js @@ -97,7 +97,9 @@ const config = { '0x0a4a169a6b2ac75c86e2F0e42822fdEA13fB1CC8', '0xafFA16b152232dAd8BF3AaDF6bb6F895A836F917', '0xFB04d48e4CE9C042188Ef933ff4cf58921Ab59B8', - '0x36232356758c746A50AD5078815F09e39E34628d' + '0x36232356758c746A50AD5078815F09e39E34628d', + '0xA0FDf5DC858ea552d51B4fa304e72cEB34e736fb', + '0xaC36A41da8f069C4874Dda60e073B5DcF889B56E' ] } } diff --git a/utils/scripts/checkFixTokensPriced.js b/utils/scripts/checkFixTokensPriced.js new file mode 100644 index 000000000000..da8b955b9051 --- /dev/null +++ b/utils/scripts/checkFixTokensPriced.js @@ -0,0 +1,34 @@ +const { fixBalancesTokens } = require("../../projects/helper/tokenMapping") +const axios = require('axios') + + +async function run() { + let allTokens = [] + const tokensMissingPrice = [] + const tokensWithPrice = [] + const tokenSet = new Set() + Object.entries(fixBalancesTokens).forEach(([chain, tokens]) => { + Object.keys(tokens).forEach(token => { + const key = chain+':'+token + if (!tokenSet.has(key.toLowerCase())) { // ignore duplicates + tokenSet.add(key.toLowerCase()) + allTokens.push(key) + } + }) + }) + const burl = 'https://coins.llama.fi/prices/current/'+allTokens.join(',') + const prices = (await axios.get(burl)).data.coins + + allTokens.forEach(token => { + if (!prices[token]) { + tokensMissingPrice.push(token) + } else { + tokensWithPrice.push(token) + } + }) + + console.log('Tokens with price:', tokensWithPrice, tokensWithPrice.length) + console.log('Tokens missing price:', tokensMissingPrice, tokensMissingPrice.length) +} + +run().catch(console.error).then(() => process.exit(0)) \ No newline at end of file