Query editor
-- DEX sells of NOVA by 0xc12e8269f392a344eb161498c7948592a4c588c8-- For each tx, find the final output token (not intermediate routing tokens)-- Shows individual trades with tx_hashWITH nova_txs AS (SELECT DISTINCT d.tx_hashFROM dex.trades dWHERE d.blockchain = 'ethereum'AND d.token_sold_address = 0x00Da8466B296E382E5Da2Bf20962D0cB87200c78AND (d.tx_from = 0xc12e8269f392a344eb161498c7948592a4c588c8OR d.taker = 0xc12e8269f392a344eb161498c7948592a4c588c8)),all_hops AS (SELECTd.tx_hash,d.evt_index,d.block_time,d.project,d.token_sold_address,d.token_sold_amount,d.token_bought_address,d.token_bought_symbol,d.token_bought_amount,d.amount_usdFROM dex.trades dINNER JOIN nova_txs nt ON d.tx_hash = nt.tx_hashWHERE d.blockchain = 'ethereum'),first_hop AS (SELECTtx_hash,token_sold_amount AS nova_sold,block_timeFROM (SELECT *,ROW_NUMBER() OVER (PARTITION BY tx_hash ORDER BY evt_index ASC) AS rnFROM all_hopsWHERE token_sold_address = 0x00Da8466B296E382E5Da2Bf20962D0cB87200c78)WHERE rn = 1),last_hop AS (SELECTtx_hash,token_bought_address,token_bought_symbol,token_bought_amount,amount_usdFROM (SELECT *,ROW_NUMBER() OVER (PARTITION BY tx_hash ORDER BY evt_index DESC) AS rnFROM all_hops)WHERE rn = 1)SELECTfh.tx_hash,fh.block_time,fh.nova_sold,