Query editor
WITH borrow_events AS (SELECT'Ethereum' AS network,block_time,tx_hash,bytearray_substring(data, 13, 20) AS borrower,CAST(bytearray_to_uint256(bytearray_substring(data, 33, 32)) AS DOUBLE) / 1e18 AS amount_warsFROM ethereum.logsWHERE block_date >= CAST(date_trunc('month', current_date) AS DATE)AND contract_address = 0xf80eeec09f417fa7fcc4a848ef03af9df2658d7bAND topic0 = 0x13ed6866d4e1ee6da46f845c46d7e54120883d75c5ea9a2dacc1c4ca8984ab80UNION ALLSELECT'World Chain' AS network,block_time,tx_hash,bytearray_substring(data, 13, 20) AS borrower,CAST(bytearray_to_uint256(bytearray_substring(data, 33, 32)) AS DOUBLE) / 1e18 AS amount_warsFROM worldchain.logsWHERE block_date >= CAST(date_trunc('month', current_date) AS DATE)AND contract_address = 0xf36749472ad6da1ccf9ede8ff321654990635ffaAND topic0 = 0x13ed6866d4e1ee6da46f845c46d7e54120883d75c5ea9a2dacc1c4ca8984ab80UNION ALLSELECT'Base' AS network,block_time,tx_hash,bytearray_substring(data, 13, 20) AS borrower,CAST(bytearray_to_uint256(bytearray_substring(data, 33, 32)) AS DOUBLE) / 1e18 AS amount_warsFROM base.logsWHERE block_date >= CAST(date_trunc('month', current_date) AS DATE)AND contract_address = 0x304cc2588850a59ec1e59a998ce883de0e884d23AND topic0 = 0x13ed6866d4e1ee6da46f845c46d7e54120883d75c5ea9a2dacc1c4ca8984ab80)SELECTCOUNT(*) AS borrows_this_month,COUNT(DISTINCT tx_hash) AS transactions_this_month,COUNT(DISTINCT borrower) AS unique_addresses_this_month,SUM(amount_wars) AS gross_volume_wars_this_month,COUNT(DISTINCT network) AS active_networks,MAX(block_time) AS data_updated_through_utcFROM borrow_events