Query editor
WITH bridge_txns AS (SELECT blockchain, contract_address, evt_tx_hash, evt_index, evt_block_time, evt_block_number, transactionId, integrator, referrer, receiver, fromAssetId, toAssetId, fromAmount, toAmountFROM (SELECT 'arbitrum' AS blockchain, contract_address, evt_tx_hash, evt_index, evt_block_time, evt_block_number, transactionId, integrator, referrer, receiver, fromAssetId, toAssetId, fromAmount, toAmountFROM lifi_arbitrum.LiFiDiamond_v2_evt_LiFiGenericSwapCompletedUNION ALLSELECT 'ethereum' AS blockchain, contract_address, evt_tx_hash, evt_index, evt_block_time, evt_block_number, transactionId, integrator, referrer, receiver, fromAssetId, toAssetId, fromAmount, toAmountFROM lifi_ethereum.LiFiDiamond_v2_evt_LiFiGenericSwapCompletedUNION ALLSELECT 'optimism' AS blockchain, contract_address, evt_tx_hash, evt_index, evt_block_time, evt_block_number, transactionId, integrator, referrer, receiver, fromAssetId, toAssetId, fromAmount, toAmountFROM lifi_optimism.LiFiDiamond_v2_evt_LiFiGenericSwapCompletedUNION ALLSELECT 'polygon' AS blockchain, contract_address, evt_tx_hash, evt_index, evt_block_time, evt_block_number, transactionId, integrator, referrer, receiver, fromAssetId, toAssetId, fromAmount, toAmountFROM lifi_polygon.LiFiDiamond_v2_evt_LiFiGenericSwapCompletedUNION ALLSELECT 'avalanche' AS blockchain, contract_address, evt_tx_hash, evt_index, evt_block_time, evt_block_number, transactionId, integrator, referrer, receiver, fromAssetId, toAssetId, fromAmount, toAmountFROM lifi_avalanche_c.LiFiDiamond_v2_evt_LiFiGenericSwapCompletedUNION ALLSELECT 'bnb' AS blockchain, contract_address, evt_tx_hash, evt_index, evt_block_time, evt_block_number, transactionId, integrator, referrer, receiver, fromAssetId, toAssetId, fromAmount, toAmountFROM lifi_bnb.LiFiDiamond_v2_evt_LiFiGenericSwapCompletedUNION ALLSELECT 'fantom' AS blockchain, contract_address, evt_tx_hash, evt_index, evt_block_time, evt_block_number, transactionId, integrator, referrer, receiver, fromAssetId, toAssetId, fromAmount, toAmountFROM lifi_fantom.LiFiDiamond_v2_evt_LiFiGenericSwapCompletedUNION ALLSELECT 'gnosis' AS blockchain, contract_address, evt_tx_hash, evt_index, evt_block_time, evt_block_number, transactionId, integrator, referrer, receiver, fromAssetId, toAssetId, fromAmount, toAmountFROM lifi_gnosis.LiFiDiamond_v2_evt_LiFiGenericSwapCompletedUNION ALLSELECT 'base' AS blockchain, contract_address, evt_tx_hash, evt_index, evt_block_time, evt_block_number, transactionId, integrator, referrer, receiver, fromAssetId, toAssetId, fromAmount, toAmountFROM lifi_base.LiFiDiamond_v2_evt_LiFiGenericSwapCompletedUNION ALLSELECT 'celo' AS blockchain, contract_address, evt_tx_hash, evt_index, evt_block_time, evt_block_number, transactionId, integrator, referrer, receiver, fromAssetId, toAssetId, fromAmount, toAmountFROM lifi_celo.LiFiDiamond_v2_evt_LiFiGenericSwapCompletedUNION ALLSELECT 'zksync' AS blockchain, contract_address, evt_tx_hash, evt_index, evt_block_time, evt_block_number, transactionId, integrator, referrer, receiver, fromAssetId, toAssetId, fromAmount, toAmountFROM lifi_zksync.LiFiDiamond_v2_evt_LiFiGenericSwapCompletedUNION ALLSELECT 'zkevm' AS blockchain, contract_address, evt_tx_hash, evt_index, evt_block_time, evt_block_number, transactionId, integrator, referrer, receiver, fromAssetId, toAssetId, fromAmount, toAmountFROM lifi_zkevm.LiFiDiamond_v2_evt_LiFiGenericSwapCompleted) AS combined_txnsWHERE integrator = 'cryptex-finance'),bridge_txns_ext AS (SELECTb.*,CASEWHEN b.fromAssetId = 0x0000000000000000000000000000000000000000 THEN 'WETH'ELSE t.symbolEND AS symbol_from,CASEWHEN b.toAssetId = 0x0000000000000000000000000000000000000000 THEN 'WETH'ELSE t2.symbolEND AS symbol_to,COALESCE(b.blockchain, t.blockchain) AS from_blockchain,COALESCE(b.blockchain, t2.blockchain) AS to_blockchain,t.decimals AS from_decimals,t2.decimals AS to_decimalsFROM bridge_txns bLEFT JOIN tokens.erc20 t ON b.fromAssetId = t.contract_address AND b.blockchain = t.blockchainLEFT JOIN tokens.erc20 t2 ON b.toAssetId = t2.contract_address AND b.blockchain = t2.blockchain