MoDeFiFS near report - new users quarterly
    Updated 2025-02-06
    with chains_tvl AS (
    -- Near New Users
    select year(BLOCK_TIMESTAMP)||'-Q'||CEIL(month(BLOCK_TIMESTAMP)/3) as "Date", 'Near' as "Chain", count(*) as "New Users"
    from (select
    ifnull(tx:actions[0]:Delegate:delegate_action:sender_id::string, TX_SIGNER) as TX_SIGNER,
    min(BLOCK_TIMESTAMP) as BLOCK_TIMESTAMP
    from near.core.fact_transactions where TX_SUCCEEDED=true group by 1)
    group by 1
    union all
    --Polygon New Users
    select year(BLOCK_TIMESTAMP)||'-Q'||CEIL(month(BLOCK_TIMESTAMP)/3) as "Date", 'Polygon' as "Chain", count(*) as "New Users"
    from (select
    FROM_ADDRESS,
    min(BLOCK_TIMESTAMP) as BLOCK_TIMESTAMP
    from polygon.core.fact_transactions where STATUS='SUCCESS' group by 1)
    group by 1
    union all
    -- Optimism New Users
    select year(BLOCK_TIMESTAMP)||'-Q'||CEIL(month(BLOCK_TIMESTAMP)/3) as "Date", 'Optimism' as "Chain", count(*) as "New Users"
    from (select
    FROM_ADDRESS,
    min(BLOCK_TIMESTAMP) as BLOCK_TIMESTAMP
    from optimism.core.fact_transactions where STATUS='SUCCESS' group by 1)
    group by 1
    union all
    -- Arbitrum New Users
    select year(BLOCK_TIMESTAMP)||'-Q'||CEIL(month(BLOCK_TIMESTAMP)/3) as "Date", 'Arbitrum' as "Chain", count(*) as "New Users"
    from (select
    FROM_ADDRESS,
    min(BLOCK_TIMESTAMP) as BLOCK_TIMESTAMP
    from arbitrum.core.fact_transactions where STATUS='SUCCESS' group by 1)
    group by 1
    union all
    -- Avalanche New Users
    select year(BLOCK_TIMESTAMP)||'-Q'||CEIL(month(BLOCK_TIMESTAMP)/3) as "Date", 'Avalanche' as "Chain", count(*) as "New Users"
    from (select
    QueryRunArchived: QueryRun has been archived