From 264baba39262475bb76adf97d07b30de738eb69a Mon Sep 17 00:00:00 2001 From: 0xgnek <0xgnek@gmail.com> Date: Wed, 8 Jan 2025 09:05:51 +0000 Subject: [PATCH] add creator-bid --- fees/creator-bid.ts | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 fees/creator-bid.ts diff --git a/fees/creator-bid.ts b/fees/creator-bid.ts new file mode 100644 index 0000000000..50992074a4 --- /dev/null +++ b/fees/creator-bid.ts @@ -0,0 +1,34 @@ +import { FetchOptions, SimpleAdapter } from "../adapters/types"; +import { CHAIN } from "../helpers/chains"; + +const contract = '0xe794f7eb7e644eb49056133373fb9b1ea39f22ad' +const payment_event = 'event Payment(address indexed from, uint256 value)' + +const fetchFees = async (options: FetchOptions) => { + const dailyFees = options.createBalances(); + const logs = await options.getLogs({ + target: contract, + eventAbi: payment_event, + }); + logs.map((log: any) => { + dailyFees.addGasToken(log.value); + }); + + return { + dailyFees, + dailyRevenue: dailyFees, + }; +} + + +const adapter: SimpleAdapter = { + version: 2, + adapter: { + [CHAIN.BASE]: { + fetch: fetchFees, + start: '2024-09-09', + }, + }, +} + +export default adapter;