Query editor
-- 2026-11-21: matview dune.ondo_team.result_dex_usdy_ousg and its daily schedule were DELETED (~13.1k credits/month).-- Consumers 6738627 and 8862695 now read this query directly as query_8577812. Do NOT add a schedule unless the matview is recreated on purpose.-- ================================================================-- [USDY/OUSG] DEX union — USDY / rUSDY / OUSG counterpart of 6453294-- Output shape (same as result_dex_ondo):-- (block_date, trader, symbol, amount_usd, tx_hash, project, blockchain)-- Materialized daily as dune.ondo_team.result_dex_usdy_ousg.---- Sources are the standalone blocks; edit a venue THERE, not here:-- query_8577669 block 1 AMM EVM dex.trades eth/arb/mantle/bnb/sei-- query_8577676 block 2 intent/RFQ EVM dex_aggregator.trades eth/arb/bnb (cow, 1inch, 0x, bebop)-- query_8577679 block 3 Solana dex_solana.trades ~230 cr/run, the cost driver-- query_8578499 block 3b Orca swap_v2 whirlpool_solana.whirlpool_call_swap_v2 — fills the-- spell gap on the USDY/USDC(T) pools since 2026-04-13 (~5 cr)-- query_8577692 block 4 Stellar stellar.history_trades-- query_8577706 block 5 LiFi RFQ dune.lifi view eth/arb/bnb---- Dedup, one leg counted once (same policy as 6453294), done in ONE pass:-- every block gets a priority and a dedup key keeps only the rows of its best-- (lowest) priority.-- * EVM key = (blockchain, tx_hash): an intent fill (prio 1) that also shows-- up in dex.trades (prio 2) is counted once, from the intent block; a LiFi-- row (prio 3) survives only when neither block 1 nor 2 has the tx.-- * Solana key = (blockchain, tx_hash, project): block 3b (prio 1) duplicates-- block 3 (prio 0) only where the spell still decodes the same Orca swap-- (Feb–Apr 2026); a Jupiter route that splits across Orca + Manifest in one-- tx keeps BOTH legs, because they are different projects. Project is part-- of the key only on Solana — on EVM the whole point is cross-project dedup.-- * Stellar (prio 0) never shares a key with anything.-- Why a window and not NOT EXISTS: Trino re-evaluates a CTE on every reference,-- so the NOT EXISTS version scanned dex.trades twice (362 cr vs 307 cr).-- A swap with an Ondo token on BOTH sides (USDY -> rUSDY) still yields two rows,-- one per side, exactly like dex_sold + dex_bought in 6453294.---- Chains deliberately absent (checked 2026-09-01, see spec): polygon, plume,-- tempo, sui (0 rows), xrpl (real OUSG issuer has 0 swaps), aptos, noble (no-- data in Dune), hyperevm (USDY not deployed there).-- ================================================================with all_rows as (select block_date, trader, symbol, amount_usd, tx_hash, project, blockchain, 2 as priofrom query_8577669union allselect block_date, trader, symbol, amount_usd, tx_hash, project, blockchain, 1 as priofrom query_8577676union allselect block_date, trader, symbol, amount_usd, tx_hash, project, blockchain, 0 as priofrom query_8577679union allselect block_date, trader, symbol, amount_usd, tx_hash, project, blockchain, 1 as priofrom query_8578499union allselect block_date, trader, symbol, amount_usd, tx_hash, project, blockchain, 0 as priofrom query_8577692union allselect block_date, trader, symbol, amount_usd, tx_hash, project, blockchain, 3 as priofrom query_8577706),ranked as (select