binhachonTop ConstitutionDAO Contributors - Top 10 vs total
    Updated 2022-01-27
    with constitutionDAO_txs as (
    select
    distinct tx_id
    from ethereum.events_emitted
    where contract_address = '0xd569d3cce55b71a8a3f3c418c329a66e5f714431' --Juicebox
    and event_inputs:projectId = 36
    and tx_succeeded = 'TRUE'
    ),
    total_contribution as (
    select
    from_address,
    sum(amount) as total_contribution,
    row_number() over (order by total_contribution desc) as rank
    from ethereum.udm_events
    where tx_id in (select tx_id from constitutionDAO_txs)
    and event_type = 'native_eth'
    group by from_address
    ),
    final_table as (
    select
    total_contribution.*,
    coalesce(redeem_amount,0) as redeem_amount,
    coalesce(sold_amount,0) as sold_amount
    from total_contribution
    left join PEOPLE_redeem on (total_contribution.from_address = PEOPLE_redeem.from_address)
    left join PEOPLE_selling on (total_contribution.from_address = PEOPLE_selling.origin_address)
    order by total_contribution desc
    limit 10
    )
    Run a query to Download Data