sarathConstitution Dao-easy
    Updated 2022-01-25
    with data1 as(
    SELECT date_trunc('HOUR',block_timestamp) as TIME1 ,FROM_ADDRESS as address_swapped ,sum(amount_usd/amount) as price_swapped from ethereum.udm_events where contract_address='0x7a58c0be72be218b41c608b7fe7c5bb630736c71' and
    origin_function_name = 'swapExactETHForTokens'
    group by 1,2
    ),
    data2 as(
    select date_trunc('HOUR',block_timestamp) as time1,from_address,sum(amount_usd) as amount from ethereum.udm_events where origin_function_name='transfer'
    group by 1,2
    ),
    data3 as(
    SELECT hour,price from ethereum.token_prices_hourly where symbol='PEOPLE'
    ),
    data4 as(
    SELECT Hour as TIME,price as price from data3 join data2 on data3.hour=data2.time1
    group by 1,2)
    SELECT * from data1 join data4 on data1.TIME1=data4.TIME
    limit 2000

    -- limit 1000
    Run a query to Download Data