SocioCryptoNEAR Projects Stats
    Updated 2023-07-12
    -- forked from Stats per Protocols dapp @ https://flipsidecrypto.xyz/edit/queries/dac82b60-b672-477e-8fff-79a19c234e56

    -- forked from Stats per Protocols @ https://flipsidecrypto.xyz/edit/queries/a6e8ed1c-9600-4db7-98bc-d329ed454a66

    SELECT
    date_trunc('week', block_timestamp) as date,
    b.project_name as project,
    count(DISTINCT tx_hash) as n_txns,
    count(DISTINCT tx_signer) as users,
    sum(transaction_fee) as t_tx_fee
    FROM near.core.fact_transactions a
    LEFT JOIN near.core.dim_address_labels b
    ON a.tx_receiver = b.address
    WHERE date > dateadd('month', -{{last_n_month}}, current_date)
    AND date < current_date
    AND b.project_name is not null
    --AND tx_status = 'TRUE'
    GROUP BY 1 , 2
    ORDER BY 1 DESC




    Run a query to Download Data