cheeyoung-kekTornado 2.1
    Updated 2022-08-10
    with tornado_address as(


    select
    address,
    address_name
    from flipside_prod_db.crosschain.address_labels
    where project_name like 'tornado cash'
    ) ,
    prices as (
    select hour:: date as day, avg(price) as price
    from ethereum.core.fact_hourly_token_prices
    WHERE token_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
    group by 1
    )

    select DISTINCT to_address, ADDRESS_NAME, total_eth, sum(total_eth*price) as amount_usd
    from (
    select
    block_timestamp::date as day,
    to_address,
    ADDRESS_NAME,
    sum(ETH_VALUE) as total_eth
    from ethereum.core.fact_transactions a inner join tornado_address b on a.TO_ADDRESS=b.ADDRESS
    where TO_ADDRESS in (select address from tornado_address)
    and BLOCK_TIMESTAMP>=CURRENT_DATE - 365
    group by 1,2,3
    ) a join prices b on a.day=b.day
    group by 1,2,3
    order by 4 desc

    Run a query to Download Data