keshanUniswap stolen tokens
    Updated 2022-07-29
    WITH eths AS
    (SELECT (date_trunc(DAY, e.block_timestamp)) AS TIME,
    count(DISTINCT eth_from_address) AS eth_victims,
    count(DISTINCT e.tx_hash) AS eth_steals,
    sum(e.amount_usd) AS eth_amount_usd,
    sum(e.amount) AS eth_amount
    FROM ethereum.core.ez_eth_transfers e
    WHERE eth_to_address in ('0xa9bba21e5b16f9b135eb185a4f8d2618edad8db1',
    '0x09b5027ef3a3b7332ee90321e558bad9c4447afa',
    '0x3cafc86a98b77eedcd3db0ee0ae562d7fe1897a2',
    '0x24a4b33bfa8e32b3456f95381de429c11c2c6fd6')
    GROUP BY TIME),
    tokens AS
    (SELECT date_trunc(DAY, t.block_timestamp) AS TIME,
    count(DISTINCT from_address) AS tokens_victims,
    count(DISTINCT t.tx_hash) AS token_steals,
    ifnull(symbol, contract_address) AS token,
    sum(t.amount_usd) AS token_amount_usd,
    sum(t.amount) AS token_amount -- It seems that almost all the USD value from non ETH tokens are BTC
    FROM ethereum.core.ez_token_transfers t
    WHERE to_address in ('0xa9bba21e5b16f9b135eb185a4f8d2618edad8db1',
    '0x09b5027ef3a3b7332ee90321e558bad9c4447afa',
    '0x3cafc86a98b77eedcd3db0ee0ae562d7fe1897a2',
    '0x24a4b33bfa8e32b3456f95381de429c11c2c6fd6')
    GROUP BY TIME,
    token)
    SELECT ifnull(e.time, t.time) AS TIME,
    eth_victims,
    tokens_victims,
    eth_steals,
    token_steals,
    token,
    eth_amount,
    eth_amount_usd AS "ETH (in USD)",
    token_amount,
    token_amount_usd AS "WBTC (in USD)"