potmotop 20 lockers
    Updated 2022-07-17
    with base as (
    select block_timestamp::date as date, from_address,
    round(ethereum.public.udf_hex_to_int(substr(input_data,11,64)::string) / pow(10,18),4) as value,
    round((ethereum.public.udf_hex_to_int(substr(input_data, 75, 128)) /(86400))) as days_locked,
    case when days_locked between 7 and 9 then 'one week'
    when days_locked between 29 and 32 then 'one month'
    when days_locked between 364 and 367 then 'one year'
    when days_locked between 1458 and 1462 then 'four years'
    else 'other' end as lock_period
    from optimism.core.fact_transactions
    where to_address = '0x9c7305eb78a432ced5c4d14cac27e8ed569a2e26'
    and origin_function_signature = '0x65fc3873'
    order by 1
    )
    select from_address, sum(value) as total_locked, rank() over(order by total_locked desc) as rank
    from base
    where date > current_date - 28
    group by 1
    order by 2 desc
    limit 20
    Run a query to Download Data