MFD-6247Untitled Query
    Updated 2022-11-15
    with ethprice as (select hour::date as date, avg (price) as usdprice from ethereum.core.fact_hourly_token_prices where symbol ='WETH' group by 1)

    select block_timestamp::date as day,
    case when origin_function_signature = '0x58c22be7' then 'Deposit'
    when origin_function_signature = '0x36118b52' then 'Withdraw' else null end as action,
    count (distinct tx_hash) as TX_Count,
    count (distinct origin_from_address) as Users_Count,
    sum (event_inputs:value/1e18) as Total_Volume,
    sum (event_inputs:value/1e18*usdprice) as Total_USD_Volume,
    avg (event_inputs:value/1e18) as Average_Volume,
    avg (event_inputs:value/1e18*usdprice) as Average_USD_Volume,
    sum (total_volume) over (partition by action order by day) as Cumulative_Total_Volume,
    sum (total_usd_volume) over (partition by action order by day) as Cumulative_USD_Volume
    from ethereum.core.fact_event_logs t1 join ethprice t2 on t1.block_timestamp::date = t2.date
    where origin_to_address = '0x3b968d2d299b895a5fcf3bba7a64ad0f566e6f88' and block_timestamp::date >= CURRENT_DATE - 31
    and event_name = 'Transfer' and contract_name = 'WETH9'
    and action is not null
    group by 1,2
    Run a query to Download Data