select
date_trunc('day',block_timestamp) as date,
count(*) as txs,
count(distinct tx_signer) as unique_users,
AVG(unique_users) OVER (ORDER BY date ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) AS moving_average_7
from near.core.fact_transactions
where tx_receiver='token.sweat' and date >= current_date - 30
GROUP BY date
ORDER BY date