Skip to content

Commit 48b81b3

Browse files
track ave ai fees/revenue (#6331)
1 parent 262246f commit 48b81b3

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

fees/aveai/index.ts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { SimpleAdapter, FetchOptions } from "../../adapters/types";
2+
import { CHAIN } from "../../helpers/chains";
3+
import { METRIC } from "../../helpers/metrics"
4+
5+
const contracts: Record<string, string> = {
6+
[CHAIN.BASE]: "0x282970F452371454332Ca522cE59F318a2C81484",
7+
[CHAIN.BSC]: "0xd270845b7EBb0B013DfCCD9cA782a57Bfb7A359A",
8+
[CHAIN.ETHEREUM]: "0x60943cb06b76A24431659165c81a03c16F1C325C",
9+
}
10+
const feeTopic = "0xc08acb1892d97145a15c4cc6206956e56a7482a9af175f548b7b40eb336790dd";
11+
12+
async function fetch(options: FetchOptions) {
13+
const { getLogs, createBalances } = options;
14+
const dailyFees = createBalances();
15+
const contract = contracts[options.chain]
16+
const logs = await getLogs({ target: contract, topics: [feeTopic], entireLog: true });
17+
logs.forEach((log: any) => {
18+
const token = "0x" + log.topics[1].slice(26);
19+
const amount = BigInt(log.data);
20+
dailyFees.add(token, amount, METRIC.TRADING_FEES);
21+
});
22+
return { dailyFees, dailyRevenue: dailyFees };
23+
}
24+
25+
const adapter: SimpleAdapter = {
26+
version: 2,
27+
pullHourly: true,
28+
adapter: {
29+
[CHAIN.BASE]: {
30+
fetch,
31+
start: "2025-07-03",
32+
},
33+
[CHAIN.BSC]: {
34+
fetch,
35+
start: "2025-07-03",
36+
},
37+
[CHAIN.ETHEREUM]: {
38+
fetch,
39+
start: "2025-07-16"
40+
}
41+
},
42+
methodology: {
43+
Fees: "Fees collected on each swap (0.5% for chain wallets, 0.8% for bot wallets).",
44+
Revenue: "All fees are collected by the protocol.",
45+
},
46+
breakdownMethodology: {
47+
Fees: {
48+
[METRIC.TRADING_FEES]: "Fees collected on each swap (0.5% for chain wallets, 0.8% for bot wallets)."
49+
},
50+
Revenue: {
51+
[METRIC.TRADING_FEES]: "All fees are collected by the protocol"
52+
}
53+
}
54+
};
55+
56+
export default adapter;

0 commit comments

Comments
 (0)