Query editor
-- This query used incompatible data types from Dune SQL alpha and may need to be updated.-- More details can be found on https://dune.com/docs/query/dunesql-changes/withaave_v3 as (selectdate_trunc('day',w.evt_block_time) as time, w.reserve as reserve-- , tk.symbol as symbol, sum(cast(w.amount as double)) as amount_withdraw-- , tk.decimals as decimalsfrom aave_v3_ethereum.Pool_evt_Withdraw w--LEFT JOIN tokens.erc20 tk ON tk.contract_address = w.reservegroup by 1, 2), aave_v2 as (selectdate_trunc('day',w.evt_block_time) as time, w.reserve as reserve-- , tk.symbol as symbol, sum(cast(w.amount as double)) as amount_withdraw-- , tk.decimals as decimalsfrom aave_v2_ethereum.LendingPool_evt_Withdraw w--LEFT JOIN tokens.erc20 tk ON tk.contract_address = w.reservegroup by 1, 2), aave_v3_usd as (selectv3.time as time-- , v3.reserve as reserve--, v3.symbol as symbol--, v3.amount_withdraw as amount_withdraw-- , tk.decimals as decimals, sum(v3.amount_withdraw / pow(10,COALESCE(tk.decimals,18)) * p.price) as token_withdraw_v3_usdfrom aave_v3 as v3LEFT JOIN tokens.erc20 tk ON tk.contract_address = v3.reserveLEFT JOIN prices.usd p ON p.minute = date_trunc('minute',v3.time) AND p.blockchain = 'ethereum' AND p.contract_address = v3.reservegroup by 1), aave_v2_usd as (selectv2.time as time-- , v2.reserve as reserve-- , v2.symbol as symbol-- , v2.amount_withdraw as amount_withdraw-- , tk.decimals as decimals, sum(v2.amount_withdraw / pow(10,COALESCE(tk.decimals,18)) * p.price) as token_withdraw_v2_usdfrom aave_v2 as v2LEFT JOIN tokens.erc20 tk ON tk.contract_address = v2.reserveLEFT JOIN prices.usd p ON p.minute = date_trunc('minute',v2.time) AND p.blockchain = 'ethereum' AND p.contract_address = v2.reservegroup by 1)