From a2581e15260806ed606864ca1ad79d1c62b3cace Mon Sep 17 00:00:00 2001 From: 0xgnek <0xgnek@gmail.com> Date: Tue, 28 Jan 2025 16:10:21 +0000 Subject: [PATCH] enable reservoir-tools-amm --- helpers/chains.ts | 3 ++ protocols/reservoir-tools-amm.ts | 58 ++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 protocols/reservoir-tools-amm.ts diff --git a/helpers/chains.ts b/helpers/chains.ts index 4ae008ceeb..7bfd4b396e 100644 --- a/helpers/chains.ts +++ b/helpers/chains.ts @@ -205,6 +205,9 @@ export enum CHAIN { SONEIUM = "soneium", INK = "ink", RIPPLE = "ripple", + ZERO = "zero_network", + SHAPE = "shape", + ABSTRACT = "abstract", } // DonĀ“t use diff --git a/protocols/reservoir-tools-amm.ts b/protocols/reservoir-tools-amm.ts new file mode 100644 index 0000000000..08c326fa24 --- /dev/null +++ b/protocols/reservoir-tools-amm.ts @@ -0,0 +1,58 @@ +import { FetchOptions, SimpleAdapter } from "../adapters/types"; +import { CHAIN } from "../helpers/chains"; +import { getGraphDimensions2 } from "../helpers/getUniSubgraph"; + + + +const v2Endpoints: { [s: string]: string } = { + [CHAIN.INK]: "https://graph-node.internal.reservoir.tools/subgraphs/name/ink/v2-subgraph", + [CHAIN.ZERO]: "https://graph-node.internal.reservoir.tools/subgraphs/name/zero/v2-subgraph", + [CHAIN.SHAPE]: "https://graph-node.internal.reservoir.tools/subgraphs/name/shape/v2-subgraph", + [CHAIN.ABSTRACT]: "https://graph-node.internal.reservoir.tools/subgraphs/name/abstract/v2-subgraph", +} + +const v2Graph = getGraphDimensions2({ + graphUrls: v2Endpoints, + feesPercent: { + type: "volume", + UserFees: 0.3, + ProtocolRevenue: 0, + SupplySideRevenue: 0.3, + HoldersRevenue: 0, + Revenue: 0, + Fees: 0.3 + } +}); + + +const adapter: SimpleAdapter = { + version: 2, + adapter: { + [CHAIN.INK]: { + fetch: (options: FetchOptions) => { + return v2Graph(options.chain)(options) + }, + start: '2025-01-07', + }, + [CHAIN.ZERO]: { + fetch: (options: FetchOptions) => { + return v2Graph(options.chain)(options) + }, + start: '2025-01-07', + }, + [CHAIN.SHAPE]: { + fetch: (options: FetchOptions) => { + return v2Graph(options.chain)(options) + }, + start: '2025-01-07', + }, + [CHAIN.ABSTRACT]: { + fetch: (options: FetchOptions) => { + return v2Graph(options.chain)(options) + }, + start: '2025-01-07', + }, + } +} + +export default adapter;