Pine Analyticsjup-jan-vote
    Updated 2025-03-18
    WITH vote_counts AS (
    SELECT ins.*
    FROM solana.core.fact_decoded_instructions ins
    WHERE ins.program_id = 'GovaE4iu227srtG2s3tZzB4RmWBzw8sTwrCLZz7kN7rY'
    AND ins.event_type = 'setVote'
    AND ins.decoded_instruction:args:weight / pow(10, 6) is not null
    ), RankedVotes AS (
    SELECT
    signers[0] as wallet,
    date_trunc('hour', block_timestamp) as hour,
    case
    when decoded_instruction['args']['side'] like 0 then 'Abstain'
    when decoded_instruction['args']['side'] like 1 then 'Against'
    when decoded_instruction['args']['side'] like 2 then 'For'
    end as vote_choice,
    decoded_instruction['args']['weight'] / power(10, 6) as voting_power,
    ROW_NUMBER() OVER (PARTITION BY signers[0] ORDER BY block_timestamp DESC) as rn
    FROM vote_counts
    WHERE block_timestamp > '2024-11-01'
    AND DECODED_INSTRUCTION['accounts'][1]['pubkey'] = 'DEiRPxWLjDFrC2AUrR7KZfjTCRiN4W2pd2SV1L1GkotK'
    )

    SELECT *
    FROM (
    SELECT
    hour,
    vote_choice,
    sum(amt) as voting_power,
    count(*) as voters,
    sum(voting_power) over (partition by vote_choice order by hour) as total_voting_power,
    sum(voters) over (partition by vote_choice order by hour) as total_voters

    FROM (
    SELECT
    wallet,
    hour,
    Last run: about 1 month ago
    HOUR
    VOTE_CHOICE
    VOTING_POWER
    VOTERS
    TOTAL_VOTING_POWER
    TOTAL_VOTERS
    1
    2025-03-18 15:00:00.000Against4365930.781907428106477164.36265216723
    2
    2025-03-18 15:00:00.000For3406942.748741818167220500.78511636721
    3
    2025-03-18 15:00:00.000Abstain1128324.42427426133873879.1356219424
    4
    2025-03-18 14:00:00.000Abstain724250.45086635332745554.7113479163
    5
    2025-03-18 14:00:00.000Against1632713.131727579102111233.58074516295
    6
    2025-03-18 14:00:00.000For4869192.3551721399163813558.03637535903
    7
    2025-03-18 13:00:00.000Abstain2750954.86777644032021304.2604818810
    8
    2025-03-18 13:00:00.000Against2430074.805539735100478520.44901815716
    9
    2025-03-18 13:00:00.000For9211079.7384711665158944365.68120334504
    10
    2025-03-18 12:00:00.000For9856591.7442081646149733285.94273232839
    11
    2025-03-18 12:00:00.000Abstain909103.16537932529270349.3927058370
    12
    2025-03-18 12:00:00.000Against1965721.9420170198048445.64347914981
    13
    2025-03-18 11:00:00.000For2986480.0808951473139876694.19852431193
    14
    2025-03-18 11:00:00.000Abstain1494536.17770737528361246.2273268045
    15
    2025-03-18 11:00:00.000Against2724105.11341555496082723.70146914280
    16
    2025-03-18 10:00:00.000Against1259640.4800958393358618.58805413726
    17
    2025-03-18 10:00:00.000Abstain812447.77144938626866710.0496197670
    18
    2025-03-18 10:00:00.000For2976479.0623011472136890214.11762929720
    19
    2025-03-18 09:00:00.000Against1894166.0238365692098978.10796413143
    20
    2025-03-18 09:00:00.000Abstain770293.76050933726054262.278177284
    75
    6KB
    2s