animatorstaked near
    Updated 2022-11-09
    WITH stake AS (
    SELECT POOL_ADDRESS, ROUND(SUM(STAKE_AMOUNT)/1e24,0) AS stake
    FROM near.core.dim_staking_actions
    WHERE ACTION='Stake'
    GROUP BY 1
    ORDER BY 2 DESC),

    unstake AS (
    SELECT POOL_ADDRESS, ROUND(SUM(STAKE_AMOUNT)/1e24,0) AS unstake
    FROM near.core.dim_staking_actions
    WHERE ACTION='Unstake'
    GROUP BY 1
    ORDER BY 2 DESC)


    SELECT s.POOL_ADDRESS, stake - unstake AS staked
    FROM stake s JOIN unstake u ON s.POOL_ADDRESS = u.POOL_ADDRESS
    WHERE staked>0






    Run a query to Download Data