SELECT
date_trunc('week', block_timestamp) as date,
b.project_name,
count(DISTINCT tx_hash) as n_txns,
count(DISTINCT tx_signer) as unique_users,
sum(transaction_fee/1e24) as tx_fee --near
FROM near.core.fact_transactions a
LEFT JOIN near.core.dim_address_labels b
ON a.tx_receiver = b.address
WHERE
block_timestamp >= DATEADD('month', -1*{{last_n_month}}, CURRENT_DATE()-1)
AND label_type IS NOT NULL
AND project_name IS NOT NULL
GROUP BY 1 , 2
ORDER BY 1 DESC