h4wktotal
    Updated 2025-04-03
    -- forked from base @ https://flipsidecrypto.xyz/studio/queries/b3c76ba9-e256-42ee-af38-467881c899e8

    with bonk_price as (
    select hour,
    symbol,
    token_address,
    price
    from solana.price.ez_prices_hourly
    where token_address = 'DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263'
    )
    , base as (
    select a.block_timestamp,
    a.tx_id,
    swapper as user_address,
    swap_from_mint,
    swap_from_amount,
    c.symbol as swap_from_symbol,
    swap_to_amount as bonk_amount,
    swap_to_amount * price as volume_bonk_usd,
    amount * 3 as fee_amount, -- Fees split into 3 addresses equally, so we just multiply by 3
    amount * 3 * price as fee_amount_usd,
    0.00203928 as rent_returned
    from solana.defi.fact_swaps_jupiter_summary a
    join bonk_price on (date_trunc('hour', a.block_timestamp) = hour)
    join (select * from solana.core.fact_transfers
    where tx_to = 'CbX9HYvyHBa2RuotGN8Y8hCKow6xppdrhAh6RL6i2BEf' -- Fee collected address (one of the three)
    and mint = 'DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263'
    and block_timestamp >= '2024-01-12') b on (swapper = tx_from and a.tx_id = b.tx_id)
    left join solana.price.ez_asset_metadata c on (swap_from_mint = c.token_address)
    where swap_to_mint = 'DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263'
    and a.block_timestamp >= '2024-01-12'
    -- order by block_timestamp desc limit 10
    )

    select count(distinct tx_id) as tx_count,
    count(distinct user_address) as user_count,
    Last run: 20 days ago
    TX_COUNT
    USER_COUNT
    SCOOP_TOKEN_COUNT
    BONK_SCOOP
    BONK_SCOOP_USD
    MEDIAN_SCOOP_USD
    AVG_SCOOP_USD
    FEE_AMOUNT_BONK
    FEE_AMOUNT_USD
    TOTAL_RENT_RETURNED
    1
    175006189263163063411569721.91294138.853404550.19305434627.394825625419279605.677068699.307379643356.88623568
    1
    122B
    202s