Query editor
WITHdeployed_vaults_v2 AS (SELECT*FROMy2k_arbitrum.CarouselFactory_evt_MarketCreated),deployed_vaults_v1 as (select*from y2k_arbitrum.VaultFactory_evt_MarketCreated),vaults as (selectcollateralfrom deployed_vaults_v2union allselectpremiumfrom deployed_vaults_v2union allselecthedgefrom deployed_vaults_v1union allselectriskfrom deployed_vaults_v1),transfers_erc_20 as (select"from" as user,evt_block_time,evt_tx_hash,contract_address,"to","from",-cast(value/1e18 as double) as amountfrom erc20_arbitrum.evt_Transferwhere "to" in (select * from vaults)and "from" not in (select * from vaults)and not "from" = 0x0000000000000000000000000000000000000000and contract_address in (0x82aF49447D8a07e3bd95BD0d56f35241523fBab1, -- weth0x912CE59144191C1204E64559FE8253a0e49E6548 -- arb)union allselect"to" as user,evt_block_time,evt_tx_hash,contract_address,"to","from",cast(value/1e18 as double) as amountfrom erc20_arbitrum.evt_Transfer