Skip to content

Commit

Permalink
Merge pull request DefiLlama#1274 from DefiLlama/fix-fetch-chain-fees
Browse files Browse the repository at this point in the history
fix fetch chain fees
  • Loading branch information
dtmkeng authored Mar 8, 2024
2 parents 5ec62a8 + 0aa244b commit 8d278c3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions fees/traderjoe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ const graph = (chain: Chain) => {
const dayTimestamp = getUniqStartOfTodayTimestamp(new Date(timestamp * 1000))
const historical: IData[] = (await fetchURL(endpointsV2[chain]));
const dailyFees = historical
.find(dayItem => dayItem.timestamp === dayTimestamp)?.feesUsd
.find(dayItem => dayItem.timestamp === dayTimestamp)?.feesUsd || 0
const dailyRevenue = historical
.find(dayItem => dayItem.timestamp === dayTimestamp)?.protocolFeesUsd
.find(dayItem => dayItem.timestamp === dayTimestamp)?.protocolFeesUsd || 0
return {
dailyUserFees: `${dailyFees}`,
dailyFees: `${dailyFees}`,
Expand Down
6 changes: 3 additions & 3 deletions helpers/getUniSubgraphFees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
DEFAULT_DAILY_VOLUME_FACTORY,
DEFAULT_DAILY_VOLUME_FIELD,
} from "../helpers/getUniSubgraphVolume";
import type { ChainEndpoints, Fetch, FetchOptions } from "../adapters/types";
import type { ChainEndpoints, Fetch, FetchOptions, FetchResultV2, FetchV2 } from "../adapters/types";

// To get ID for daily data https://docs.uniswap.org/protocol/V2/reference/API/entities
const getUniswapDateId = (date?: Date) => getUniqStartOfTodayTimestamp(date) / 86400;
Expand Down Expand Up @@ -138,8 +138,8 @@ const getDexChainFees = ({ volumeAdapter, totalFees = 0, protocolFees = 0, ...pa
const adapterObj = volumeAdapter.adapter

Object.keys(adapterObj).map(chain => {
const fetchFees = async (timestamp: number, chainBlocks: ChainBlocks, options: FetchOptions) => {
const fetchedResult: FetchResultVolume = await (adapterObj[chain].fetch as Fetch)(timestamp, chainBlocks, options)
const fetchFees = async (timestamp: number, _: ChainBlocks, options: FetchOptions) => {
const fetchedResult: FetchResultV2 = await (adapterObj[chain].fetch as FetchV2)(options)
const chainDailyVolume = fetchedResult.dailyVolume as number;
const chainTotalVolume = fetchedResult.totalVolume as number;
const response: FetchResultGeneric = { timestamp }
Expand Down

0 comments on commit 8d278c3

Please sign in to comment.