0xHaM-dUntitled Query
Updated 2022-09-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 actin_tx as (
SELECT
date_trunc('week', block_timestamp) as date,
ORIGIN_FUNCTION_SIGNATURE,
count(*) as tx_cnt,
STATUS,
count(CASE WHEN STATUS = 'FAIL' THEN 1 END) as fail_tx_cnt
FROM ethereum.core.fact_transactions
WHERE date >= '2022-01-01'
GROUP BY 1,2,4
)
SELECT
date,
'Swapping' as action_type,
sum(tx_cnt-fail_tx_cnt)/(1440) as tx_per_min,
sum(fail_tx_cnt)/sum(tx_cnt)*100 as fail_rate,
sum(tx_per_min) over (order by date) as cum_tx_per_min,
sum(fail_rate) over (order by date) as cum_fail_rate
FROM actin_tx
WHERE ORIGIN_FUNCTION_SIGNATURE in (SELECT ORIGIN_FUNCTION_SIGNATURE FROM ethereum.core.ez_dex_swaps WHERE PLATFORM = 'sushiswap')
group by 1,2
UNION ALL
SELECT
date,
'Lending' as action_type,
sum(tx_cnt-fail_tx_cnt)/(1440) as tx_per_min,
sum(fail_tx_cnt)/sum(tx_cnt)*100 as fail_rate,
sum(tx_per_min) over (order by date) as cum_tx_per_min,
sum(fail_rate) over (order by date) as cum_fail_rate
FROM actin_tx
WHERE ORIGIN_FUNCTION_SIGNATURE in (SELECT ORIGIN_FUNCTION_SIGNATURE FROM ethereum.sushi.ez_lending)
group by 1,2
Run a query to Download Data