Query editor
-- DuneSQL (Trino)-- Parameter:-- {{as_of_datetime}} (UI input like "2026-02-02 00:00:00")-- Interpreted as UTC and snapped to 00:00:00 UTC of that day.WITHconst AS (SELECT0x834560F580764Bc2e0B16925F8bF229bb00cB759 AS trp_multisig,0x5a98fcbea516cf06857215779fd812ca3bef1b32 AS ldo_token,-- VestingEscrowInitialized0x2d30caaf2a01e6264cf4671ca427c07d01ad37075b1830726c7004e291faf896 AS topic_escrow_initialized,-- UnvestedTokensRevoked0xf23abb1803813c60f11b7ce4b5ae745d16ce0d99b71cf034c699d6634d0a9613 AS topic_unvested_revoked,-- Parse param safely (force to string literal), treat as UTC, truncate to midnight UTCdate_trunc('day',with_timezone(CAST('{{as_of_datetime}}' AS timestamp), 'UTC')) AS as_of_datetime_utc,CAST(to_unixtime(date_trunc('day', with_timezone(CAST('{{as_of_datetime}}' AS timestamp), 'UTC'))) AS BIGINT) AS as_of_ts),-- 1) All VestingEscrowInitialized logs for LDO escrows (no factory filter)escrow_inits_raw AS (SELECTl.tx_hash,l.block_time AS init_block_time,l.contract_address AS escrow,-- indexed args (topic2 = recipient, topic3 = token)bytearray_substring(l.topic2, 13, 20) AS recipient,bytearray_substring(l.topic3, 13, 20) AS token,-- non-indexed args (data slots)bytearray_to_uint256(bytearray_substring(l.data, 1, 32)) AS amount_raw,bytearray_to_uint256(bytearray_substring(l.data, 33, 32)) AS start_time,bytearray_to_uint256(bytearray_substring(l.data, 65, 32)) AS end_time,bytearray_to_uint256(bytearray_substring(l.data, 97, 32)) AS cliff_lengthFROM ethereum.logs lCROSS JOIN const cWHERE l.topic0 = c.topic_escrow_initializedAND bytearray_substring(l.topic3, 13, 20) = c.ldo_token),-- 2) All LDO transfers out of TRP multisig, limited up to as_of midnight UTCtrp_multisig_ldo_out AS (SELECTt.evt_block_time AS block_time,t."to" AS to_addr,t.valueFROM erc20_ethereum.evt_Transfer tCROSS JOIN const cWHERE t.contract_address = c.ldo_token