Skip to content

Commit

Permalink
dexs azuro
Browse files Browse the repository at this point in the history
  • Loading branch information
Javokhir Artykov committed Jun 6, 2024
1 parent 0112b81 commit 945a1a3
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions dexs/azuro/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { CHAIN } from "../../helpers/chains";
import { getUniqStartOfTodayTimestamp } from "../../helpers/getUniSubgraphVolume";
import { queryDune } from "../../helpers/dune";
import type { SimpleAdapter, FetchOptions } from "../../adapters/types";

type TChain = {
[key: string]: string;
};

const CHAINS: TChain = {
[CHAIN.POLYGON]: "polygon",
[CHAIN.XDAI]: "gnosis",
[CHAIN.ARBITRUM]: "arbitrum"
};

const fetch = async (options: FetchOptions) => {
const unixTimestamp = getUniqStartOfTodayTimestamp(new Date(options.endTimestamp * 1000));
const data = await queryDune("3800632", { endTime: unixTimestamp, blockchain: options.chain });

return {
dailyVolume: data[0].daily_volume,
totalVolume: data[0].total_volume,
timestamp: unixTimestamp,
};
};

const adapter: any = {
version: 2,
adapter: {
...Object.values(CHAINS).reduce((acc, chain) => {
return {
...acc,
[chain]: {
fetch: fetch,
start: 1717372800,
},
};
}, {}),
},
};

export default adapter;

0 comments on commit 945a1a3

Please sign in to comment.