Query editor
with add_transfer as(select evt_tx_hashfrom erc20_bnb.evt_transfer awhere a.to = 0x855B9cBF30CCE55D0764c8F2fD25414f1079dAD7),remove_transfer as(select evt_tx_hashfrom erc20_bnb.evt_transfer awhere a."from" = 0x855B9cBF30CCE55D0764c8F2fD25414f1079dAD7),add_call as(select call_tx_hash as tx_hash,'add' as type,to as liquidity_provider,case when tokenA = 0x74da4c5f8c254dd4fb39f9804c0924f52a808318 then tokenA else 0x74da4c5f8c254dd4fb39f9804c0924f52a808318 end as tokenA,case when tokenB = 0x8d0d000ee44948fc98c9b98a4fa4921476f08b0d then tokenB else 0x8d0d000ee44948fc98c9b98a4fa4921476f08b0d end as tokenB,case when tokenA = 0x74da4c5f8c254dd4fb39f9804c0924f52a808318 then output_amountA else output_amountB end as output_amountA,case when tokenB = 0x8d0d000ee44948fc98c9b98a4fa4921476f08b0d then output_amountB else output_amountA end as output_amountB,output_liquidity as liquidityfrom pancakeswap_v2_bnb.pancakerouter_call_addliquiditywhere call_tx_hash in(select evt_tx_hash from add_transfer)),remove_call as(select call_tx_hash as tx_hash,'remove' as type,to as liquidity_provider,case when tokenA = 0x74da4c5f8c254dd4fb39f9804c0924f52a808318 then tokenA else 0x74da4c5f8c254dd4fb39f9804c0924f52a808318 end as tokenA,case when tokenB = 0x8d0d000ee44948fc98c9b98a4fa4921476f08b0d then tokenB else 0x8d0d000ee44948fc98c9b98a4fa4921476f08b0d end as tokenB,case when tokenA = 0x74da4c5f8c254dd4fb39f9804c0924f52a808318 then -output_amountA else -output_amountB end as output_amountA,case when tokenB = 0x8d0d000ee44948fc98c9b98a4fa4921476f08b0d then -output_amountB else -output_amountA end as output_amountB,-liquidity as liquidityfrom pancakeswap_v2_bnb.pancakerouter_call_removeliquiditywhere call_tx_hash in(select evt_tx_hash from remove_transfer)),all_evt as(select *from add_callunion allselect *from remove_call)select liquidity_provider,tokenA,tokenB,sum(output_amountA) / 1e18 as amountA,sum(output_amountB) / 1e18 as amountB,sum(liquidity) / 1e18 as liquidityfrom all_evtgroup by 1,2,3