Skip to content

Commit

Permalink
fix query
Browse files Browse the repository at this point in the history
  • Loading branch information
dtmkeng committed Aug 7, 2024
1 parent 5609b67 commit 3887d0d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions fees/gmx-v2/index.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -12,12 +12,12 @@ interface IFee {
}

const fetch = (chain: Chain) => {
return async (timestamp: number): Promise<FetchResultFees> => {
return async (timestamp: number, _t: any, options: FetchOptions): Promise<FetchResultFees> => {
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
Expand All @@ -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,
Expand Down

0 comments on commit 3887d0d

Please sign in to comment.