0xHaM-dUntitled Query
    Updated 2022-09-30
    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