Arionear Transparency - staking Users
    Updated 2023-01-09
    with
    staking_user as (
    select
    date_trunc('week', BLOCK_TIMESTAMP) as date,
    count(distinct TX_SIGNER) as "# Staker",
    sum(STAKE_AMOUNT / pow(10, 24)) as "Stake Volume",
    "Stake Volume" / "# Staker" as "Stake Volume per User"
    from
    near.core.dim_staking_actions
    where
    1 = 1
    and ACTION = 'Stake'
    and BLOCK_TIMESTAMP >= '2022-07-01'
    and STAKE_AMOUNT is not null
    group by
    1
    ),
    Unstaking_user as (
    select
    date_trunc('week', BLOCK_TIMESTAMP) as date,
    count(distinct TX_SIGNER) as "# Unstaker",
    sum(STAKE_AMOUNT / pow(10, 24)) as "Unstake Volume",
    "Unstake Volume" / "# Unstaker" as "Unstake Volume per User"
    from
    near.core.dim_staking_actions
    where
    1 = 1
    and ACTION = 'Unstake'
    and BLOCK_TIMESTAMP >= '2022-07-01'
    and STAKE_AMOUNT is not null
    group by
    1
    )
    select
    date,
    "# Staker",
    Run a query to Download Data