bachifail txn2
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
›
⌄
SELECT 'adding or removing liquidity' as label,
count(CASE WHEN status = 'SUCCESS' THEN 1 end) as succ,
count(CASE WHEN status = 'FAIL' THEN 1 end) as fail,
round(100*(succ/(fail+succ)),2) as success_rate,
round(100*(fail/(fail+succ)),2) as failure_rate
FROM ethereum.core.fact_transactions
WHERE (from_Address in (
SELECT pool_address
FROM ethereum.core.dim_dex_liquidity_pools
WHERE platform ilike 'sushiswap') OR
to_address in (
SELECT pool_address
FROM ethereum.core.dim_dex_liquidity_pools
WHERE platform ilike 'sushiswap'))
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_borrowing)
AND tx_hash not IN (SELECT tx_hash
FROM ethereum.sushi.ez_swaps)
UNION
SELECT 'Swap' as label,
count(CASE WHEN status = 'SUCCESS' THEN 1 end) as succ,
count(CASE WHEN status = 'FAIL' THEN 1 end) as fail,
100*(succ/(fail+succ)) as success_rate,
round((100-success_rate),2) as failure_rate
FROM ethereum.core.fact_transactions
WHERE origin_function_signature in (
SELECT DISTINCT origin_function_signature
FROM ethereum.sushi.ez_swaps)
UNION
SELECT 'Borrowing' as label,
count(CASE WHEN status = 'SUCCESS' THEN 1 end) as succ,
count(CASE WHEN status = 'FAIL' THEN 1 end) as fail,
100*(succ/(fail+succ)) as success_rate,
round((100-success_rate),2) as failure_rate
Run a query to Download Data