DrsimonUntitled Query
    Updated 2023-01-28
    with year2022 as
    (
    select action, count(*) as staking_count , sum(stake_amount/1e24) as staking_amount ,avg(stake_amount/1e24) as avg_staking_amount
    from near.core.dim_staking_actions
    where year(block_timestamp::date)=2022
    group by 1
    )

    , year2023 as
    (
    select action , count(*) as staking_count , sum(stake_amount/1e24) as staking_amount ,avg(stake_amount/1e24) as avg_staking_amount
    from near.core.dim_staking_actions
    where year(block_timestamp::date)=2023
    group by 1
    )

    , chart as
    (
    select action , block_timestamp::date , count(*) as staking_count , sum(stake_amount/1e24) as staking_amount ,avg(stake_amount/1e24) as avg_staking_amount
    from near.core.dim_staking_actions
    where year(block_timestamp::date) >= 2022
    group by 1,2
    )

    , stake_2022 as
    (
    select count(*) as staking_count , sum(stake_amount/1e24) as staking_amount , count(distinct tx_signer) as users
    from near.core.dim_staking_actions
    where action='Stake' and year(block_timestamp::date)=2022
    )

    , unstake_2022 as
    (
    select count(*) as staking_count , sum(stake_amount/1e24) as staking_amount , count(distinct tx_signer) as users
    from near.core.dim_staking_actions
    where action='Unstake' and year(block_timestamp::date)=2022
    Run a query to Download Data