Query editor
/* Total token transfer volume involving a specific contract (both sent and received) */WITH transfer_volume AS (SELECTevt_tx_hash,contract_address AS token_address,"from","to",value AS amount_raw,evt_block_time,CASEWHEN "from" = 0x21568459854adcda462f6d9c11ce4f157dc70f93THEN 'outgoing'WHEN "to" = 0x21568459854adcda462f6d9c11ce4f157dc70f93THEN 'incoming'END AS transfer_directionFROM erc20_arbitrum.evt_TransferWHERE"from" = 0x21568459854adcda462f6d9c11ce4f157dc70f93OR "to" = 0x21568459854adcda462f6d9c11ce4f157dc70f93UNION ALLSELECTevt_tx_hash,contract_address AS token_address,"from","to",1 AS amount_raw,evt_block_time,CASEWHEN "from" = 0x21568459854adcda462f6d9c11ce4f157dc70f93THEN 'outgoing'WHEN "to" = 0x21568459854adcda462f6d9c11ce4f157dc70f93THEN 'incoming'END AS transfer_directionFROM erc721_arbitrum.evt_TransferWHERE"from" = 0x21568459854adcda462f6d9c11ce4f157dc70f93OR "to" = 0x21568459854adcda462f6d9c11ce4f157dc70f93UNION ALLSELECTevt_tx_hash,contract_address AS token_address,"from","to",value AS amount_raw,evt_block_time,CASEWHEN "from" = 0x21568459854adcda462f6d9c11ce4f157dc70f93THEN 'outgoing'WHEN "to" = 0x21568459854adcda462f6d9c11ce4f157dc70f93THEN 'incoming'END AS transfer_directionFROM erc1155_arbitrum.evt_TransferSingleWHERE"from" = 0x21568459854adcda462f6d9c11ce4f157dc70f93OR "to" = 0x21568459854adcda462f6d9c11ce4f157dc70f93UNION ALLSELECTevt_tx_hash,contract_address AS token_address,"from",