binhachonBiggest Losers - Top 10
    Updated 2022-01-23
    with PEOPLE_redeem as (
    select
    date_trunc('hour', block_timestamp) as block_timestamp,
    from_address,
    amount,
    amount / 1000000 as ETH_amount
    from ethereum.udm_events
    where contract_address = '0x7a58c0be72be218b41c608b7fe7c5bb630736c71'
    and origin_function_signature = '0x3015a5b5'
    ),
    ETH_price as (
    select
    hour,
    price
    from ethereum.token_prices_hourly
    where symbol = 'WETH'
    ),
    PEOPLE_redeem_with_price as (
    select
    from_address,
    sum(amount) as PEOPLE_amount,
    sum(ETH_amount) as ETH_amount,
    sum(ETH_amount * price) as USD_amount
    from PEOPLE_redeem
    left join ETH_price on (hour = block_timestamp)
    group by from_address -- Must use sum to account for 1 address redeemed multiple times
    ),
    PEOPLE_max_price as (
    select
    max(price) as max_price_usd
    from ethereum.token_prices_hourly
    where symbol = 'PEOPLE'
    ),
    PEOPLE_current_price as (
    select
    price as current_price
    Run a query to Download Data