DataBeingVolume Hop Exchange
    Updated 2022-06-17
    with eth_price as (
    SELECT avg(price) as price, date_trunc('day', hour) as day
    FROM ethereum.core.fact_hourly_token_prices
    WHERE symbol = 'WETH'
    GROUP BY 2
    )

    SELECT sum(event_inputs:amount / 1000000000000000000) as eth_amount, sum(event_inputs:amount / 1000000000000000000 * e.price) as amount_usd, date_trunc('day', f.block_timestamp) as day
    FROM flipside_prod_db.ethereum_core.fact_event_logs f
    JOIN eth_price as e on date_trunc('day', f.block_timestamp) = e.day
    WHERE contract_address = lower('0xb8901acB165ed027E32754E0FFe830802919727f') and origin_function_signature = ('0xdeace8f5') and event_inputs:chainId = '10' and block_timestamp >= CURRENT_DATE - 59
    GROUP BY 3
    -- 10
    Run a query to Download Data