freeman_7VELODROME GOVERNACE
    Updated 2024-09-19
    -- Pools with the highest vote in each Epoch
    -- pool with the highest votes get the biggest share of the emission of $velo token

    With vote as (
    SELECT
    Date_trunc('week',block_timestamp) as week,
    DECODED_LOG:voter as voters,
    DECODED_LOG:pool as pool,
    DECODED_LOG:weight as vote_weight
    From optimism.core.ez_decoded_event_logs
    Where origin_to_address = lower('0x41C914ee0c7E1A5edCD0295623e6dC557B5aBf3C')
    And origin_function_signature = lower('0x7ac09bf7')
    And event_name ilike 'voted'
    ),

    EpochVote as (
    Select
    Week as epoch,
    Pool,
    count(voters) as pool_voters,
    Sum(vote_weight) as totalWeight
    From vote
    Group by epoch,pool
    Order by epoch
    )

    SELECT
    epoch,
    pool,
    symbol,
    pool_voters,
    total_epoch_voter,
    (pool_voters*100)/total_epoch_voter as Percentage_Of_pool_voter_total_epoch_voter,
    pool_vote_weight,
    total_pools_weight,
    (pool_vote_weight*100)/total_pools_weight as pecentage_of_pool_wieght_to_total_weight
    QueryRunArchived: QueryRun has been archived