Ali3NDaily Blockchains DEXs New Users Before and After FTX Collapse Over Time
    Updated 2022-12-01
    select 'Arbitrum' as chain,
    date_trunc (day,mindate) as date,
    case when date < '2022-11-08' then 'Before Collapse'
    when date >= '2022-11-08' and date <= '2022-11-10' then 'Main Collapse Days'
    when date > '2022-11-10' then 'After Collapse' end as timespan,
    count (distinct origin_from_address) as New_Users
    from (
    select origin_from_address,
    min (block_timestamp::date) as mindate
    from arbitrum.core.fact_event_logs
    where origin_to_address in (select distinct address from arbitrum.core.dim_labels where label_type ilike 'dex')
    and tx_status = 'SUCCESS'
    group by 1)
    where mindate >= '2022-10-25' and mindate::date != CURRENT_DATE
    group by 1,2,3

    union ALL

    select 'Optimism' as chain,
    date_trunc (day,mindate) as date,
    case when date < '2022-11-08' then 'Before Collapse'
    when date >= '2022-11-08' and date <= '2022-11-10' then 'Main Collapse Days'
    when date > '2022-11-10' then 'After Collapse' end as timespan,
    count (distinct origin_from_address) as New_Users
    from (
    select origin_from_address,
    min (block_timestamp::date) as mindate
    from optimism.core.fact_event_logs
    where origin_to_address in (select distinct address from optimism.core.dim_labels where label_type ilike 'dex')
    and tx_status = 'SUCCESS'
    group by 1)
    where mindate >= '2022-10-25' and mindate::date != CURRENT_DATE
    group by 1,2,3

    union ALL

    Run a query to Download Data