diff --git a/dexs/dappos-intentEx/index.ts b/dexs/dappos-intentEx/index.ts new file mode 100644 index 0000000000..00e56b4290 --- /dev/null +++ b/dexs/dappos-intentEx/index.ts @@ -0,0 +1,35 @@ +import type { SimpleAdapter } from "../../adapters/types"; +import { getUniqStartOfTodayTimestamp } from "../../helpers/getUniSubgraphVolume"; +import { httpGet } from "../../utils/fetchURL"; +import { CHAIN } from "../../helpers/chains"; + +const URL = "https://trade-info.dappos.com/market/archive?timestamp="; + +interface Response { + daily_trade_volume: string; +} + +const fetch = async (timestamp: number) => { + const dayTimestamp = getUniqStartOfTodayTimestamp(new Date(timestamp * 1000)); + const url = `${URL}${dayTimestamp}` + const respose: Response[] = await httpGet(url); + const dailyVolume = respose.reduce((acc, item) => { + return acc + Number(item.daily_trade_volume); + }, 0); + + return { + dailyVolume: dailyVolume?.toString(), + timestamp: dayTimestamp, + }; +}; + +const adapter: SimpleAdapter = { + adapter: { + [CHAIN.OP_BNB]: { + fetch, + start: '2025-01-01', + }, + } +}; + +export default adapter; \ No newline at end of file diff --git a/fees/dappos-intentEx.ts b/fees/dappos-intentEx.ts new file mode 100644 index 0000000000..4ffed76f1d --- /dev/null +++ b/fees/dappos-intentEx.ts @@ -0,0 +1,41 @@ +import { CHAIN } from "../helpers/chains" +import { Adapter, FetchOptions, } from '../adapters/types'; +import { httpGet } from "../utils/fetchURL"; +import { getUniqStartOfTodayTimestamp } from "../helpers/getUniSubgraphVolume"; + +const URL = "https://trade-info.dappos.com/market/archive?timestamp="; + +interface Response { + daily_trade_fee: string; + total_trade_fee: string; +} + +const fetchFees = async (options: FetchOptions) => { + const dayTimestamp = getUniqStartOfTodayTimestamp(new Date(options.endTimestamp * 1000)); + const url = `${URL}${dayTimestamp}` + const respose: Response[] = await httpGet(url); + const dailyFees = respose.reduce((acc, item) => { + return acc + Number(item.daily_trade_fee); + }, 0); + const totalFees = respose.reduce((acc, item) => { + return acc + Number(item.total_trade_fee); + }, 0); + + return { + dailyFees, + dailyRevenue: dailyFees, + totalFees, + totalRevenue: totalFees, + } +} + +const adapter: Adapter = { + version: 2, + adapter: { + [CHAIN.OP_BNB]: { + fetch: fetchFees, + start: '2025-01-01', + }, + }, +} +export default adapter \ No newline at end of file