MoDeFinear meteor moon - users growth
    Updated 2025-01-13
    with migrated_moons as (
    select BLOCK_TIMESTAMP,
    try_parse_json(CLEAN_LOG):data[0]:owner_id as user,
    try_parse_json(CLEAN_LOG):data[0]:memo as memo,
    try_parse_json(CLEAN_LOG):data[0]:amount/1e8 as amount
    from near.core.fact_logs a
    where receiver_id='aa-harvest-moon.near'
    and memo='Migration'
    and amount>0
    and try_parse_json(CLEAN_LOG):event='ft_mint')

    select date_trunc(day, min_date) as "Date", count(user) as "New Users",
    sum("New Users") over (order by "Date") as "Total Users"
    from (
    select
    try_parse_json(CLEAN_LOG):data[0]:owner_id as user,
    min(BLOCK_TIMESTAMP) as min_date
    from near.core.fact_logs a
    where receiver_id='harvest-moon.near'
    and user in (select user from migrated_moons)
    and try_parse_json(CLEAN_LOG):event='ft_mint'
    group by 1
    union all
    select
    try_parse_json(CLEAN_LOG):data[0]:owner_id as user,
    min(BLOCK_TIMESTAMP) as min_date
    from near.core.fact_logs a
    where receiver_id='aa-harvest-moon.near'
    -- and try_parse_json(CLEAN_LOG):data[0]:memo='Harvest'
    and try_parse_json(CLEAN_LOG):data[0]:amount>0
    and user not in (select user from migrated_moons)
    and try_parse_json(CLEAN_LOG):event='ft_mint'
    group by 1)
    group by 1
    QueryRunArchived: QueryRun has been archived