binhachonCopy of 15. [Hard] Renewal Timeline - Overall metrics
    Updated 2021-12-25
    with ens_domain_register as (
    select
    distinct
    block_timestamp,
    event_inputs:id as id,
    event_inputs:expires::int as expire_date,
    row_number() over (partition by id order by block_timestamp desc) as rownumber
    from
    ethereum.events_emitted
    where
    event_name in ('NameRegistered')
    and
    contract_address in ('0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85', '0x283af0b28c62c092c9727f1ee09c02ca627eb7f5')
    qualify rownumber = 1
    ),
    ens_domain_renewal as (
    select
    distinct
    block_timestamp,
    event_inputs:id as id,
    event_inputs:expires::int as expire_date
    from
    ethereum.events_emitted
    where
    event_name in ('NameRenewed')
    and
    contract_address in ('0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85', '0x283af0b28c62c092c9727f1ee09c02ca627eb7f5')
    ),
    ens_domain_register_with_renewal as (
    select
    id,
    block_timestamp as register_date,
    expire_date,
    lead(block_timestamp, 1, NULL) over (partition by id order by block_timestamp) as renewal_date,
    lead(expire_date, 1, NULL) over (partition by id order by block_timestamp) as new_expire_date
    from (
    Run a query to Download Data