with
stake as (
select tx_hash
from near.core.fact_actions_events_function_call
where method_name in ('deposit_and_stake','stake','stake_all')
)
select
tx_receiver as validator,
count(distinct tx_signer) as stakers,
sum(tx:actions[0]:FunctionCall:deposit/pow(10,24)) as near_staked
from near.core.fact_transactions
where tx_hash in (select * from stake)
and block_timestamp >= current_date-90
group by 1
order by 2 desc
limit 10