Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-add totalFees #2327

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion fees/goplus.ts
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
Loading