Skip to content

Commit

Permalink
Merge pull request #1911 from arpitsingh1409/master
Browse files Browse the repository at this point in the history
LogX V2 Volume Dashbaord
  • Loading branch information
dtmkeng committed Sep 15, 2024
2 parents 85e5c3e + 6e6e8fd commit f4024e5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 105 deletions.
92 changes: 21 additions & 71 deletions dexs/logx/index.ts
Original file line number Diff line number Diff line change
@@ -1,81 +1,31 @@
import fetchURL from "../../utils/fetchURL";
import { BreakdownAdapter, ChainBlocks, Fetch, FetchOptions, FetchResult, SimpleAdapter } from "../../adapters/types";
import { CHAIN } from "../../helpers/chains";
import { adapterAgg } from './logx-aggregator/index'
import { FetchResult, SimpleAdapter } from "../../adapters/types";

const URL = "https://backend-lp.logx.trade/defillama";

const chain_ids: { [chain: string]: string } = {
[CHAIN.MANTLE]: "5000",
[CHAIN.MODE]: "34443",
[CHAIN.BLAST]: "81457",
[CHAIN.LINEA]: "59144",
[CHAIN.KROMA]: "255",
[CHAIN.MANTA]: "169",
[CHAIN.TELOS]: "40",
[CHAIN.FUSE]: "122",
}
const URLEndpoint = "https://apiserver.logx.network/api/v1/stats/defillama?endTime=";
const startTimestamp = 1725580800; // 06.09.2024

interface IAPIResponse {
dailyVolume: string;
totalVolume: string;
last24HourVolume: string;
totalVolume: string;
}

const getFetch = async (timestamp: number, _: ChainBlocks, { createBalances, getLogs, chain, api }: FetchOptions): Promise<FetchResult> => {
const { dailyVolume, totalVolume }: IAPIResponse = (
await fetchURL(`${URL}?chainId=${chain_ids[chain]}&timestamp=${timestamp}`)
);
return {
dailyVolume,
totalVolume,
timestamp,
};
const fetch = async (timestamp: number): Promise<FetchResult> => {
const { last24HourVolume, totalVolume }: IAPIResponse = (
await fetchURL(`${URLEndpoint}${timestamp}`)
);
return {
totalVolume: totalVolume,
dailyVolume: last24HourVolume,
timestamp: timestamp
};
};

const adapter: any = {
adapter: {
[CHAIN.MANTLE]: {
fetch: getFetch,
start: 1701475200,
},
[CHAIN.MODE]: {
fetch: getFetch,
start: 1707436800,
},
[CHAIN.BLAST]: {
fetch: getFetch,
start: 1709337600,
},
[CHAIN.LINEA]: {
fetch: getFetch,
start: 1701475200,
},
[CHAIN.KROMA]: {
fetch: getFetch,
start: 1703548800,
},
[CHAIN.MANTA]: {
fetch: getFetch,
start: 1705968000,
},
[CHAIN.TELOS]: {
fetch: getFetch,
start: 1706522866,
},
[CHAIN.FUSE]: {
fetch: getFetch,
start: 1706659200,
},
const adapter: SimpleAdapter = {
adapter: {
"logx network": {
fetch,
start: startTimestamp,
},
};



const adapterBreakdown: BreakdownAdapter = {
breakdown: {
"derivative": adapter["adapter"],
"logx-aggregator": adapterAgg["adapter"],
}
}
};

export default adapterBreakdown;
export default adapter;
34 changes: 0 additions & 34 deletions dexs/logx/logx-aggregator/index.ts

This file was deleted.

0 comments on commit f4024e5

Please sign in to comment.