theericstoneTarnodo DAIquiry
    Updated 2020-12-16
    WITH torn_in AS (
    SELECT
    date_trunc('day',block_timestamp) as date,
    from_address,
    from_label,
    sum(amount) as amount_sent
    FROM
    gold.ethereum_events
    where
    contract_address = '0x6b175474e89094c44da98b954eedeac495271d0f' -- DAI token
    and
    to_label = 'tornado_cash'
    and block_timestamp > getdate() - interval '3 months'
    GROUP BY 1, 2,3
    ),
    torn_out AS (
    SELECT
    date_trunc('day',block_timestamp) as date,
    to_address,
    to_label,
    sum(amount) as amount_sent
    FROM
    gold.ethereum_events
    where
    contract_address = '0x6b175474e89094c44da98b954eedeac495271d0f' -- DAI token
    and
    from_label = 'tornado_cash'
    and block_timestamp > getdate() - interval '3 months'
    GROUP BY 1,2,3
    )
    SELECT
    torn_out.date as date,
    torn_in.from_address,
    torn_in.from_label,
    torn_in.amount_sent as amount_to_tornado,
    torn_out.to_address,
    Run a query to Download Data