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.*/WITHdeposits AS (SELECTDATE_TRUNC('month', token1.evt_block_time) AS month_d,token2.symbol AS token_d,token2.contract_address AS contract_address_d,SUM(CAST(value AS DOUBLE) / POWER(10, token2.decimals)) AS amount_dFROMerc20_polygon.evt_Transfer AS token1LEFT JOIN tokens.erc20 AS token2 ON token1.contract_address = token2.contract_addressWHERE"to" = 0x19B620929f97b7b990801496c3b361CA5dEf8C71AND (blockchain = 'polygon')GROUP BY1,2,3ORDER BYmonth_d DESC NULLS FIRSTLIMIT1000000),withdraws AS (SELECTDATE_TRUNC('month', token1.evt_block_time) AS month_w,token2.symbol AS token_w,token2.contract_address AS contract_address_w,SUM(CAST(value AS DOUBLE) / POWER(10, token2.decimals)) AS amount_wFROMerc20_polygon.evt_Transfer AS token1LEFT JOIN tokens.erc20 AS token2 ON token1.contract_address = token2.contract_addressWHERE"from" = 0x19B620929f97b7b990801496c3b361CA5dEf8C71AND (blockchain = 'polygon')GROUP BY1,2,3ORDER BYmonth_w DESC NULLS FIRSTLIMIT100000),p AS (SELECT*FROMprices.usd