Afonso_Diaz2023-04-19 11:38 PM
    Updated 2023-04-19
    WITH
    staking as (
    SELECT tx_hash
    FROM near.core.fact_actions_events_function_call
    WHERE method_name in ('deposit_and_stake','stake','stake_all')
    ),
    stakes as (
    SELECT
    block_timestamp,
    tx_hash as tx,
    tx_receiver as validator,
    tx_signer as delegator,
    tx:actions[0]:FunctionCall:deposit/pow(10,24) near_staked
    FROM near.core.fact_transactions
    WHERE tx_hash in (select * from staking)
    )


    select
    date_trunc('month', block_timestamp) as month,
    sum(near_staked) as volume_near
    from stakes
    group by 1
    Run a query to Download Data