Skip to content

Commit

Permalink
fix increment-swap
Browse files Browse the repository at this point in the history
  • Loading branch information
dtmkeng committed Feb 28, 2024
1 parent 98e4ea4 commit 796b686
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions dexs/increment-swap/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import fetchURL from "../../utils/fetchURL"
import { Chain } from "@defillama/sdk/build/general";
import { SimpleAdapter } from "../../adapters/types";
import fetchURL from "../../utils/fetchURL";
import { ChainBlocks, FetchOptions, FetchResultVolume, SimpleAdapter } from "../../adapters/types";
import { CHAIN } from "../../helpers/chains";
import customBackfill from "../../helpers/customBackfill";
import { getUniqStartOfTodayTimestamp } from "../../helpers/getUniSubgraphVolume";

const historicalVolumeEndpoint = "https://app.increment.fi/info/totalinfos"
Expand All @@ -13,7 +11,7 @@ interface IVolumeall {
}


const fetch = async (timestamp: number) => {
const fetch = async (timestamp: number, _: ChainBlocks, options: FetchOptions): Promise<FetchResultVolume> => {
const dayTimestamp = getUniqStartOfTodayTimestamp(new Date(timestamp * 1000))
const callhistoricalVolume = (await fetchURL(historicalVolumeEndpoint)).vol;
const historicalVolume: IVolumeall[] = callhistoricalVolume.map((e: string[] | number[]) => {
Expand All @@ -38,24 +36,12 @@ const fetch = async (timestamp: number) => {
};
};

const getStartTimestamp = async () => {
const callhistoricalVolume = (await fetchURL(historicalVolumeEndpoint)).vol;
const historicalVolume: IVolumeall[] = callhistoricalVolume.map((e: string[] | number[]) => {
const [time, volume] = e;
return {
time,
volume
};
});
return (new Date(historicalVolume[0].time).getTime()) / 1000
}

const adapter: SimpleAdapter = {
adapter: {
[CHAIN.FLOW]: {
fetch,
start: getStartTimestamp,
// customBackfill: customBackfill(CHAIN.FLOW as Chain, (_chian: string) => fetch)
start: 1650844800,
},
},
};
Expand Down

0 comments on commit 796b686

Please sign in to comment.