winnie-fsSol CUs - Transactions & Fees (Standard, Priority)
    Updated 2023-12-13
    with

    activity as (

    select

    block_timestamp
    , fee / pow(10,9) as fee_sol
    , fee / pow(10,9) * close as fee_usd
    , 'Solana' as blockchain

    -- credit @ltirrell_ for the priority fee filter
    , case
    when regexp_count(
    array_to_string(instructions, ',')
    , 'ComputeBudget111111111111111111111111111111'
    ) = 2 then 'Priority Fees'
    else 'Standard Fees'
    end as fee_type

    from solana.core.fact_transactions
    left join solana.price.ez_token_prices_hourly
    on date_trunc('hour', fact_transactions.block_timestamp) = ez_token_prices_hourly.recorded_hour
    and ez_token_prices_hourly.symbol = 'sol'
    where date_trunc('minute', fact_transactions.block_timestamp) > current_timestamp() - interval '{{hours}} hours'
    )

    select

    date_trunc('{{date_trunc}}', block_timestamp) as date
    , fee_type
    , count(1) as transactions
    , case
    when '{{date_trunc}}' = 'minute' then count(1) / 60
    when '{{date_trunc}}' = 'hour' then count(1) / 3600
    when '{{date_trunc}}' = 'hour' then count(1) / 86400
    QueryRunArchived: QueryRun has been archived