Query editor
WITH raw AS (SELECTblock_time AS evt_block_time,tx_hash, topic0, topic1, topic2, topic3, dataFROM ethereum.logsWHERE block_number >= 20240097AND contract_address IN (0x3962f6585946823440d274ad7c719b02b49de51e, -- linear0x9deabf7815b42bf4e9a03eec35a486ff74ee7459, -- dynamic0xf86b359035208e4529686a1825f2d5bee38c28a8 -- tranched)AND topic0 IN (0x44cb432df42caa86b7ec73644ab8aec922bc44c71c98fc330addc75b88adbc7c,0x33eb09bbf19ea3fb22c760d5164234f8bf62ca07dcf5a437ad389e96b0bd6443,0xfeb1cb9ce021c8bd5fb1eb836e6284c68866fa32d1d844238de19955238f8076)),decoded AS (SELECTevt_block_time,tx_hash,CASE topic0WHEN 0x44cb432df42caa86b7ec73644ab8aec922bc44c71c98fc330addc75b88adbc7c THEN 'linear'WHEN 0x33eb09bbf19ea3fb22c760d5164234f8bf62ca07dcf5a437ad389e96b0bd6443 THEN 'dynamic'ELSE 'tranched'END AS shape,-- indexed params (identical across shapes)bytearray_substring(topic1, 13, 20) AS sender,bytearray_substring(topic2, 13, 20) AS recipient,bytearray_substring(topic3, 13, 20) AS asset,-- shared head words (identical offsets across all three shapes)bytearray_to_uint256(bytearray_substring(data, 1, 32)) AS stream_id,bytearray_substring(data, 45, 20) AS funder,bytearray_to_uint256(bytearray_substring(data, 65, 32)) AS deposit_raw,bytearray_to_uint256(bytearray_substring(data, 97, 32)) AS broker_fee_raw,bytearray_to_uint256(bytearray_substring(data, 129, 32)) <> 0 AS cancelable,bytearray_to_uint256(bytearray_substring(data, 161, 32)) <> 0 AS transferable,-- start: linear @ word6 (byte 193); dynamic/tranched @ word7 (byte 225)CASE WHEN topic0 = 0x44cb432df42caa86b7ec73644ab8aec922bc44c71c98fc330addc75b88adbc7cTHEN bytearray_to_uint256(bytearray_substring(data, 193, 32))ELSE bytearray_to_uint256(bytearray_substring(data, 225, 32))END AS start_ts,-- cliff: linear only (@ word7, byte 225); NULL for dynamic/tranchedCASE WHEN topic0 = 0x44cb432df42caa86b7ec73644ab8aec922bc44c71c98fc330addc75b88adbc7cTHEN bytearray_to_uint256(bytearray_substring(data, 225, 32))END AS cliff_ts,-- end: word8 (byte 257) for all threebytearray_to_uint256(bytearray_substring(data, 257, 32)) AS end_ts,bytearray_substring(data, 301, 20) AS brokerFROM raw)SELECT evt_block_time, shape, sender, funder, recipient, asset,deposit_raw / 1e18 AS amount,from_unixtime(start_ts) AS vest_start,from_unixtime(end_ts) AS vest_end,CASE WHEN cliff_ts IS NULL OR cliff_ts = 0 THEN NULLELSE from_unixtime(cliff_ts) END AS cliff,cancelable, transferable, stream_idFROM decoded-- WHERE asset = 0xc770eefad204b5180df6a14ee197d99d808ee52d -- FOX; drop to see all tokens