forked from DefiLlama/dimension-adapters
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvelar.ts
33 lines (29 loc) · 858 Bytes
/
velar.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
import fetchURL from "../utils/fetchURL";
import { FetchResult, SimpleAdapter } from "../adapters/types";
import { CHAIN } from "../helpers/chains";
import { getUniqStartOfTodayTimestamp } from "../helpers/getUniSubgraphVolume";
const URL = "https://gateway.velar.network/watcherapp/pool";
const fetch = async (): Promise<FetchResult> => {
const dayTimestamp = getUniqStartOfTodayTimestamp();
const { message }: any = await fetchURL(`${URL}`);
let dailyVolume = 0
let dailyFees = 0
message.forEach((pool: any) => {
dailyVolume += Number(pool.stats.volume.value)
dailyFees += Number(pool.stats.fees.value)
})
return {
dailyVolume,
dailyFees,
timestamp: dayTimestamp,
};
};
const adapter: SimpleAdapter = {
adapter: {
[CHAIN.STACKS]: {
fetch,
runAtCurrTime: true
},
},
};
export default adapter;