mattkstewChain Comparison 4.5
Updated 2023-07-30
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
with tab_Avalance as (
SELECT
'Avalanche' as Chain,
count(distinct tx_hash) AS Swaps,
count(distinct origin_from_address) AS Unique_Swappers,
sum(case when amount_in_usd is null then amount_out_usd else amount_in_usd end) AS Volume_USD,
sum(case when amount_in_usd is null then amount_out_usd else amount_in_usd end) * .003 AS Fee_Volume_USD,
count(distinct case when Swaps = 1 then origin_from_address end) AS Single_Swappers
FROM (
SELECT *,
count(*) OVER (PARTITION BY origin_from_address) as Swaps
FROM avalanche.core.ez_dex_swaps
WHERE platform = 'uniswap-v3'
AND (AMOUNT_IN_USD between AMOUNT_OUT_USD - 5000 and AMOUNT_OUT_USD + 5000)
and block_timestamp >= '2023-07-13'
)
),
tab_Ethereum as (
SELECT
'Ethereum' as Chain,
count(distinct tx_hash) AS Swaps,
count(distinct sender) AS Unique_Swappers,
sum(case when AMOUNT1_USD < 0 then AMOUNT1_USD * -1 end) AS Volume_USD,
sum(case when AMOUNT1_USD < 0 then AMOUNT1_USD * -1 end) * .003 AS Fee_Volume_USD,
count(distinct case when Swaps = 1 then sender end) AS Single_Swappers
FROM (
SELECT *,
count(*) OVER (PARTITION BY sender) as Swaps
FROM ethereum.uniswapv3.ez_swaps
WHERE block_timestamp >= '2023-07-13'
)
),
tab_Polygon as (
SELECT
Run a query to Download Data