maybeyonassushi_uni_gas
    Updated 2022-01-29
    with
    swaps as (
    select distinct
    tx_id,
    platform
    from ethereum.dex_swaps
    where platform in (
    'sushiswap',
    'uniswap-v3',
    'uniswap-v2'
    )
    ),
    gas as (
    select
    block_timestamp,
    t.tx_id,
    platform,
    gas_limit,
    gas_price,
    gas_used,
    tx_fee,
    fee_usd
    from ethereum.transactions t join swaps s on s.tx_id=t.tx_id
    )

    select
    date(block_timestamp) date,
    platform,
    count(tx_id) as swaps,
    avg(gas_price/pow(10,9)) as avg_gwei,
    sum(gas_used) as gas_used,
    sum(tx_fee) as tx_fees,
    avg(tx_fee) as avg_tx_fee
    from gas
    where date(block_timestamp) >= current_date - interval '60 days'
    group by 1,2
    Run a query to Download Data