From 3887d0da7710bc005d708216c7684044ac70ec9e Mon Sep 17 00:00:00 2001 From: 0xgnek <0xgnek@gmail.com> Date: Wed, 7 Aug 2024 16:17:33 +0000 Subject: [PATCH] fix query --- fees/gmx-v2/index.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fees/gmx-v2/index.ts b/fees/gmx-v2/index.ts index ba32f49562..1ffbeb04ed 100644 --- a/fees/gmx-v2/index.ts +++ b/fees/gmx-v2/index.ts @@ -1,5 +1,5 @@ import { Chain } from "@defillama/sdk/build/general"; -import { Adapter, FetchResultFees } from "../../adapters/types"; +import { Adapter, FetchOptions, FetchResultFees } from "../../adapters/types"; import { CHAIN } from "../../helpers/chains"; import { queryDune } from "../../helpers/dune"; import { getUniqStartOfTodayTimestamp } from "../../helpers/getUniSubgraphVolume"; @@ -12,12 +12,12 @@ interface IFee { } const fetch = (chain: Chain) => { - return async (timestamp: number): Promise => { + return async (timestamp: number, _t: any, options: FetchOptions): Promise => { const fees: IFee[] = (await queryDune(chain === CHAIN.ARBITRUM ? "3464532" : "3464559")) // const queryId = chain === CHAIN.ARBITRUM ? "3186689" : "3186714"; // const fees: IFee[] = (await fetchURLWithRetry(`https://api.dune.com/api/v1/query/${queryId}/results`)).result.rows; // const fees: IFee[] = require(`./${chain}.json`); - const dayTimestamp = getUniqStartOfTodayTimestamp(new Date(timestamp * 1000)); + const dayTimestamp = getUniqStartOfTodayTimestamp(new Date(options.endTimestamp * 1000)); const dateString = new Date(dayTimestamp * 1000).toISOString().split("T")[0]; const daily = fees.find(fee => fee.time.split(' ')[0] === dateString); const dailyFees = daily?.v2_fees || 0 @@ -39,12 +39,10 @@ const adapter: Adapter = { [CHAIN.ARBITRUM]: { fetch: fetch(CHAIN.ARBITRUM), start: 1690848000, - runAtCurrTime: true, }, [CHAIN.AVAX]: { fetch: fetch(CHAIN.AVAX), start: 1692835200, - runAtCurrTime: true, }, }, isExpensiveAdapter: true,