Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LogX V2 Volume Dashbaord #1911

Merged
merged 2 commits into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading