Kruys-CollinsNet Delegated AXl and Number of Stakers
    Updated 2024-09-16
    WITH Amount AS (
    SELECT
    VALIDATOR_ADDRESS,
    SUM(amount) / 1e6 AS balance
    FROM (
    SELECT
    BLOCK_TIMESTAMP,
    VALIDATOR_ADDRESS,
    CASE
    WHEN action = 'undelegate' THEN -amount
    ELSE amount
    END AS amount
    FROM axelar.gov.fact_staking
    UNION ALL
    SELECT
    BLOCK_TIMESTAMP,
    REDELEGATE_SOURCE_VALIDATOR_ADDRESS,
    -amount
    FROM axelar.gov.fact_staking
    WHERE action = 'redelegate'
    )
    GROUP BY VALIDATOR_ADDRESS
    ),
    Delegations AS (
    SELECT
    VALIDATOR_ADDRESS,
    DELEGATOR_ADDRESS,
    SUM(amount) / 1e6 AS total_delegated
    FROM axelar.gov.fact_staking
    WHERE action = 'delegate'
    GROUP BY VALIDATOR_ADDRESS, DELEGATOR_ADDRESS
    ),
    CurrentPrice AS (
    SELECT
    QueryRunArchived: QueryRun has been archived