boomer77last tx sushiswap
    Updated 2021-11-17
    with satu as (select from_address, max(date(block_timestamp)) as latest, (CURRENT_DATE - latest) as days_since_last_tx, 'swaps' as actions
    from ethereum.dex_swaps
    where platform = 'sushiswap'
    group by 1),

    dua as (select from_address, max(date(block_timestamp)) as latest, (CURRENT_DATE - latest) as days_since_last_tx, function_name as actions, ROW_NUMBER() OVER (PARTITION BY from_address ORDER BY latest desc) as num
    from ethereum.transactions
    where to_address_name = 'sushiswap' and function_name is not null and success = 'TRUE' and function_name in ('addLiquidity', 'addLiquidityETH', 'removeLiquidity', 'removeLiquidityETH')
    group by 1,4),

    tiga as (select from_address, latest, days_since_last_tx,actions
    from satu
    where days_since_last_tx > 30

    UNION

    select from_address, latest, days_since_last_tx,actions
    from dua
    where days_since_last_tx > 30 and num = 1),

    empat as (select from_address, latest, days_since_last_tx,actions, ROW_NUMBER() OVER (PARTITION BY from_address ORDER BY latest desc) as num
    from tiga),

    lima as (select from_address, latest, days_since_last_tx,actions
    from empat
    where num = 1)

    select latest, count(distinct from_address) as count, actions
    from lima
    group by 1,3
    Run a query to Download Data