-- forked from Masi / Storage Staking @ https://flipsidecrypto.xyz/Masi/q/D6HlZMdtFqF1/storage-staking
select trunc(block_timestamp,'day') as "Date",
sum(deposit/pow(10,24)) as "Daily (NEAR)",
sum("Daily (NEAR)") over (order by "Date" asc) as "Total Amount (Near)"
from near.core.fact_actions_events_function_call
where method_name = 'storage_deposit'
and RECEIPT_SUCCEEDED = 'TRUE'
and block_timestamp::date >= '2024-09-01'
group by 1