Query editor
withstatic as (selectbegin['{{src blockchain}}'] as ts_from, date_trunc('{{timebox}}', timestamp '{{displayed period from}}') as displayed_from, depth['{{timebox}}'] as depth_back_seconds, to_unixtime(next['{{timebox}}']) - to_unixtime(now()) as seconds_left_in_timeboxfrom query_3298581), swaps as (selectorder_hash, user, amount_usd, blockchain, date_trunc('{{timebox}}', block_time) as time, block_time > date_add('second', -(select depth_back_seconds from static), now()) as last_period, row_number() over(partition by user order by block_time) as user_rn_asc, row_number() over(partition by user order by block_time desc) as user_rn_desc, rank() over(partition by user order by date_trunc('{{timebox}}', block_time)) as user_timebox_rnk, coalesce(element_at(flags, 'first'), true) as first_execution, count(*) over(partition by order_hash) as order_fillsfrom oneinch.swapswheretx_success and call_successand if('{{src blockchain}}' = 'all', true, blockchain = '{{src blockchain}}')and flags['cross_chain']and dst_blockchain is not null-- TEMP -- SOL<>EVM cross-chain swaps-- union all-- select-- order_hash-- , user-- , amount_usd-- , blockchain-- , date_trunc('{{timebox}}', block_time) as time-- , block_time > date_add('second', -(select depth_back_seconds from static), now()) as last_period-- , row_number() over(partition by user order by block_time) as user_rn_asc-- , row_number() over(partition by user order by block_time desc) as user_rn_desc-- , rank() over(partition by user order by date_trunc('{{timebox}}', block_time)) as user_timebox_rnk-- , true as first_execution -- mock-- , count(*) over(partition by order_hash) as order_fills-- from (-- -- evm -> sol-- select blockchain, dst_blockchain, order_hash, src_user as user, src_block_time as block_time, src_tx_hash as tx_hash, coalesce(src_amount_usd, dst_amount_usd) amount_usd from query_5687094-- union all-- -- sol -> evm-- select blockchain, dst_blockchain, order_hash, dst_user as user, src_block_time as block_time, dst_tx_hash as tx_hash, coalesce(src_amount_usd, dst_amount_usd) amount_usd from query_5687238-- )), agg as (selecttime, count_if(first_execution) as swaps_total