Skip to content

Commit

Permalink
Merge pull request #1760 from miler012/master
Browse files Browse the repository at this point in the history
add new chain data
  • Loading branch information
dtmkeng committed Aug 12, 2024
2 parents 4b79100 + c6eb1ba commit 412b316
Showing 1 changed file with 66 additions and 4 deletions.
70 changes: 66 additions & 4 deletions dexs/satori/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import { SimpleAdapter } from "../../adapters/types";
import { CHAIN } from "../../helpers/chains";


const ZKEVM_URL = 'https://zksync.satori.finance/api/data-center/pub/overview/integration'
const ZKEVM_URL = 'https://zkevm.satori.finance/api/data-center/pub/overview/integration'
const ZkSYNC_URL = 'https://zksync.satori.finance/api/data-center/pub/overview/integration'
const SCROLL_URL = 'https://scroll.satori.finance/api/data-center/pub/overview/integration'
const LINEA_URL = 'https://linea.satori.finance/api/data-center/pub/overview/integration'

const BASE_URL = 'https://base.satori.finance/api/data-center/pub/overview/integration'
const ARBITRUM_URL = 'https://arbitrum.satori.finance/api/data-center/pub/overview/integration'
const XLARY_URL = 'https://xlayer.satori.finance/api/data-center/pub/overview/integration'
interface VolumeInfo {
fee24h: string;
tradVol24h: string;
Expand All @@ -28,6 +30,15 @@ const scroll = {
const linea = {
"exchange":"linea"
}
const base = {
"exchange":"base"
}
const arbitrum = {
"exchange":"arbitrum-one"
}
const xlayer = {
"exchange":"xlayer"
}
const evm_fetch = async (_timestamp: number) => {
const volumeData: VolumeInfo = (await postURL(ZKEVM_URL,zk_evm)).data;

Expand All @@ -53,7 +64,7 @@ const era_fetch = async (_timestamp: number) => {
};

const linea_fetch = async (_timestamp: number) => {
const volumeData: VolumeInfo = (await postURL(ZkSYNC_URL,linea)).data;
const volumeData: VolumeInfo = (await postURL(LINEA_URL,linea)).data;

return {
totalVolume: volumeData.totalTradVol,
Expand All @@ -65,7 +76,43 @@ const linea_fetch = async (_timestamp: number) => {
};

const scroll_fetch = async (_timestamp: number) => {
const volumeData: VolumeInfo = (await postURL(ZkSYNC_URL,scroll)).data;
const volumeData: VolumeInfo = (await postURL(SCROLL_URL,scroll)).data;

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

const base_fetch = async (_timestamp: number) => {
const volumeData: VolumeInfo = (await postURL(BASE_URL,base)).data;

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

const arbitrum_fetch = async (_timestamp: number) => {
const volumeData: VolumeInfo = (await postURL(ARBITRUM_URL,arbitrum)).data;

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

const xlayer_fetch = async (_timestamp: number) => {
const volumeData: VolumeInfo = (await postURL(XLARY_URL,xlayer)).data;

return {
totalVolume: volumeData.totalTradVol,
Expand Down Expand Up @@ -96,6 +143,21 @@ const adapter: SimpleAdapter = {
fetch:scroll_fetch,
runAtCurrTime: true,
start: 1684003134,
},
[CHAIN.BASE]: {
fetch:base_fetch,
runAtCurrTime: true,
start: 1684003134,
},
[CHAIN.ARBITRUM]: {
fetch:arbitrum_fetch,
runAtCurrTime: true,
start: 1684003134,
},
[CHAIN.XLAYER]: {
fetch:xlayer_fetch,
runAtCurrTime: true,
start: 1684003134,
}
},
};
Expand Down

0 comments on commit 412b316

Please sign in to comment.