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/withpair_tokens as (select token0, token1from uniswap_v2_ethereum.Factory_evt_PairCreatedwhere pair = {{Pair Address}}), all_router_swaps as (select call_tx_hash, path from uniswap_v2_ethereum.Router02_call_swapETHForExactTokensunion allselect call_tx_hash, path from uniswap_v2_ethereum.Router02_call_swapExactETHForTokensunion allselect call_tx_hash, path from uniswap_v2_ethereum.Router02_call_swapExactETHForTokensSupportingFeeOnTransferTokensunion allselect call_tx_hash, path from uniswap_v2_ethereum.Router02_call_swapExactTokensForETHunion allselect call_tx_hash, path from uniswap_v2_ethereum.Router02_call_swapExactTokensForETHSupportingFeeOnTransferTokensunion allselect call_tx_hash, path from uniswap_v2_ethereum.Router02_call_swapExactTokensForTokensunion allselect call_tx_hash, path from uniswap_v2_ethereum.Router02_call_swapExactTokensForTokensSupportingFeeOnTransferTokensunion allselect call_tx_hash, path from uniswap_v2_ethereum.Router02_call_swapTokensForExactETHunion allselect call_tx_hash, path from uniswap_v2_ethereum.Router02_call_swapTokensForExactETHunion allselect call_tx_hash, path from uniswap_v2_ethereum.Router02_call_swapTokensForExactTokens), paths_nondirect as (selectp.*, s.path[1] as first_token, s.path[cardinality(path)] as last_token, s.call_tx_hash as tx_hash, s.path as full_pathfrom all_router_swaps s, pair_tokens pwhere cardinality(s.path) > 2and (contains_sequence(s.path, array[p.token0, p.token1])or contains_sequence(s.path, array[p.token1, p.token0]))), final as (selectconcat(coalesce(tk0.symbol, first_token), '/', coalesce(tk1.symbol, last_token)) as path_symbols, count(*) as times_routed, arbitrary(tx_hash) as example_hashfrom paths_nondirect pnleft join tokens.erc20 tk0 on tk0.contract_address = pn.first_token and tk0.blockchain = 'ethereum'left join tokens.erc20 tk1 on tk1.contract_address = pn.last_token and tk1.blockchain = 'ethereum'group by 1order by 2 DESC