Yousefi_1994Ecosystem or Project Analysis - Total Transactions
    Updated 2023-02-12
    with fix_parameter as (
    select
    case
    when '{{Days}}' = 'Last 90 Days' then 90
    when '{{Days}}' = 'Last 180 Days' then 180
    when '{{Days}}' = 'Last 360 Days' then 360
    when '{{Days}}' = 'All Time' then 2000
    else 90
    end as time_frame
    ),
    optimism_transactions as (
    select
    block_timestamp,
    tx_hash,
    origin_from_address
    from optimism.core.fact_event_logs
    where tx_status = 'SUCCESS'
    and block_timestamp::date >= current_date - (select time_frame from fix_parameter)
    and block_timestamp::date <= current_date - 1
    ),
    transactions_results as (
    select
    count(distinct tx_hash) as "Number of Transactions",
    count(distinct origin_from_address) as "Daily Active User"
    from optimism_transactions
    )

    select
    *
    from transactions_results
    Run a query to Download Data