winnie-fsSol Perps - [all] txs copy
    Updated 2023-04-10
    -- forked from marqu / Sol Perps - [all] txs @ https://staging.flipsidecrypto.xyz/marqu/q/2023-03-27-09-47-pm-H08dk1

    with

    activity as (

    select

    block_timestamp,
    tx_id,
    signers[0] as wallet_address,
    case
    when program_id = 'ZETAxsqBRek56DhiGXrn75yj2NHU3aYUnxvHXpkf3aD' then 'Zeta Markets'
    when program_id = 'dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH' then 'Drift V2'
    end as label

    from solana.core.fact_events events
    where succeeded
    and program_id in ('dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH','ZETAxsqBRek56DhiGXrn75yj2NHU3aYUnxvHXpkf3aD')
    and block_timestamp >= '2023-01-01' ::date
    ),

    aggregated as (

    select

    date_trunc('day',block_timestamp) as date,
    label,

    count(distinct tx_id) as txs,
    count(distinct wallet_address) as users

    from activity
    group by 1,2
    )

    Run a query to Download Data