h4wkdestination redux
    Updated 2022-11-01
    with eth_price as (
    select hour as price_hour, price
    from ethereum.core.fact_hourly_token_prices where symbol = 'WETH'
    )

    , deposit as (
    select
    block_timestamp as deposit_date,
    tx_hash,
    from_address as deposit_address,
    eth_value
    from ethereum.core.fact_transactions join eth_price on date_trunc(hour, block_timestamp) = price_hour
    where to_address = '0x99c9fc46f92e8a1c0dec1b1747d010903e884be1'
    and block_timestamp::date > CURRENT_DATE - 31 and block_timestamp::date < CURRENT_DATE
    and eth_value > 0
    )

    , top_10 as (
    select
    count(distinct from_address) as total_address,
    -- label_type,
    project_name as top_project
    from optimism.core.fact_transactions
    join optimism.core.dim_labels on to_address = address
    join deposit on from_address = deposit_address
    where label_type != 'token' and label_type != 'nft' and block_timestamp::date > CURRENT_DATE - 30
    group by top_project order by total_address desc limit 10
    )

    , event as (
    select
    block_timestamp as event_date,
    from_address as event_address,
    -- label_type,
    project_name as type
    Run a query to Download Data