Query editor
withmain as (selecttx_hash,block_time,cast(JSON_EXTRACT_SCALAR(action_function_call_args_parsed, '$.amount') as double) / 1e18 as amount,JSON_EXTRACT_SCALAR(action_function_call_args_parsed, '$.sender_id') as user,'Stake' as event_namefromnear.actionswhereblock_date >= date('2025-07-29')and block_date >= current_date - interval '30' dayand block_date != current_dateand tx_to = 'token.rhealab.near'and execution_status like 'SUCCESS%'and action_function_call_call_method_name = 'ft_on_transfer'and JSON_EXTRACT_SCALAR(action_function_call_args_parsed, '$.msg') like '%Stake%'union allselecttx_hash,block_time,cast(JSON_EXTRACT_SCALAR(action_function_call_args_parsed, '$.unlocked_amount') as double) / 1e18 as amount,JSON_EXTRACT_SCALAR(action_function_call_args_parsed, '$.account_id') as user,'Unstake' as event_namefromnear.actionswhereblock_date >= date('2025-07-29')and block_date >= current_date - interval '1' dayand block_date != current_dateand tx_to = 'xtoken.rhealab.near'and execution_status like 'SUCCESS%'and action_function_call_call_method_name = 'callback_post_unstake')selectdate_trunc('day', block_time) as dt,event_name,count(distinct tx_hash) as transactions,count(distinct user) as users,sum(amount) as volume,avg(amount) as average_amount,sum(sum(amount)) over (partition by event_name order by date_trunc('day', block_time)) as cumulative_volumefrommainwhere event_name = 'Stake'group by 1, 2order by 1, 2