Query editor
-- =====================================================================================-- Sablier Lockup — unified stream-creation decoder across ALL versions, from raw logs-- Covers: v1.2 (3 separate contracts, flat layout) + v2.0 / v3.0 / v4.0 (singleton,-- commonParams dynamic-tuple layout) — plus the `shape` string (v2.0+).---- Anchored on contract addresses + event topic0s only (no Sablier Dune spell tables).-- All addresses/blocks/topic0s and byte offsets were derived from the on-chain ABIs-- and validated against ABI-encoded sample events.---- Notes on the singleton (v2.0+):-- * Only `streamId` is indexed now -> read from topic1; everything else is in `data`.-- * `commonParams` is a DYNAMIC tuple (holds `string shape`), so its position is an-- offset pointer (data word 0). We read `cp` = that offset, then slice fields-- relative to `cp`. `shape` is itself an offset within commonParams.-- * v2.0 commonParams = (funder,sender,recipient,(deposit,brokerFee),token,cancelable,-- transferable,(start,end),shape,broker) -> token@cp+173, start@cp+257, shape word10.-- * v3.0/v4.0 commonParams = (funder,sender,recipient,depositAmount,token,cancelable,-- transferable,(start,end),shape) -> token@cp+141, start@cp+225, shape word9.-- * PriceGated (v4.0) is a sparse companion event; the actual stream is still logged as-- a CreateLockupLinearStream, so it is captured here without special handling.-- * Amounts shown as /1e18 (FOX). For other tokens, join tokens.erc20 for decimals.-- =====================================================================================WITH logs_raw AS (SELECT block_time AS evt_block_time, tx_hash, contract_address, topic0, topic1, topic2, topic3, dataFROM ethereum.logsWHERE block_number >= 20240097AND contract_address IN (0x3962f6585946823440d274ad7c719b02b49de51e, -- v1.2 Linear0x9deabf7815b42bf4e9a03eec35a486ff74ee7459, -- v1.2 Dynamic0xf86b359035208e4529686a1825f2d5bee38c28a8, -- v1.2 Tranched0x7c01aa3783577e15fd7e272443d44b92d5b21056, -- v2.0 SablierLockup0xcf8ce57fa442ba50acbc57147a62ad03873ffa73, -- v3.0 SablierLockup0x93b37bd5b6b278373217333ac30d7e74c85fbdcb -- v4.0 SablierLockup)AND topic0 IN (0x44cb432df42caa86b7ec73644ab8aec922bc44c71c98fc330addc75b88adbc7c, -- v1.2 Linear0x33eb09bbf19ea3fb22c760d5164234f8bf62ca07dcf5a437ad389e96b0bd6443, -- v1.2 Dynamic0xfeb1cb9ce021c8bd5fb1eb836e6284c68866fa32d1d844238de19955238f8076, -- v1.2 Tranched0xcf6da1cdefbf0f0870377128cab020f3b9895ce9613b14b933bbd193d764a92e, -- v2.0 Linear0x7cb83640a329cb238b531daa26ffca31b59dd7c51020184cb4394ac43a11278c, -- v2.0 Dynamic0x1cb15a39f12b6a349f8d1d45499b7b9df63464a79fa2e294a7237107e62c384f, -- v2.0 Tranched0xc79bd540ef5a04a4ac63a943cd4fb703e8a730be1368c34f4c31bb7142bbdb3a, -- v3.0 Linear0xbc42cec3f2bd75ce97894dacc83ec6c4b682220d349b5a52d5743e7b46eba2d0, -- v4.0 Linear0x0e7eb51bad11fb6392e8e6cfd568e0750bbaf84bca8bf4dceb9bcae5b46a3311, -- v3.0/v4.0 Dynamic0xb5286ba059f8139658108ff5a9617e2ba55bd80fb2dd93063f9f9bc0e65c4c2a -- v3.0/v4.0 Tranched)),-- ------------------------------------------------------------------ v1.2 : flat, indexed topicsv12 AS (SELECT'v1.2' AS version,CASE topic0WHEN 0x44cb432df42caa86b7ec73644ab8aec922bc44c71c98fc330addc75b88adbc7c THEN 'linear'WHEN 0x33eb09bbf19ea3fb22c760d5164234f8bf62ca07dcf5a437ad389e96b0bd6443 THEN 'dynamic'ELSE 'tranched'END AS model,CAST(NULL AS VARCHAR) AS shape, -- no shape string before v2.0bytearray_substring(topic1, 13, 20) AS sender,