Skip to content

Commit 4abac73

Browse files
oxapo11onoateden
andauthored
Feat: add GODL protocol fees (#4693)
* Feat: add GODL protocol fees * use received function * use dune query --------- Co-authored-by: Eden <noat.eth@gmail.com>
1 parent 0736993 commit 4abac73

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

fees/godl/index.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import {
2+
Dependencies,
3+
FetchOptions,
4+
SimpleAdapter,
5+
} from "../../adapters/types";
6+
import { CHAIN } from "../../helpers/chains";
7+
import { queryDuneSql } from "../../helpers/dune";
8+
9+
const fetch: any = async (_a: any, _b: any, options: FetchOptions) => {
10+
const dailyFees = options.createBalances()
11+
12+
const duneQueryString = `
13+
SELECT
14+
SUM(CASE WHEN post_balance > pre_balance THEN (post_balance - pre_balance) / 1e9 ELSE 0 END) AS total_sol_inbound
15+
FROM solana.account_activity
16+
WHERE
17+
address = '5epGzdW6veQwLQiQs1L45uUQ8jdSLQHWL8RbC7uTWVY3'
18+
AND block_time >= from_unixtime(${options.startTimestamp})
19+
AND block_time < from_unixtime(${options.endTimestamp})
20+
AND tx_success = true
21+
`;
22+
23+
const results = await queryDuneSql(options, duneQueryString);
24+
if (results.length > 0) {
25+
const revenue = results[0].total_sol_inbound || 0;
26+
dailyFees.addCGToken("solana",revenue);
27+
}
28+
29+
const dailyProtocolRevenue = dailyFees.clone(0.01);
30+
const dailyHoldersRevenue = dailyFees.clone(0.99);
31+
32+
return {
33+
dailyFees,
34+
dailyRevenue: dailyFees,
35+
dailyProtocolRevenue: dailyProtocolRevenue,
36+
dailyHoldersRevenue: dailyHoldersRevenue,
37+
};
38+
};
39+
40+
const adapter: SimpleAdapter = {
41+
version: 1,
42+
fetch,
43+
chains: [CHAIN.SOLANA],
44+
start: "2025-11-18",
45+
dependencies: [Dependencies.DUNE],
46+
methodology: {
47+
Fees: "Calculate the GODL tokens gathered from 10% of the total SOL allocated to GODL boards and sent to the protocol wallet 5epGzdW6veQwLQiQs1L45uUQ8jdSLQHWL8RbC7uTWVY3.",
48+
Revenue: "All collected GODL fees count as revenue.",
49+
ProtocolRevenue: "1% of all GODL revenue is allocated to the protocol treasury.",
50+
HoldersRevenue: "The remaining 99% of GODL fees are used for GODL buybacks and burns, with value distributed to GODL stakers.",
51+
},
52+
};
53+
54+
export default adapter;

0 commit comments

Comments
 (0)