From f0f8798b1c43bf7e4051d99cd642ba0e0d246122 Mon Sep 17 00:00:00 2001 From: 0xgnek <0xgnek@gmail.com> Date: Fri, 7 Feb 2025 09:38:23 +0000 Subject: [PATCH] add kodiak-v3 --- helpers/chains.ts | 1 + protocols/kodiak-v3/index.ts | 37 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 protocols/kodiak-v3/index.ts diff --git a/helpers/chains.ts b/helpers/chains.ts index f81e76974b..4a31ebf4b9 100644 --- a/helpers/chains.ts +++ b/helpers/chains.ts @@ -211,6 +211,7 @@ export enum CHAIN { REDSTONE = "redstone", PLUME = "plume", PENUMBRA = "penumbra", + BERACHAIN = "berachain" } // DonĀ“t use diff --git a/protocols/kodiak-v3/index.ts b/protocols/kodiak-v3/index.ts new file mode 100644 index 0000000000..da5ac06043 --- /dev/null +++ b/protocols/kodiak-v3/index.ts @@ -0,0 +1,37 @@ +import { FetchOptions, SimpleAdapter } from "../../adapters/types"; +import { CHAIN } from "../../helpers/chains"; +import { DEFAULT_TOTAL_VOLUME_FIELD, getGraphDimensions2 } from "../../helpers/getUniSubgraph"; + +const v3Endpoints: { [key: string]: string } = { + [CHAIN.BERACHAIN]: "https://api.goldsky.com/api/public/project_clpx84oel0al201r78jsl0r3i/subgraphs/kodiak-v3-berachain-mainnet/latest/gn" +} +const v3Graphs = getGraphDimensions2({ + graphUrls: v3Endpoints, + totalVolume: { + factory: "factories", + field: DEFAULT_TOTAL_VOLUME_FIELD, + }, + feesPercent: { + type: "fees", + ProtocolRevenue: 0, + HoldersRevenue: 0, + UserFees: 100, // User fees are 100% of collected fees + SupplySideRevenue: 100, // 100% of fees are going to LPs + Revenue: 0 // Revenue is 100% of collected fees + } +}); + + +const adapters: SimpleAdapter = { + version: 2, + adapter: { + [CHAIN.BERACHAIN]: { + fetch: (options: FetchOptions) => { + return v3Graphs(options.chain)(options) + } + }, + } +} + + +export default adapters;