vegardDaily Defi Transactions and effect of FTX crash on Defi Transactions
    Updated 2022-11-21
    select
    block_timestamp::date as day,
    label as platform,
    iff(day >= '2022-11-08', 'FTX Crisis: After', 'FTX Crisis: Before') as timespan,
    count(distinct (tx_id)) as txn_count,
    count(distinct (instruction:accounts[1])) as users_count,
    (txn_count / users_count) as avg_txn_per_user,
    row_number() over (partition by day order by txn_count desc) as rank
    from solana.core.dim_labels
    join solana.core.fact_events on address = program_id
    where (
    label_type = 'dex' or label_type = 'defi'
    )
    and day >= '2022-11-01'
    and succeeded = 1
    group by day, label, timespan
    qualify rank <= 10
    order by day asc