elsinadaily gas in USD spent on Polygon
    Updated 2022-11-16
    with token_price as (
    select
    date_trunc('day', hour) as day,
    avg(price) as price
    from ethereum.core.fact_hourly_token_prices
    where symbol = 'MATIC'
    group by 1
    ),
    block_fee as (
    select
    date_trunc('hour', block_timestamp) as date,
    block_number,
    'Polygon' as blockchain,
    avg(price) * sum(tx_fee) as gas_fee
    from polygon.core.fact_transactions join token_price on block_timestamp::date = day
    where date >= '2022-10-01' and date < current_date
    group by 1, 2
    )
    select
    date,
    avg(gas_fee) as blocks_fee
    from block_fee
    group by 1
    Run a query to Download Data