From e2d2540097552518dfd2680ff193c63de450c383 Mon Sep 17 00:00:00 2001 From: 9mmdev Date: Mon, 25 Nov 2024 15:11:33 +0530 Subject: [PATCH] Added 9mm v3 & v2 in dexes --- dexs/9mm-v2/index.ts | 56 ++++++++++++++++++++++++++++++++++++++++++++ dexs/9mm/index.ts | 42 +++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 dexs/9mm-v2/index.ts create mode 100644 dexs/9mm/index.ts diff --git a/dexs/9mm-v2/index.ts b/dexs/9mm-v2/index.ts new file mode 100644 index 0000000000..392ac8fec7 --- /dev/null +++ b/dexs/9mm-v2/index.ts @@ -0,0 +1,56 @@ +import customBackfill from "../../helpers/customBackfill"; +import {CHAIN} from "../../helpers/chains"; +import type {ChainEndpoints, SimpleAdapter} from "../../adapters/types"; +import type {Chain} from "@defillama/sdk/build/general"; +import { getGraphDimensions2} from "../../helpers/getUniSubgraph"; + +// Subgraphs endpoints +const endpoints: ChainEndpoints = { + [CHAIN.PULSECHAIN]: "https://graph.9mm.pro/subgraphs/name/pulsechain/9mm", + [CHAIN.BASE]: "https://api.studio.thegraph.com/query/80328/9mmbasev2/version/latest", +}; + +// Fetch function to query the subgraphs +const graphs = getGraphDimensions2({ + graphUrls: endpoints, + totalVolume: { + factory: "pancakeFactories", + field: "totalVolumeUSD", + }, + feesPercent: { + type: "volume", + UserFees: 0.25, + SupplySideRevenue: 0.17, + ProtocolRevenue: 0.08, + Revenue: 0.25, + Fees: 0.25, + } +}); + +const methodology = { + UserFees: "User pays 0.25% fees on each swap.", + SupplySideRevenue: "LPs receive 0.17% of each swap.", + ProtocolRevenue: "Treasury receives 0.08% of each swap.", + Revenue: "All revenue generated comes from user fees.", + Fees: "All fees comes from the user.", +}; + +const adapter: SimpleAdapter = { + version: 2, + adapter: Object.keys(endpoints).reduce((acc, chain) => { + return { + ...acc, + [chain]: { + fetch: graphs(chain as Chain), + start: async () => + chain === CHAIN.PULSECHAIN ? 1698693960 + : chain === CHAIN.BASE ? 1718210460 + : 0, + customBackfill: customBackfill(chain, graphs), + meta: {methodology}, + } + } + }, {}) +}; + +export default adapter; \ No newline at end of file diff --git a/dexs/9mm/index.ts b/dexs/9mm/index.ts new file mode 100644 index 0000000000..debe599193 --- /dev/null +++ b/dexs/9mm/index.ts @@ -0,0 +1,42 @@ +import { IJSON, SimpleAdapter } from "../../adapters/types"; +import { CHAIN } from "../../helpers/chains"; +import { getGraphDimensions2 } from "../../helpers/getUniSubgraph"; + +const v3Endpoint = { + [CHAIN.PULSECHAIN]: + "https://graph.9mm.pro/subgraphs/name/pulsechain/9mm-v3", + [CHAIN.BASE]: + "https://api.studio.thegraph.com/query/80328/9mmbasev3/version/latest", +}; + +const v3Graph = getGraphDimensions2({ + graphUrls: v3Endpoint, + totalVolume: { + factory: "factories", + }, + totalFees: { + factory: "factories", + }, +}); + +const v3StartTimes = { + [CHAIN.PULSECHAIN]: 1701128040, + [CHAIN.BASE]: 1718318340, + +} as IJSON; + +const adapter: SimpleAdapter = { + adapter: { + [CHAIN.BASE]: { + fetch: v3Graph(CHAIN.BASE), + start: v3StartTimes[CHAIN.BASE] + }, + [CHAIN.PULSECHAIN]: { + fetch: v3Graph(CHAIN.PULSECHAIN), + start: v3StartTimes[CHAIN.PULSECHAIN] + }, + }, + version: 2 +}; + +export default adapter; \ No newline at end of file