diff --git a/aggregators/arcane-dex/index.ts b/aggregators/arcane-dex/index.ts index 46c61f4cce..abbcce6c8e 100644 --- a/aggregators/arcane-dex/index.ts +++ b/aggregators/arcane-dex/index.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../../helpers/coreAssets.json' import request from "graphql-request" import { FetchResultVolume, SimpleAdapter } from "../../adapters/types" @@ -38,7 +39,7 @@ const fetchVolume = async (timestamp: number): Promise => { } ` const result: IResponse = await request("https://api.thegraph.com/subgraphs/name/0xandee/arcanedex", query) - const ethAddress = "ethereum:0x0000000000000000000000000000000000000000"; + const ethAddress = "ethereum:" + ADDRESSES.null; const dailyVolumeInEth = Number(result.today.totalVolumeInEth) - Number(result.yesterday.totalVolumeInEth) const totalVolumeInEth = Number(result.today.totalVolumeInEth) diff --git a/dexs/kyberswap/index.ts b/dexs/kyberswap/index.ts index 0a3143b8d4..1de592c7ee 100644 --- a/dexs/kyberswap/index.ts +++ b/dexs/kyberswap/index.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../../helpers/coreAssets.json' import request from "graphql-request"; import { BaseAdapter, BreakdownAdapter, FetchResultVolume } from "../../adapters/types"; import { CHAIN } from "../../helpers/chains"; @@ -97,7 +98,7 @@ const optimismElastic = async (timestamp: number) => { const url = "https://api.thegraph.com/subgraphs/name/kybernetwork/kyberswap-elastic-optimism"; const blacklisted = [ '0xa00e3a3511aac35ca78530c85007afcd31753819', - '0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9', + ADDRESSES.optimism.sUSD, '0xb448ec505c924944ca8b2c55ef05c299ee0781df' ] const poolBlacklist = [ diff --git a/dexs/pingu/index.ts b/dexs/pingu/index.ts index 86d2cfa8a1..e2217aacf2 100644 --- a/dexs/pingu/index.ts +++ b/dexs/pingu/index.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../../helpers/coreAssets.json' import { FetchResult, SimpleAdapter } from "../../adapters/types"; import { CHAIN } from "../../helpers/chains"; import { gql, request } from "graphql-request"; @@ -24,8 +25,8 @@ const fetch = async (timestamp: number): Promise => { }`; const response: IGraph = (await request(URL, query)).dayData; const element = response; - balances._add('0xaf88d065e77c8cc2239327c5edb3a432268e5831', element.volumeUsdc); - balances._add('0x82af49447d8a07e3bd95bd0d56f35241523fbab1', element.volumeEth); + balances._add(ADDRESSES.arbitrum.USDC_CIRCLE, element.volumeUsdc); + balances._add(ADDRESSES.arbitrum.WETH, element.volumeEth); return { dailyVolume: await balances.getUSDString(), diff --git a/dexs/saber/index.ts b/dexs/saber/index.ts index f83e01c84d..14bfc18461 100644 --- a/dexs/saber/index.ts +++ b/dexs/saber/index.ts @@ -1,14 +1,15 @@ +import ADDRESSES from '../../helpers/coreAssets.json' import { httpPost } from "../../utils/fetchURL"; import { getPrices } from "../../utils/prices"; async function last24h(timestamp: number) { const data = await httpPost('https://saberqltest.aleph.cloud/', { "query": "{\n pools {\n ammId\n name\n coin {\n chainId\n address\n name\n decimals\n symbol\n logoURI\n }\n pc {\n chainId\n address\n name\n decimals\n symbol\n logoURI\n }\n lp {\n chainId\n address\n name\n decimals\n symbol\n logoURI\n }\n stats {\n tvl_pc\n tvl_coin\n price\n vol24h\n }\n }\n}\n" }) - const coinId = "solana:So11111111111111111111111111111111111111112"; + const coinId = "solana:" + ADDRESSES.solana.SOL; const prices = await getPrices([coinId], timestamp) const vol = data.data.pools.reduce( (a: number, b: any) => a + b.stats.vol24h * - (b.pc.address === "So11111111111111111111111111111111111111112" ? prices[coinId].price : 1) + (b.pc.address === ADDRESSES.solana.SOL ? prices[coinId].price : 1) , 0) return { dailyVolume: vol, diff --git a/dexs/shell-protocol/index.ts b/dexs/shell-protocol/index.ts index e2b7cdd1cc..16dc483aa9 100644 --- a/dexs/shell-protocol/index.ts +++ b/dexs/shell-protocol/index.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../../helpers/coreAssets.json' import { SimpleAdapter } from "../../adapters/types"; import { CHAIN } from "../../helpers/chains"; import * as sdk from "@defillama/sdk"; @@ -5,10 +6,10 @@ import { getBlock } from "../../helpers/getBlock"; import BigNumber from "bignumber.js"; import { getPrices } from "../../utils/prices"; -const DAI_CONTRACT = '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1'; -const USDC_CONTRACT = '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8'; -const USDT_CONTRACT = '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9'; -const WBTC_CONTRACT = '0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f'; +const DAI_CONTRACT = ADDRESSES.optimism.DAI; +const USDC_CONTRACT = ADDRESSES.arbitrum.USDC; +const USDT_CONTRACT = ADDRESSES.arbitrum.USDT; +const WBTC_CONTRACT = ADDRESSES.arbitrum.WBTC; const topic = 'Transfer (index_topic_1 address from, index_topic_2 address to, uint256 value)'; const topic0 = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'; diff --git a/dexs/synfutures-v2/index.ts b/dexs/synfutures-v2/index.ts index 1b9b919e4d..27664785b1 100644 --- a/dexs/synfutures-v2/index.ts +++ b/dexs/synfutures-v2/index.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../../helpers/coreAssets.json' import { Chain } from "@defillama/sdk/build/general"; import { getUniqStartOfTodayTimestamp } from "../../helpers/getUniSubgraphVolume"; import { getBlock } from "../../helpers/getBlock"; @@ -12,20 +13,20 @@ type TContracts = { }; const contracts: TContracts = { [CHAIN.POLYGON]: [ - ['0x89cf9a71d45c58673a7f8b4c829df466da7a473a','0x7ceb23fd6bc0add59e62ac25578270cff1b9f619'], - ['0xa40986ccd9dc00c533ba71c9362529c9694f9f7b','0x2791bca1f2de4661ed88a30c99a7a9449aa84174'], - ['0xf479405a2518b02a79c060f3d91fe0c98cfe6e25','0x2791bca1f2de4661ed88a30c99a7a9449aa84174'], - ['0x64b8b618cddc31c61305338c6ab7a2d85a7ab5ca','0x2791bca1f2de4661ed88a30c99a7a9449aa84174'], - ['0x19759660e5ee693df6105fc3629d5d91cb0a9447','0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270'], - ['0xbda26f37656218b2b3983800bc5734998445cc92','0x2791bca1f2de4661ed88a30c99a7a9449aa84174'], - ['0x4b6e851015581e88824f1efd71cb65dd9826189b','0x2791bca1f2de4661ed88a30c99a7a9449aa84174'], - ['0x4baa9f1af8653a875d51324ca563d12d7925adf5','0x2791bca1f2de4661ed88a30c99a7a9449aa84174'], - ['0x8c7822f283137e1e73ea0bdc537ccfb2fa1fb030','0x2791bca1f2de4661ed88a30c99a7a9449aa84174'], - ['0x13f7f23db676431a2371d0f1884ae1526a0fe5c2','0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270'], - ['0xb09d2ec9afff13589ddfab190e2d1aba7e02095b','0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270'], - ['0x6909bfbe79f9c33589c637eed166a32afea76ef6','0x2791bca1f2de4661ed88a30c99a7a9449aa84174'], - ['0xf51dcd52bd075c91632aac42c3926b2a523b3da5','0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270'], - ['0x9ceeb2a6f17d3c7bd086471095fcf80cfe780149','0x7ceb23fd6bc0add59e62ac25578270cff1b9f619'], + ['0x89cf9a71d45c58673a7f8b4c829df466da7a473a',ADDRESSES.polygon.WETH_1], + ['0xa40986ccd9dc00c533ba71c9362529c9694f9f7b',ADDRESSES.polygon.USDC], + ['0xf479405a2518b02a79c060f3d91fe0c98cfe6e25',ADDRESSES.polygon.USDC], + ['0x64b8b618cddc31c61305338c6ab7a2d85a7ab5ca',ADDRESSES.polygon.USDC], + ['0x19759660e5ee693df6105fc3629d5d91cb0a9447',ADDRESSES.polygon.WMATIC_2], + ['0xbda26f37656218b2b3983800bc5734998445cc92',ADDRESSES.polygon.USDC], + ['0x4b6e851015581e88824f1efd71cb65dd9826189b',ADDRESSES.polygon.USDC], + ['0x4baa9f1af8653a875d51324ca563d12d7925adf5',ADDRESSES.polygon.USDC], + ['0x8c7822f283137e1e73ea0bdc537ccfb2fa1fb030',ADDRESSES.polygon.USDC], + ['0x13f7f23db676431a2371d0f1884ae1526a0fe5c2',ADDRESSES.polygon.WMATIC_2], + ['0xb09d2ec9afff13589ddfab190e2d1aba7e02095b',ADDRESSES.polygon.WMATIC_2], + ['0x6909bfbe79f9c33589c637eed166a32afea76ef6',ADDRESSES.polygon.USDC], + ['0xf51dcd52bd075c91632aac42c3926b2a523b3da5',ADDRESSES.polygon.WMATIC_2], + ['0x9ceeb2a6f17d3c7bd086471095fcf80cfe780149',ADDRESSES.polygon.WETH_1], ] } @@ -106,8 +107,8 @@ const fetchVolume = (chain: Chain) => { // getPrices API currently has a bug that it doesn't return price for polygon:0x2791bca1f2de4661ed88a30c99a7a9449aa84174 (USDC) for some reason // so we set it as 1 manually to temporarily fix this issue - if (!prices['polygon:0x2791bca1f2de4661ed88a30c99a7a9449aa84174']) { - prices['polygon:0x2791bca1f2de4661ed88a30c99a7a9449aa84174'] = { + if (!prices['polygon:' + ADDRESSES.polygon.USDC]) { + prices['polygon:' + ADDRESSES.polygon.USDC] = { symbol: 'USDC', timestamp: now, price: 1, diff --git a/dexs/tokenlon/index.ts b/dexs/tokenlon/index.ts index c0e3ed9197..961c5842e8 100644 --- a/dexs/tokenlon/index.ts +++ b/dexs/tokenlon/index.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../../helpers/coreAssets.json' import { FetchResultVolume, SimpleAdapter } from "../../adapters/types"; import { CHAIN } from "../../helpers/chains"; import { gql, request } from "graphql-request"; @@ -44,7 +45,7 @@ const fetchVolume = (chain: Chain) => { const coins = [...new Set(historicalData.map((e: IGraph) => `${chain}:${e.makerAssetAddr}`))] const prices = await getPrices(coins, toTimestamp); if (!prices[`ethereum:0x3212b29e33587a00fb1c83346f5dbfa69a458923`]) { - prices[`ethereum:0x3212b29e33587a00fb1c83346f5dbfa69a458923`] = prices[`ethereum:0x2260fac5e5542a773aa44fbcfedf7c193bc2c599`] // imBTC + prices[`ethereum:0x3212b29e33587a00fb1c83346f5dbfa69a458923`] = prices[`ethereum:` + ADDRESSES.ethereum.WBTC] // imBTC } const dailyVolume = historicalData.map((e: IGraph) => { const price = prices[`${chain}:${e.makerAssetAddr}`]?.price || 0; diff --git a/dexs/xfai/index.ts b/dexs/xfai/index.ts index 2544ac4510..475299acd4 100644 --- a/dexs/xfai/index.ts +++ b/dexs/xfai/index.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../../helpers/coreAssets.json' import { CHAIN } from "../../helpers/chains"; import { ChainApi } from "@defillama/sdk"; import { FetchResult, SimpleAdapter } from "../../adapters/types"; @@ -5,7 +6,7 @@ import { getBlock } from "../../helpers/getBlock"; const FACTORY_ADDRESS = "0xa5136eAd459F0E61C99Cec70fe8F5C24cF3ecA26"; const INFT_ADDRESS = "0xa155f12D3Be29BF20b615e1e7F066aE9E3C5239a"; -const LINEA_WETH_ADDRESS = "0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f"; +const LINEA_WETH_ADDRESS = ADDRESSES.linea.WETH; const ONE_DAY_IN_SECONDS = 60 * 60 * 24; const FEE_VOLUME_MULTIPLIER = 1000 / 2; diff --git a/dexs/y2k/y2k-finance.ts b/dexs/y2k/y2k-finance.ts index 97146d70c4..fbca3cbef0 100644 --- a/dexs/y2k/y2k-finance.ts +++ b/dexs/y2k/y2k-finance.ts @@ -1,7 +1,8 @@ +import ADDRESSES from '../../helpers/coreAssets.json' import { FetchOptions, FetchResultVolume } from "../../adapters/types"; const vault_factory = "0x984e0eb8fb687afa53fc8b33e12e04967560e092"; -const WETH = "0x82af49447d8a07e3bd95bd0d56f35241523fbab1"; +const WETH = ADDRESSES.arbitrum.WETH; const event_deposit = "event Deposit (address indexed user, address indexed receiver, uint256 id, uint256 assets)"; const abis: any = { diff --git a/fees/Scale.ts b/fees/Scale.ts index 9bb04b6387..8282c90915 100644 --- a/fees/Scale.ts +++ b/fees/Scale.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { FetchResultFees, SimpleAdapter } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; import * as sdk from "@defillama/sdk"; @@ -93,7 +94,7 @@ const fetch = async (timestamp: number): Promise => { }); const voterGauges = poolsGauges.filter((_vg: string) => - _vg !== '0x0000000000000000000000000000000000000000' + _vg !== ADDRESSES.null ); diff --git a/fees/aerodrome/bribes.ts b/fees/aerodrome/bribes.ts index b2a5d657a4..d32553bf95 100644 --- a/fees/aerodrome/bribes.ts +++ b/fees/aerodrome/bribes.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../../helpers/coreAssets.json' import * as sdk from "@defillama/sdk"; import { getPrices } from "../../utils/prices"; import { ethers } from "ethers"; @@ -37,10 +38,10 @@ const abis: any = { } export const fees_bribes = async (fromBlock: number, toBlock: number, timestamp: number): Promise => { - const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'; + const ZERO_ADDRESS = ADDRESSES.null; const bribeVotingReward: string[] = (await sdk.api2.abi.call({ target: gurar, - params: [1000, 0, '0x0000000000000000000000000000000000000000'], + params: [1000, 0, ADDRESSES.null], abi: abis.all, chain: CHAIN.BASE, })).map((e: any) => { diff --git a/fees/amphor/index.ts b/fees/amphor/index.ts index 9b97aac8df..4619d92ab3 100644 --- a/fees/amphor/index.ts +++ b/fees/amphor/index.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../../helpers/coreAssets.json' import * as sdk from "@defillama/sdk"; import { ethers, EventFilter } from 'ethers'; @@ -156,9 +157,9 @@ const data = async (timestamp: number): Promise => { }); const TOKENS = { - USDC: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - WSTETH: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0", - WBTC: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + USDC: ADDRESSES.ethereum.USDC, + WSTETH: ADDRESSES.ethereum.WSTETH, + WBTC: ADDRESSES.ethereum.WBTC, } const totalFees = new sdk.Balances({ chain: CHAIN.ETHEREUM, timestamp: toTimestamp }); const totalRevenue = new sdk.Balances({ chain: CHAIN.ETHEREUM, timestamp: toTimestamp }); diff --git a/fees/basepaint.ts b/fees/basepaint.ts index a826592c69..63d6cd4168 100644 --- a/fees/basepaint.ts +++ b/fees/basepaint.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { FetchOptions, FetchResultFees, SimpleAdapter } from "../adapters/types" import { CHAIN } from "../helpers/chains" @@ -5,7 +6,7 @@ const contract = '0xBa5e05cb26b78eDa3A2f8e3b3814726305dcAc83' const eventAbi = 'event ArtistsEarned(uint256 indexed day,uint256 amount)'; const protocol_fees = 10; // 10% fees -const ethAddress = "0x0000000000000000000000000000000000000000"; +const ethAddress = ADDRESSES.null; const fetch: any = async (timestamp: number, _: any, { getLogs, createBalances, }: FetchOptions): Promise => { const logs = await getLogs({ target: contract, eventAbi }) diff --git a/fees/blazebot.ts b/fees/blazebot.ts index caf2ac0b22..28a6c37d12 100644 --- a/fees/blazebot.ts +++ b/fees/blazebot.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import {Adapter, FetchResultFees} from "../adapters/types"; import {CHAIN} from "../helpers/chains"; import {Chain} from "@defillama/sdk/build/general"; @@ -34,7 +35,7 @@ const graphs = (chain: Chain) => { ` const graphRes: ISwap[] = (await request(endpoints[chain], query)).fees; - const ethAddress = "ethereum:0x0000000000000000000000000000000000000000"; + const ethAddress = "ethereum:" + ADDRESSES.null; const ethPrice = (await getPrices([ethAddress], timestamp))[ethAddress].price; const dailyFees = graphRes.map((e: ISwap) => { const decimals = 18; diff --git a/fees/bsc.ts b/fees/bsc.ts index bb11f00434..d4b2bf1028 100644 --- a/fees/bsc.ts +++ b/fees/bsc.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { Adapter, ProtocolType } from "../adapters/types"; import { BSC } from "../helpers/chains"; import { request, gql } from "graphql-request"; @@ -38,7 +39,7 @@ const graphs = (graphUrls: ChainEndpoints) => { const dailyFee = new BigNumber(graphRes["today"]["totalFees"]).minus(new BigNumber(graphRes["yesterday"]["totalFees"])) - const bnbAddress = "bsc:0x0000000000000000000000000000000000000000"; + const bnbAddress = "bsc:" + ADDRESSES.null; const pricesObj: any = await getPrices([bnbAddress], todaysTimestamp); const latestPrice = new BigNumber(pricesObj[bnbAddress]["price"]) diff --git a/fees/caviar-tangible.ts b/fees/caviar-tangible.ts index 7c3e30a27c..b59410fade 100644 --- a/fees/caviar-tangible.ts +++ b/fees/caviar-tangible.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { FetchResultFees, SimpleAdapter } from "../adapters/types" import { CHAIN } from "../helpers/chains" import { getBlock } from "../helpers/getBlock"; @@ -6,7 +7,7 @@ import * as sdk from "@defillama/sdk"; const topic0_evt_transfer = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'; const topic1_evt_transfer = '0x000000000000000000000000bbc843dcb1009bc7dc988bceb5bb1b50299d9a6d'; const topic2_evt_transfer = '0x0000000000000000000000006ced48efbb581a141667d7487222e42a3fa17cf7'; -const usdc = '0x2791bca1f2de4661ed88a30c99a7a9449aa84174'; +const usdc = ADDRESSES.polygon.USDC; interface ILog { data: string; diff --git a/fees/chainlink-ccip.ts b/fees/chainlink-ccip.ts index 1d4cfdebea..195244ef4f 100644 --- a/fees/chainlink-ccip.ts +++ b/fees/chainlink-ccip.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { Chain } from "@defillama/sdk/build/general"; import { FetchResultFees, SimpleAdapter } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; @@ -105,7 +106,7 @@ const fetchFees = (chain: Chain) => { address: addressString, } }); - const linkETH = `${CHAIN.ETHEREUM}:0x514910771af9ca656af840dff83e8264ecf986ca` + const linkETH = `${CHAIN.ETHEREUM}:${ADDRESSES.ethereum.LINK}`; const coins = [...new Set(rawData.map((e: any) => `${chain}:${e.address}`)), linkETH]; const prices = await getPrices(coins, timestamp); const dailyFees = rawData.reduce((acc: number, { amount, address }: any) => { diff --git a/fees/chainlink-keepers.ts b/fees/chainlink-keepers.ts index e90931a381..e903848202 100644 --- a/fees/chainlink-keepers.ts +++ b/fees/chainlink-keepers.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { SimpleAdapter, ChainBlocks, FetchResultFees, IJSON } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; import { getPrices } from "../utils/prices"; diff --git a/fees/cow-protocol.ts b/fees/cow-protocol.ts index 64be51a504..005e9d50ef 100644 --- a/fees/cow-protocol.ts +++ b/fees/cow-protocol.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { Adapter, FetchOptions, FetchResultFees } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; import { Chain, } from "@defillama/sdk/build/general"; @@ -37,7 +38,7 @@ const fetch = (chain: Chain) => { AND ethereum.event_logs.block_time BETWEEN llama_replace_date_range GROUP by sum`, options); - gasUsed.map((e: any) => dailyRevenue.add('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', e.sum * -1 / e._count)) + gasUsed.map((e: any) => dailyRevenue.add(ADDRESSES.ethereum.WETH, e.sum * -1 / e._count)) } return { dailyUserFees: dailyFees, dailyFees, dailyRevenue, timestamp } diff --git a/fees/crv-usd.ts b/fees/crv-usd.ts index af71000224..3d08994d19 100644 --- a/fees/crv-usd.ts +++ b/fees/crv-usd.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { Chain } from "@defillama/sdk/build/general"; import { FetchResultFees, SimpleAdapter } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; diff --git a/fees/equalizer-exchange.ts b/fees/equalizer-exchange.ts index 188a07e36b..3f38dbdae1 100644 --- a/fees/equalizer-exchange.ts +++ b/fees/equalizer-exchange.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { FetchResultFees, SimpleAdapter } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; import * as sdk from "@defillama/sdk"; @@ -98,7 +99,7 @@ const fetch = async (timestamp: number): Promise => { }); const voterGauges = poolsGauges.filter((_vg: string) => - _vg !== '0x0000000000000000000000000000000000000000' + _vg !== ADDRESSES.null ); diff --git a/fees/ethereum/index.ts b/fees/ethereum/index.ts index 687a0830ae..5a2ff93e86 100644 --- a/fees/ethereum/index.ts +++ b/fees/ethereum/index.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../../helpers/coreAssets.json' import { Adapter, ProtocolType } from "../../adapters/types"; import { ETHEREUM } from "../../helpers/chains"; import { getTimestampAtStartOfPreviousDayUTC, getTimestampAtStartOfDayUTC } from "../../utils/date"; @@ -28,7 +29,7 @@ const graphs = () => { .filter(item => item.Timestamp === yesterdaysTimestamp) .find(item => item)?.Result || 0 - const ethAddress = "ethereum:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; + const ethAddress = "ethereum:" + ADDRESSES.ethereum.WETH; const pricesObj: any = await getPrices([ethAddress], todaysTimestamp); const latestPrice = new BigNumber(pricesObj[ethAddress]["price"]) diff --git a/fees/foundation.ts b/fees/foundation.ts index 9fc6f37a74..2668637e34 100644 --- a/fees/foundation.ts +++ b/fees/foundation.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { Adapter, FetchResultFees } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; import * as sdk from "@defillama/sdk"; @@ -113,7 +114,7 @@ const fetch = async (timestamp: number): Promise => { ...logs_mint_from_fixed_price_drop, ...logs_withdraw_creator_revenue_from_dutch_auction, ] - const ethAddress = "ethereum:0x0000000000000000000000000000000000000000"; + const ethAddress = "ethereum:" + ADDRESSES.null; const ethPrice = (await getPrices([ethAddress], timestamp))[ethAddress].price; const totalFees = total_logs.reduce((a: number, b: IFee) => a + b.totalFees, 0) const dailyFees = totalFees * ethPrice diff --git a/fees/friend-room.ts b/fees/friend-room.ts index 83ae4087e2..76ce37145b 100644 --- a/fees/friend-room.ts +++ b/fees/friend-room.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { Adapter, FetchResultFees, SimpleAdapter } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; import * as sdk from "@defillama/sdk"; @@ -49,7 +50,7 @@ const fetch = async (timestamp: number): Promise => { }) const dailyFees = fees_details.reduce((a: number, b: IFee) => a + b.fees, 0) const dailyRev = fees_details.reduce((a: number, b: IFee) => a + b.rev, 0) - const ethAddress = "ethereum:0x0000000000000000000000000000000000000000"; + const ethAddress = "ethereum:" + ADDRESSES.null; const ethPrice = (await getPrices([ethAddress], timestamp))[ethAddress].price; const dailyFeesUSD = (dailyFees) * ethPrice; const dailyRevUSD = (dailyRev) * ethPrice; diff --git a/fees/gearbox/index.ts b/fees/gearbox/index.ts index 51c4ce090b..3e5bf8bfca 100644 --- a/fees/gearbox/index.ts +++ b/fees/gearbox/index.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../../helpers/coreAssets.json' import { Adapter, FetchOptions, } from "../../adapters/types"; import { CHAIN } from "../../helpers/chains"; import { queryIndexer } from "../../helpers/indexer"; @@ -7,25 +8,25 @@ type IMapDieselToken = { }; const mapDieselToken: IMapDieselToken = { - "0x6CFaF95457d7688022FC53e7AbE052ef8DFBbdBA": "0x6b175474e89094c44da98b954eedeac495271d0f", - "0xc411dB5f5Eb3f7d552F9B8454B2D74097ccdE6E3": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - "0xF21fc650C1B34eb0FDE786D52d23dA99Db3D6278": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "0xe753260F1955e8678DCeA8887759e07aa57E8c54": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", - "0x2158034dB06f06dcB9A786D2F1F8c38781bA779d": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0", + "0x6CFaF95457d7688022FC53e7AbE052ef8DFBbdBA": ADDRESSES.ethereum.DAI, + "0xc411dB5f5Eb3f7d552F9B8454B2D74097ccdE6E3": ADDRESSES.ethereum.USDC, + "0xF21fc650C1B34eb0FDE786D52d23dA99Db3D6278": ADDRESSES.ethereum.WETH, + "0xe753260F1955e8678DCeA8887759e07aa57E8c54": ADDRESSES.ethereum.WBTC, + "0x2158034dB06f06dcB9A786D2F1F8c38781bA779d": ADDRESSES.ethereum.WSTETH, "0xba3335588d9403515223f109edc4eb7269a9ab5d": "0xba3335588d9403515223f109edc4eb7269a9ab5d", - "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", - "0x6b175474e89094c44da98b954eedeac495271d0f": "0x6b175474e89094c44da98b954eedeac495271d0f", - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0": "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0", - "0x8a1112afef7f4fc7c066a77aabbc01b3fff31d47": "0x853d955aCEf822Db058eb8505911ED77F175b99e", - "0x853d955aCEf822Db058eb8505911ED77F175b99e": "0x853d955aCEf822Db058eb8505911ED77F175b99e", - "0xda00000035fef4082f78def6a8903bee419fbf8e": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - "0xda0002859b2d05f66a753d8241fcde8623f26f4f": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - "0xda00010eda646913f273e10e7a5d1f659242757d": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", - "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48": "0xda00000035fef4082f78def6a8903bee419fbf8e", - "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2": "0xda0002859b2d05f66a753d8241fcde8623f26f4f", - "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599": "0xda00010eda646913f273e10e7a5d1f659242757d", + [ADDRESSES.ethereum.WETH]: ADDRESSES.ethereum.WETH, + [ADDRESSES.ethereum.WBTC]: ADDRESSES.ethereum.WBTC, + [ADDRESSES.ethereum.DAI]: ADDRESSES.ethereum.DAI, + [ADDRESSES.ethereum.USDC]: ADDRESSES.ethereum.USDC, + [ADDRESSES.ethereum.WSTETH]: ADDRESSES.ethereum.WSTETH, + "0x8a1112afef7f4fc7c066a77aabbc01b3fff31d47": ADDRESSES.ethereum.FRAX, + [ADDRESSES.ethereum.FRAX]: ADDRESSES.ethereum.FRAX, + "0xda00000035fef4082f78def6a8903bee419fbf8e": ADDRESSES.ethereum.USDC, + "0xda0002859b2d05f66a753d8241fcde8623f26f4f": ADDRESSES.ethereum.WETH, + "0xda00010eda646913f273e10e7a5d1f659242757d": ADDRESSES.ethereum.WBTC, + [ADDRESSES.ethereum.USDC]: "0xda00000035fef4082f78def6a8903bee419fbf8e", + [ADDRESSES.ethereum.WETH]: "0xda0002859b2d05f66a753d8241fcde8623f26f4f", + [ADDRESSES.ethereum.WBTC]: "0xda00010eda646913f273e10e7a5d1f659242757d", }; Object.keys(mapDieselToken).forEach((key: string) => mapDieselToken[key.toLowerCase()] = mapDieselToken[key]) diff --git a/fees/gnd-protocol.ts b/fees/gnd-protocol.ts index c883fdaea6..2270314393 100644 --- a/fees/gnd-protocol.ts +++ b/fees/gnd-protocol.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { Chain } from "@defillama/sdk/build/general"; import { Adapter, FetchResultFees } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; @@ -33,7 +34,7 @@ const weth_address_tranfer_topic:TTopics = { } const weth_address: TAddress = { - [CHAIN.ARBITRUM]: '0x82af49447d8a07e3bd95bd0d56f35241523fbab1' + [CHAIN.ARBITRUM]: ADDRESSES.arbitrum.WETH } const fetch = (chain: Chain) => { @@ -70,7 +71,7 @@ const fetch = (chain: Chain) => { } as IData }); - const ethAddress = "ethereum:0x0000000000000000000000000000000000000000"; + const ethAddress = "ethereum:" + ADDRESSES.null; const ethPrice = (await getPrices([ethAddress], timestamp))[ethAddress].price; const buybackAmount = logs_fund_disposit.reduce((sum: number, a: IData) => sum + a.amount, 0); const dividends = logs_dividends.reduce((a: number, b: IData) => a + b.amount, 0); diff --git a/fees/goku-money/index.ts b/fees/goku-money/index.ts index 9bee4c04bc..4134106f9f 100644 --- a/fees/goku-money/index.ts +++ b/fees/goku-money/index.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../../helpers/coreAssets.json' import * as sdk from "@defillama/sdk"; import { Adapter, ChainBlocks } from "../../adapters/types"; import { CHAIN } from "../../helpers/chains"; @@ -15,15 +16,15 @@ const BORROW_CONTRACT_ADDRESS = [ const PYTH_CONFIG = { USDC: { contractAddress: "0x5B27B4ACA9573F26dd12e30Cb188AC53b177006e", - address: '0xb73603C5d87fA094B7314C74ACE2e64D165016fb', + address: ADDRESSES.manta.USDC, }, USDT: { contractAddress: "0x2D18cE2adC5B7c4d8558b62D49A0137A6B87049b", - address: '0xf417F5A458eC102B90352F697D6e2Ac3A3d2851f', + address: ADDRESSES.manta.USDT, }, WETH: { contractAddress: "0x17Efd0DbAAdc554bAFDe3cC0E122f0EEB94c8661", - address: '0x0Dc808adcE2099A9F62AA87D9670745AbA741746', + address: ADDRESSES.manta.WETH, }, TIA: { contractAddress: "0xaa41F9e1f5B6d27C22f557296A0CDc3d618b0113", diff --git a/fees/hono.ts b/fees/hono.ts index a5a2714f07..bd6fc656c6 100644 --- a/fees/hono.ts +++ b/fees/hono.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { Adapter, FetchResultFees } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; import { request, gql } from "graphql-request"; @@ -34,7 +35,7 @@ const graph = (graphUrls: ChainEndpoints) => { timestampFrom: fromTimestamp, timestampTo: toTimestamp })).dailyRevenueAggregators; - const ethcoinID = "ethereum:0x0000000000000000000000000000000000000000"; + const ethcoinID = "ethereum:" + ADDRESSES.null; const prices = await getPrices([ethcoinID], timestamp); const value = graphRes.reduce((acc, cur) => acc + Number(cur.todayETHRevenue) / 10 ** 18, 0); const dailyRevenue = (value) * prices[ethcoinID].price; diff --git a/fees/hopr/index.ts b/fees/hopr/index.ts index 41fa84bdea..147c07f07a 100644 --- a/fees/hopr/index.ts +++ b/fees/hopr/index.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../../helpers/coreAssets.json' import { Adapter, FetchResultFees } from "../../adapters/types"; import { CHAIN } from "../../helpers/chains"; import * as sdk from "@defillama/sdk"; @@ -7,7 +8,7 @@ import { getBlock } from "../../helpers/getBlock"; import { getPrices } from "../../utils/prices"; const channels_address = '0x693Bac5ce61c720dDC68533991Ceb41199D8F8ae'; -const wxHOPR_address = '0xd4fdec44db9d44b8f2b6d529620f9c0c7066a2c1'; +const wxHOPR_address = ADDRESSES.xdai.XHOPR; const xHOPR_address = '0xd057604a14982fe8d88c5fc25aac3267ea142a08'; const chain = 'xdai'; const topic0 = '0x7165e2ebc7ce35cc98cb7666f9945b3617f3f36326b76d18937ba5fecf18739a'; //TicketRedeemed diff --git a/fees/justlend.ts b/fees/justlend.ts index 549ab7c09d..8857c72f3b 100644 --- a/fees/justlend.ts +++ b/fees/justlend.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { Adapter, ChainBlocks, FetchResultFees } from "../adapters/types" import { CHAIN } from "../helpers/chains"; import * as sdk from "@defillama/sdk"; @@ -85,22 +86,22 @@ const getContext = async (timestamp: number, _: ChainBlocks): Promise const max_block_timestamp = toTimestamp * 1000; const underlyings: string[] = [ - 'TNUC9Qb1rRpS5CbWLmNMxXBjyFoydXjWFR', - 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t', - 'TMwFHYXLJaRUPeW6421aqXL4ZEzPRFGkGT', - 'TKkeiboTkxXKJpbmVFbv4a8ov5rAfRDMf9', + ADDRESSES.tron.WTRX, + ADDRESSES.tron.USDT, + ADDRESSES.tron.USDJ, + ADDRESSES.tron.SUN_1, 'TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7', - 'TN3W4H6rK2ce4vX9YnFQHwKENnHjoxb3m9', - 'TCFLL5dx5ZJdKnWuesXxi1VPwjLVmWZZy9', - 'TKfjV9RNKJJCqPvBtK8L7Knykh7DNWvnYt', - 'THb4CqiFdwNHsWsQCs4JhzwjMWys4aqCbF', - 'TUpMhErZL2fhh4sVNULAbNKLokS4GjC1F4', + ADDRESSES.tron.BTC, + ADDRESSES.tron.JST, + ADDRESSES.tron.WBTT, + ADDRESSES.tron.ETH, + ADDRESSES.tron.TUSD, 'TFczxzPhnThNSqr5by8tvxsdCFRRz6cPNq', - 'TSSMHYeV2uE9qYH95DqyoCuNCzEL1NvU3S', - 'TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8', - 'TAFjULxiVgT4qWk6UZwjqwZXTSaGaqnVp4', - 'TPYmHEhy5n8TCEfYGqW2rPxsghSfzghPDn', - 'TMz2SWatiAtZVVcH2ebpsbVtYwUPT9EdjH', + ADDRESSES.tron.SUN, + ADDRESSES.tron.USDC, + ADDRESSES.tron.BTT, + ADDRESSES.tron.USDD, + ADDRESSES.tron.BUSD, 'TU3kjFuhtEo42tsCBtfYUAZxoqQ4yuSLQ5', 'TRFe3hT5oYhjSZ6f3ji5FJ7YCfrkWnHRvh', 'TGkxzkDKyMeq2T7edKnyjZoFypyzjkkssq' @@ -179,7 +180,7 @@ const getMarketDetails = async (markets: string[], chain: CHAIN): Promise<{under permitFailure: true, }); const _underlyings = underlyings; - _underlyings[0] = 'TNUC9Qb1rRpS5CbWLmNMxXBjyFoydXjWFR'; + _underlyings[0] = ADDRESSES.tron.WTRX; return { underlyings: _underlyings, reserveFactors: reserveFactors, diff --git a/fees/liquis.ts b/fees/liquis.ts index bbd98d8fa4..336e6b8851 100644 --- a/fees/liquis.ts +++ b/fees/liquis.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { getBlock } from "../helpers/getBlock"; import { Adapter, FetchResultFees } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; diff --git a/fees/liquity.ts b/fees/liquity.ts index 8fa4b83083..5c87a27b1a 100644 --- a/fees/liquity.ts +++ b/fees/liquity.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { Adapter, ChainBlocks, ProtocolType } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; import { getBlock } from "../helpers/getBlock"; @@ -43,7 +44,7 @@ const adapter: Adapter = { const borrowingFees = Number(graphResDaily.today.totalBorrowingFeesPaid) - Number(graphResDaily.yesterday.totalBorrowingFeesPaid); const redemptionFeesETH = Number(graphResDaily.today.totalRedemptionFeesPaid) - Number(graphResDaily.yesterday.totalRedemptionFeesPaid); - const ethAddress = "ethereum:0x0000000000000000000000000000000000000000"; + const ethAddress = "ethereum:" + ADDRESSES.null; const pricesObj: any = await getPrices([ethAddress], todaysTimestamp); const latestPrice = pricesObj[ethAddress]["price"] const redemptionFeesUSD = redemptionFeesETH * latestPrice; diff --git a/fees/llamalend.ts b/fees/llamalend.ts index 6e744ad3dd..8717999241 100644 --- a/fees/llamalend.ts +++ b/fees/llamalend.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { Adapter } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; import { request, gql } from "graphql-request"; @@ -22,7 +23,7 @@ const graphs = (graphUrls: ChainEndpoints) => { const graphQuery = gql ` { - loans(where:{owner_not: "0x0000000000000000000000000000000000000000"}, block:{ number: ${todaysBlock}}) { + loans(where:{owner_not: ADDRESSES.null}, block:{ number: ${todaysBlock}}) { interest borrowed } @@ -30,7 +31,7 @@ const graphs = (graphUrls: ChainEndpoints) => { `; const graphRes: IGraph[] = (await request(graphUrls[chain], graphQuery)).loans; - const ethAddress = "ethereum:0x0000000000000000000000000000000000000000"; + const ethAddress = "ethereum:" + ADDRESSES.null; const ethPrice = (await getPrices([ethAddress], timestamp))[ethAddress].price; const dailyFeePerSec = graphRes.reduce((a: number, b: IGraph) => a + (Number(b.interest) * Number(b.borrowed)), 0) const dailyFee = dailyFeePerSec / 1e36 * ONE_DAY_IN_SECONDS * ethPrice; diff --git a/fees/looksrare.ts b/fees/looksrare.ts index b41d3e322f..ba1f3614d5 100644 --- a/fees/looksrare.ts +++ b/fees/looksrare.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { Adapter } from "../adapters/types"; import { ETHEREUM } from "../helpers/chains"; import { Chain } from '@defillama/sdk/build/general'; @@ -46,7 +47,7 @@ const graphs = (chain: Chain) => { return amount; }); - const ethAddress = "ethereum:0x0000000000000000000000000000000000000000"; + const ethAddress = "ethereum:" + ADDRESSES.null; const ethPrice = (await getPrices([ethAddress], timestamp))[ethAddress].price; const dailyFee = rawLogsData.reduce((a: number, b: number) => a+b, 0); const dailyFeeUSD = dailyFee * ethPrice; diff --git a/fees/maple-finance.ts b/fees/maple-finance.ts index 1aaa552c6a..ce4c7bed6c 100644 --- a/fees/maple-finance.ts +++ b/fees/maple-finance.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { CHAIN } from "../helpers/chains"; import { FetchOptions, SimpleAdapter } from "../adapters/types"; import { queryIndexer } from "../helpers/indexer"; @@ -56,11 +57,11 @@ const fetchFees = async (timestamp: number, _: any, options: FetchOptions) => { logs_funds_distribution.map((e: any, index: number) => { const isEthBase = contract_loan_mangaer[index].toLowerCase() === eth_base.toLowerCase(); - const token = isEthBase ? '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' : '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' + const token = isEthBase ? [ADDRESSES.ethereum.WETH]: ADDRESSES.ethereum.USDC e.forEach((i: any) => dailyFees.add(token, i.netInterest_)) }) - logs_claim_funds.map((e: any) => dailyFees.add('0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', e.netInterest_)) + logs_claim_funds.map((e: any) => dailyFees.add(ADDRESSES.ethereum.USDC, e.netInterest_)) logsTranferERC20.forEach((b: any) => { dailyFees.add(b.contract_address, b.value) dailyRevenue.add(b.contract_address, b.value) diff --git a/fees/nftearth.ts b/fees/nftearth.ts index 167098bc23..e819203f64 100644 --- a/fees/nftearth.ts +++ b/fees/nftearth.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { Adapter, FetchResultFees } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; import { getTimestampAtStartOfDayUTC, getTimestampAtStartOfNextDayUTC } from "../utils/date"; @@ -44,7 +45,7 @@ const fetch = (chain: Chain) => { chain: chain })).map((e: any) => { return { data: e.data.replace('0x', ''), transactionHash: e.transactionHash } as ITx}); - const ethAddress = chain !== CHAIN.POLYGON ? "ethereum:0x0000000000000000000000000000000000000000" : 'ethereum:0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0'; + const ethAddress = chain !== CHAIN.POLYGON ? ["ethereum:" + ADDRESSES.null]: 'ethereum:' + ADDRESSES.ethereum.MATIC; const payableToken: string[] = logs.map((tx: ITx) => { const postionPayableToken = Number(tx.data.slice(320, 384)) === 1 ? 6 : 11; const address = tx.data.slice(postionPayableToken*64, (postionPayableToken*64)+64); // 11 diff --git a/fees/op-bnb.ts b/fees/op-bnb.ts index 471585f5b3..0798001f7e 100644 --- a/fees/op-bnb.ts +++ b/fees/op-bnb.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { CHAIN } from "../helpers/chains"; import { Adapter, ChainBlocks, FetchOptions, FetchResultFees, ProtocolType } from "../adapters/types"; import { queryFlipside } from "../helpers/flipsidecrypto"; @@ -13,8 +14,8 @@ async function getFees(options: FetchOptions) { const balances = createBalances(); const eventAbi = 'event Withdrawal (uint256 value, address to, address from, uint8 withdrawalNetwork)' - await api.sumTokens({ owners: feeVaults, tokens: ['0x0000000000000000000000000000000000000000'] }) - await fromApi.sumTokens({ owners: feeVaults, tokens: ['0x0000000000000000000000000000000000000000'] }) + await api.sumTokens({ owners: feeVaults, tokens: [ADDRESSES.null] }) + await fromApi.sumTokens({ owners: feeVaults, tokens: [ADDRESSES.null] }) const logs = await getLogs({ targets: feeVaults, eventAbi, }) diff --git a/fees/opensea/seaport.ts b/fees/opensea/seaport.ts index ddd05d410d..721d43b6e7 100644 --- a/fees/opensea/seaport.ts +++ b/fees/opensea/seaport.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../../helpers/coreAssets.json' import * as sdk from "@defillama/sdk"; import { getBlock } from "../../helpers/getBlock"; import { getPrices } from "../../utils/prices"; @@ -85,7 +86,7 @@ export const fetch = async (timestamp: number): Promise => { const fees = (marketplace_fee + creator_fee); const rev = (marketplace_fee); - const ethAddress = "ethereum:0x0000000000000000000000000000000000000000"; + const ethAddress = "ethereum:" + ADDRESSES.null; const ethPrice = (await getPrices([ethAddress], timestamp))[ethAddress].price; const dailyFees = (fees * ethPrice) const dailyRevenue = (rev * ethPrice) diff --git a/fees/pendle.ts b/fees/pendle.ts index 3d429d1cff..f80420b505 100644 --- a/fees/pendle.ts +++ b/fees/pendle.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { FetchResultFees, SimpleAdapter } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; import { ethers } from "ethers"; @@ -26,7 +27,7 @@ const gqlQuery = gql` } ` -const STETH_ETHEREUM = "ethereum:0xae7ab96520de3a18e5e111b5eaab095312d7fe84" +const STETH_ETHEREUM = "ethereum:" + ADDRESSES.ethereum.STETH const SY_WSTETH_ARBITRUM = "0x80c12d5b6cc494632bf11b03f09436c8b61cc5df"; const SY_WSTETH_OP = "0x96a528f4414ac3ccd21342996c93f2ecdec24286" diff --git a/fees/pingu/index.ts b/fees/pingu/index.ts index e25be1f9d3..b4f6c6a7ba 100644 --- a/fees/pingu/index.ts +++ b/fees/pingu/index.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../../helpers/coreAssets.json' import { FetchResult, SimpleAdapter } from "../../adapters/types"; import { CHAIN } from "../../helpers/chains"; import { gql, request } from "graphql-request"; @@ -28,8 +29,8 @@ const fetch = async (timestamp: number): Promise => { const response: IGraph = (await request(URL, query)).dayData; const element = response; - balances._add('0xaf88d065e77c8cc2239327c5edb3a432268e5831', element.totalFeesUsdc); - balances._add('0x82af49447d8a07e3bd95bd0d56f35241523fbab1', element.totalFeesEth); + balances._add(ADDRESSES.arbitrum.USDC_CIRCLE, element.totalFeesUsdc); + balances._add(ADDRESSES.arbitrum.WETH, element.totalFeesEth); return { dailyFees: await balances.getUSDString(), diff --git a/fees/polygon.ts b/fees/polygon.ts index cb071fcf3c..5a522f1d69 100644 --- a/fees/polygon.ts +++ b/fees/polygon.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { Adapter, ChainBlocks, FetchOptions, ProtocolType } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; import { queryFlipside } from "../helpers/flipsidecrypto"; @@ -46,7 +47,7 @@ const adapter: Adapter = { BlockTotals bt ON tt.BLOCK_NUMBER = bt.BLOCK_NUMBER;` const [tx_fee, burn_fee]: number[] = (await queryFlipside(query_tx_fee, 260)).flat(); - const maticAddress = "ethereum:0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0"; + const maticAddress = "ethereum:" + ADDRESSES.ethereum.MATIC; dailyFees.addTokenVannila(maticAddress, tx_fee * 1e18); dailyRevenue.addTokenVannila(maticAddress, burn_fee * 1e18); diff --git a/fees/post-tech.ts b/fees/post-tech.ts index 33f5fb3dbd..c3e892db77 100644 --- a/fees/post-tech.ts +++ b/fees/post-tech.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { FetchResultFees, SimpleAdapter } from "../adapters/types" import { CHAIN } from "../helpers/chains" import { getBlock } from "../helpers/getBlock" @@ -48,7 +49,7 @@ const fetchFees = async (timestamp: number): Promise => { }) const dailyFees = fees_details.reduce((a: number, b: IFee) => a+b.fees, 0) const dailyRev = fees_details.reduce((a: number, b: IFee) => a+b.rev, 0) - const ethAddress = "ethereum:0x0000000000000000000000000000000000000000"; + const ethAddress = "ethereum:" + ADDRESSES.null; const ethPrice = (await getPrices([ethAddress], timestamp))[ethAddress].price; const dailyFeesUSD = (dailyFees) * ethPrice; const dailyRevUSD = (dailyRev) * ethPrice; diff --git a/fees/predy-finance/index.ts b/fees/predy-finance/index.ts index b41279485a..b18b9ffec4 100644 --- a/fees/predy-finance/index.ts +++ b/fees/predy-finance/index.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../../helpers/coreAssets.json' import { Chain } from "@defillama/sdk/build/general"; import BigNumber from "bignumber.js"; import { gql, request } from "graphql-request"; @@ -32,9 +33,9 @@ const DIVISOR = 1e18; // Set decimals for each token let decimalByAddress: { [key: string]: number } = { - "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8": USDC_DECIMAL, - "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1": ETH_DECIMAL, - "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f": WBTC_DECIMAL, + [ADDRESSES.arbitrum.USDC]: USDC_DECIMAL, + [ADDRESSES.arbitrum.WETH]: ETH_DECIMAL, + [ADDRESSES.arbitrum.WBTC]: WBTC_DECIMAL, "0x589d35656641d6aB57A545F08cf473eCD9B6D5F7": GYEN_DECIMAL, }; @@ -45,7 +46,7 @@ const graphs = (graphUrls: ChainEndpoints) => { const graphUrl = graphUrls[chain]; // ETH oracle price - const ethAddress = "ethereum:0x0000000000000000000000000000000000000000"; + const ethAddress = "ethereum:" + ADDRESSES.null; const ethPrice = (await getPrices([ethAddress], dayTime))[ethAddress] .price; diff --git a/fees/sharesgram.ts b/fees/sharesgram.ts index 548a1f8070..56721e59c1 100644 --- a/fees/sharesgram.ts +++ b/fees/sharesgram.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { getBalance } from "@defillama/sdk/build/eth"; import { Adapter, ChainBlocks, FetchResultFees } from "../adapters/types" import { CHAIN } from "../helpers/chains" @@ -46,7 +47,7 @@ const fetch = async (timestamp: number, chainBlocks: ChainBlocks): Promise { diff --git a/fees/synthetix.ts b/fees/synthetix.ts index 8fd3a9379b..2c2dd9e0e5 100644 --- a/fees/synthetix.ts +++ b/fees/synthetix.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { Adapter } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; import { Chain } from '@defillama/sdk/build/general'; @@ -22,8 +23,8 @@ type IContract = { [l: string | Chain]: string; } const contract_address: IContract = { - [CHAIN.ETHEREUM]: '0x57ab1ec28d129707052df4df418d58a2d46d5f51', - [CHAIN.OPTIMISM]: '0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9' + [CHAIN.ETHEREUM]: ADDRESSES.ethereum.sUSD, + [CHAIN.OPTIMISM]: ADDRESSES.optimism.sUSD } interface ITx { data: string; diff --git a/fees/tangible-rwa.ts b/fees/tangible-rwa.ts index ba0933f625..795a034915 100644 --- a/fees/tangible-rwa.ts +++ b/fees/tangible-rwa.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { FetchResultFees, SimpleAdapter } from "../adapters/types"; import { CHAIN } from "../helpers/chains" import * as sdk from "@defillama/sdk"; @@ -5,7 +6,7 @@ import { getBlock } from "../helpers/getBlock"; const topic0 = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'; const topic2 = '0x0000000000000000000000006ced48efbb581a141667d7487222e42a3fa17cf7' -const usdc = '0x2791bca1f2de4661ed88a30c99a7a9449aa84174' +const usdc = ADDRESSES.polygon.USDC const list_from_addres_hex = [ '0x00000000000000000000000043e656716cf49c008435a8196d8f825f66f37254', '0x000000000000000000000000cb7daa45ed2a9253ad3c900583b33bed822e8283', diff --git a/fees/touch.fan.ts b/fees/touch.fan.ts index 37f0113f78..f67627efac 100644 --- a/fees/touch.fan.ts +++ b/fees/touch.fan.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { Adapter, FetchResultFees, SimpleAdapter } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; import * as sdk from "@defillama/sdk"; @@ -88,7 +89,7 @@ const fetch = async (timestamp: number): Promise => { let fees = [...fan_fees_details, ...touch_fees_details] const dailyFees = fees.reduce((a: number, b: IFee) => a + b.fees, 0) const dailyRev = fees.reduce((a: number, b: IFee) => a + b.rev, 0) - const ethAddress = "ethereum:0x0000000000000000000000000000000000000000"; + const ethAddress = "ethereum:" + ADDRESSES.null; const ethPrice = (await getPrices([ethAddress], timestamp))[ethAddress].price; const dailyFeesUSD = (dailyFees) * ethPrice; const dailyRevUSD = (dailyRev) * ethPrice; diff --git a/fees/uniswap-lab.ts b/fees/uniswap-lab.ts index 88736c0835..24328258a1 100644 --- a/fees/uniswap-lab.ts +++ b/fees/uniswap-lab.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { FetchResultFees, SimpleAdapter } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; import { getPrices } from "../utils/prices"; @@ -20,7 +21,7 @@ const fetchFees = (chain: Chain) => { from ethereum.core.fact_event_logs WHERE - contract_address = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' + contract_address ='${ADDRESSES.ethereum.USDC}' and topics[0] = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' and ( topics[2] = '0x0000000000000000000000006460d14dbaeb27aefec8ebef85db35defa31c3b9' @@ -36,7 +37,7 @@ const fetchFees = (chain: Chain) => { from ${CHAIN.OPTIMISM}.core.fact_event_logs WHERE - contract_address = '0x0b2c639c533813f4aa9d7837caf62653d097ff85' + contract_address ='${ADDRESSES.optimism.USDC_CIRCLE}' and topics[0] = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' and topics[2] = '0x000000000000000000000000d4ce1f1b8640c1988360a6729d9a73c85a0c80a3' AND BLOCK_TIMESTAMP BETWEEN '${dayAgo.toISOString()}' AND '${now.toISOString()}' @@ -48,7 +49,7 @@ const fetchFees = (chain: Chain) => { from ${CHAIN.POLYGON}.core.fact_event_logs WHERE - contract_address = '0x2791bca1f2de4661ed88a30c99a7a9449aa84174' + contract_address ='${ADDRESSES.polygon.USDC}' and topics[0] = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' and topics[2] = '0x000000000000000000000000ce946931adf7afc0797de2a76270a28458f487ed' AND BLOCK_TIMESTAMP BETWEEN '${dayAgo.toISOString()}' AND '${now.toISOString()}' @@ -60,7 +61,7 @@ const fetchFees = (chain: Chain) => { from ${CHAIN.ARBITRUM}.core.fact_event_logs WHERE - contract_address = '0xaf88d065e77c8cc2239327c5edb3a432268e5831' + contract_address ='${ADDRESSES.arbitrum.USDC_CIRCLE}' and topics[0] = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' and topics[2] = '0x000000000000000000000000d4ce1f1b8640c1988360a6729d9a73c85a0c80a3' AND BLOCK_TIMESTAMP BETWEEN '${dayAgo.toISOString()}' AND '${now.toISOString()}' diff --git a/fees/up-vs-down-game.ts b/fees/up-vs-down-game.ts index c6cdd3893f..98f4635f26 100644 --- a/fees/up-vs-down-game.ts +++ b/fees/up-vs-down-game.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { CHAIN } from "../helpers/chains" import { getBlock } from "../helpers/getBlock" import * as sdk from "@defillama/sdk"; diff --git a/fees/vesta-finance.ts b/fees/vesta-finance.ts index e23349375d..3d84552622 100644 --- a/fees/vesta-finance.ts +++ b/fees/vesta-finance.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { Adapter, FetchResultFees } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; import { getTimestampAtStartOfDayUTC, getTimestampAtStartOfNextDayUTC } from "../utils/date"; @@ -25,10 +26,10 @@ const event_reward_staker = 'event RewardReceived(uint256 reward)'; const VST_ADDRESS = "0x64343594ab9b56e99087bfa6f2335db24c2d1f17"; const ACTIVE_POOL_ADDRESS = "0xbe3de7fb9aa09b3fa931868fb49d5ba5fee2ebb1"; -const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"; +const ZERO_ADDRESS = ADDRESSES.null; const GMX_STAKER = "0xB9b8f95568D5a305c6D70D10Cc1361d9Df3e9F9a"; const GLP_STAKER = "0xDB607928F10Ca503Ee6678522567e80D8498D759"; -const ETHEREUM = "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"; +const ETHEREUM = ADDRESSES.arbitrum.WETH; const contract_interface = new ethers.Interface([ event_redemption, diff --git a/fees/woofi.ts b/fees/woofi.ts index 8a803926f8..62f8ed8270 100644 --- a/fees/woofi.ts +++ b/fees/woofi.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { Adapter, FetchResultFees } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; import * as sdk from "@defillama/sdk"; @@ -17,7 +18,7 @@ type TFeeDetail = { } const fee_detail: TFeeDetail = { [CHAIN.AVAX]: { - target: '0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e', + target: ADDRESSES.avax.USDC, targetDecimal: 6, topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', @@ -25,7 +26,7 @@ const fee_detail: TFeeDetail = { ] }, [CHAIN.BSC]: { - target: '0x55d398326f99059fF775485246999027B3197955', + target: ADDRESSES.bsc.USDT, targetDecimal: 18, topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', @@ -33,7 +34,7 @@ const fee_detail: TFeeDetail = { ] }, [CHAIN.FANTOM]: { - target: '0x04068DA6C83AFCFA0e13ba15A6696662335D5B75', + target: ADDRESSES.fantom.USDC, targetDecimal: 6, topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', @@ -41,7 +42,7 @@ const fee_detail: TFeeDetail = { ] }, [CHAIN.POLYGON]: { - target: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', + target: ADDRESSES.polygon.USDC, targetDecimal: 6, topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', @@ -49,7 +50,7 @@ const fee_detail: TFeeDetail = { ] }, [CHAIN.ARBITRUM]: { - target: '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8', + target: ADDRESSES.arbitrum.USDC, targetDecimal: 6, topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', @@ -57,7 +58,7 @@ const fee_detail: TFeeDetail = { ] }, [CHAIN.OPTIMISM]: { - target: '0x7F5c764cBc14f9669B88837ca1490cCa17c31607', + target: ADDRESSES.optimism.USDC, targetDecimal: 6, topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', diff --git a/fees/y2k/y2k-finance-v2.ts b/fees/y2k/y2k-finance-v2.ts index 2a80b6acd8..27de2f3a5c 100644 --- a/fees/y2k/y2k-finance-v2.ts +++ b/fees/y2k/y2k-finance-v2.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../../helpers/coreAssets.json' import { FetchResultFees } from "../../adapters/types"; import { ethers } from "ethers"; @@ -6,8 +7,8 @@ const event_market_create = "event MarketCreated (uint256 indexed marketId, address premium, address collateral, address underlyingAsset, address token, string name, uint256 strike, address controller)"; const tokens = [ - "0x912ce59144191c1204e64559fe8253a0e49e6548", // ARB - "0x82af49447d8a07e3bd95bd0d56f35241523fbab1", // WETH + ADDRESSES.arbitrum.ARB, // ARB + ADDRESSES.arbitrum.WETH, // WETH ]; const treasury = "0x5c84cf4d91dc0acde638363ec804792bb2108258"; const topic0_transfer = "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"; diff --git a/fees/y2k/y2k-finance.ts b/fees/y2k/y2k-finance.ts index a265fc001c..12f7165c42 100644 --- a/fees/y2k/y2k-finance.ts +++ b/fees/y2k/y2k-finance.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../../helpers/coreAssets.json' import { FetchResultFees } from "../../adapters/types"; import { ethers } from "ethers"; @@ -9,8 +10,8 @@ const abis: any = { }; const tokens = [ - "0x912ce59144191c1204e64559fe8253a0e49e6548", // ARB - "0x82af49447d8a07e3bd95bd0d56f35241523fbab1", // WETH + ADDRESSES.arbitrum.ARB, // ARB + ADDRESSES.arbitrum.WETH, // WETH ]; const treasury = "0x5c84cf4d91dc0acde638363ec804792bb2108258"; const topic0_transfer = "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"; diff --git a/fees/yield-yak-staked-avax.ts b/fees/yield-yak-staked-avax.ts index 55c008e670..c9e1d80cc6 100644 --- a/fees/yield-yak-staked-avax.ts +++ b/fees/yield-yak-staked-avax.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { Adapter, FetchResultFees } from "../adapters/types" import { CHAIN } from "../helpers/chains"; import { ethers } from "ethers"; @@ -12,7 +13,7 @@ const topic_0_distribution = '0xb6bcab815b7a952b8759f2f92fc9981dc1156f6c11bf4dc7 const topic_0_paid = '0x4f2d18324ee95128de091ed2adc501295479000ce4c2cec607aeb1b67e189e2f'; const event_distribution = 'event Distribution(uint256 indexed epoch,address indexed by,uint256 amount)'; const event_paid = 'event Paid(uint256 indexed epoch,address indexed payee,uint256 amount)'; -const AVAX = '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7'; +const AVAX = ADDRESSES.avax.WAVAX; const yield_yak_master = '0x0cf605484a512d3f3435fed77ab5ddc0525daf5f'; const yak_gov = '0x5925c5c6843a8f67f7ef2b55db1f5491573c85eb'; const contract_interface = new ethers.Interface([ diff --git a/fees/zapper-channels.ts b/fees/zapper-channels.ts index 49a08b7b75..334082b96c 100644 --- a/fees/zapper-channels.ts +++ b/fees/zapper-channels.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { Adapter, FetchResultFees, SimpleAdapter } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; import * as sdk from "@defillama/sdk"; @@ -53,7 +54,7 @@ const fetch = async (timestamp: number): Promise => { }) const dailyFees = fees_details.reduce((a: number, b: IFee) => a + b.fees, 0) const dailyRev = fees_details.reduce((a: number, b: IFee) => a + b.rev, 0) - const ethAddress = "ethereum:0x0000000000000000000000000000000000000000"; + const ethAddress = "ethereum:" + ADDRESSES.null; const ethPrice = (await getPrices([ethAddress], timestamp))[ethAddress].price; const dailyFeesUSD = (dailyFees) * ethPrice; const dailyRevUSD = (dailyRev) * ethPrice; diff --git a/fees/zonic.ts b/fees/zonic.ts index c087bda640..223e2b02fd 100644 --- a/fees/zonic.ts +++ b/fees/zonic.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { Adapter, FetchResultFees } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; import { getTimestampAtStartOfDayUTC, getTimestampAtStartOfNextDayUTC } from "../utils/date"; @@ -62,7 +63,7 @@ const fetch = (chain: Chain) => { } as ISaleData }); - const ethAddress = "ethereum:0x0000000000000000000000000000000000000000"; + const ethAddress = "ethereum:" + ADDRESSES.null; const ethPrice = (await getPrices([ethAddress], timestamp))[ethAddress].price; const marketplace_fee = rawLogsData.reduce((a: number, b: ISaleData) => a+b.marketplace_fee, 0); const creator_fee = rawLogsData.reduce((a: number, b: ISaleData) => a+b.creator_fee, 0); diff --git a/helpers/compoundV2.ts b/helpers/compoundV2.ts index 566eaf7e0b..5987040352 100644 --- a/helpers/compoundV2.ts +++ b/helpers/compoundV2.ts @@ -1,3 +1,4 @@ +import ADDRESSES from './coreAssets.json' import { Fetch, FetchOptions } from "../adapters/types"; import * as sdk from "@defillama/sdk"; @@ -22,7 +23,7 @@ export async function getFees(market: string, { createBalances, api, getLogs, }: const markets = await api.call({ target: market, abi: comptrollerABI.getAllMarkets, }) const underlyings = await api.multiCall({ calls: markets, abi: comptrollerABI.underlying, permitFailure: true, }); underlyings.forEach((underlying, index) => { - if (!underlying) underlyings[index] = '0x0000000000000000000000000000000000000000' + if (!underlying) underlyings[index] = ADDRESSES.null }) const reserveFactors = await api.multiCall({ calls: markets, abi: abis.reserveFactor ?? comptrollerABI.reserveFactor, }); const logs: any[] = (await getLogs({ diff --git a/helpers/ethereum-l2.ts b/helpers/ethereum-l2.ts index e032ed8119..cb1c4c862d 100644 --- a/helpers/ethereum-l2.ts +++ b/helpers/ethereum-l2.ts @@ -1,3 +1,4 @@ +import ADDRESSES from './coreAssets.json' import { ChainBlocks, FetchOptions, FetchResultFees, } from "../adapters/types"; import { queryIndexer, toByteaArray } from "../helpers/indexer"; @@ -10,8 +11,8 @@ async function getFees(options: FetchOptions, { feeVaults, gasToken }: { feeVaul const balances = createBalances(); const eventAbi = 'event Withdrawal (uint256 value, address to, address from, uint8 withdrawalNetwork)' - await api.sumTokens({ owners: feeVaults, tokens: ['0x0000000000000000000000000000000000000000'] }) - await fromApi.sumTokens({ owners: feeVaults, tokens: ['0x0000000000000000000000000000000000000000'] }) + await api.sumTokens({ owners: feeVaults, tokens: [ADDRESSES.null] }) + await fromApi.sumTokens({ owners: feeVaults, tokens: [ADDRESSES.null] }) const logs = await getLogs({ targets: feeVaults, eventAbi, }) diff --git a/helpers/token.ts b/helpers/token.ts index bc8a954d57..012f1214fb 100644 --- a/helpers/token.ts +++ b/helpers/token.ts @@ -1,10 +1,11 @@ +import ADDRESSES from './coreAssets.json' import { FetchOptions } from "../adapters/types"; import * as sdk from '@defillama/sdk' import axios from 'axios' import { getCache, setCache } from "./cache"; import { ethers } from "ethers"; -export const nullAddress = '0x0000000000000000000000000000000000000000' +export const nullAddress = ADDRESSES.null export async function addGasTokensReceived(params: { multisig?: string; diff --git a/nfts/chains.ts b/nfts/chains.ts index c14e47bdca..f22513ebe7 100644 --- a/nfts/chains.ts +++ b/nfts/chains.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../helpers/coreAssets.json' import { queryAllium } from "../helpers/allium"; import { queryFlipside } from "../helpers/flipsidecrypto"; import { httpGet, httpPost } from "../utils/fetchURL"; @@ -23,8 +24,8 @@ async function optimism(start: number, end: number) { return { volume: await sumPricedTokens(start, data, { "ETH": "ethereum", - "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7": "optimism", - "0x4200000000000000000000000000000000000006": "ethereum" + [ADDRESSES.avax.WAVAX]: "optimism", + [ADDRESSES.optimism.WETH_1]: "ethereum" }), } } @@ -35,7 +36,7 @@ async function avalanche(start: number, end: number) { volume: await sumPricedTokens(start, data.map(([token, value]: any)=>[token, token.startsWith("0x")?value:value/1e18]), { "ETH": "avalanche-2", "AVAX": "avalanche-2", - "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7": "avalanche-2" + [ADDRESSES.avax.WAVAX]: "avalanche-2" }), } } diff --git a/protocols/uniswap/index.ts b/protocols/uniswap/index.ts index 767f5b9d0e..6f815e0749 100644 --- a/protocols/uniswap/index.ts +++ b/protocols/uniswap/index.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../../helpers/coreAssets.json' import { Chain } from "@defillama/sdk/build/general"; import { BreakdownAdapter, FetchResultGeneric, BaseAdapter } from "../../adapters/types"; import { CHAIN } from "../../helpers/chains"; @@ -76,7 +77,7 @@ const v3Endpoints = { const VOLUME_USD = "volumeUSD"; // fees results are in eth, needs to be converted to a balances objects -const ETH_ADDRESS = "ethereum:0x0000000000000000000000000000000000000000"; +const ETH_ADDRESS = "ethereum:" + ADDRESSES.null; const v1Graph = getGraphDimensions({ graphUrls: v1Endpoints, totalVolume: { diff --git a/users/routers/routerAddresses.ts b/users/routers/routerAddresses.ts index 6a3c79d3e7..455ccdf9b2 100644 --- a/users/routers/routerAddresses.ts +++ b/users/routers/routerAddresses.ts @@ -1,3 +1,4 @@ +import ADDRESSES from '../../helpers/coreAssets.json' import { isAddressesUsable } from "../utils/countUsers"; import { ProtocolAddresses } from "../utils/types"; @@ -2338,7 +2339,7 @@ export default ([ "addresses":{ "ethereum":[ "0xf403c135812408bfbe8713b5a23a04b3d48aae31", - "0x72a19342e8f1838460ebfccef09f6585e32db86e", + ADDRESSES.ethereum.vlCVX, ], } }, @@ -2478,7 +2479,7 @@ export default ([ "0x04B724389Dd28Ffc9a3A91Ab4149a77530282f04",//PrivateTgeVester "0xA61f0d1d831BA4Be2ae253c13ff906d9463299c2",//PlutusChef "0xb059Fc19371691aa7A3EC66dD80684FFE17A7D5c",//PlutusChef - "0x5326E71Ff593Ecc2CF7AcaE5Fe57582D6e74CFF1",//PlvGlpToken + ADDRESSES.arbitrum.plvGLP,//PlvGlpToken "0x4E5Cf54FdE5E1237e80E87fcbA555d829e1307CE",//PlutusDAO: plvGLP Farm "0x8c12e3C9b26Ee2e43A1a71cd974e6bF250472129",//SpaDepositor "0x73e7c78E8a85C074733920f185d1c78163b555C8",//