Updated 2025-05-10
    -- forked from https://flipsidecrypto.xyz/hess/q/blZ-l4FMTnz3/fees

    with chains as (
    select date(block_timestamp) as date,
    'Aptos' as chain,
    'APT' as symbol,
    (gas_used * gas_unit_price) / pow(10, 8) as tx_fee
    from aptos.core.fact_transactions --a join ethereum.core.dim_dates b on a.block_timestamp::date = b.date_day
    where tx_type = 'user_transaction'
    AND date >= current_date() - 30
    -- and block_timestamp::date >= '2023-11-01'
    -- and SUCCESS = TRUE
    UNION ALL
    select date(block_timestamp) as date,
    'Sei' as chain,
    'SEI' as symbol,
    (split(fee,'usei')[0]/pow(10,6)) as tx_fee
    from sei.core.fact_transactions --a join ethereum.core.dim_dates b on a.block_timestamp::date = b.date_day
    where date >= current_date() - 30
    -- and block_timestamp::date >= '2023-11-01'
    -- and TX_SUCCEEDED = TRUE
    and split(fee,'usei')[0]/pow(10,6) > 0

    UNION ALL
    select date(block_timestamp) as date,
    'Arbitrum' as chain,
    'WETH' as symbol,
    tx_fee
    from arbitrum.core.fact_transactions -- a join ethereum.core.dim_dates b on a.block_timestamp::date = b.date_day
    where date >= current_date() - 30
    -- and block_timestamp::date >= '2023-11-01'
    -- and status = 'SUCCESS'

    UNION ALL
    select date(block_timestamp) as date,
    'Optimism' as chain,
    Last run: 15 days ago
    CHAIN
    AVG_FEE
    1
    Atom0.02653306309
    2
    BSC0.0976167745
    3
    Sei0.00395464435
    4
    Avalanche0.02131784632
    5
    Polygon0.003000881734
    6
    Solana0.01285313983
    7
    Optimism0.008698941551
    8
    Base0.01755026702
    9
    Aptos0.000694765623
    10
    Ethereum0.5584976552
    11
    Flow0.00001549624999
    11
    275B
    188s