cheeyoung-kekToken distribution in tornado
    Updated 2022-08-10
    with tornado_address as(
    select
    address,
    address_name,
    project_name
    from flipside_prod_db.crosschain.address_labels
    where project_name like 'tornado cash' and blockchain = 'ethereum'
    ) ,
    prices as (
    select hour as day, avg(price) as price, symbol
    from ethereum.core.fact_hourly_token_prices
    group by 1,3
    ),

    token_tx as(
    select
    a.block_timestamp as day,
    from_address,
    to_address,
    a.amount as amount,
    (a.amount*b.price) as USD,
    a.symbol
    from ethereum.core.ez_token_transfers a
    join prices b on date_trunc('hour', a.block_timestamp)=b.day and a.symbol=b.symbol
    join ethereum.core.fact_hourly_token_prices c
    on date_trunc('hour', a.block_timestamp)=c.hour
    and a.contract_address = c.token_address
    where block_timestamp::date <= current_date - 1
    and b.symbol is not null
    and amount > 0
    and USD > 0)


    select
    Run a query to Download Data