From 16e349f9695a3850678d54f3d239ee730b0a144f Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Sun, 13 Oct 2024 14:09:20 +0100 Subject: [PATCH 1/6] deadFrom --- adapters/types.ts | 1 + fees/junoswap.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/adapters/types.ts b/adapters/types.ts index c4756f9aa0..382495c4f4 100644 --- a/adapters/types.ts +++ b/adapters/types.ts @@ -93,6 +93,7 @@ export type AdapterBase = { isExpensiveAdapter?: boolean, protocolType?: ProtocolType; version?: number; + deadFrom?: number } export type SimpleAdapter = AdapterBase & { diff --git a/fees/junoswap.ts b/fees/junoswap.ts index 04f82c96ae..462b4f3d03 100644 --- a/fees/junoswap.ts +++ b/fees/junoswap.ts @@ -39,7 +39,8 @@ const adapter: Adapter = { fetch: fetch, start: 1646784000, }, - } + }, + deadFrom: 1728824666 // no tvl and api dead } export default adapter; From 6ddb86597b009e626d8fca4e9a27b3f5ae266d37 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Sun, 13 Oct 2024 14:23:16 +0100 Subject: [PATCH 2/6] horiza --- dexs/horiza/index.ts | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/dexs/horiza/index.ts b/dexs/horiza/index.ts index fb96a97237..af47940223 100644 --- a/dexs/horiza/index.ts +++ b/dexs/horiza/index.ts @@ -1,32 +1,12 @@ import { SimpleAdapter } from "../../adapters/types"; import { CHAIN } from "../../helpers/chains"; -import { DEFAULT_TOTAL_VOLUME_FIELD, getGraphDimensions2 } from "../../helpers/getUniSubgraph"; - -const endpointV3 = { - [CHAIN.ARBITRUM]: 'https://subgraph-prod.goerli.horiza.io/subgraphs/name/retro-arbitrum-one-uniswap-v3' -} - -const v3Graphs = getGraphDimensions2({ - graphUrls: endpointV3, - totalVolume: { - factory: "factories", - field: DEFAULT_TOTAL_VOLUME_FIELD, - }, - feesPercent: { - type: "fees", - ProtocolRevenue: 10, - HoldersRevenue: 0, - UserFees: 100, - SupplySideRevenue: 90, - Revenue: 10, - } -}); +import { getUniV3LogAdapter } from '../../helpers/uniswap' const adapters: SimpleAdapter = { version: 2, adapter: { [CHAIN.ARBITRUM]: { - fetch: v3Graphs(CHAIN.ARBITRUM), + fetch: getUniV3LogAdapter({ factory: '0x5b1C257B88537d1Ce2AF55a1760336288CcD28B6', }), start: 1704585600, } } From 1b4447762b124a0bf282fe1c83bb02e08ca859b4 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Sun, 13 Oct 2024 15:06:58 +0100 Subject: [PATCH 3/6] amo --- fees/frax-amo.ts | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/fees/frax-amo.ts b/fees/frax-amo.ts index 2c5dac76ae..6b5b2edfad 100644 --- a/fees/frax-amo.ts +++ b/fees/frax-amo.ts @@ -1,6 +1,6 @@ import * as sdk from "@defillama/sdk"; import { gql, GraphQLClient } from "graphql-request"; -import { FetchOptions, SimpleAdapter } from "../adapters/types"; +import { FetchOptions, FetchResult, SimpleAdapter } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; const query = (amo: string, timestamp: number) => gql` @@ -38,19 +38,19 @@ const findRevenue = (timedData: any) => Number(timedData.depositedAmount) + Number(timedData.profitTaken); -const fetch = async ({ createBalances, chain, toTimestamp }: FetchOptions) => { - const { amos, graph, FRAX } = config[chain]; +const fetch = async (timestamp: number, _: any, options: FetchOptions): Promise => { + const { amos, graph, FRAX } = config[options.chain]; const client = getGQLClient(graph); - const dailyRevenue = createBalances(); - const totalRevenue = createBalances(); - const dailyFees = createBalances(); + const dailyRevenue = options.createBalances(); + const totalRevenue = options.createBalances(); await Promise.all( amos.map(async (amo: string) => { - const data = (await client.request(query(amo, toTimestamp))).amos[0]; - data.positions.map((p: any) => { - const latest = findRevenue(p.fraxAccountingPerDay[0]); - const previous = findRevenue(p.fraxAccountingPerDay[1]); + const data = (await client.request(query(amo, timestamp))).amos[0]; + data.positions.map(({ fraxAccountingPerDay: days }: any) => { + if (days.length < 2) return + const latest = findRevenue(days[0]); + const previous = findRevenue(days[1]); dailyRevenue.add(FRAX, latest - previous); totalRevenue.add(FRAX, latest); }); @@ -58,6 +58,7 @@ const fetch = async ({ createBalances, chain, toTimestamp }: FetchOptions) => { ); return { + timestamp, dailyRevenue, totalRevenue, dailyFees: dailyRevenue, @@ -100,7 +101,7 @@ const adapter: SimpleAdapter = { }, }; }, {}), - version: 2, + version: 1, }; export default adapter; From 2b2229c94487b3ce828ac8b0a6bc64c940f7c127 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Sun, 13 Oct 2024 15:13:00 +0100 Subject: [PATCH 4/6] shibaswap --- fees/shibaswap.ts | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/fees/shibaswap.ts b/fees/shibaswap.ts index 8db120bc9f..357320608f 100644 --- a/fees/shibaswap.ts +++ b/fees/shibaswap.ts @@ -1,18 +1,17 @@ import { Adapter } from "../adapters/types"; -import volumeAdapter from "../dexs/shibaswap"; -import { getDexChainFees } from "../helpers/getUniSubgraphFees"; - -const TOTAL_FEES = 0.003; - -const feeAdapter = getDexChainFees({ - totalFees: TOTAL_FEES, - volumeAdapter -}); +import { CHAIN } from "../helpers/chains"; +import { getUniV2LogAdapter } from "../helpers/uniswap"; const adapter: Adapter = { version: 2, - adapter: feeAdapter + adapter: { + [CHAIN.ETHEREUM]: { + fetch: getUniV2LogAdapter({ + factory: "0x115934131916c8b277dd010ee02de363c09d037c", + }), + start: 1625566975, + }, + }, }; - export default adapter; From acecd0972133a482b11215d2e8a42d0234420556 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Sun, 13 Oct 2024 15:23:51 +0100 Subject: [PATCH 5/6] honeyswap --- fees/honeyswap.ts | 49 ++++++++++++++++++----------------------------- 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/fees/honeyswap.ts b/fees/honeyswap.ts index ff81768b53..34963556d0 100644 --- a/fees/honeyswap.ts +++ b/fees/honeyswap.ts @@ -1,35 +1,24 @@ +import { Adapter } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; -import { univ2DimensionAdapter2 } from "../helpers/getUniSubgraph"; +import { getUniV2LogAdapter } from "../helpers/uniswap"; -const adapters = univ2DimensionAdapter2({ - graphUrls: { - [CHAIN.POLYGON]: " https://api.thegraph.com/subgraphs/name/1hive/honeyswap-polygon", - [CHAIN.XDAI]: "https://api.thegraph.com/subgraphs/name/1hive/honeyswap-xdai" +const adapter: Adapter = { + version: 2, + adapter: { + [CHAIN.POLYGON]: { + fetch: getUniV2LogAdapter({ + factory: "0x03daa61d8007443a6584e3d8f85105096543c19c", + }), + start: 1622173831, + }, + [CHAIN.XDAI]: { + fetch: getUniV2LogAdapter({ + factory: "0xa818b4f111ccac7aa31d0bcc0806d64f2e0737d7", + }), + start: 1599191431, + }, }, - totalVolume: { - factory: "honeyswapFactories" - }, - feesPercent: { - type: 'volume', - Fees: 0.3, - UserFees: 0.3, - SupplySideRevenue: 0.25, - HoldersRevenue: 0, - ProtocolRevenue: 0.05, - Revenue: 0.05 - } -}, { - methodology: { - UserFees: "A 0.3% fee is charged for token swaps", - Fees: "Trading fees are 0.3% of each swap", - SupplySideRevenue: "A 0.25% of each swap is distributed to liquidity providers", - Revenue: "A 0.05% trading fee goes to treasury", - HoldersRevenue: "There's no revenue from trading fees for token holders", - ProtocolRevenue: "A 0.05% goes to the protocol treasury" - } -}); -adapters.adapter.polygon.start = 1622173831; -adapters.adapter.xdai.start = 1599191431; +}; -export default adapters; +export default adapter; From 45b3ed2bc0634ef4726b16b49be6766631a20e91 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Sun, 13 Oct 2024 15:27:48 +0100 Subject: [PATCH 6/6] revert deadfrom --- adapters/types.ts | 1 - fees/junoswap.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/adapters/types.ts b/adapters/types.ts index 382495c4f4..c4756f9aa0 100644 --- a/adapters/types.ts +++ b/adapters/types.ts @@ -93,7 +93,6 @@ export type AdapterBase = { isExpensiveAdapter?: boolean, protocolType?: ProtocolType; version?: number; - deadFrom?: number } export type SimpleAdapter = AdapterBase & { diff --git a/fees/junoswap.ts b/fees/junoswap.ts index 462b4f3d03..d722b07360 100644 --- a/fees/junoswap.ts +++ b/fees/junoswap.ts @@ -40,7 +40,6 @@ const adapter: Adapter = { start: 1646784000, }, }, - deadFrom: 1728824666 // no tvl and api dead } export default adapter;