diff --git a/dexs/fulcrom-finance/index.ts b/dexs/fulcrom-finance/index.ts index f180408a87..80341d76a2 100644 --- a/dexs/fulcrom-finance/index.ts +++ b/dexs/fulcrom-finance/index.ts @@ -8,6 +8,7 @@ const endpoints: { [key: string]: string } = { "https://graph.cronoslabs.com/subgraphs/name/fulcrom/stats-prod", [CHAIN.ERA]: "https://api.studio.thegraph.com/query/52869/stats-prod/version/latest", + [CHAIN.CRONOS_ZKEVM]: "https://api.goldsky.com/api/public/project_clwrfupe2elf301wlhnd7bvva/subgraphs/fulcrom-stats-mainnet/prod/gn" }; const historicalDataSwap = gql` @@ -39,51 +40,52 @@ interface IGraphResponse { const getFetch = (query: string) => - (chain: string): Fetch => - async (timestamp: number) => { - const dayTimestamp = getUniqStartOfTodayTimestamp( - new Date(timestamp * 1000) - ); - const dailyData: IGraphResponse = await request(endpoints[chain], query, { - id: "daily:" + String(dayTimestamp), - period: "daily", - }); - const totalData: IGraphResponse = await request(endpoints[chain], query, { - id: "total", - period: "total", - }); + (chain: string): Fetch => + async (timestamp: number) => { + const dayTimestamp = getUniqStartOfTodayTimestamp( + new Date(timestamp * 1000) + ); + const dailyData: IGraphResponse = await request(endpoints[chain], query, { + id: "daily:" + String(dayTimestamp), + period: "daily", + }); + const totalData: IGraphResponse = await request(endpoints[chain], query, { + id: "total", + period: "total", + }); - return { - timestamp: dayTimestamp, - dailyVolume: - dailyData.volumeStats.length == 1 - ? String( - Number( - Object.values(dailyData.volumeStats[0]).reduce((sum, element) => - String(Number(sum) + Number(element)) - ) - ) * + return { + timestamp: dayTimestamp, + dailyVolume: + dailyData.volumeStats.length == 1 + ? String( + Number( + Object.values(dailyData.volumeStats[0]).reduce((sum, element) => + String(Number(sum) + Number(element)) + ) + ) * 10 ** -30 - ) - : undefined, - totalVolume: - totalData.volumeStats.length == 1 - ? String( - Number( - Object.values(totalData.volumeStats[0]).reduce((sum, element) => - String(Number(sum) + Number(element)) - ) - ) * + ) + : undefined, + totalVolume: + totalData.volumeStats.length == 1 + ? String( + Number( + Object.values(totalData.volumeStats[0]).reduce((sum, element) => + String(Number(sum) + Number(element)) + ) + ) * 10 ** -30 - ) - : undefined, - }; - }; + ) + : undefined, + }; + }; - const startTimestamps: { [chain: string]: number } = { - [CHAIN.CRONOS]: 1677470400, - [CHAIN.ERA]: 1696496400, - }; +const startTimestamps: { [chain: string]: number } = { + [CHAIN.CRONOS]: 1677470400, + [CHAIN.ERA]: 1696496400, + [CHAIN.CRONOS_ZKEVM]: 1723698700, +}; const adapter: BreakdownAdapter = { breakdown: { diff --git a/fees/fulcrom-finance.ts b/fees/fulcrom-finance.ts index eda0a42544..dc05ba8d20 100644 --- a/fees/fulcrom-finance.ts +++ b/fees/fulcrom-finance.ts @@ -9,6 +9,7 @@ const endpoints = { "https://graph.cronoslabs.com/subgraphs/name/fulcrom/stats-prod", [CHAIN.ERA]: "https://api.studio.thegraph.com/query/52869/stats-prod/version/latest", + [CHAIN.CRONOS_ZKEVM]: "https://api.goldsky.com/api/public/project_clwrfupe2elf301wlhnd7bvva/subgraphs/fulcrom-stats-mainnet/prod/gn" }; const methodology = { @@ -99,6 +100,13 @@ const adapter: Adapter = { methodology, }, }, + [CHAIN.CRONOS_ZKEVM]: { + fetch: graphs(endpoints)(CHAIN.CRONOS_ZKEVM), + start: 1723698700, + meta: { + methodology, + }, + }, }, }; diff --git a/helpers/chains.ts b/helpers/chains.ts index 058d0bf155..bbb61fb8f8 100644 --- a/helpers/chains.ts +++ b/helpers/chains.ts @@ -162,7 +162,8 @@ export enum CHAIN { ZKLINK = "zklink", DEXALOT = "dexalot", IMMUTABLEX = "immutablex", - CHAINFLIP = "chainflip" + CHAINFLIP = "chainflip", + CRONOS_ZKEVM = "cronos_zkevm", } // DonĀ“t use