Skip to content

Commit

Permalink
Merge pull request #2362 from DefiLlama/reservoir-tools-clmm
Browse files Browse the repository at this point in the history
enable reservoir-tools-clmm
  • Loading branch information
dtmkeng authored Jan 28, 2025
2 parents a9094af + 3b3e065 commit bf26723
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions helpers/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ export enum CHAIN {
ZERO = "zero_network",
SHAPE = "shape",
ABSTRACT = "abstract",
REDSTONE = "redstone",
}

// Don´t use
Expand Down
61 changes: 61 additions & 0 deletions protocols/reservoir-tools-clmm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
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.ABSTRACT]: "https://graph-node.internal.reservoir.tools/subgraphs/name/abstract/v3-subgraph",
[CHAIN.ZERO]: "https://graph-node.internal.reservoir.tools/subgraphs/name/zero/v3-subgraph",
[CHAIN.SHAPE]: "https://graph-node.internal.reservoir.tools/subgraphs/name/shape/v3-subgraph",
[CHAIN.REDSTONE]: "https://graph-node.internal.reservoir.tools/subgraphs/name/redstone/v3-subgraph",
}

// https://graph-node.internal.reservoir.tools/subgraphs/name/abstract/v3-subgraph
// https://graph-node.internal.reservoir.tools/subgraphs/name/zero/v3-subgraph
// https://graph-node.internal.reservoir.tools/subgraphs/name/shape/v3-subgraph
// https://graph-node.internal.reservoir.tools/subgraphs/name/redstone/v3-subgraph
// https://graph-node.internal.reservoir.tools/subgraphs/name/ink/v3-subgraph

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.ABSTRACT]: {
fetch: (options: FetchOptions) => {
return v3Graphs(options.chain)(options)
}
},
[CHAIN.ZERO]: {
fetch: (options: FetchOptions) => {
return v3Graphs(options.chain)(options)
}
},
[CHAIN.SHAPE]: {
fetch: (options: FetchOptions) => {
return v3Graphs(options.chain)(options)
}
},
[CHAIN.REDSTONE]: {
fetch: (options: FetchOptions) => {
return v3Graphs(options.chain)(options)
}
},
}
}

export default adapters

0 comments on commit bf26723

Please sign in to comment.