Sajjadiii3.Daily ETH staked in C.R.E.A.M. Finance
    Updated 2022-09-06
    with price_tab as (
    select hour::date as date, avg(price) as eth_price
    from ethereum.core.fact_hourly_token_prices
    where symbol ='WETH'
    group by 1
    ),

    Cream as (
    select block_timestamp::date as date ,
    count (distinct tx_hash) as total_transaction,
    count (distinct origin_from_address) as total_users,
    sum (event_inputs:amount/1e18) as total_eth,
    sum (event_inputs:amount/1e18*eth_price) as total_usd_volume,
    min (event_inputs:amount/1e18) as min_eth_volume,
    min (event_inputs:amount/1e18*eth_price) as min_usd_volume,
    median (event_inputs:amount/1e18) as median_eth_volume,
    median (event_inputs:amount/1e18*eth_price) as median_usd_volume,
    avg (event_inputs:amount/1e18) as average_eth_volume,
    avg (event_inputs:amount/1e18*eth_price) as average_usd_volume,
    max (event_inputs:amount/1e18) as max_eth_volume,
    max (event_inputs:amount/1e18*eth_price) as max_usd_volume
    from ethereum.core.fact_event_logs a
    join price_tab b
    on a.block_timestamp::date = b.date
    where origin_to_address in ('0x2689008dcda0c2b744b344b9e5a3d5a042c227da','0x9d2850c3112b5fb851c4aae23c1e97c1736898cb')-- Cream.Finance:staking-reward-pool
    and contract_address = origin_to_address
    and event_name = 'Staked'
    and origin_function_signature = '0xa694fc3a'
    --tx_hash = '0x6294a705136cf8904753ca782148b0ff6658abdf9b9fa34d267aa882685a2a9d'
    --or tx_hash = '0x2e19b4d76d893385fe02c88449cb426f336e7315881720e44bc0cc6627f8d892'
    group by 1
    ),

    Rocket_pool as (
    select block_timestamp::date as date ,
    count (distinct tx_hash) as total_transaction,
    Run a query to Download Data