From 0554d6fedb84e53b25f731972cd6df6641767788 Mon Sep 17 00:00:00 2001 From: lina Date: Tue, 24 Sep 2024 17:51:02 +0800 Subject: [PATCH 1/4] feat: pixelswap totalVolume and dailyVolume --- dexs/pixelswap/index.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 dexs/pixelswap/index.ts diff --git a/dexs/pixelswap/index.ts b/dexs/pixelswap/index.ts new file mode 100644 index 0000000000..96f318410c --- /dev/null +++ b/dexs/pixelswap/index.ts @@ -0,0 +1,30 @@ +import fetchURL from '../../utils/fetchURL' + +const fetch = async () => { + const volumeApiResult = await fetchURL( + 'https://api.pixelswap.ip-dynamic.org/apis/pairs', + ); + const volumeResult = volumeApiResult.data.pairs; + let dailyVolumeResult = 0; + let totalVolumeResult = 0; + volumeResult.forEach(pairs => { + dailyVolumeResult += Number(pairs.volume.dailyVolume / (10 ^ Number(pairs.token1.decimals)) * pairs.token1.usdPrice); + totalVolumeResult += Number(pairs.volume.totalVolume / (10 ^ Number(pairs.token1.decimals)) * pairs.token1.usdPrice); + }); + + return { + dailyVolume: dailyVolumeResult, + totalVolume: totalVolumeResult, + } +} + +const adapter = { + adapter: { + ton: { + fetch, + start: 1726034340, + }, + }, +} + +export default adapter \ No newline at end of file From 75067cfd4c1e2ea74a6c3185b3c980379b8b4f7c Mon Sep 17 00:00:00 2001 From: lina Date: Thu, 26 Sep 2024 16:31:18 +0800 Subject: [PATCH 2/4] fix: fix pixel-swap decimals calculate --- dexs/pixelswap/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dexs/pixelswap/index.ts b/dexs/pixelswap/index.ts index 96f318410c..0266a5c833 100644 --- a/dexs/pixelswap/index.ts +++ b/dexs/pixelswap/index.ts @@ -8,8 +8,8 @@ const fetch = async () => { let dailyVolumeResult = 0; let totalVolumeResult = 0; volumeResult.forEach(pairs => { - dailyVolumeResult += Number(pairs.volume.dailyVolume / (10 ^ Number(pairs.token1.decimals)) * pairs.token1.usdPrice); - totalVolumeResult += Number(pairs.volume.totalVolume / (10 ^ Number(pairs.token1.decimals)) * pairs.token1.usdPrice); + dailyVolumeResult += Number(pairs.volume.dailyVolume / (Math.pow(10, Number(pairs.token1.decimals))) * pairs.token1.usdPrice); + totalVolumeResult += Number(pairs.volume.totalVolume / (Math.pow(10, Number(pairs.token1.decimals))) * pairs.token1.usdPrice); }); return { From b56fb4fb9e99288ec231d43c5cc2d5ca0f7b1b82 Mon Sep 17 00:00:00 2001 From: lina Date: Thu, 26 Sep 2024 16:47:14 +0800 Subject: [PATCH 3/4] fix: change api --- dexs/pixelswap/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dexs/pixelswap/index.ts b/dexs/pixelswap/index.ts index 0266a5c833..3000b07ddf 100644 --- a/dexs/pixelswap/index.ts +++ b/dexs/pixelswap/index.ts @@ -2,7 +2,7 @@ import fetchURL from '../../utils/fetchURL' const fetch = async () => { const volumeApiResult = await fetchURL( - 'https://api.pixelswap.ip-dynamic.org/apis/pairs', + 'https://api.pixelswap.io/apis/pairs', ); const volumeResult = volumeApiResult.data.pairs; let dailyVolumeResult = 0; From 15b843885307001171457d7685b3d28d93d61929 Mon Sep 17 00:00:00 2001 From: lina Date: Fri, 11 Oct 2024 22:01:45 +0800 Subject: [PATCH 4/4] fix: change the calculate about volume, remove LP volume. Now the volume is swap, deposit and withdraw(We have funding contract, which other Dex doesn't have funding contract, so the volume add deposit and withdraw) --- dexs/pixelswap/index.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/dexs/pixelswap/index.ts b/dexs/pixelswap/index.ts index 3000b07ddf..a6015f339f 100644 --- a/dexs/pixelswap/index.ts +++ b/dexs/pixelswap/index.ts @@ -1,17 +1,26 @@ import fetchURL from '../../utils/fetchURL' const fetch = async () => { - const volumeApiResult = await fetchURL( + const swapVolumeApiResult = await fetchURL( 'https://api.pixelswap.io/apis/pairs', ); - const volumeResult = volumeApiResult.data.pairs; + const depositAndWithdrawVolumeResult = await fetchURL( + 'https://api.pixelswap.io/apis/tokens', + ); + const swapvolumeResult = swapVolumeApiResult.data.pairs; + const depositAndWithdrawVolume = depositAndWithdrawVolumeResult.data.tokens; let dailyVolumeResult = 0; let totalVolumeResult = 0; - volumeResult.forEach(pairs => { + swapvolumeResult.forEach(pairs => { dailyVolumeResult += Number(pairs.volume.dailyVolume / (Math.pow(10, Number(pairs.token1.decimals))) * pairs.token1.usdPrice); totalVolumeResult += Number(pairs.volume.totalVolume / (Math.pow(10, Number(pairs.token1.decimals))) * pairs.token1.usdPrice); }); + depositAndWithdrawVolume.forEach(token => { + dailyVolumeResult += Number(token.volume.dailyVolume / (Math.pow(10, Number(token.decimals))) * token.usdPrice); + totalVolumeResult += Number(token.volume.totalVolume / (Math.pow(10, Number(token.decimals))) * token.usdPrice); + }); + return { dailyVolume: dailyVolumeResult, totalVolume: totalVolumeResult,