From 311803cf0d933b2d9f62058a529de06f96d1ce15 Mon Sep 17 00:00:00 2001 From: Mr-Lucky Date: Fri, 17 Jan 2025 17:39:55 +0800 Subject: [PATCH] re-add totalFees --- fees/goplus.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/fees/goplus.ts b/fees/goplus.ts index c7451ca009..7a179f41cf 100644 --- a/fees/goplus.ts +++ b/fees/goplus.ts @@ -1,17 +1,30 @@ import { FetchOptions, SimpleAdapter } from "../adapters/types"; import { CHAIN } from "../helpers/chains"; +import { queryDune } from "../helpers/dune"; import { addTokensReceived } from "../helpers/token"; +import moment from "moment"; const GOPLUS_FOUNDATION = "0x34ebddd30ccbd3f1e385b41bdadb30412323e34f"; const GOPLUS_REVENUE_POOL = "0x648d7f4ad39186949e37e9223a152435ab97706c"; const fetch = async (options: FetchOptions) => { const dailyFees = options.createBalances(); + const totalFees = options.createBalances(); await addTokensReceived({ balances: dailyFees, target: GOPLUS_FOUNDATION, options, }) await addTokensReceived({ balances: dailyFees, target: GOPLUS_REVENUE_POOL, options, }) - return { dailyFees, dailyRevenue: dailyFees, dailyProtocolRevenue: dailyFees }; + let startDate = new Date(); + startDate.setTime(options.startTimestamp * 1000); + let start = moment(startDate).format("YYYY-MM-DD hh:mm:ss"); + const values = await queryDune("4581834", { + end: start + }) + values.forEach((e: { contract_address: string; amount_raw: string; }) => { + totalFees.add(e.contract_address, e.amount_raw); + }); + + return { dailyFees, totalFees, dailyRevenue: dailyFees, dailyProtocolRevenue: dailyFees, totalProtocolRevenue: totalFees }; }; const adapter: SimpleAdapter = {