JonasoMOE staking pool (2)
    Updated 2025-02-07
    with

    P as( select price, hour from mantle.price.ez_prices_hourly where token_address = '0x4515a45337f461a11ff0fe8abf3c606ae5dc00c9' order by hour desc limit 1 ),

    X as(
    select 'Mantle' as chain, block_timestamp, 0+amount as balance, from_address as user, to_address as pool, contract_address from mantle.core.ez_token_transfers union all
    select 'Mantle' as chain, block_timestamp, 0-amount as balance, to_address as user, from_address as pool, contract_address from mantle.core.ez_token_transfers ),

    A as(
    select user, min(block_timestamp) as time, sum(balance) as balance
    from X
    where pool = '0xb3938e6ee233e7847a5f17bb843e9bd0aa07e116'
    and contract_address = '0x4515a45337f461a11ff0fe8abf3c606ae5dc00c9'
    and user != '0x0000000000000000000000000000000000000000'
    group by 1),


    B as(
    select date_trunc('month',time) as time, count(distinct user) as holder
    from A
    where balance > 0
    group by 1)

    select time, holder as new_holder,
    sum(holder) over(order by time) - holder as pre_holder,
    sum(holder) over(order by time) as total_holder
    from B
    order by 1 desc






    QueryRunArchived: QueryRun has been archived