sepehrmhz8Untitled Query
Updated 2022-10-03
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 sushipools as (select distinct pool_address from ethereum.core.dim_dex_liquidity_pools where platform ilike 'sushiswap'),
sushiswaps as (select distinct origin_function_signature from ethereum.sushi.ez_swaps),
sushilends as (select distinct origin_function_signature from ethereum.sushi.ez_lending),
sushiborrows as (select distinct origin_function_signature from ethereum.sushi.ez_borrowing),
Swapt as (
select 'Swap' as Action_Type,
count (case when STATUS != 'SUCCESS' then 1 end) as Failed_TX,
count (case when STATUS = 'SUCCESS' then 1 end) as Success_TX,
(Failed_TX / (Success_TX + Failed_TX)) * 100 as Failure_Rate
from ethereum.core.fact_transactions
where origin_function_signature in (select origin_function_signature from sushiswaps)
having failed_tx > 0 and success_tx > 0),
Lendingt as (
select 'Lending' as Action_Type,
count (case when STATUS != 'SUCCESS' then 1 end) as Failed_TX,
count (case when STATUS = 'SUCCESS' then 1 end) as Success_TX,
(Failed_TX / (Success_TX + Failed_TX)) * 100 as Failure_Rate
from ethereum.core.fact_transactions
where origin_function_signature in (select origin_function_signature from sushilends)
having failed_tx > 0 and success_tx > 0),
Borrowt as (
select 'Borrow' as Action_Type,
count (case when STATUS != 'SUCCESS' then 1 end) as Failed_TX,
count (case when STATUS = 'SUCCESS' then 1 end) as Success_TX,
(Failed_TX / (Success_TX + Failed_TX)) * 100 as Failure_Rate
from ethereum.core.fact_transactions
where origin_function_signature in (select origin_function_signature from sushiborrows)
having failed_tx > 0 and success_tx > 0),
AddRemoveLiqt as (
Run a query to Download Data