Yousefi_1994Gas Guzzlers - Ethereum Daily Average Gas Spent per Liquidity Transferred
    Updated 2022-12-18

    -------------------------------------ethereum-------------------------------------

    with ethereum_fee_transactions as (
    select
    block_timestamp,
    tx_hash,
    (gas_price / 1e9) * gas_used as fee,
    from_address
    from ethereum.core.fact_transactions
    where block_timestamp::date > current_date - 31
    ),
    eth_price_usd as (
    select
    hour::date as days,
    avg(price) as price_usd
    from ethereum.core.fact_hourly_token_prices
    where token_address is null
    and hour::date > current_date - 31
    group by days
    ),
    ethereum_fee_transactions_with_price as (
    select
    gas.*,
    price.price_usd
    from ethereum_fee_transactions gas
    join eth_price_usd price
    on gas.block_timestamp::date = price.days
    ),
    ethereum_fee_transactions_fix_price as (
    select
    *,
    fee * price_usd as fee_spent
    from ethereum_fee_transactions_with_price
    ),
    ethereum_final_result as (
    Run a query to Download Data