Query editor
-- sUSDe cooldown unstaking flow on Ethereum, in 4-hour UTC buckets, past 365 days---- sUSDe vault (StakedUSDeV2): 0x9d39a5de30e57443bff2a8307a4256c8797a3497-- USDe Silo (escrow contract): 0x7FC7c91D556B400AFa565013E3F32055a0713425-- Method: cooldownShares(uint256) -- selector 0x9343d9e1---- Definitions per 4h bucket:-- queued = USDe / sUSDe entering cooldown via cooldownShares() in that bucket-- ready = USDe / sUSDe whose cooldown ENDS in that bucket (i.e. becomes-- withdrawable via unstake()). Computed as call_block_time + cooldownDuration-- where cooldownDuration is the value active at that block.---- Cooldown duration timeline (from CooldownDurationUpdated events):-- 2023-11-20 22:16 UTC : 90d -> 7d-- 2026-03-16 11:37 UTC : 7d -> 24h---- Note: this query covers ONLY cooldownShares(). Ethena also exposes-- cooldownAssets(uint256), which produces equivalent cooldown entries.-- To include both, UNION ALL the equivalent CTE from-- ethena_labs_ethereum.stakedusdev2_call_cooldownassets (column names differ:-- it has `assets` and `output_shares`).WITH-- 1. Step-function timeline of the cooldownDuration value over timeduration_timeline AS (SELECTevt_block_time AS effective_from,newDuration AS duration_seconds,LEAD(evt_block_time) OVER (ORDER BY evt_block_time, evt_index)AS effective_untilFROM ethena_labs_ethereum.stakedusdev2_evt_cooldowndurationupdated),-- 2. Each successful cooldownShares() call, joined to the duration active at-- that block, with computed ready_at = started_at + duration_seconds.cooldowns AS (SELECTc.call_tx_hash,c.call_tx_from AS user_address,c.call_block_time AS started_at,from_unixtime(to_unixtime(c.call_block_time)+ COALESCE(d.duration_seconds, 604800) -- fallback: 7d) AS ready_at,c.shares,c.output_assets,COALESCE(d.duration_seconds, 604800) AS duration_secondsFROM ethena_labs_ethereum.stakedusdev2_call_cooldownshares cLEFT JOIN duration_timeline dON c.call_block_time >= d.effective_fromAND (d.effective_until IS NULL OR c.call_block_time < d.effective_until)WHERE c.call_success = trueAND c.call_block_date >= CURRENT_DATE - INTERVAL '365' DAY),-- 3. Emit one row per (cooldown, leg). Leg = "started" or "ready".-- Each gets tagged to its 4h UTC bucket.events AS (-- queued legSELECT