From 33f24417f5f7341590130d69d58777b899368aae Mon Sep 17 00:00:00 2001 From: David Cumps Date: Fri, 23 Aug 2024 15:46:12 +0200 Subject: [PATCH] feat: add chainflip dexs --- dexs/chainflip/index.ts | 32 ++++++++++++++++++++++++++++++++ helpers/chains.ts | 3 ++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 dexs/chainflip/index.ts diff --git a/dexs/chainflip/index.ts b/dexs/chainflip/index.ts new file mode 100644 index 0000000000..c7045cb633 --- /dev/null +++ b/dexs/chainflip/index.ts @@ -0,0 +1,32 @@ +import { SimpleAdapter } from "../../adapters/types"; +import { CHAIN } from "../../helpers/chains"; +import { httpGet } from "../../utils/fetchURL"; + +const dimensionsEndpoint = "https://chainflip-broker.io/defillama/dexs" + +const fetch = async (timestamp: number) => { + const dimensionsData = await httpGet(`${dimensionsEndpoint}?timestamp=${timestamp}`, { headers: {"x-client-id": "defillama"}}); + + return { + timestamp: dimensionsData.timestamp, + dailyVolume: dimensionsData.dailyVolume, + totalVolume: dimensionsData.totalVolume + }; +}; + +const adapter: SimpleAdapter = { + adapter: { + [CHAIN.CHAINFLIP]: { + fetch, + start: 1700740800, // FLIP went live on 2023-11-23 12:00 UTC + runAtCurrTime: true, + meta: { + methodology: { + Volume: "Deposit value of a swap.", + } + } + }, + }, +}; + +export default adapter; diff --git a/helpers/chains.ts b/helpers/chains.ts index 96f6b47760..058d0bf155 100644 --- a/helpers/chains.ts +++ b/helpers/chains.ts @@ -161,7 +161,8 @@ export enum CHAIN { IOTAEVM = "iotaevm", ZKLINK = "zklink", DEXALOT = "dexalot", - IMMUTABLEX = "immutablex" + IMMUTABLEX = "immutablex", + CHAINFLIP = "chainflip" } // DonĀ“t use