diff --git a/dexs/ArbitrumExchange/index.ts b/dexs/ArbitrumExchange/index.ts index 947ae22ea9..7c72ca2016 100644 --- a/dexs/ArbitrumExchange/index.ts +++ b/dexs/ArbitrumExchange/index.ts @@ -66,6 +66,7 @@ const startTimeV3:TStartTime = { [CHAIN.ARBITRUM]: 1683590400, } const adapter: BreakdownAdapter = { + version: 2, breakdown: { v2: { [CHAIN.ARBITRUM]: { diff --git a/dexs/SmarDex/index.ts b/dexs/SmarDex/index.ts index fe070ffdc6..7bc1ae13a0 100644 --- a/dexs/SmarDex/index.ts +++ b/dexs/SmarDex/index.ts @@ -39,6 +39,14 @@ const graphRequestHeaders:IMap = { [CHAIN.POLYGON]: defaultHeaders, }; +const startTimes = { + [CHAIN.ARBITRUM]: 1689582249, + [CHAIN.BASE]: 1691491872, + [CHAIN.BSC]: 1689581494, + [CHAIN.ETHEREUM]: 1678404995, + [CHAIN.POLYGON]: 1689582144, +} + /** * @note We are using this method that allow us to use http headers * The method `getGraphDimensions` try returns daily fees and total fees @@ -58,29 +66,13 @@ const graphs = getGraphDimensions({ }, }); -const adapter: SimpleAdapter = { - adapter: { - [CHAIN.ETHEREUM]: { - fetch: graphs(CHAIN.ETHEREUM), - start: 1678404995, // birthBlock timestamp - }, - [CHAIN.BSC]: { - fetch: graphs(CHAIN.BSC), - start: 1689581494, - }, - [CHAIN.POLYGON]: { - fetch: graphs(CHAIN.POLYGON), - start: 1689582144, - }, - [CHAIN.ARBITRUM]: { - fetch: graphs(CHAIN.ARBITRUM), - start: 1689582249, - }, - [CHAIN.BASE]: { - fetch: graphs(CHAIN.BASE), - start: 1691491872, - }, - }, -}; +const adapter: SimpleAdapter = { adapter: {}, version: 2 } + +Object.keys(graphUrls).map((chain: string) => { + adapter.adapter[chain] = { + fetch: graphs(chain), + start: startTimes[chain] + } +}) export default adapter; diff --git a/dexs/archly-finance/index.ts b/dexs/archly-finance/index.ts index 755b578d01..e8b48b3d57 100644 --- a/dexs/archly-finance/index.ts +++ b/dexs/archly-finance/index.ts @@ -27,6 +27,7 @@ const graphFetch = getGraphDimensions({ }); const adapter: Adapter = { + version: 2, adapter: { [CHAIN.TELOS]: { fetch: graphFetch(CHAIN.TELOS), diff --git a/dexs/butterxyz/index.ts b/dexs/butterxyz/index.ts index a11ff6c622..793a5c8ea7 100644 --- a/dexs/butterxyz/index.ts +++ b/dexs/butterxyz/index.ts @@ -30,6 +30,7 @@ const dimensions = getGraphDimensions({ }); export default { + version: 2, adapter: { [CHAIN.MANTLE]: { fetch: dimensions(CHAIN.MANTLE), diff --git a/dexs/doveswap/index.ts b/dexs/doveswap/index.ts index 18be32c56f..266e95c726 100644 --- a/dexs/doveswap/index.ts +++ b/dexs/doveswap/index.ts @@ -55,6 +55,7 @@ const startTimeV3:TStartTime = { } const adapter: BreakdownAdapter = { + version: 2, breakdown: { v3: Object.keys(v3Endpoints).reduce((acc, chain) => { acc[chain] = { diff --git a/dexs/dragonswap/index.ts b/dexs/dragonswap/index.ts index 5860ea9e3f..9c86871dc5 100644 --- a/dexs/dragonswap/index.ts +++ b/dexs/dragonswap/index.ts @@ -73,6 +73,7 @@ const v3Graph = getGraphDimensions({ }); const adapter: BreakdownAdapter = { + version: 2, breakdown: { v2: Object.keys(endpoints).reduce((acc, chain) => { acc[chain] = { @@ -86,14 +87,7 @@ const adapter: BreakdownAdapter = { }, {} as BaseAdapter), v3: Object.keys(v3Endpoint).reduce((acc, chain) => { acc[chain] = { - fetch: async (timestamp: number) => { - const v3stats = await v3Graph(chain)(timestamp, {}) - return { - ...v3stats, - timestamp - } - - }, + fetch: v3Graph(chain), start: v3StartTimes[chain], } return acc diff --git a/dexs/fusionx-v2/index.ts b/dexs/fusionx-v2/index.ts index e871b210ef..0ec617436f 100644 --- a/dexs/fusionx-v2/index.ts +++ b/dexs/fusionx-v2/index.ts @@ -28,6 +28,7 @@ const v2Graphs = getGraphDimensions({ }); const adapter: SimpleAdapter = { + version: 2, adapter: { [CHAIN.MANTLE]: { fetch: v2Graphs(CHAIN.MANTLE), diff --git a/dexs/fusionx-v3/index.ts b/dexs/fusionx-v3/index.ts index 9cb028c967..de797f05fd 100644 --- a/dexs/fusionx-v3/index.ts +++ b/dexs/fusionx-v3/index.ts @@ -34,6 +34,7 @@ const v3Graphs = getGraphDimensions({ }); const adapter: SimpleAdapter = { + version: 2, adapter: { [CHAIN.MANTLE]: { fetch: v3Graphs(CHAIN.MANTLE), diff --git a/dexs/horiza/index.ts b/dexs/horiza/index.ts index d84a44b2d6..ef1f305ec5 100644 --- a/dexs/horiza/index.ts +++ b/dexs/horiza/index.ts @@ -27,6 +27,7 @@ const v3Graphs = getGraphDimensions({ }); const adapters: SimpleAdapter = { + version: 2, adapter: { [CHAIN.ARBITRUM]: { fetch: v3Graphs(CHAIN.ARBITRUM), diff --git a/dexs/hydradex/index.ts b/dexs/hydradex/index.ts index e422a69461..b0b3fe33c2 100644 --- a/dexs/hydradex/index.ts +++ b/dexs/hydradex/index.ts @@ -118,6 +118,7 @@ const methodology = { }; const adapter: BreakdownAdapter = { + version: 2, breakdown: { v2: { [DISABLED_ADAPTER_KEY]: disabledAdapter, diff --git a/dexs/jswap/index.ts b/dexs/jswap/index.ts index 303d9a80a7..9048810a9f 100644 --- a/dexs/jswap/index.ts +++ b/dexs/jswap/index.ts @@ -57,6 +57,7 @@ const graphs = getGraphDimensions({ }); const adapter: SimpleAdapter = { + version: 2, adapter: { [DISABLED_ADAPTER_KEY]: disabledAdapter, [CHAIN.OKEXCHAIN]: { diff --git a/dexs/kinetix-v3/index.ts b/dexs/kinetix-v3/index.ts index 50f0ad489b..99b46ae329 100644 --- a/dexs/kinetix-v3/index.ts +++ b/dexs/kinetix-v3/index.ts @@ -55,6 +55,7 @@ const v3 = Object.keys(endpointsV3).reduce( ); const adapter: BreakdownAdapter = { + version: 2, breakdown: { v3: v3, }, diff --git a/dexs/maia-v3/index.ts b/dexs/maia-v3/index.ts index e816a089d8..09d40286bd 100644 --- a/dexs/maia-v3/index.ts +++ b/dexs/maia-v3/index.ts @@ -42,6 +42,7 @@ const methodology = { } const adapter: SimpleAdapter = { + version: 2, adapter: { [CHAIN.METIS]: { fetch: v3Graphs(CHAIN.METIS), diff --git a/dexs/metavault-v3/index.ts b/dexs/metavault-v3/index.ts index e69c44baa8..0dd002315f 100644 --- a/dexs/metavault-v3/index.ts +++ b/dexs/metavault-v3/index.ts @@ -58,6 +58,7 @@ const v3 = Object.keys(endpointsV3).reduce( ); const adapter: BreakdownAdapter = { + version: 2, breakdown: { v3: v3, }, diff --git a/dexs/miaswap/index.ts b/dexs/miaswap/index.ts index 335f43b31a..da01785875 100644 --- a/dexs/miaswap/index.ts +++ b/dexs/miaswap/index.ts @@ -34,6 +34,7 @@ const v3Graphs = getGraphDimensions({ }); const adapter: SimpleAdapter = { + version: 2, adapter: { [CHAIN.ONUS]: { fetch: v3Graphs(CHAIN.ONUS), diff --git a/dexs/monocerus/index.ts b/dexs/monocerus/index.ts index 3d5e9b6420..3b5b4ec443 100644 --- a/dexs/monocerus/index.ts +++ b/dexs/monocerus/index.ts @@ -33,6 +33,7 @@ const v3Graphs = getGraphDimensions({ }); const adapter: Adapter = { + version: 2, adapter: { [DISABLED_ADAPTER_KEY]: disabledAdapter, [CHAIN.MANTA]: { diff --git a/dexs/nomiswap/index.ts b/dexs/nomiswap/index.ts index 29ed48eba9..bfed4ade50 100644 --- a/dexs/nomiswap/index.ts +++ b/dexs/nomiswap/index.ts @@ -1,7 +1,7 @@ import { univ2Adapter } from "../../helpers/getUniSubgraphVolume"; import { CHAIN } from "../../helpers/chains"; import { getGraphDimensions } from "../../helpers/getUniSubgraph"; -import { SimpleAdapter } from "../../adapters/types"; +import { FetchOptions, SimpleAdapter } from "../../adapters/types"; import { time } from "console"; const endpoints = { @@ -28,10 +28,11 @@ const graphsClassic = getGraphDimensions({ }); const adapters: SimpleAdapter = { + version: 2, adapter: { [CHAIN.BSC]: { - fetch: async (timestamp: number) => { - const data = await graphsClassic(CHAIN.BSC)(timestamp, {}); + fetch: async (options: FetchOptions) => { + const data = await graphsClassic(CHAIN.BSC)(options); const removeSpike = Number(data.totalVolume) - 2035654137.527446631277942307129497; data.totalVolume = removeSpike > 0 ? removeSpike : data.totalVolume; return { diff --git a/dexs/quickswap/index.ts b/dexs/quickswap/index.ts index a873d09f94..91ec9a8903 100644 --- a/dexs/quickswap/index.ts +++ b/dexs/quickswap/index.ts @@ -84,6 +84,7 @@ const fetchLiquidityHub = async (timestamp: number) => { const adapter: BreakdownAdapter = { + version: 2, breakdown: { v2: { [CHAIN.POLYGON]: { diff --git a/dexs/retro/index.ts b/dexs/retro/index.ts index 38797f1c8b..103a65b215 100644 --- a/dexs/retro/index.ts +++ b/dexs/retro/index.ts @@ -27,6 +27,7 @@ const v3Graphs = getGraphDimensions({ }); const adapters: SimpleAdapter = { + version: 2, adapter: { [CHAIN.POLYGON]: { fetch: v3Graphs(CHAIN.POLYGON), diff --git a/dexs/shimmersea/index.ts b/dexs/shimmersea/index.ts index 14cd66008e..c837061bc7 100644 --- a/dexs/shimmersea/index.ts +++ b/dexs/shimmersea/index.ts @@ -27,6 +27,7 @@ const v3Graphs = getGraphDimensions({ }); const adapter: SimpleAdapter = { + version: 2, adapter: Object.keys(v3Endpoints).reduce((acc, chain) => { return { ...acc, diff --git a/dexs/squadswap-v2/index.ts b/dexs/squadswap-v2/index.ts index 60c6843f9f..cfad7ffd19 100644 --- a/dexs/squadswap-v2/index.ts +++ b/dexs/squadswap-v2/index.ts @@ -29,6 +29,7 @@ const v2Graph = getGraphDimensions({ }); const adapter: SimpleAdapter = { + version: 2, adapter: { [CHAIN.BSC]: { fetch: v2Graph(CHAIN.BSC), diff --git a/dexs/squadswap-v3/index.ts b/dexs/squadswap-v3/index.ts index c65dd3f019..4598f8920f 100644 --- a/dexs/squadswap-v3/index.ts +++ b/dexs/squadswap-v3/index.ts @@ -33,6 +33,7 @@ const v3Graphs = getGraphDimensions({ }); const adapter: SimpleAdapter = { + version: 2, adapter: { [CHAIN.BSC]: { fetch: v3Graphs(CHAIN.BSC), diff --git a/dexs/supswap-v2/index.ts b/dexs/supswap-v2/index.ts index 7efae4a30f..4642869cf6 100644 --- a/dexs/supswap-v2/index.ts +++ b/dexs/supswap-v2/index.ts @@ -28,6 +28,7 @@ const v2Graphs = getGraphDimensions({ }); const adapter: SimpleAdapter = { + version: 2, adapter: { [CHAIN.MODE]: { fetch: v2Graphs(CHAIN.MODE), diff --git a/dexs/supswap-v3/index.ts b/dexs/supswap-v3/index.ts index d09a6cb0f7..1d0569a1bf 100644 --- a/dexs/supswap-v3/index.ts +++ b/dexs/supswap-v3/index.ts @@ -34,6 +34,7 @@ const v3Graphs = getGraphDimensions({ }); const adapter: SimpleAdapter = { + version: 2, adapter: { [CHAIN.MODE]: { fetch: v3Graphs(CHAIN.MODE), diff --git a/dexs/surfswap/index.ts b/dexs/surfswap/index.ts index 661b7f624a..ad2dccdb8e 100644 --- a/dexs/surfswap/index.ts +++ b/dexs/surfswap/index.ts @@ -67,6 +67,7 @@ const v1graphs = getGraphDimensions({ }); const adapter: BreakdownAdapter = { + version: 2, breakdown: { classic: { [CHAIN.KAVA]: { diff --git a/dexs/sushiswap/classic.ts b/dexs/sushiswap/classic.ts index dd67edfb45..daebdfb3f7 100644 --- a/dexs/sushiswap/classic.ts +++ b/dexs/sushiswap/classic.ts @@ -166,4 +166,6 @@ classic[CHAIN.FANTOM] = { start: 0 } +classic.version = 2 + export default classic diff --git a/dexs/sushiswap/v3.ts b/dexs/sushiswap/v3.ts index a0cce49c6d..06cdf1ccde 100644 --- a/dexs/sushiswap/v3.ts +++ b/dexs/sushiswap/v3.ts @@ -1,6 +1,7 @@ import { Chain } from "@defillama/sdk/build/general"; import { CHAIN } from "../../helpers/chains"; import { getGraphDimensions } from "../../helpers/getUniSubgraph"; +import { Adapter, SimpleAdapter } from "../../adapters/types"; const endpointsV3 = { [CHAIN.ARBITRUM_NOVA]: 'https://subgraphs.sushi.com/subgraphs/name/sushi-v3/v3-arbitrum-nova', @@ -58,25 +59,23 @@ const startTimeV3: {[key: string]: number} = { [CHAIN.BASE]: 1691020800, } -const v3 = Object.keys(endpointsV3).reduce( - (acc, chain) => ({ - ...acc, - [chain]: { - fetch: v3Graphs(chain as Chain), - start: startTimeV3[chain], - meta: { - methodology: { - Fees: "Each pool charge between 0.01% to 1% fee", - UserFees: "Users pay between 0.01% to 1% fee", - Revenue: "0 to 1/4 of the fee goes to treasury", - HoldersRevenue: "None", - ProtocolRevenue: "Treasury receives a share of the fees", - SupplySideRevenue: "Liquidity providers get most of the fees of all trades in their pools" - } +const v3: SimpleAdapter = { adapter: {}, version: 2 } + +Object.keys(endpointsV3).map((chain: string) => { + v3.adapter[chain] = { + fetch: v3Graphs(chain as Chain), + start: startTimeV3[chain], + meta: { + methodology: { + Fees: "Each pool charge between 0.01% to 1% fee", + UserFees: "Users pay between 0.01% to 1% fee", + Revenue: "0 to 1/4 of the fee goes to treasury", + HoldersRevenue: "None", + ProtocolRevenue: "Treasury receives a share of the fees", + SupplySideRevenue: "Liquidity providers get most of the fees of all trades in their pools" } - }, - }), - {} -); + } + } +}) export default v3 diff --git a/dexs/tangleswap/index.ts b/dexs/tangleswap/index.ts index d4bb141392..6354b59383 100644 --- a/dexs/tangleswap/index.ts +++ b/dexs/tangleswap/index.ts @@ -24,6 +24,7 @@ const v3Graphs = getGraphDimensions({ }); const adapter: SimpleAdapter = { + version: 2, adapter: Object.keys(v3Endpoints).reduce((acc, chain) => { return { ...acc, diff --git a/dexs/throne-v3/index.ts b/dexs/throne-v3/index.ts index 2df22f6b8c..87d959a8b3 100644 --- a/dexs/throne-v3/index.ts +++ b/dexs/throne-v3/index.ts @@ -33,6 +33,7 @@ const v3StartTimes = { } as IJSON; const adapter: SimpleAdapter = { + version: 2, adapter: { [CHAIN.BASE]: { fetch: v3Graph(CHAIN.BASE), diff --git a/dexs/vapordex/v2.ts b/dexs/vapordex/v2.ts index 5bab677215..350f1e760e 100644 --- a/dexs/vapordex/v2.ts +++ b/dexs/vapordex/v2.ts @@ -43,7 +43,7 @@ const v2 = Object.keys(endpointsV2).reduce( start: startTimeV2[chain], }, }), - {} + { version: 2 } ); export default v2; diff --git a/dexs/xswap-protocol/index.ts b/dexs/xswap-protocol/index.ts index f00e3083c6..6daa99921a 100644 --- a/dexs/xswap-protocol/index.ts +++ b/dexs/xswap-protocol/index.ts @@ -17,6 +17,7 @@ const graphs = getGraphDimensions({ }); const adapters: SimpleAdapter = { + version: 2, adapter: { [CHAIN.XDC]: { fetch: graphs(CHAIN.XDC), diff --git a/dexs/zkswap/index.ts b/dexs/zkswap/index.ts index 481d6fc0db..7ab3d543b8 100644 --- a/dexs/zkswap/index.ts +++ b/dexs/zkswap/index.ts @@ -1,5 +1,5 @@ import { time } from "console"; -import { SimpleAdapter } from "../../adapters/types"; +import { FetchOptions, SimpleAdapter } from "../../adapters/types"; import { CHAIN } from "../../helpers/chains"; import { getGraphDimensions } from "../../helpers/getUniSubgraph"; @@ -27,10 +27,11 @@ const graph = getGraphDimensions({ }); const adapters: SimpleAdapter = { + version: 2, adapter: { [CHAIN.ERA]: { - fetch: async (timestamp: number) => { - const data = await graph(CHAIN.ERA)(timestamp, {}); + fetch: async (options: FetchOptions) => { + const data = await graph(CHAIN.ERA)(options); data.totalVolume = undefined; return { ...data diff --git a/fees/ascent-v3.ts b/fees/ascent-v3.ts index 8a80a3c633..1d26faf801 100644 --- a/fees/ascent-v3.ts +++ b/fees/ascent-v3.ts @@ -45,6 +45,7 @@ const v3Graphs = getGraphDimensions({ }); const adapter: SimpleAdapter = { + version: 2, adapter: { [CHAIN.EON]: { fetch: v3Graphs(CHAIN.EON), diff --git a/fees/cleopatra-exchange.ts b/fees/cleopatra-exchange.ts index 5af83abbbc..1243220066 100644 --- a/fees/cleopatra-exchange.ts +++ b/fees/cleopatra-exchange.ts @@ -1,64 +1,65 @@ import { SimpleAdapter, FetchResultFees, BaseAdapter } from "../adapters/types"; import { MANTLE, CHAIN } from "../helpers/chains"; - import { - getGraphDimensions, - DEFAULT_DAILY_VOLUME_FACTORY, - DEFAULT_TOTAL_VOLUME_FIELD, - } from "../helpers/getUniSubgraph" + getGraphDimensions, + DEFAULT_DAILY_VOLUME_FACTORY, + DEFAULT_TOTAL_VOLUME_FIELD, +} from "../helpers/getUniSubgraph"; type TStartTime = { -[key: string]: number; -} -const startTimeV2:TStartTime = { -[CHAIN.MANTLE]: 1704326400, -} - + [key: string]: number; +}; +const startTimeV2: TStartTime = { + [CHAIN.MANTLE]: 1704326400, +}; const v2Endpoints = { - [CHAIN.MANTLE]: "https://subgraph-api.mantle.xyz/subgraphs/name/cleoexchange/cl-subgraph", - }; + [CHAIN.MANTLE]: + "https://subgraph-api.mantle.xyz/subgraphs/name/cleoexchange/cl-subgraph", +}; const VOLUME_USD = "volumeUSD"; const v2Graphs = getGraphDimensions({ - graphUrls: v2Endpoints, - totalVolume: { - factory: "factories", - field: DEFAULT_TOTAL_VOLUME_FIELD, - }, - dailyVolume: { - factory: DEFAULT_DAILY_VOLUME_FACTORY, - field: VOLUME_USD, - }, - feesPercent: { - type: "fees", - HoldersRevenue: 50, - UserFees: 100, // User fees are 100% of collected fees - Revenue: 50, // Revenue is 50% of collected fees - SupplySideRevenue: 50, - } - }); + graphUrls: v2Endpoints, + totalVolume: { + factory: "factories", + field: DEFAULT_TOTAL_VOLUME_FIELD, + }, + dailyVolume: { + factory: DEFAULT_DAILY_VOLUME_FACTORY, + field: VOLUME_USD, + }, + feesPercent: { + type: "fees", + HoldersRevenue: 50, + UserFees: 100, // User fees are 100% of collected fees + Revenue: 50, // Revenue is 50% of collected fees + SupplySideRevenue: 50, + }, +}); - const methodology = { - UserFees: "User pays 0.3% fees on each swap.", - ProtocolRevenue: "Revenue going to the protocol.", - HoldersRevenue: "User fees are distributed among holders." - } +const methodology = { + UserFees: "User pays 0.3% fees on each swap.", + ProtocolRevenue: "Revenue going to the protocol.", + HoldersRevenue: "User fees are distributed among holders.", +}; - const adapter: SimpleAdapter = { - adapter: { - [CHAIN.MANTLE]: {fetch: v2Graphs(MANTLE), - start: startTimeV2[CHAIN.MANTLE], - meta: { - methodology: { - ...methodology, - UserFees: "User pays 0.05%, 0.30%, or 1% on each swap." - } - } - }, - } - }; +const adapter: SimpleAdapter = { + version: 2, + adapter: { + [CHAIN.MANTLE]: { + fetch: v2Graphs(MANTLE), + start: startTimeV2[CHAIN.MANTLE], + meta: { + methodology: { + ...methodology, + UserFees: "User pays 0.05%, 0.30%, or 1% on each swap.", + }, + }, + }, + }, +}; export default adapter; diff --git a/fees/dragonswap/index.ts b/fees/dragonswap/index.ts index 5860ea9e3f..9648b3661c 100644 --- a/fees/dragonswap/index.ts +++ b/fees/dragonswap/index.ts @@ -1,5 +1,5 @@ import { Chain } from "@defillama/sdk/build/types"; -import { BaseAdapter, BreakdownAdapter, IJSON } from "../../adapters/types"; +import { BaseAdapter, BreakdownAdapter, FetchOptions, IJSON } from "../../adapters/types"; import { CHAIN } from "../../helpers/chains"; import { getGraphDimensions } from "../../helpers/getUniSubgraph"; @@ -73,6 +73,7 @@ const v3Graph = getGraphDimensions({ }); const adapter: BreakdownAdapter = { + version: 2, breakdown: { v2: Object.keys(endpoints).reduce((acc, chain) => { acc[chain] = { @@ -86,14 +87,7 @@ const adapter: BreakdownAdapter = { }, {} as BaseAdapter), v3: Object.keys(v3Endpoint).reduce((acc, chain) => { acc[chain] = { - fetch: async (timestamp: number) => { - const v3stats = await v3Graph(chain)(timestamp, {}) - return { - ...v3stats, - timestamp - } - - }, + fetch: v3Graph(chain), start: v3StartTimes[chain], } return acc diff --git a/fees/kyotoswap.ts b/fees/kyotoswap.ts index 7b89cdee87..1f597c37f7 100644 --- a/fees/kyotoswap.ts +++ b/fees/kyotoswap.ts @@ -46,6 +46,7 @@ const methodology = { }; const adapter: Adapter = { + version: 2, adapter: Object.keys(endpoints).reduce((acc, chain) => { acc[chain] = { fetch: graphs(chain as Chain), diff --git a/fees/pharaoh-exchange.ts b/fees/pharaoh-exchange.ts index c00c818e5b..bffdda48ec 100644 --- a/fees/pharaoh-exchange.ts +++ b/fees/pharaoh-exchange.ts @@ -1,64 +1,65 @@ import { SimpleAdapter, FetchResultFees, BaseAdapter } from "../adapters/types"; import { AVAX, CHAIN } from "../helpers/chains"; - import { - getGraphDimensions, - DEFAULT_DAILY_VOLUME_FACTORY, - DEFAULT_TOTAL_VOLUME_FIELD, - } from "../helpers/getUniSubgraph" + getGraphDimensions, + DEFAULT_DAILY_VOLUME_FACTORY, + DEFAULT_TOTAL_VOLUME_FIELD, +} from "../helpers/getUniSubgraph"; type TStartTime = { -[key: string]: number; -} -const startTimeV2:TStartTime = { -[CHAIN.AVAX]: 1702339200, -} - + [key: string]: number; +}; +const startTimeV2: TStartTime = { + [CHAIN.AVAX]: 1702339200, +}; const v2Endpoints = { - [CHAIN.AVAX]: "https://api.thegraph.com/subgraphs/name/ramsesexchange/pharaoh-cl-subgraph", - }; + [CHAIN.AVAX]: + "https://api.thegraph.com/subgraphs/name/ramsesexchange/pharaoh-cl-subgraph", +}; const VOLUME_USD = "volumeUSD"; const v2Graphs = getGraphDimensions({ - graphUrls: v2Endpoints, - totalVolume: { - factory: "factories", - field: DEFAULT_TOTAL_VOLUME_FIELD, - }, - dailyVolume: { - factory: DEFAULT_DAILY_VOLUME_FACTORY, - field: VOLUME_USD, - }, - feesPercent: { - type: "fees", - HoldersRevenue: 50, - UserFees: 100, // User fees are 100% of collected fees - Revenue: 50, // Revenue is 50% of collected fees - SupplySideRevenue: 50, - } - }); + graphUrls: v2Endpoints, + totalVolume: { + factory: "factories", + field: DEFAULT_TOTAL_VOLUME_FIELD, + }, + dailyVolume: { + factory: DEFAULT_DAILY_VOLUME_FACTORY, + field: VOLUME_USD, + }, + feesPercent: { + type: "fees", + HoldersRevenue: 50, + UserFees: 100, // User fees are 100% of collected fees + Revenue: 50, // Revenue is 50% of collected fees + SupplySideRevenue: 50, + }, +}); - const methodology = { - UserFees: "User pays 0.3% fees on each swap.", - ProtocolRevenue: "Revenue going to the protocol.", - HoldersRevenue: "User fees are distributed among holders." - } +const methodology = { + UserFees: "User pays 0.3% fees on each swap.", + ProtocolRevenue: "Revenue going to the protocol.", + HoldersRevenue: "User fees are distributed among holders.", +}; - const adapter: SimpleAdapter = { - adapter: { - [CHAIN.AVAX]: {fetch: v2Graphs(AVAX), - start: startTimeV2[CHAIN.AVAX], - meta: { - methodology: { - ...methodology, - UserFees: "User pays 0.05%, 0.30%, or 1% on each swap." - } - } - }, - } - }; +const adapter: SimpleAdapter = { + version: 2, + adapter: { + [CHAIN.AVAX]: { + fetch: v2Graphs(AVAX), + start: startTimeV2[CHAIN.AVAX], + meta: { + methodology: { + ...methodology, + UserFees: "User pays 0.05%, 0.30%, or 1% on each swap.", + }, + }, + }, + }, +}; export default adapter; diff --git a/fees/quickswap.ts b/fees/quickswap.ts index b4b914de1d..bafac82a51 100644 --- a/fees/quickswap.ts +++ b/fees/quickswap.ts @@ -75,6 +75,7 @@ const methodology = { } const adapter: BreakdownAdapter = { + version: 2, breakdown: { v2: { [CHAIN.POLYGON]: { diff --git a/fees/ramses-exchange-v2/index.ts b/fees/ramses-exchange-v2/index.ts index 361876e250..523d7fdcbb 100644 --- a/fees/ramses-exchange-v2/index.ts +++ b/fees/ramses-exchange-v2/index.ts @@ -61,10 +61,11 @@ const methodology = { } const adapter: Adapter = { + version: 2, adapter: { [CHAIN.ARBITRUM]: { - fetch: async (timestamp: number, chainBlocks: any, options: FetchOptions) => { - const v2Result = await v2Graphs(ARBITRUM)(timestamp, chainBlocks); // Pass chainBlocks as the second argument + fetch: async (options: FetchOptions) => { + const v2Result = await v2Graphs(ARBITRUM)(options) const bribesResult = await getBribes(options); v2Result.dailyBribesRevenue = bribesResult.dailyBribesRevenue; diff --git a/fees/zyberswap.ts b/fees/zyberswap.ts index ef25180e3d..722c284641 100644 --- a/fees/zyberswap.ts +++ b/fees/zyberswap.ts @@ -107,6 +107,7 @@ const methodologyStable = { } const adapter: BreakdownAdapter = { + version: 2, breakdown: { v2: { [CHAIN.ARBITRUM]: { diff --git a/protocols/pancakeswap/index.ts b/protocols/pancakeswap/index.ts index c7c64204d0..01d2d9a9d1 100644 --- a/protocols/pancakeswap/index.ts +++ b/protocols/pancakeswap/index.ts @@ -1,4 +1,4 @@ -import { BaseAdapter, BreakdownAdapter, DISABLED_ADAPTER_KEY, FetchV2, IJSON } from "../../adapters/types"; +import { BaseAdapter, BreakdownAdapter, DISABLED_ADAPTER_KEY, FetchOptions, FetchV2, IJSON } from "../../adapters/types"; import { CHAIN } from "../../helpers/chains"; import disabledAdapter from "../../helpers/disabledAdapter"; @@ -262,7 +262,7 @@ const adapter: BreakdownAdapter = { }, v2: Object.keys(endpoints).reduce((acc, chain) => { acc[chain] = { - fetch: async ({ chain, startTimestamp, getBlock }) => graphs(chain)(startTimestamp, getBlock), + fetch: graphs(chain), start: startTimes[chain], meta: { methodology @@ -272,14 +272,10 @@ const adapter: BreakdownAdapter = { }, {} as BaseAdapter), v3: Object.keys(v3Endpoint).reduce((acc, chain) => { acc[chain] = { - fetch: async ({ chain, startTimestamp, getBlock }) => { - const v3stats = await v3Graph(chain)(startTimestamp, getBlock) + fetch: async (options: FetchOptions) => { + const v3stats = await v3Graph(chain)(options) if (chain === CHAIN.ETHEREUM) v3stats.totalVolume = (Number(v3stats.totalVolume) - 7385565913).toString() - return { - ...v3stats, - timestamp: startTimestamp - } - + return v3stats }, start: v3StartTimes[chain], } @@ -287,7 +283,7 @@ const adapter: BreakdownAdapter = { }, {} as BaseAdapter), stableswap: Object.keys(stablesSwapEndpoints).reduce((acc, chain) => { acc[chain] = { - fetch: async ({ chain, startTimestamp, getBlock }) => graphsStableSwap(chain)(startTimestamp, getBlock), + fetch: graphsStableSwap(chain), start: stableTimes[chain], meta: { methodology: { diff --git a/protocols/smbswap/index.ts b/protocols/smbswap/index.ts index 4b0ed19bd1..3e0c0b4201 100644 --- a/protocols/smbswap/index.ts +++ b/protocols/smbswap/index.ts @@ -1,5 +1,5 @@ import { Chain } from "@defillama/sdk/build/general"; -import { BaseAdapter, BreakdownAdapter, DISABLED_ADAPTER_KEY, IJSON } from "../../adapters/types"; +import { BaseAdapter, BreakdownAdapter, DISABLED_ADAPTER_KEY, FetchOptions, IJSON } from "../../adapters/types"; import { CHAIN } from "../../helpers/chains"; import disabledAdapter from "../../helpers/disabledAdapter"; @@ -109,6 +109,7 @@ const methodology = { } const adapter: BreakdownAdapter = { + version: 2, breakdown: { v1: { [DISABLED_ADAPTER_KEY]: disabledAdapter, @@ -116,10 +117,9 @@ const adapter: BreakdownAdapter = { }, v2: { [CHAIN.BSC]: { - fetch: async (timestamp: number) => { - const volume = await graphs(CHAIN.BSC)(timestamp, {}) + fetch: async (options: FetchOptions) => { + const volume = await graphs(CHAIN.BSC)(options) return { - timestamp, dailyFees: volume.dailyFees, dailyVolume: volume.dailyVolume, }