forked from DefiLlama/dimension-adapters
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshadow-legacy.ts
46 lines (39 loc) · 1.1 KB
/
shadow-legacy.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { FetchOptions, SimpleAdapter } from "../adapters/types";
import { CHAIN } from "../helpers/chains";
import { fetchPools } from "./shadow-exchange";
type TStartTime = {
[key: string]: number;
};
const startTimeV2: TStartTime = {
[CHAIN.SONIC]: 1735129946,
};
const fetch = async (options: FetchOptions) => {
const pools = (await fetchPools(options)).filter((pool) => !pool.isCL)
const dailyFees = pools.reduce((acc, pool) => acc + Number(pool.feesUSD), 0);
const dailyVolume = pools.reduce((acc, pool) => acc + Number(pool.volumeUSD), 0);
return {
dailyVolume,
dailyFees,
dailyUserFees: dailyFees,
dailyRevenue: dailyFees,
dailyHoldersRevenue: dailyFees,
};
}
const methodology = {
UserFees: "User pays fees on each swap.",
ProtocolRevenue: "Revenue going to the protocol.",
HoldersRevenue: "User fees are distributed among holders.",
};
const adapter: SimpleAdapter = {
version: 2,
adapter: {
[CHAIN.SONIC]: {
fetch,
start: startTimeV2[CHAIN.SONIC],
meta: {
methodology: methodology
},
},
},
};
export default adapter;