Query editor
with chain_0 as (-- Ethereum Trade USDC v3. Fixed cutoff makes the benchmark reproducible.-- Exact transfer/principal reconstruction; LP valuation is an explicit estimate.with events as (select cast(block_time as date) day, block_time, block_number, "index",contract_address, topic0, topic1, topic2,cast(varbinary_to_uint256(varbinary_substring(data, 1, 32)) as int256) amount,case when topic0 in (0xdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7,0xfbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db) then cast(varbinary_to_uint256(varbinary_substring(data, 1, 32)) as double)/ nullif(cast(varbinary_to_uint256(varbinary_substring(data, 33, 32)) as double), 0)end assets_per_share_rawfrom ethereum.logswhere block_time >= timestamp '2023-01-01'and block_time < timestamp '2026-09-06'and ((contract_address = 0xda00000035fef4082f78def6a8903bee419fbf8eand topic0 in (0x312a5e5e1079f5dda4e95dbbd0b908b291fd5b992ef22073643ab691572c5b52,0x2fe77b1c99aca6b022b8efc6e3e8dd1b48b30748709339b65c50ef3263443e09,0xdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7,0xfbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db,0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef))or (contract_address = 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48and topic0 = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efand (topic1 = 0x000000000000000000000000da00000035fef4082f78def6a8903bee419fbf8eor topic2 = 0x000000000000000000000000da00000035fef4082f78def6a8903bee419fbf8e)))), daily as (select day,sum(case when contract_address = 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48then (case when topic2 = 0x000000000000000000000000da00000035fef4082f78def6a8903bee419fbf8e then amount else int256 '0' end)- (case when topic1 = 0x000000000000000000000000da00000035fef4082f78def6a8903bee419fbf8e then amount else int256 '0' end)else int256 '0' end) cash_delta_raw,sum(case when contract_address = 0xda00000035fef4082f78def6a8903bee419fbf8eand topic0 = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efthen (case when topic1 = 0x0000000000000000000000000000000000000000000000000000000000000000 then amount else int256 '0' end)- (case when topic2 = 0x0000000000000000000000000000000000000000000000000000000000000000 then amount else int256 '0' end)else int256 '0' end) supply_delta_raw,sum(case topic0when 0x312a5e5e1079f5dda4e95dbbd0b908b291fd5b992ef22073643ab691572c5b52 then amountwhen 0x2fe77b1c99aca6b022b8efc6e3e8dd1b48b30748709339b65c50ef3263443e09 then -amountelse int256 '0' end) principal_delta_raw,max_by(assets_per_share_raw, row(block_number, "index"))filter (where assets_per_share_raw > 0) assets_per_share_raw,max(block_time) filter (where assets_per_share_raw > 0) ratio_observed_at,max(block_time) last_event_atfrom eventsgroup by day), calendar as (select day from unnest(sequence(date '2023-12-18', date '2026-09-05', interval '1' day)) as s(day)), balances as (select c.day,coalesce(d.cash_delta_raw, int256 '0') cash_delta_raw,coalesce(d.supply_delta_raw, int256 '0') supply_delta_raw,coalesce(d.principal_delta_raw, int256 '0') principal_delta_raw,