Skip to content

Commit 33b384e

Browse files
committed
enable mondrain
1 parent c55e6e7 commit 33b384e

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

protocols/mondrain/index.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import request from "graphql-request"
2+
import { FetchOptions, SimpleAdapter } from "../../adapters/types"
3+
import { CHAIN } from "../../helpers/chains"
4+
5+
const url = 'https://api.mondrianswap.xyz/graphql'
6+
7+
8+
interface IProtocolData {
9+
swapVolume24h: number
10+
swapFee24h: number
11+
}
12+
const fetchVolume = async (options: FetchOptions) => {
13+
const querry = `
14+
{
15+
embrGetProtocolData{
16+
swapVolume24h
17+
swapFee24h
18+
19+
}
20+
}`
21+
22+
const respose = (await request(url, querry)).embrGetProtocolData as IProtocolData
23+
24+
const dailyVolume = options.createBalances();
25+
dailyVolume.addUSDValue(Number(respose.swapVolume24h))
26+
const dailyFees = dailyVolume.clone();
27+
dailyFees.addUSDValue(Number(respose.swapFee24h))
28+
return {
29+
dailyVolume: dailyVolume,
30+
dailyFees: dailyFees,
31+
}
32+
}
33+
34+
const adapters: SimpleAdapter = {
35+
version: 2,
36+
adapter: {
37+
[CHAIN.ABSTRACT]: {
38+
fetch: fetchVolume,
39+
runAtCurrTime: true
40+
}
41+
}
42+
}
43+
44+
export default adapters

0 commit comments

Comments
 (0)