-
Notifications
You must be signed in to change notification settings - Fork 950
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1911 from arpitsingh1409/master
LogX V2 Volume Dashbaord
- Loading branch information
Showing
2 changed files
with
21 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]}×tamp=${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; |
This file was deleted.
Oops, something went wrong.