MLDZMNcash.4
    Updated 2022-08-10
    with tornado as (select
    ADDRESS
    from flipside_prod_db.crosschain.address_labels where PROJECT_NAME= 'tornado cash'
    ),
    tb2 as (select
    hour::date as day,
    avg(price) as price_token
    from ethereum.core.fact_hourly_token_prices where SYMBOL = 'WETH'
    group by 1),

    tb3 as (select
    ADDRESS_NAME as Cash_address,
    ETH_VALUE as ETH_w,
    ETH_w*price_token as USD_w

    from ethereum.core.fact_transactions a
    join flipside_prod_db.crosschain.address_labels b on a.TO_ADDRESS=b.address
    join tb2 y on a.BLOCK_TIMESTAMP::date=y.day
    where a.TO_ADDRESS in (select ADDRESS from tornado)
    and a.BLOCK_TIMESTAMP>=CURRENT_DATE-30
    )

    select
    Cash_address,
    sum(ETH_w) as ETH_worth,
    sum(USD_w) as USD_worth
    from tb3
    group by 1 having USD_worth!=0
    order by 3 desc


    Run a query to Download Data