Query editor
with withdrawt as (SELECT'withdraw' as action,block_time,tx_hash,tx_from,tx_to,l.contract_address,-- Indexed topics (first 3 topics after the signature hash)lower(CONCAT('0x', SUBSTRING(TO_HEX(topic1), 25, 40))) AS targetToken,e2.symbol as targetToken_sym,e2.decimals as targetToken_decimal,lower(CONCAT('0x', SUBSTRING(TO_HEX(topic2), 25, 40))) AS currency,e1.symbol as currency_sym,e1.decimals as currency_decimal,lower(CONCAT('0x', SUBSTRING(TO_HEX(topic3), 25, 40))) AS user,-- Non-indexed parameters (come from `data`)--varbinary_to_int256(varbinary_substring(data, 1, 32))/pow(10,e2.decimals) AS targetTokenAmount,varbinary_to_int256(varbinary_substring(data, 33, 32))/pow(10,e2.decimals) AS currencyAmountFROM bob.logs lleft join tokens.erc20 e1 on lower(CONCAT('0x', SUBSTRING(TO_HEX(topic2), 25, 40))) = LOWER(CONCAT('0x', TO_HEX(e1.contract_address)))left join tokens.erc20 e2 on lower(CONCAT('0x', SUBSTRING(TO_HEX(topic1), 25, 40))) = LOWER(CONCAT('0x', TO_HEX(e2.contract_address)))where topic0 = 0x50aa488fffd286866bc78078718365f7c3880cf5f95179a61e37cf84c5fd76c5and lower(CONCAT('0x', SUBSTRING(TO_HEX(topic1), 25, 40))) = '0x4ca70811e831db42072cba1f0d03496ef126faad'and e1.blockchain = 'bob' and e2.blockchain = 'bob'),depositt as (SELECT'deposit' as action,block_time,tx_hash,tx_from,tx_to,l.contract_address,-- Indexed topics (first 3 topics after the signature hash)lower(CONCAT('0x', SUBSTRING(TO_HEX(topic1), 25, 40))) AS targetToken,e2.symbol as targetToken_sym,e2.decimals as targetToken_decimal,lower(CONCAT('0x', SUBSTRING(TO_HEX(topic2), 25, 40))) AS currency,e1.symbol as currency_sym,e1.decimals as currency_decimal,lower(CONCAT('0x', SUBSTRING(TO_HEX(topic3), 25, 40))) AS user,-- Non-indexed parameters (come from `data`)varbinary_to_int256(varbinary_substring(data, 1, 32))/pow(10,e2.decimals) AS targetTokenAmount,varbinary_to_int256(varbinary_substring(data, 33, 32))/pow(10,e1.decimals) AS currencyAmountFROM bob.logs lleft join tokens.erc20 e1 on lower(CONCAT('0x', SUBSTRING(TO_HEX(topic2), 25, 40))) = LOWER(CONCAT('0x', TO_HEX(e1.contract_address)))left join tokens.erc20 e2 on lower(CONCAT('0x', SUBSTRING(TO_HEX(topic1), 25, 40))) = LOWER(CONCAT('0x', TO_HEX(e2.contract_address)))where topic0 = 0x6937da7733b7e101e4ab6e3a3ec12fe857d7a7ca921348ef12feff7abfcee01aand lower(CONCAT('0x', SUBSTRING(TO_HEX(topic1), 25, 40))) = '0x4ca70811e831db42072cba1f0d03496ef126faad'and e1.blockchain = 'bob' and e2.blockchain = 'bob'),pricet as (select