Skip to content

Commit 5620267

Browse files
committed
feat: add the bucket protocol v2 fee
1 parent fc68b06 commit 5620267

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

fees/bucket-protocol-v2/index.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { Adapter, FetchOptions } from "../../adapters/types";
2+
import { CHAIN } from "../../helpers/chains";
3+
import fetchURL from "../../utils/fetchURL";
4+
5+
const bucketApiURL = "https://backend.bucketprotocol.io/api";
6+
interface DailyStats {
7+
date: string;
8+
dailyFee: string;
9+
startTimestampMs: number;
10+
endTimestampMs: number;
11+
}
12+
13+
const methodology = {
14+
dailyFees:
15+
"All the services fees paid by users, including borrow, PSM, liquidation, redeem, flashLoan and interest",
16+
dailyRevenue:
17+
"All the services fees paid by users, including borrow, PSM, liquidation, redeem, flashLoan and interest earned by Bucket",
18+
};
19+
20+
const fetchBucketStats = async (
21+
_: any,
22+
_1: any,
23+
{ startTimestamp }: FetchOptions
24+
) => {
25+
const url = `${bucketApiURL}/fee/dailystatus?timestamp_ms=${
26+
startTimestamp * 1000
27+
}`;
28+
const stats: DailyStats = (await fetchURL(url)).data;
29+
30+
const dailyFees = stats.dailyFee;
31+
const dailyRevenue = stats.dailyFee;
32+
33+
return {
34+
dailyFees,
35+
dailyUserFees: dailyFees,
36+
dailyRevenue,
37+
dailyProtocolRevenue: dailyRevenue,
38+
};
39+
};
40+
41+
const adapter: Adapter = {
42+
methodology,
43+
adapter: {
44+
[CHAIN.SUI]: {
45+
fetch: fetchBucketStats,
46+
start: "2025-09-01",
47+
},
48+
},
49+
};
50+
51+
export default adapter;

0 commit comments

Comments
 (0)