From dbb01de1b4d60e053b4e1c336abbfc47c4ccac65 Mon Sep 17 00:00:00 2001 From: nicetomeetyou1 Date: Thu, 29 Aug 2024 22:30:20 +0700 Subject: [PATCH] feat: add scallop adapter --- aggregators/scallop/index.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 aggregators/scallop/index.ts diff --git a/aggregators/scallop/index.ts b/aggregators/scallop/index.ts new file mode 100644 index 0000000000..c53c0e88f4 --- /dev/null +++ b/aggregators/scallop/index.ts @@ -0,0 +1,22 @@ +import fetchURL from '../../utils/fetchURL'; +import { FetchV2, SimpleAdapter } from '../../adapters/types'; +import { CHAIN } from '../../helpers/chains'; + +const fetch: FetchV2 = async ({ startTimestamp, endTimestamp }) => { + const dailyVolume = await fetchURL( + `https://sui.apis.scallop.io/statistic/swap/daily-volume?fromTimestamp=${startTimestamp}&toTimestamp=${endTimestamp}`, + ); + return { dailyVolume: dailyVolume.swapVolume }; +}; + +const adapter: SimpleAdapter = { + version: 2, + adapter: { + [CHAIN.SUI]: { + fetch, + start: 1722877683, + }, + }, +}; + +export default adapter;