Query editor
WITH product_addresses(chain_key, component_name, component_group, address) AS (VALUES('ethereumSepolia','Ethereum Intent Router','router',0x8a996eB1AC6580662b66CE5Df7f1892EA6382e72),('arcTestnet','Arc Intent Router','router',0xB8d19Db51A912010b913201af33CB0CF5Df1FE83),('arcTestnet','Circle Gateway Wallet','gateway',0x0077777d7EBA4688BDeF3E311b846F25870A19B9))SELECT 'sepolia.transactions' AS source_table, p.chain_key, p.component_name, p.component_group, tx.block_time, tx.block_number, concat('0x', to_hex(tx.hash)) AS tx_hash, concat('0x', to_hex(tx."from")) AS user_or_counterparty, concat('0x', to_hex(p.address)) AS product_address, CASE WHEN tx."to"=p.address THEN 'call_to_product' WHEN tx."from"=p.address THEN 'sent_by_product' ELSE 'related' END AS direction, tx.success, tx.gas_used, cast(NULL AS varchar) AS token_symbol, cast(NULL AS double) AS amount_rawFROM sepolia.transactions txJOIN product_addresses p ON p.chain_key='ethereumSepolia' AND (tx."to"=p.address OR tx."from"=p.address)WHERE tx.block_date >= current_date - interval '180' dayUNION ALLSELECT 'erc20_arc.evt_transfer' AS source_table, p.chain_key, p.component_name, p.component_group, tr.evt_block_time AS block_time, tr.evt_block_number AS block_number, concat('0x', to_hex(tr.evt_tx_hash)) AS tx_hash, CASE WHEN tr."from"=p.address THEN concat('0x', to_hex(tr."to")) ELSE concat('0x', to_hex(tr."from")) END AS user_or_counterparty, concat('0x', to_hex(p.address)) AS product_address, CASE WHEN tr."to"=p.address THEN 'token_in' WHEN tr."from"=p.address THEN 'token_out' ELSE 'related' END AS direction, true AS success, cast(NULL AS bigint) AS gas_used, 'USDC' AS token_symbol, cast(tr.value AS double) AS amount_rawFROM erc20_arc.evt_transfer trJOIN product_addresses p ON p.chain_key='arcTestnet' AND (tr."from"=p.address OR tr."to"=p.address)WHERE tr.contract_address=0x3600000000000000000000000000000000000000 AND tr.evt_block_date >= current_date - interval '180' dayUNION ALLSELECT 'erc20_sepolia.evt_transfer' AS source_table, p.chain_key, p.component_name, p.component_group, tr.evt_block_time AS block_time, tr.evt_block_number AS block_number, concat('0x', to_hex(tr.evt_tx_hash)) AS tx_hash, CASE WHEN tr."from"=p.address THEN concat('0x', to_hex(tr."to")) ELSE concat('0x', to_hex(tr."from")) END AS user_or_counterparty, concat('0x', to_hex(p.address)) AS product_address, CASE WHEN tr."to"=p.address THEN 'token_in' WHEN tr."from"=p.address THEN 'token_out' ELSE 'related' END AS direction, true AS success, cast(NULL AS bigint) AS gas_used, 'USDC' AS token_symbol, cast(tr.value AS double) AS amount_rawFROM erc20_sepolia.evt_transfer trJOIN product_addresses p ON p.chain_key='ethereumSepolia' AND (tr."from"=p.address OR tr."to"=p.address)WHERE tr.contract_address=0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238 AND tr.evt_block_date >= current_date - interval '180' dayORDER BY block_time DESCLIMIT 1000