From 3a8138ce72c5f1a17ea03b96ecce12f84ac58e49 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Wed, 11 Sep 2024 22:58:39 +0100 Subject: [PATCH] protocols --- fees/dragonswap/index.ts | 21 ++------ fees/kyotoswap.ts | 10 +--- fees/nile-exchange/index.ts | 11 ++-- fees/nuri-exchange-v2/index.ts | 13 ++--- fees/pharaoh-exchange.ts | 11 ++-- fees/quickswap.ts | 66 +++++++++++------------- fees/ramses-exchange-v2/index.ts | 11 +--- fees/zyberswap.ts | 88 ++++++++++++++------------------ protocols/pancakeswap/index.ts | 30 ++--------- protocols/smbswap/index.ts | 25 ++------- protocols/uniswap/index.ts | 37 ++------------ 11 files changed, 98 insertions(+), 225 deletions(-) diff --git a/fees/dragonswap/index.ts b/fees/dragonswap/index.ts index 9648b3661c..e1ecef611e 100644 --- a/fees/dragonswap/index.ts +++ b/fees/dragonswap/index.ts @@ -1,7 +1,7 @@ import { Chain } from "@defillama/sdk/build/types"; -import { BaseAdapter, BreakdownAdapter, FetchOptions, IJSON } from "../../adapters/types"; +import { BaseAdapter, BreakdownAdapter, IJSON } from "../../adapters/types"; import { CHAIN } from "../../helpers/chains"; -import { getGraphDimensions } from "../../helpers/getUniSubgraph"; +import { getGraphDimensions2 } from "../../helpers/getUniSubgraph"; const endpoints = { [CHAIN.KLAYTN]: "https://graph.dgswap.io/subgraphs/name/dragonswap/exchange-v2", @@ -11,8 +11,6 @@ const v3Endpoint = { [CHAIN.KLAYTN]: "https://graph.dgswap.io/subgraphs/name/dragonswap/exchange-v3", }; -const VOLUME_USD = "volumeUSD"; - const startTimes = { [CHAIN.KLAYTN]: 1707297572, } as IJSON; @@ -30,7 +28,7 @@ const methodology = { Fees: "All fees comes from the user." } -const graphs = getGraphDimensions({ +const graphs = getGraphDimensions2({ graphUrls: endpoints, graphRequestHeaders: { [CHAIN.KLAYTN]: { @@ -40,9 +38,6 @@ const graphs = getGraphDimensions({ totalVolume: { factory: "pancakeFactories" }, - dailyVolume: { - factory: "pancakeDayData" - }, feesPercent: { type: "volume", Fees: 0.3, @@ -54,22 +49,14 @@ const graphs = getGraphDimensions({ } }); -const v3Graph = getGraphDimensions({ +const v3Graph = getGraphDimensions2({ graphUrls: v3Endpoint, totalVolume: { factory: "factories", }, - dailyVolume: { - factory: "pancakeDayData", - field: VOLUME_USD - }, totalFees: { factory: "factories", }, - dailyFees: { - factory: "pancakeDayData", - field: "feesUSD" - }, }); const adapter: BreakdownAdapter = { diff --git a/fees/kyotoswap.ts b/fees/kyotoswap.ts index 15ef9b3f38..2999b680ab 100644 --- a/fees/kyotoswap.ts +++ b/fees/kyotoswap.ts @@ -1,14 +1,11 @@ import * as sdk from "@defillama/sdk"; -import { getDexChainFees } from "../helpers/getUniSubgraphFees"; -import volumeAdapter from "../dexs/spookyswap"; import { Adapter, BaseAdapter, - BreakdownAdapter, IJSON, } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; -import { getGraphDimensions } from "../helpers/getUniSubgraph"; +import { getGraphDimensions, getGraphDimensions2 } from "../helpers/getUniSubgraph"; import { Chain } from "@defillama/sdk/build/general"; const endpoints = { @@ -16,14 +13,11 @@ const endpoints = { sdk.graph.modifyEndpoint('B1VWKexyptT1ixDdHsxj3EJnAxvuje7ANT39rnfq9rRG'), }; -const graphs = getGraphDimensions({ +const graphs = getGraphDimensions2({ graphUrls: endpoints, totalVolume: { factory: "pancakeFactories", }, - dailyVolume: { - factory: "pancakeDayData", - }, feesPercent: { type: "volume", Fees: 0.25, diff --git a/fees/nile-exchange/index.ts b/fees/nile-exchange/index.ts index ea38c99ce3..84533903f2 100644 --- a/fees/nile-exchange/index.ts +++ b/fees/nile-exchange/index.ts @@ -1,10 +1,11 @@ import { Adapter, FetchOptions } from "../../adapters/types"; -import { ARBITRUM, CHAIN } from "../../helpers/chains"; +import { CHAIN } from "../../helpers/chains"; import { fees_bribes } from './bribes'; import { getGraphDimensions, DEFAULT_DAILY_VOLUME_FACTORY, DEFAULT_TOTAL_VOLUME_FIELD, + getGraphDimensions2, } from "../../helpers/getUniSubgraph" type TStartTime = { @@ -31,18 +32,12 @@ const v2Endpoints = { [CHAIN.LINEA]: "https://api.studio.thegraph.com/query/66247/nile-cl/version/latest/", }; -const VOLUME_USD = "volumeUSD"; - -const v2Graphs = getGraphDimensions({ +const v2Graphs = getGraphDimensions2({ graphUrls: v2Endpoints, totalVolume: { factory: "factories", field: DEFAULT_TOTAL_VOLUME_FIELD, }, - dailyVolume: { - factory: DEFAULT_DAILY_VOLUME_FACTORY, - field: VOLUME_USD, - }, feesPercent: { type: "fees", HoldersRevenue: 72, diff --git a/fees/nuri-exchange-v2/index.ts b/fees/nuri-exchange-v2/index.ts index ace7747bcb..798d67f7cd 100644 --- a/fees/nuri-exchange-v2/index.ts +++ b/fees/nuri-exchange-v2/index.ts @@ -1,10 +1,9 @@ import { Adapter, FetchOptions } from "../../adapters/types"; -import { ARBITRUM, CHAIN } from "../../helpers/chains"; +import { CHAIN } from "../../helpers/chains"; import { fees_bribes } from './bribes'; import { - getGraphDimensions, - DEFAULT_DAILY_VOLUME_FACTORY, DEFAULT_TOTAL_VOLUME_FIELD, + getGraphDimensions2, } from "../../helpers/getUniSubgraph" type TStartTime = { @@ -31,18 +30,12 @@ const v2Endpoints = { [CHAIN.SCROLL]: "https://api.studio.thegraph.com/query/66247/nuri-cl/version/latest", }; -const VOLUME_USD = "volumeUSD"; - -const v2Graphs = getGraphDimensions({ +const v2Graphs = getGraphDimensions2({ graphUrls: v2Endpoints, totalVolume: { factory: "factories", field: DEFAULT_TOTAL_VOLUME_FIELD, }, - dailyVolume: { - factory: DEFAULT_DAILY_VOLUME_FACTORY, - field: VOLUME_USD, - }, feesPercent: { type: "fees", HoldersRevenue: 72, diff --git a/fees/pharaoh-exchange.ts b/fees/pharaoh-exchange.ts index e8c81e0de9..f3b464ec50 100644 --- a/fees/pharaoh-exchange.ts +++ b/fees/pharaoh-exchange.ts @@ -1,11 +1,10 @@ import * as sdk from "@defillama/sdk"; -import { SimpleAdapter, FetchResultFees, BaseAdapter } from "../adapters/types"; +import { SimpleAdapter } from "../adapters/types"; import { AVAX, CHAIN } from "../helpers/chains"; - import { - getGraphDimensions, DEFAULT_DAILY_VOLUME_FACTORY, DEFAULT_TOTAL_VOLUME_FIELD, + getGraphDimensions2, } from "../helpers/getUniSubgraph"; type TStartTime = { @@ -22,16 +21,12 @@ const v2Endpoints = { const VOLUME_USD = "volumeUSD"; -const v2Graphs = getGraphDimensions({ +const v2Graphs = getGraphDimensions2({ graphUrls: v2Endpoints, totalVolume: { factory: "factories", field: DEFAULT_TOTAL_VOLUME_FIELD, }, - dailyVolume: { - factory: DEFAULT_DAILY_VOLUME_FACTORY, - field: VOLUME_USD, - }, feesPercent: { type: "fees", HoldersRevenue: 72, diff --git a/fees/quickswap.ts b/fees/quickswap.ts index 006bb0dfd5..ee1dfa3122 100644 --- a/fees/quickswap.ts +++ b/fees/quickswap.ts @@ -2,16 +2,14 @@ import * as sdk from "@defillama/sdk"; import { Chain } from "@defillama/sdk/build/general"; import { BreakdownAdapter, BaseAdapter } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; -import customBackfill from "../helpers/customBackfill"; - -import { - getGraphDimensions -} from "../helpers/getUniSubgraph" +import { getGraphDimensions2 } from "../helpers/getUniSubgraph"; const v2Endpoints = { - [CHAIN.POLYGON]: sdk.graph.modifyEndpoint('FUWdkXWpi8JyhAnhKL5pZcVshpxuaUQG8JHMDqNCxjPd'), -} -const v2Graph = getGraphDimensions({ + [CHAIN.POLYGON]: sdk.graph.modifyEndpoint( + "FUWdkXWpi8JyhAnhKL5pZcVshpxuaUQG8JHMDqNCxjPd", + ), +}; +const v2Graph = getGraphDimensions2({ graphUrls: v2Endpoints, feesPercent: { type: "volume", @@ -20,41 +18,35 @@ const v2Graph = getGraphDimensions({ SupplySideRevenue: 0.3, HoldersRevenue: 0, Revenue: 0, - Fees: 0.3 - } + Fees: 0.3, + }, }); const v3Endpoints = { - [CHAIN.POLYGON]: sdk.graph.modifyEndpoint('CCFSaj7uS128wazXMdxdnbGA3YQnND9yBdHjPtvH7Bc7'), + [CHAIN.POLYGON]: sdk.graph.modifyEndpoint( + "CCFSaj7uS128wazXMdxdnbGA3YQnND9yBdHjPtvH7Bc7", + ), // [CHAIN.DOGECHAIN]: "https://graph-node.dogechain.dog/subgraphs/name/quickswap/dogechain-info", - [CHAIN.POLYGON_ZKEVM]:"https://api.studio.thegraph.com/query/44554/quickswap-v3-02/0.0.7" -} + [CHAIN.POLYGON_ZKEVM]: + "https://api.studio.thegraph.com/query/44554/quickswap-v3-02/0.0.7", +}; type TStartTime = { [s: string | Chain]: number; -} +}; const startTimeV3: TStartTime = { [CHAIN.POLYGON]: 1662425243, [CHAIN.POLYGON_ZKEVM]: 1679875200, [CHAIN.DOGECHAIN]: 1660694400, -} +}; -const v3Graphs = getGraphDimensions({ +const v3Graphs = getGraphDimensions2({ graphUrls: v3Endpoints, totalVolume: { factory: "factories", field: "totalVolumeUSD", }, - dailyVolume: { - factory: "algebraDayData", - field: "volumeUSD", - dateField: "date" - }, - dailyFees: { - factory: "algebraDayData", - field: "feesUSD", - }, feesPercent: { type: "fees", ProtocolRevenue: 0, @@ -62,8 +54,8 @@ const v3Graphs = getGraphDimensions({ Fees: 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 - } + Revenue: 0, // Revenue is 100% of collected fees + }, }); const methodology = { @@ -72,8 +64,8 @@ const methodology = { Revenue: "Protocol have no revenue", ProtocolRevenue: "Protocol have no revenue.", SupplySideRevenue: "All user fees are distributed among LPs.", - HoldersRevenue: "Holders have no revenue." -} + HoldersRevenue: "Holders have no revenue.", +}; const adapter: BreakdownAdapter = { version: 2, @@ -83,7 +75,7 @@ const adapter: BreakdownAdapter = { fetch: v2Graph(CHAIN.POLYGON), start: 1602118043, meta: { - methodology + methodology, }, }, }, @@ -92,12 +84,12 @@ const adapter: BreakdownAdapter = { fetch: v3Graphs(chain as Chain), start: startTimeV3[chain], meta: { - methodology - } - } - return acc - }, {} as BaseAdapter) - } -} + methodology, + }, + }; + return acc; + }, {} as BaseAdapter), + }, +}; export default adapter; diff --git a/fees/ramses-exchange-v2/index.ts b/fees/ramses-exchange-v2/index.ts index 470ceb83be..d4d300ff43 100644 --- a/fees/ramses-exchange-v2/index.ts +++ b/fees/ramses-exchange-v2/index.ts @@ -3,9 +3,8 @@ import { Adapter, FetchOptions } from "../../adapters/types"; import { ARBITRUM, CHAIN } from "../../helpers/chains"; import { fees_bribes } from './bribes'; import { - getGraphDimensions, - DEFAULT_DAILY_VOLUME_FACTORY, DEFAULT_TOTAL_VOLUME_FIELD, + getGraphDimensions2, } from "../../helpers/getUniSubgraph" type TStartTime = { @@ -32,18 +31,12 @@ const v2Endpoints = { [CHAIN.ARBITRUM]: sdk.graph.modifyEndpoint('G2tXDm6mgqBMuC7hq9GRVeTv5SRBAVnPFGcpGBab2cea'), }; -const VOLUME_USD = "volumeUSD"; - -const v2Graphs = getGraphDimensions({ +const v2Graphs = getGraphDimensions2({ graphUrls: v2Endpoints, totalVolume: { factory: "factories", field: DEFAULT_TOTAL_VOLUME_FIELD, }, - dailyVolume: { - factory: DEFAULT_DAILY_VOLUME_FACTORY, - field: VOLUME_USD, - }, feesPercent: { type: "fees", HoldersRevenue: 72, diff --git a/fees/zyberswap.ts b/fees/zyberswap.ts index f693284f26..4c2213ec4e 100644 --- a/fees/zyberswap.ts +++ b/fees/zyberswap.ts @@ -2,16 +2,14 @@ import * as sdk from "@defillama/sdk"; import { Chain } from "@defillama/sdk/build/general"; import { BreakdownAdapter, BaseAdapter } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; -import customBackfill from "../helpers/customBackfill"; - -import { - getGraphDimensions -} from "../helpers/getUniSubgraph" +import { getGraphDimensions2 } from "../helpers/getUniSubgraph"; const v2Endpoints = { - [CHAIN.ARBITRUM]: sdk.graph.modifyEndpoint('3g83GYhbyHtjy581vpTmN1AP9cB9MjWMh5TiuNpvTU4R'), -} -const v2Graph = getGraphDimensions({ + [CHAIN.ARBITRUM]: sdk.graph.modifyEndpoint( + "3g83GYhbyHtjy581vpTmN1AP9cB9MjWMh5TiuNpvTU4R", + ), +}; +const v2Graph = getGraphDimensions2({ graphUrls: v2Endpoints, feesPercent: { type: "volume", @@ -20,28 +18,21 @@ const v2Graph = getGraphDimensions({ SupplySideRevenue: 0.15, HoldersRevenue: 0, Revenue: 0.1, - Fees: 0.25 - } + Fees: 0.25, + }, }); const v3Endpoints = { - [CHAIN.ARBITRUM]: sdk.graph.modifyEndpoint('7ZP9MeeuXno2y9pWR5LzA96UtYuZYWTA4WYZDZR7ghbN'), -} -const v3Graphs = getGraphDimensions({ + [CHAIN.ARBITRUM]: sdk.graph.modifyEndpoint( + "7ZP9MeeuXno2y9pWR5LzA96UtYuZYWTA4WYZDZR7ghbN", + ), +}; +const v3Graphs = getGraphDimensions2({ graphUrls: v3Endpoints, totalVolume: { factory: "factories", field: "totalVolumeUSD", }, - dailyVolume: { - factory: "algebraDayData", - field: "volumeUSD", - dateField: "date" - }, - dailyFees: { - factory: "algebraDayData", - field: "feesUSD", - }, feesPercent: { type: "fees", ProtocolRevenue: 10, @@ -49,25 +40,22 @@ const v3Graphs = getGraphDimensions({ Fees: 10, UserFees: 90, // User fees are 90% of collected fees SupplySideRevenue: 90, // 90% of fees are going to LPs - Revenue: 10 // Revenue is 10% of collected fees - } + Revenue: 10, // Revenue is 10% of collected fees + }, }); const endpointsStable = { - [CHAIN.ARBITRUM]: sdk.graph.modifyEndpoint('H7QEsa69B3bbXZVtmqGaRZVUV8PCUqsKfqXGRb69LHa6') + [CHAIN.ARBITRUM]: sdk.graph.modifyEndpoint( + "H7QEsa69B3bbXZVtmqGaRZVUV8PCUqsKfqXGRb69LHa6", + ), }; -const stableGraph = getGraphDimensions({ +const stableGraph = getGraphDimensions2({ graphUrls: endpointsStable, totalVolume: { factory: "tradeVolumes", field: "volume", }, - dailyVolume: { - factory: "dailyVolume", - field: "volume", - dateField: "timestamp" - }, feesPercent: { type: "volume", UserFees: 0.04, @@ -75,18 +63,19 @@ const stableGraph = getGraphDimensions({ SupplySideRevenue: 0.02, HoldersRevenue: 0, Revenue: 0.02, - Fees: 0.04 - } + Fees: 0.04, + }, }); const methodology = { UserFees: "User pays 0.25% fees on each swap.", Fees: "A 0.25% of each swap is collected as trading fees", - Revenue: "Protocol receives 0.1% on each swap. A part is used to buyback and burn and a part is used to buy WETH and distribute to stakers.", + Revenue: + "Protocol receives 0.1% on each swap. A part is used to buyback and burn and a part is used to buy WETH and distribute to stakers.", ProtocolRevenue: "Protocol receives 0.1% on each swap.", SupplySideRevenue: "All user fees are distributed among LPs.", - HoldersRevenue: "Stakers receive WETH a part of protocol revenue." -} + HoldersRevenue: "Stakers receive WETH a part of protocol revenue.", +}; const methodologyV3 = { UserFees: "User pays dynamic swap fee.", @@ -94,9 +83,9 @@ const methodologyV3 = { Revenue: "Protocol receives 10% of the dynamic swap fee", ProtocolRevenue: "Protocol receives 10% of the dynamic swap fee", SupplySideRevenue: "90% of the dynamic swap fee is distributed to LPs", - HoldersRevenue: "A portion of the protocol fees is used to purchase WETH and distribute to stakers." -} - + HoldersRevenue: + "A portion of the protocol fees is used to purchase WETH and distribute to stakers.", +}; const methodologyStable = { UserFees: "User pays a 0.04% fee on each swap.", @@ -104,8 +93,9 @@ const methodologyStable = { Revenue: "Protocol receives 0.02% of the swap fee", ProtocolRevenue: "Protocol receives 0.02% of the swap fee", SupplySideRevenue: "0.02% of the swap fee is distributed to LPs", - HoldersRevenue: "A portion of the protocol fees is used to purchase WETH and distribute to stakers." -} + HoldersRevenue: + "A portion of the protocol fees is used to purchase WETH and distribute to stakers.", +}; const adapter: BreakdownAdapter = { version: 2, @@ -115,7 +105,7 @@ const adapter: BreakdownAdapter = { fetch: v2Graph(CHAIN.ARBITRUM), start: 1674432000, meta: { - methodology + methodology, }, }, }, @@ -124,21 +114,21 @@ const adapter: BreakdownAdapter = { fetch: v3Graphs(chain as Chain), start: 1676887200, meta: { - methodology: methodologyV3 - } - } - return acc + methodology: methodologyV3, + }, + }; + return acc; }, {} as BaseAdapter), stable: { [CHAIN.ARBITRUM]: { fetch: stableGraph(CHAIN.ARBITRUM), start: 1676113200, meta: { - methodology: methodologyStable + methodology: methodologyStable, }, }, }, - } -} + }, +}; export default adapter; diff --git a/protocols/pancakeswap/index.ts b/protocols/pancakeswap/index.ts index df3848e389..750fbb0532 100644 --- a/protocols/pancakeswap/index.ts +++ b/protocols/pancakeswap/index.ts @@ -1,8 +1,7 @@ import { BaseAdapter, BreakdownAdapter, DISABLED_ADAPTER_KEY, FetchOptions, FetchV2, IJSON } from "../../adapters/types"; import { CHAIN } from "../../helpers/chains"; import disabledAdapter from "../../helpers/disabledAdapter"; - -import { getGraphDimensions } from "../../helpers/getUniSubgraph" +import { getGraphDimensions2 } from "../../helpers/getUniSubgraph" import * as sdk from "@defillama/sdk"; import { httpGet } from "../../utils/fetchURL"; import { getEnv } from "../../helpers/env"; @@ -34,9 +33,7 @@ const v3Endpoint = { [CHAIN.OP_BNB]: `${getEnv('PANCAKESWAP_OPBNB_SUBGRAPH')}/subgraphs/name/pancakeswap/exchange-v3` } -const VOLUME_USD = "volumeUSD"; - -const graphs = getGraphDimensions({ +const graphs = getGraphDimensions2({ graphUrls: endpoints, graphRequestHeaders: { [CHAIN.BSC]: { @@ -46,9 +43,6 @@ const graphs = getGraphDimensions({ totalVolume: { factory: "pancakeFactories" }, - dailyVolume: { - factory: "pancakeDayData" - }, feesPercent: { type: "volume", Fees: 0.25, @@ -60,14 +54,11 @@ const graphs = getGraphDimensions({ } }); -const graphsStableSwap = getGraphDimensions({ +const graphsStableSwap = getGraphDimensions2({ graphUrls: stablesSwapEndpoints, totalVolume: { factory: "factories" }, - dailyVolume: { - factory: "pancakeDayData" - }, feesPercent: { type: "volume", Fees: 0.25, // 0.25% volume @@ -79,23 +70,14 @@ const graphsStableSwap = getGraphDimensions({ } }); -const v3Graph = getGraphDimensions({ +const v3Graph = getGraphDimensions2({ graphUrls: v3Endpoint, totalVolume: { factory: "factories", - - }, - dailyVolume: { - factory: "pancakeDayData", - field: VOLUME_USD }, totalFees: { factory: "factories", }, - dailyFees: { - factory: "pancakeDayData", - field: "feesUSD" - }, }); const startTimes = { @@ -162,9 +144,7 @@ const getResources = async (account: string): Promise => { return data } -const fetchVolume: FetchV2 = async ({ endTimestamp: timestamp, createBalances }) => { - const fromTimestamp = timestamp - 86400; - const toTimestamp = timestamp; +const fetchVolume: FetchV2 = async ({ fromTimestamp, toTimestamp, createBalances }) => { const account_resource: any[] = (await getResources(account)) const pools = account_resource.filter(e => e.type?.includes('swap::PairEventHolder')) .map((e: any) => { diff --git a/protocols/smbswap/index.ts b/protocols/smbswap/index.ts index 770fbf195b..5c49110140 100644 --- a/protocols/smbswap/index.ts +++ b/protocols/smbswap/index.ts @@ -3,8 +3,7 @@ import { Chain } from "@defillama/sdk/build/general"; import { BaseAdapter, BreakdownAdapter, DISABLED_ADAPTER_KEY, FetchOptions, IJSON } from "../../adapters/types"; import { CHAIN } from "../../helpers/chains"; import disabledAdapter from "../../helpers/disabledAdapter"; - -import { getGraphDimensions } from "../../helpers/getUniSubgraph" +import { getGraphDimensions2 } from "../../helpers/getUniSubgraph" const endpoints = { [CHAIN.BSC]: sdk.graph.modifyEndpoint('9BtGwsWynjj21VyrAtNfeKG5kMhcZ7Z12T53wo7PBTLj') @@ -18,14 +17,13 @@ const v3Endpoint = { [CHAIN.BSC]: sdk.graph.modifyEndpoint('8XiGZs3G3dDL3YQJx7CsMGXdn3CUBBC9CVpCe1xrsSA7') } -const VOLUME_USD = "volumeUSD"; const blackListedPairs = { [CHAIN.BSC]: [ "0x609f59c97ddf58475c7d3f3fc829c3ff9fc4f76f" ] } -const graphs = getGraphDimensions({ +const graphs = getGraphDimensions2({ graphUrls: endpoints, graphRequestHeaders: { [CHAIN.BSC]: { @@ -35,9 +33,6 @@ const graphs = getGraphDimensions({ totalVolume: { factory: "smbfactories" }, - dailyVolume: { - factory: "smbdayData" - }, feesPercent: { type: "volume", Fees: 0.25, @@ -50,14 +45,11 @@ const graphs = getGraphDimensions({ blacklistTokens: blackListedPairs }); -const graphsStableSwap = getGraphDimensions({ +const graphsStableSwap = getGraphDimensions2({ graphUrls: stablesSwapEndpoints, totalVolume: { factory: "factories" }, - dailyVolume: { - factory: "smbdayData" - }, feesPercent: { type: "volume", Fees: 0.25, // 0.25% volume @@ -69,23 +61,14 @@ const graphsStableSwap = getGraphDimensions({ } }); -const v3Graph = getGraphDimensions({ +const v3Graph = getGraphDimensions2({ graphUrls: v3Endpoint, totalVolume: { factory: "factories", - - }, - dailyVolume: { - factory: "smbdayData", - field: VOLUME_USD }, totalFees:{ factory: "factories", }, - dailyFees: { - factory: "smbdayData", - field: "feesUSD" - }, }); const startTimes = { diff --git a/protocols/uniswap/index.ts b/protocols/uniswap/index.ts index 10117aef27..810f010fb0 100644 --- a/protocols/uniswap/index.ts +++ b/protocols/uniswap/index.ts @@ -4,13 +4,7 @@ import { BreakdownAdapter, FetchResultGeneric, BaseAdapter, FetchOptions } from import { CHAIN } from "../../helpers/chains"; import { getStartTimestamp } from "../../helpers/getStartTimestamp"; import * as sdk from "@defillama/sdk"; -import {getUniV2LogAdapter} from "../../helpers/uniswap" - -import { - getGraphDimensions, - DEFAULT_DAILY_VOLUME_FACTORY, - DEFAULT_TOTAL_VOLUME_FIELD, -} from "../../helpers/getUniSubgraph" +import { DEFAULT_TOTAL_VOLUME_FIELD, getGraphDimensions2 } from "../../helpers/getUniSubgraph" import request, { gql } from 'graphql-request'; import { httpPost } from '../../utils/fetchURL'; @@ -79,18 +73,11 @@ const VOLUME_USD = "volumeUSD"; // fees results are in eth, needs to be converted to a balances objects const ETH_ADDRESS = "ethereum:" + ADDRESSES.null; -const v1Graph = getGraphDimensions({ +const v1Graph = getGraphDimensions2({ graphUrls: v1Endpoints, totalVolume: { factory: "uniswaps", }, - dailyVolume: { - field: "dailyVolumeInUSD", - }, - dailyFees: { - factory: "exchangeHistoricalData", - field: "feeInEth" - }, feesPercent: { type: "fees", UserFees: 100, @@ -102,7 +89,7 @@ const v1Graph = getGraphDimensions({ } }); -const v2Graph = getGraphDimensions({ +const v2Graph = getGraphDimensions2({ graphUrls: v2Endpoints, feesPercent: { type: "volume", @@ -116,16 +103,12 @@ const v2Graph = getGraphDimensions({ blacklistTokens: blacklisted }); -const v3Graphs = getGraphDimensions({ +const v3Graphs = getGraphDimensions2({ graphUrls: v3Endpoints, totalVolume: { factory: "factories", field: DEFAULT_TOTAL_VOLUME_FIELD, }, - dailyVolume: { - factory: DEFAULT_DAILY_VOLUME_FACTORY, - field: VOLUME_USD, - }, feesPercent: { type: "fees", ProtocolRevenue: 0, @@ -158,18 +141,6 @@ const startTimeV3:TStartTime = { [CHAIN.ERA]: 1693440000 } -const v2Deployments = { - // ethereum: '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f', - optimism: '0x0c3c1c532F1e39EdF36BE9Fe0bE1410313E074Bf', - arbitrum: '0xf1D7CC64Fb4452F05c498126312eBE29f30Fbcf9', - avax: '0x9e5A52f57b3038F1B8EeE45F28b3C1967e22799C', - base: '0x8909dc15e40173ff4699343b6eb8132c65e18ec6', - bsc: '0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6', - polygon: '0x9e5A52f57b3038F1B8EeE45F28b3C1967e22799C', - //celo: '0x79a530c8e2fA8748B7B40dd3629C0520c2cCf03f', - zora: '0x0F797dC7efaEA995bB916f268D919d0a1950eE3C' -} - const chainv2mapping: any = { [CHAIN.ARBITRUM]: "ARBITRUM", [CHAIN.ETHEREUM]: "ETHEREUM",