HadisehSolana Since The Mango Hack 8
    Updated 2022-10-17
    with t1 as ( select date(block_timestamp) as date,
    case
    when block_timestamp::date < '2022-10-11' then 'befor-hack'
    when block_timestamp::date >= '2022-10-11' then 'after-hack'
    end as date_case,
    SWAP_PROGRAM,
    count(DISTINCT tx_id) as transactions,
    swapper
    from solana.core.fact_swaps
    where date > CURRENT_DATE - 20
    group by date,date_case,SWAP_PROGRAM,swapper)
    ,
    t2 as ( select date,
    date_case,
    SWAP_PROGRAM,
    count(DISTINCT swapper) as total_user,
    sum(transactions) as total_transaction,
    avg(transactions) as average_tx
    from t1
    group by date,date_case,SWAP_PROGRAM
    order by date)

    select date_case,
    swap_program,
    avg(total_user) as user_average,
    avg(total_transaction) as transactions_average
    from t2
    group by date_case,swap_program


    Run a query to Download Data