diff --git a/dexs/spectra-v2.ts b/dexs/spectra-v2.ts index a9bb619140..8ecb14960a 100644 --- a/dexs/spectra-v2.ts +++ b/dexs/spectra-v2.ts @@ -1,3 +1,4 @@ +import * as sdk from "@defillama/sdk"; import { FetchOptions, FetchV2, SimpleAdapter } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; import BigNumber from "bignumber.js"; @@ -83,9 +84,7 @@ const chains: { start: "2024-07-01", protocolSubgraphUrl: "https://subgraph.satsuma-prod.com/957f3120c2b2/perspective/spectra-base/api", - blacklistPools: [ - '0x447d24edf78b20a4cf748a7cee273510edf87df1', - ], + blacklistPools: ["0x447d24edf78b20a4cf748a7cee273510edf87df1"], }, [CHAIN.SONIC]: { id: 146, @@ -118,6 +117,12 @@ const chains: { "https://api.goldsky.com/api/public/project_cm55feuq3euos01xjb3w504ls/subgraphs/spectra-hyperevm/1.2.1/gn", limit: 1000, }, + [CHAIN.KATANA]: { + id: 747474, + start: "2025-07-02", + protocolSubgraphUrl: sdk.graph.modifyEndpoint("EM1PDEWqo1BWaLEW5FotmHtVK1HX8z7eFnLVfDRLjfQh"), + limit: 1000, + }, }; type Address = `0x${string}`; @@ -168,8 +173,8 @@ const fetchDailyFeesAndVolume = async ({ ).transactions as Transaction[]; dailyData.forEach((transaction) => { - if (chains[chain].blacklistPools && (new Set(chains[chain].blacklistPools)).has(transaction.poolInTransaction.id)) { - return + if (chains[chain].blacklistPools && new Set(chains[chain].blacklistPools).has(transaction.poolInTransaction.id)) { + return; } dailyFees.add( @@ -204,9 +209,8 @@ const fetchDailyHoldersRevenue = async ({ // Count both reward types (voting incentives + fees) separately dailyData.forEach((reward) => { - if ( - reward.distributor.governancePool.chainId === chains[chain].id.toString() // Only count rewards for pools on the current chain - ) { + // Only count rewards for pools on the current chain + if (reward.distributor.governancePool.chainId === chains[chain].id.toString()) { if (reward.distributor.type === "FEE") { dailyVotingFeesRevenue.add(reward.address, reward.amount.toString()); } else { @@ -227,8 +231,7 @@ const fetch: FetchV2 = async (options) => { const dailyRevenue = dailyFees.clone(0.8); const dailySupplySideRevenue = dailyFees.clone(0.2); - const [dailyVotingFeesRevenue, dailyVotingIncentivesRevenue] = - await fetchDailyHoldersRevenue(options); + const [dailyVotingFeesRevenue, dailyVotingIncentivesRevenue] = await fetchDailyHoldersRevenue(options); return { dailyVolume, @@ -253,44 +256,14 @@ const methodology = { const adapter: SimpleAdapter = { version: 2, methodology, - adapter: { - [CHAIN.ETHEREUM]: { - fetch, - start: "2024-07-01", - }, - [CHAIN.ARBITRUM]: { - fetch, - start: "2024-07-01", - }, - [CHAIN.OPTIMISM]: { - fetch, - start: "2024-07-01", - }, - [CHAIN.BASE]: { - fetch, - start: "2024-07-01", - }, - [CHAIN.SONIC]: { - fetch, - start: "2024-12-27", - }, - [CHAIN.HEMI]: { - fetch, - start: "2025-03-06", - }, - [CHAIN.AVAX]: { - fetch, - start: "2025-05-26", - }, - [CHAIN.BSC]: { - fetch, - start: "2025-05-26", - }, - [CHAIN.HYPERLIQUID]: { - fetch, - start: "2025-06-01", - }, - }, + adapter: {}, }; +for (const [chain, config] of Object.entries(chains)) { + (adapter.adapter as any)[chain] = { + fetch, + start: config.start, + }; +} + export default adapter;