jackguyAurora Contract Users 5 copy
    Updated 2023-04-23
    -- forked from Aurora Contract Users 5 @ https://flipsidecrypto.xyz/edit/queries/f2539733-b390-4546-84e2-598e4c7e985c

    with a_users as (
    SELECT
    DISTINCT TX_SIGNER
    FROM near.core.fact_transactions
    WHERE tx_receiver LIKE 'aurora'
    )


    SELECT
    CASE when transactions = 1 then 'a 1 Transaction'
    when transactions < 10 then 'b 2 - 10 Transactions'
    when transactions < 100 then 'c 11 - 100 Transactions'
    when transactions < 1000 then 'd 101 - 1,000 Transactions'
    when transactions < 10000 then 'e 1,001 - 10,000 Transactions'
    else 'f 10,000+ Transactions' end as user_group,
    count(*) as users
    FROM (
    SELECT
    tx_signer,
    count(DISTINCT tx_hash) as transactions,
    count(DISTINCT date_trunc('month', block_timestamp)) as active_weeks
    FROM near.core.fact_transactions
    WHERE not tx_signer in (SELECT * from a_users)
    GROUP BY 1
    )
    GROUP BY 1


    Run a query to Download Data