hessCopy of new users
    Updated 2022-11-17
    with tb1 as ( select trunc(block_timestamp,'day') as day,
    unlock_date,
    origin_from_address
    from optimism.velodrome.ez_velo_locks
    where velo_action = 'deposit' and DEPOSIT_TYPE in ('1','2')
    and day >= '2022-11-15')
    ,
    tb2 as ( select origin_from_address,
    datediff('day', day , unlock_date) as number_of_days
    from tb1)

    select '1 Week' as status,
    count(DISTINCT origin_from_address) as total_user
    from tb2
    where number_of_days <= 7
    UNION
    select 'Under a Month' as status,
    count(DISTINCT origin_from_address) as total_user
    from tb2
    where number_of_days <= 30 and number_of_days > 7
    UNION
    select 'Under a Year' as status,
    count(DISTINCT origin_from_address) as total_user
    from tb2
    where number_of_days <= 365 and number_of_days > 30
    UNION
    select 'Under two years' as status,
    count(DISTINCT origin_from_address) as total_user
    from tb2
    where number_of_days <= 730 and number_of_days >365
    UNION
    select 'More than Two years' as status,
    count(DISTINCT origin_from_address) as total_user
    from tb2
    where number_of_days > 730
    Run a query to Download Data