binhachon7. [Hard] ENS vs Gas - In the last 180 days
    Updated 2021-12-15
    with ens_registration as(
    select
    distinct block_timestamp,
    tx_id,
    origin_address,
    row_number() over (
    partition by origin_address
    order by
    block_timestamp
    ) as rownumber
    from
    ethereum.udm_events
    where
    contract_address = '0x283af0b28c62c092c9727f1ee09c02ca627eb7f5'
    and origin_function_name ilike '%register%'
    ),
    ens_registration_gas as(
    select
    date_trunc('day', block_timestamp) as blocktime,
    avg(fee_usd) as fee_usd,
    count(distinct tx_id) as number_of_transactions
    from
    ethereum.transactions
    where
    tx_id in (
    select
    tx_id
    from
    ens_registration
    )
    and fee_usd < 10000
    group by
    blocktime
    )
    select
    *
    Run a query to Download Data