Afonso_Diaz2023-05-26 08:39 PM
    Updated 2023-05-26
    with t as (
    select
    hour::date as date,
    symbol,
    avg(price) as price_usd
    from ethereum.core.fact_hourly_token_prices
    where symbol in ('WFLOW', 'SOL', 'axl')
    group by 1, 2
    ),

    t2 as (
    select
    'Flow' as chain,
    tx_id,
    event_data:amount::float * price_usd as fee_usd
    from flow.core.fact_events a
    join t on a.block_timestamp::date = t.date and t.symbol = 'WFLOW'
    where event_type = 'FeesDeducted'
    and block_timestamp::date >= current_date - 30

    union all

    select
    'Solana' as chain,
    tx_id,
    (fee/1e9) * price_usd as fee_usd
    from solana.core.fact_transactions a
    join t on a.block_timestamp::date = t.date and t.symbol = 'SOL'
    where block_timestamp::date >= current_date - 30

    union all

    select
    'Osmosis' as chain,
    tx_id,
    (case
    Run a query to Download Data