Skip to content

Commit

Permalink
enable mondrain
Browse files Browse the repository at this point in the history
  • Loading branch information
dtmkeng committed Feb 11, 2025
1 parent c55e6e7 commit 33b384e
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions protocols/mondrain/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import request from "graphql-request"
import { FetchOptions, SimpleAdapter } from "../../adapters/types"
import { CHAIN } from "../../helpers/chains"

const url = 'https://api.mondrianswap.xyz/graphql'


interface IProtocolData {
swapVolume24h: number
swapFee24h: number
}
const fetchVolume = async (options: FetchOptions) => {
const querry = `
{
embrGetProtocolData{
swapVolume24h
swapFee24h
}
}`

const respose = (await request(url, querry)).embrGetProtocolData as IProtocolData

const dailyVolume = options.createBalances();
dailyVolume.addUSDValue(Number(respose.swapVolume24h))
const dailyFees = dailyVolume.clone();
dailyFees.addUSDValue(Number(respose.swapFee24h))
return {
dailyVolume: dailyVolume,
dailyFees: dailyFees,
}
}

const adapters: SimpleAdapter = {
version: 2,
adapter: {
[CHAIN.ABSTRACT]: {
fetch: fetchVolume,
runAtCurrTime: true
}
}
}

export default adapters

0 comments on commit 33b384e

Please sign in to comment.