Skip to content

Commit

Permalink
add myswapcl volume support
Browse files Browse the repository at this point in the history
  • Loading branch information
omrybraavos committed May 2, 2024
1 parent 852ab53 commit 6064279
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions dexs/myswap-cl/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { SimpleAdapter } from "../../adapters/types";
import { CHAIN } from "../../helpers/chains";
import fetchURL from "../../utils/fetchURL";

type VolumeResponse = { timestamp: number; volume: number };
const fetch = async (timestamp: number) => {
const response = (await fetchURL(
"https://myswap-cl-charts.s3.amazonaws.com/data/total_volume.json"
)) as VolumeResponse[];
return {
timestamp: timestamp,
dailyVolume: response[response.length - 1].volume,
};
};

const adapter: SimpleAdapter = {
version: 2,
adapter: {
[CHAIN.STARKNET]: {
fetch: fetch,
runAtCurrTime: true,
start: 1695081600,
},
},
};

export default adapter;

0 comments on commit 6064279

Please sign in to comment.