xeejsgr478distribution of staking actions on Near
    Updated 2022-11-10
    WITH
    near as (
    SELECT
    trunc(block_timestamp,'day') as date,
    method_name,
    case when method_name in ('deposit_and_stake','stake','stake_all') then 'staking'
    when method_name in ('unstake','unstake_all') then 'unstaking'
    else method_name end as method_name2,
    count(distinct TX_HASH) as actions
    from near.core.fact_actions_events_function_call
    WHERE method_name in ('deposit_and_stake','stake','stake_all','unstake','unstake_all','unbond_delegation','update_validator')
    --'vote',
    and date>=CURRENT_DATE-INTERVAL '3 MONTHS'
    group by 1,2,3
    ),
    solana as (
    select
    trunc(block_timestamp,'day') as date,
    event_type as method_name,
    case when event_type='delegate' then 'staking' else 'unstaking' end as method_names2,
    COUNT (distinct tx_id) as actions
    from solana.core.ez_staking_lp_actions
    where succeeded = 'TRUE'
    and date>=CURRENT_DATE-INTERVAL '3 MONTHS'
    and node_pubkey is not null
    group by 1,2,3
    )
    select * from near order by 1 asc,2
    Run a query to Download Data