Query editor
WITH smart_accounts AS (SELECT DISTINCT account_address AS account, blockchain, 'Nexus' AS implementationFROM dune.rhinestone_dev.result_nexus_accountsUNION ALLSELECT DISTINCT account_address AS account, blockchain, 'Safe' AS implementationFROM dune.rhinestone_dev.result_safe_7579_accountsUNION ALLSELECT DISTINCT account_address AS account, blockchain, 'Etherspot' AS implementationFROM dune.rhinestone_dev.result_etherspot_accounts_addressUNION ALLSELECT DISTINCT account_address AS account, blockchain, 'Kernel' AS implementationFROM dune.rhinestone_dev.result_zero_dev_kernel_acccounts), inflows AS (SELECTDATE_TRUNC('day', t.block_time) AS date_time, t.blockchain, sa.implementation, SUM(t.amount_usd) AS inflowFROM tokens.transfers tINNER JOIN smart_accounts saON t."to" = sa.accountAND t.blockchain = sa.blockchainWHERE t.block_time >= TIMESTAMP '2023-12-01'AND t.amount_usd IS NOT NULLGROUP BY 1,2,3), outflows AS (SELECTDATE_TRUNC('day', t.block_time) AS date_time, t.blockchain, sa.implementation, SUM(t.amount_usd) AS outflowFROM tokens.transfers tINNER JOIN smart_accounts saON t."from" = sa.accountAND t.blockchain = sa.blockchainWHERE t.block_time >= TIMESTAMP '2023-12-01'AND amount_usd IS NOT NULLGROUP BY 1,2,3), daily_volume AS (SELECTCOALESCE(i.date_time, o.date_time) AS date_time, COALESCE(i.blockchain, o.blockchain) AS blockchain, COALESCE(i.implementation, o.implementation) AS implementation, COALESCE(i.inflow, 0) + COALESCE(o.outflow, 0) AS daily_volumeFROM inflows iFULL OUTER JOIN outflows oON i.date_time = o.date_timeAND i.blockchain = o.blockchainAND i.implementation = o.implementation)