mehrancrypto-dxoepqUntitled Query
    Updated 2022-08-10
    with tx1 as (select address , ADDRESS_NAME
    from ethereum.core.dim_labels
    where label = 'tornado cash'
    ) , tx2 as (
    SELECT ETH_VALUE, ADDRESS_NAME , B.tx_hash , C.amount , D.amount As tokens , CONTRACT_ADDRESS , B.block_timestamp::date as daily
    from tx1 A , ethereum.core.fact_transactions B
    left outer JOIN ethereum.core.ez_eth_transfers C on B.tx_hash = C.tx_hash
    left outer JOIN ethereum.core.ez_token_transfers D on B.tx_hash = D.tx_hash
    where address = B.TO_ADDRESS
    and B.block_timestamp > CURRENT_DATE - 365

    ) ,
    tx3 as (
    SELECT tx_hash , avg(price) as price
    from ethereum.core.fact_hourly_token_prices A , tx2 B
    where CONTRACT_ADDRESS = TOKEN_ADDRESS
    and hour::date = daily
    GROUP by 1
    )
    , tx4 as (
    SELECT ADDRESS_NAME ,daily , A.tx_hash , price*tokens as usd_volume
    from tx2 A, tx3 B
    where A.tx_hash = B.tx_hash
    )
    , tx5 as (
    SELECT daily , avg(price) as price_ETH
    from ethereum.core.fact_hourly_token_prices A , tx2 B
    where symbol = 'WETH'
    and hour::date = daily
    GROUP by 1
    )
    , tx6 as (
    SELECT ADDRESS_NAME, A.tx_hash , usd_volume
    ,
    case
    Run a query to Download Data