Query editor
with tokens(contract_address, symbol, decimals) as (values(0x0000000000000000000000000000000000000000, 'ETH', 18),(0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48, 'USDC', 6),(0xdac17f958d2ee523a2206206994597c13d831ec7, 'USDT', 6),(0x2260fac5e5542a773aa44fbcfedf7c193bc2c599, 'WBTC', 8),(0xa49d7499271ae71cd8ab9ac515e6694c755d400c, 'MUTE', 18),(0xae78736cd615f374d3085123a210448e74fc6393, 'rETH', 18),(0x5f98805a4e8be255a32880fdec7f6728c6568ba0, 'LUSD', 18)), prices as (with tmp as (select date_trunc('day', minute) as day,if(symbol = 'WETH', 'ETH', symbol) as symbol, avg(price) as pricefrom prices.usdwhere blockchain = 'ethereum' and minute >= timestamp '2023-2-14'and symbol in ('WETH', 'USDC', 'USDT', 'WBTC', 'rETH', 'LUSD')group by 1,2unionselect date_trunc('day', block_time) as day, 'MUTE' as symbol,avg(amount_usd/token_bought_amount) as pricefrom uniswap_v2_ethereum.tradeswhere block_time >= timestamp '2023-2-14'and project_contract_address = 0x0efb424c465dbd0a626359d63412838f727f2c25and token_bought_address = 0xa49d7499271ae71cd8ab9ac515e6694c755d400cgroup by 1,2),tmp2 as (select day, symbol, price,lead(day, 1, date_trunc('day', now() + interval '1' day)) over (partition by symbol order by day) as next_dayfrom tmp),days as(with days_seq as (select sequence(timestamp '2023-2-14', date_trunc('day', cast(now() as timestamp)) , interval '1' day) as day)select days.day from days_seq cross join unnest(day) as days(day))select a.day, b.symbol, b.pricefrom days a left join tmp2 b on a.day >= b.day and a.day < b.next_day), dws as (select evt_block_time as block_time, "from" as user,l1Token as token_address, cast(amount as double) as raw_amount,'deposit' as tx_typefrom zksync_v2_ethereum.L1ERC20Bridge_evt_DepositInitiatedunionselect evt_block_time as block_time, "to" as user,l1Token as token_address, cast(amount as double) * -1 as raw_amount,'withdraw' as tx_typefrom zksync_v2_ethereum.L1ERC20Bridge_evt_WithdrawalFinalizedunionselect block_time, bytearray_substring(data, 205, 20) as user,0x0000000000000000000000000000000000000000 as token_address,cast(bytearray_to_uint256(bytearray_substring(data, 449, 32)) as double) as raw_amount,'deposit' as tx_typefrom ethereum.logswhere block_time >= timestamp '2023-2-14 10:11'and contract_address = 0x32400084c286cf3e17e7b677ea9583e60a000324