sepehrmhz8Untitled Query
Updated 2022-10-04
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 main as (select distinct pool_address
from ethereum.core.dim_dex_liquidity_pools
where platform in ('sushiswap'))
select 'swapping' as type_,
count (case when status ilike 'success'
then 1 end) as successed,
count (case when status ilike 'fail'
then 1 end) as failed,
successed + failed as total,
(successed/(total)) * 100 as successed_rate,
(failed/(total)) * 100 as failed_rate
from ethereum.core.fact_transactions
where block_timestamp >= '2022-01-01'
and origin_function_signature in (select origin_function_signature from (select distinct origin_function_signature from ethereum.sushi.ez_swaps))
group by type_
union
select 'adding or removing liquidity' as type_,
count (case when status ilike 'success'
then 1 end) as successed,
count (case when status ilike 'fail'
then 1 end) as failed,
successed + failed as total,
(successed/(total)) * 100 as successed_rate,
(failed/(total)) * 100 as failed_rate
from ethereum.core.fact_transactions
where block_timestamp >= '2022-01-01'
and (to_address in (select pool_address from main)
or from_address in (select pool_address from main))
and tx_hash not in (select tx_hash from ethereum.sushi.ez_lending)
and tx_hash not in (select tx_hash from ethereum.sushi.ez_swaps)
and tx_hash not in (select tx_hash from ethereum.sushi.ez_borrowing)
group by type_