Query editor
WITH creditAccounts as (select distinctaccount as addressfrom gearbox_ethereum.AccountFactory_evt_NewCreditAccount),CA_transfers as (-- Tokens FROM Credit Accountsselect-value as amount,contract_address as token,evt_block_time,evt_tx_hash,c.address,NULL as poolidFROM erc20_ethereum.evt_Transfer t, creditAccounts cwhere t."from" = c.addressand evt_block_time > date( '2023-12-01' )and contract_address IN (0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee,--weETH0xbf5495Efe5DB9ce00f80364C8B423567e58d2110,--ezETH0xa1290d69c65a6fe4df752f95823fae25cb99e5a7 --rsETH)UNION ALLselectvalue as amount,contract_address as token,evt_block_time,evt_tx_hash,address,NULL as poolidFROM erc20_ethereum.evt_Transfer t, creditAccounts cwhere t."to" = c.addressand evt_block_time > date( '2023-12-01' )and contract_address IN (0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee,--weETH0xbf5495Efe5DB9ce00f80364C8B423567e58d2110,--ezETH0xa1290d69c65a6fe4df752f95823fae25cb99e5a7 --rsETH)),days as (select distinctDATE_TRUNC('day',time) as dayfrom evms.blockswhere blockchain = 'ethereum'and time > date( '2023-12-20')),v3_open as (selectcreditAccount,onBehalfOf as owner,contract_address as facade,evt_block_time as open_time,evt_block_number as open_blockfrom gearbox_ethereum.CreditFacade_V3_evt_OpenCreditAccountUNION ALLselectcreditAccount,onBehalfOf as owner,