with stake_tx_group_id as (
select
distinct tx_group_id
from algorand.application_call_transaction
where app_id = 482608867
and try_base64_decode_string(tx_message:txn:note::string) = 'Market: mt'
),
stake_transaction as (
select
block_timestamp,
sender,
row_number() over (partition by sender order by block_timestamp) as rownumber
from algorand.asset_transfer_transaction
where tx_group_id in (select tx_group_id from stake_tx_group_id)
and asset_transferred = 465865291
qualify rownumber = 1
),
stake_wallet as (
select
block_timestamp::date as time,
count(sender) as number_of_wallets_that_have_staked
from stake_transaction
group by time
)
select
time,
number_of_wallets_that_have_staked,
sum(number_of_wallets_that_have_staked) over (order by time) as total_number_of_wallets_that_have_staked
from stake_wallet
order by time desc