Query editor
WITH all_borrow_events AS (SELECT 'wARS' AS asset, '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 amountFROM ethereum.logsWHERE block_date >= DATE '2025-08-01'AND contract_address = 0xf80eeec09f417fa7fcc4a848ef03af9df2658d7bAND topic0 = 0x13ed6866d4e1ee6da46f845c46d7e54120883d75c5ea9a2dacc1c4ca8984ab80UNION ALLSELECT 'wARS', 'World Chain', block_time, tx_hash,bytearray_substring(data, 13, 20),CAST(bytearray_to_uint256(bytearray_substring(data, 33, 32)) AS DOUBLE) / 1e18FROM worldchain.logsWHERE block_date >= DATE '2025-08-01'AND contract_address = 0xf36749472ad6da1ccf9ede8ff321654990635ffaAND topic0 = 0x13ed6866d4e1ee6da46f845c46d7e54120883d75c5ea9a2dacc1c4ca8984ab80UNION ALLSELECT 'wARS', 'Base', block_time, tx_hash,bytearray_substring(data, 13, 20),CAST(bytearray_to_uint256(bytearray_substring(data, 33, 32)) AS DOUBLE) / 1e18FROM base.logsWHERE block_date >= DATE '2025-08-01'AND contract_address = 0x304cc2588850a59ec1e59a998ce883de0e884d23AND topic0 = 0x13ed6866d4e1ee6da46f845c46d7e54120883d75c5ea9a2dacc1c4ca8984ab80UNION ALLSELECT 'wBRL', 'Ethereum', block_time, tx_hash,bytearray_substring(data, 13, 20),CAST(bytearray_to_uint256(bytearray_substring(data, 33, 32)) AS DOUBLE) / 1e18FROM ethereum.logsWHERE block_date >= DATE '2025-08-01'AND contract_address = 0x93d9ddeebf3b5dbf7d7dfc04d3804ce5450987c8AND topic0 = 0x13ed6866d4e1ee6da46f845c46d7e54120883d75c5ea9a2dacc1c4ca8984ab80UNION ALLSELECT 'wBRL', 'Base', block_time, tx_hash,bytearray_substring(data, 13, 20),CAST(bytearray_to_uint256(bytearray_substring(data, 33, 32)) AS DOUBLE) / 1e18FROM base.logsWHERE block_date >= DATE '2025-08-01'AND contract_address = 0x601222822dd82c68590a9c4a6b34df62ef361fc8AND topic0 = 0x13ed6866d4e1ee6da46f845c46d7e54120883d75c5ea9a2dacc1c4ca8984ab80),first_borrows AS (SELECT asset, borrower, MIN(block_time) AS first_borrow_timeFROM all_borrow_eventsGROUP BY 1,2),program_events AS (SELECT e.*, f.first_borrow_timeFROM all_borrow_events eJOIN first_borrows fON e.asset=f.asset AND e.borrower=f.borrowerWHERE e.block_time >= TIMESTAMP '2026-07-07 00:00:00 UTC')SELECTasset,COUNT(*) AS borrow_events_since_start,