Sajjadiii3.1 $MLS
    Updated 2022-09-22
    with xmatic as (
    select
    block_timestamp as date ,
    origin_from_address as users,
    tx_hash
    from polygon.core.fact_token_transfers
    where from_address = '0x0000000000000000000000000000000000000000'
    and contract_address =lower('0x3aD736904E9e65189c3000c7DD2c8AC8bB7cD4e3')--superfluid.finance Matic (PoS)

    ),

    datecalc_xmatic as (
    select a.users,
    datediff(day, a.date, b.date) as difference
    from xmatic a
    left join xmatic b
    on a.users = b.users
    and a.tx_hash != b.tx_hash
    and b.date > a.date
    )

    select
    case
    when difference between 1 and 7 then 'Daily'
    when difference between 7 and 30 then 'Weekly'
    when difference between 30 and 90 then 'Monthly'
    when difference between 90 and 364 then 'Quarterly'
    when difference >= 365 then 'Yearly'
    else 'non DCA'
    end as actions,
    count (distinct users) as depositers,
    row_number() over (order by depositers desc) as rank
    from datecalc_xmatic
    group by 1
    Run a query to Download Data