From 6b6d016c3528d386f60bc7a9ffcba5b1b0b315de Mon Sep 17 00:00:00 2001 From: Dragun-Sultan <111299241+Dragun-Sultan@users.noreply.github.com> Date: Wed, 15 Jan 2025 11:47:39 +0300 Subject: [PATCH 1/2] feat: [OOIA] Add ooia aggregator --- aggregators/ooia/index.ts | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 aggregators/ooia/index.ts diff --git a/aggregators/ooia/index.ts b/aggregators/ooia/index.ts new file mode 100644 index 0000000000..5328985040 --- /dev/null +++ b/aggregators/ooia/index.ts @@ -0,0 +1,36 @@ +import { FetchOptions, FetchV2, SimpleAdapter } from "../../adapters/types"; +import { CHAIN } from "../../helpers/chains"; +import fetchURL from "../../utils/fetchURL"; + +const BaseURL = "https://apiprod662ba0315.ooia.art"; +const endpoint = "api/v1/collections/defillama/analytics/volumes"; +const currency = "USDT"; + +interface IAPIResponse { + dailyVolume: string; + totalVolume: string; +} +const fromMicro = (value: string) => { + return (parseFloat(value) / 1e6).toString(); +}; + +const fetch: FetchV2 = async ({ endTimestamp }: FetchOptions) => { + const { dailyVolume, totalVolume }: IAPIResponse = await fetchURL( + `${BaseURL}/${endpoint}?timestamp=${endTimestamp}¤cy=${currency}` + ); + return { + dailyVolume: fromMicro(dailyVolume), + totalVolume: fromMicro(totalVolume), + }; +}; + +const adapters: SimpleAdapter = { + version: 2, + adapter: { + [CHAIN.TON]: { + start: "2024-11-01", + fetch, + }, + }, +}; +export default adapters; From 4ffa444a6eb6135fc63dba8951cc5a09578a6ef6 Mon Sep 17 00:00:00 2001 From: 0xgnek <0xgnek@gmail.com> Date: Thu, 16 Jan 2025 13:37:47 +0000 Subject: [PATCH 2/2] fix start time --- aggregators/ooia/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aggregators/ooia/index.ts b/aggregators/ooia/index.ts index 5328985040..546b64d9c6 100644 --- a/aggregators/ooia/index.ts +++ b/aggregators/ooia/index.ts @@ -14,9 +14,9 @@ const fromMicro = (value: string) => { return (parseFloat(value) / 1e6).toString(); }; -const fetch: FetchV2 = async ({ endTimestamp }: FetchOptions) => { +const fetch: FetchV2 = async ({ startOfDay }: FetchOptions) => { const { dailyVolume, totalVolume }: IAPIResponse = await fetchURL( - `${BaseURL}/${endpoint}?timestamp=${endTimestamp}¤cy=${currency}` + `${BaseURL}/${endpoint}?timestamp=${startOfDay}¤cy=${currency}` ); return { dailyVolume: fromMicro(dailyVolume),