cheeyoung-kekTop 30 Proposal Vote on Noun Dao
    Updated 2022-07-06
    With proposals as (
    select substring(event_inputs:description,0, 40) as title,
    event_inputs:id as proposal_id ,
    event_inputs:quorumVotes as Threshold_Vote
    from ethereum.core.fact_event_logs
    where event_name ='ProposalCreatedWithRequirements'
    --tx_hash=lower('0x18468451aa048ba1ab1f605a65f0d4e26c86e3753646321edb2c4710cd39eb51')
    --contract_address=lower('0x9C8fF314C9Bc7F6e59A9d9225Fb22946427eDC03') and contract_name='NounsDAOProxy'
    ),
    votes as (

    select
    event_inputs:voters as voters,
    event_inputs:proposalId as voted_proposals,
    sum(event_inputs:votes) as vote,
    MIN(BLOCK_TIMESTAMP) AS first_vote_time,
    MAX(BLOCK_TIMESTAMP) AS last_vote_time

    from ethereum.core.fact_event_logs
    where contract_name='NounsDAOProxy'
    and event_name ='VoteCast'
    group by 1,2
    )
    select proposal_id, title, Threshold_Vote , vote , first_vote_time,last_vote_time
    from proposals a
    inner join votes b
    on a.proposal_id=b.voted_proposals
    --group by 1,2,3,4,6,6,7
    order by vote desc
    limit 30

    Run a query to Download Data