select
date_trunc('day', first_transaction_stamp) as first_transaction_date,
count(sender) as new_active_users
from (
select
msg_value:sender::string as sender,
min(block_timestamp) as first_transaction_stamp,
max(block_timestamp) as last_transaction_stamp
from terra.msgs
WHERE msg_value:contract = 'terra1sepfj7s0aeg5967uxnfk4thzlerrsktkpelm5s' --anchor
AND block_timestamp >= CURRENT_DATE - 90
group by 1
)
--where first_transaction_date > current_date - 90
where first_transaction_date > '2021-09-24' --users in last 90 days
-- and first_transaction_date < '2021-06-27'
and first_transaction_stamp != last_transaction_stamp
group by 1
order by 1