rezarwzmain copy
    Updated 2024-09-01
    -- forked from main @ https://flipsidecrypto.xyz/edit/queries/54738a17-2015-4429-88d9-8c7684b30388
    with all_tornado_blast as (
    SELECT
    *
    FROM
    (
    SELECT
    CASE
    when et.from_address = tx.from_address then 'Buy'
    else 'Sell'
    end as Type,
    tx.tx_hash,
    tk.SYMBOL as Token,
    tk.AMOUNT as token_amount,
    tx.BLOCK_TIMESTAMP,
    tx.from_address as ua,
    sum(et.amount_usd) as USD_AMOUNT,
    sum(et.AMOUNT) as ETH_AMOUNT,
    FROM
    blast.core.fact_transactions tx
    left JOIN blast.core.ez_native_transfers et on et.tx_hash = tx.tx_hash
    and (
    et.from_address = '0x02df485037c08c3743c182636987c1452cf2e7f9'
    or et.to_address = '0x02df485037c08c3743c182636987c1452cf2e7f9'
    )
    and (
    et.from_address = tx.from_Address
    or et.to_address = tx.from_address
    )
    left JOIN blast.core.ez_token_transfers tk on tx.tx_hash = tk.tx_hash
    and(
    (
    et.from_address = tx.from_Address
    and tk.to_address = tx.from_Address
    )
    or(
    QueryRunArchived: QueryRun has been archived