adriaparcerisassushi failure global
    Updated 2023-04-06
    with
    t1 as (
    SELECT
    distinct origin_function_signature
    from ethereum.sushi.ez_borrowing
    ),
    t2 as (
    SELECT
    trunc(block_timestamp,'{{granularity}}') as date,
    count(case when status = 'SUCCESS' then 1 end) as succeed_tx,
    count(case when status = 'FAIL' then 1 end) as failed_tx,
    (failed_tx/(failed_tx+succeed_tx))*100 as failed_rate,
    count(distinct tx_hash) as n_transactions
    FROM ethereum.core.fact_transactions
    WHERE origin_function_signature in (select * from t1)
    GROUP BY 1
    ),
    t3 as (
    select * from t2 where date >=CURRENT_DATE-INTERVAL'{{number_months}} MONTHS'
    ),
    t4 as (
    SELECT
    distinct origin_function_signature
    from ethereum.sushi.ez_lending
    ),
    t5 as (
    SELECT
    trunc(block_timestamp,'{{granularity}}') as date,
    count(case when status = 'SUCCESS' then 1 end) as succeed_tx,
    count(case when status = 'FAIL' then 1 end) as failed_tx,
    (failed_tx/(failed_tx+succeed_tx))*100 as failed_rate,
    count(distinct tx_hash) as n_transactions
    FROM ethereum.core.fact_transactions
    WHERE origin_function_signature in (select * from t4)
    GROUP BY 1
    ),
    Run a query to Download Data