Afonso_DiazTotal
Updated 2024-07-09
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
›
⌄
WITH tab1 AS (
SELECT
from_address AS user
,ABS(nvl(amount0_usd, amount1_usd)) AS amount_usd
,a.tx_hash
,a.block_timestamp::date as dt
,CASE WHEN dt<'2023-10-17' THEN 'without fee'
WHEN dt>='2023-10-17' AND dt<='2024-04-10' THEN 'introducing 0.15% fee'
ELSE 'introducing 0.25% fee'
END AS timeEvent
,tx_fee
FROM ethereum.uniswapv3.ez_swaps a
JOIN ethereum.core.fact_transactions b
ON a.tx_hash=b.tx_hash
WHERE dt>='2023-04-10'
AND amount_usd>0
AND amount_usd IS NOT NULL
AND amount_usd<10000000
)
SELECT
COUNT(DISTINCT(tx_hash)) AS "swaps"
,COUNT(DISTINCT user) AS "users"
,SUM(amount_usd) AS "volume($)"
,AVG(amount_usd) AS "avg volume($)"
,SUM(tx_fee) AS "total fee($ETH)"
,AVG(tx_fee) AS "average fee($ETH)"
,timeEvent AS "type"
FROM tab1
GROUP BY "type"
QueryRunArchived: QueryRun has been archived