Query editor
/* Migration success :)There are some cases such as unnest/sequence and array/json functions the migrator won't take care of for you(but we have examples of in the docs linked below!)If you're still running into issues, check out the doc examples https://dune.com/docs/reference/dune-v2/query-engine/or reach out to us in the Dune discord in the #dune-sql channel.*//* !Generated view warning: you can't query v1 views anymore. All queries in dune SQL are by default views though (try querying the table 'query_1747157') */WITHlocks AS (SELECTDATE_TRUNC('day', evt_block_time) AS dt,SUM(CAST(value AS DOUBLE) / 1e18) AS depositsFROMcurvefi_ethereum.voting_escrow_evt_DepositGROUP BY1),unlocks AS (SELECTDATE_TRUNC('day', evt_block_time) AS dt,SUM(CAST(value AS DOUBLE) / 1e18) AS withdrawalsFROMcurvefi_ethereum.voting_escrow_evt_WithdrawGROUP BY1),m AS (SELECT*,SUM(daily_net_locks) OVER (ORDER BYdt) AS total_net_lockedFROM(SELECTl.dt,COALESCE(deposits, 0) - COALESCE(withdrawals, 0) AS daily_net_locksFROMlocks AS lLEFT JOIN unlocks AS u ON l.dt = u.dt) AS sub),fin AS (SELECT*,CASEWHEN dt < CAST('2020-11-22' AS TIMESTAMP) THEN NULLELSE AVG(daily_lr) OVER (ORDER BYdt ROWS BETWEEN 99 PRECEDINGAND CURRENT ROW)END AS daily_lr_MA,CASEWHEN dt < CAST('2020-11-22' AS TIMESTAMP) THEN NULLELSE AVG(daily_lr) OVER (ORDER BY