Skip to content

Commit

Permalink
Merge pull request #727 from miler012/master
Browse files Browse the repository at this point in the history
add satori.finance
  • Loading branch information
dtmkeng authored Aug 10, 2023
2 parents 932a6ab + a8e47b0 commit 260ff0d
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions dexs/satori/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import {postURL} from "../../utils/fetchURL"
import { SimpleAdapter } from "../../adapters/types";
import { CHAIN } from "../../helpers/chains";


const ZKEVM_URL = 'https://zk.satori.finance/api/data-center/pub/analytics/integration'
const ZkSYNC_URL = 'https://zksync.satori.finance/api/data-center/pub/analytics/integration'
// const Test_URL = "https://satori-dev.citik.xyz/api/data-center/pub/analytics/integration"

interface VolumeInfo {
fee24h: string;
tradVol24h: string;
totalTradVol: string;
totalUsers: string;
time: string;
}

const evm_fetch = async (_timestamp: number) => {
const volumeData: VolumeInfo = (await postURL(ZKEVM_URL,'')).data.data;

return {
totalVolume: volumeData.totalTradVol,
dailyVolume: volumeData.tradVol24h,
dailyFees: volumeData.fee24h,
timestamp: parseInt(volumeData.time),
};
};

const era_fetch = async (_timestamp: number) => {
const volumeData: VolumeInfo = (await postURL(ZkSYNC_URL,'')).data.data;

return {
totalVolume: volumeData.totalTradVol,
dailyVolume: volumeData.tradVol24h,
dailyFees: volumeData.fee24h,
timestamp: parseInt(volumeData.time),
};
};

const adapter: SimpleAdapter = {
adapter: {
[CHAIN.POLYGON_ZKEVM]: {
fetch:evm_fetch,
runAtCurrTime: true,
start: async () => 1684003134,
},
[CHAIN.ERA]: {
fetch:era_fetch,
runAtCurrTime: true,
start: async () => 1684003134,
}
},
};

export default adapter;

0 comments on commit 260ff0d

Please sign in to comment.