Query editor
-- This query has been migrated to run on DuneSQL.-- If you need to change back because you’re seeing issues, use the Query History view to restore the previous version.-- If you notice a regression, please email [email protected].WITHinbound AS (SELECTDATE_TRUNC('day', block_time) AS day,SUM(cast(rad as int256) / CAST(1e45 AS DOUBLE)) AS inbFROMmaker_ethereum.VAT_call_moveLEFT JOIN ethereum."transactions" AS tx ON call_tx_hash = tx.hashWHEREdst = 0x197e90f9fad81970ba7976f33cbd77088e5d7cf7AND call_successGROUP BY1ORDER BY1 DESC),outbound AS (SELECTDATE_TRUNC('day', block_time) AS day,SUM(- cast(rad as int256) / CAST(1e45 AS DOUBLE)) AS outbFROMmaker_ethereum.VAT_call_moveLEFT JOIN ethereum."transactions" AS tx ON call_tx_hash = tx.hashWHEREsrc = 0x197e90f9fad81970ba7976f33cbd77088e5d7cf7AND call_successGROUP BY1ORDER BY1 DESC)SELECTinbound.day,SUM(inb + outb) AS net_dsr,SUM(SUM(inb + outb)) OVER (ORDER BYinbound.day) AS cumulative_dsr_depositsFROMinboundLEFT JOIN outbound ON inbound.day = outbound.dayGROUP BY1ORDER BY1 DESCLIMIT50