MostlyData_Solana Vote Rewards
    Updated 2025-01-27
    -- forked from Solana APR by entity @ https://flipsidecrypto.xyz/studio/queries/37e6195b-677f-4285-bc9e-139aaf3d36da

    with leader_inflation_raw as(
    select
    --block_id,
    rv.epoch_earned as epoch,
    case
    when vote_pubkey = 'Chorus6Kis8tFHA7AowrPMcRJk3LbApHTYpgSNXzY5KE' then 'Chorus One'
    when vote_pubkey = 'EogKVYgic8LKAuV1kR9nRqJaS5zpwCvSMfqoehzmAMpK' then 'Chorus One - Research'
    when vote_pubkey = 'FKsC411dik9ktS6xPADxs4Fk2SCENvAiuccQHLAPndvk' then 'P2P.org'
    when vote_pubkey = 'CcaHc2L43ZWjwCHART3oZoJvHLAe9hzT2DJNUpBzoTN1' then 'Figment'
    when vote_pubkey = 'J1to1yufRnoWn81KYg1XkTWzmKjnYSnmE2VY8DGUJ9Qv' then 'Jito1'
    when vote_pubkey = 'J1to2NAwajc8hD6E6kujdQiPn1Bbt2mGKKZLY9kSQKdB' then 'Jito2'
    when vote_pubkey = 'DdCNGDpP7qMgoAy6paFzhhak2EeyCZcgjH7ak5u5v28m' then 'Kiln'
    when vote_pubkey = 'CertusDeBmqN8ZawdkxK5kFGMwBXdudvWHYwtNgNhvLu' then 'Jump Crypto'
    when vote_pubkey = 'FQwewNXahV7MiZcLpY6p1xhUs2acVGQ3U5Xxc7FzV571' then 'Blockdaemon'
    when vote_pubkey = 'Haz7b47sZBpxh9SwggGndN3fAyNQ1S949BPdxWXS3ab6' then 'Temporal'
    when vote_pubkey = 'he1iusunGwqrNtafDtLdhsUQDFvo13z9sUa36PauBtk' then 'Helius'
    else null
    end as validator,
    reward_amount_sol as vote_rewards

    from solana.gov.fact_rewards_voting rv

    where
    (
    '{{n_days}}' = 0
    and block_timestamp >= cast('{{start_date}}' as timestamp)
    and block_timestamp <= cast('{{end_date}}' as timestamp)
    )
    or
    (
    '{{n_days}}' != 0
    and block_timestamp >= current_date() - interval '{{n_days}} days'
    )

    QueryRunArchived: QueryRun has been archived