Query editor
withpair_tokens as (selecttoken0, 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_swapETHForExactTokenswhere call_success union allselect call_tx_hash, path from uniswap_v2_ethereum.Router02_call_swapExactETHForTokenswhere call_success union allselect call_tx_hash, path from uniswap_v2_ethereum.Router02_call_swapExactETHForTokensSupportingFeeOnTransferTokenswhere call_success union allselect call_tx_hash, path from uniswap_v2_ethereum.Router02_call_swapExactTokensForETHwhere call_success union allselect call_tx_hash, path from uniswap_v2_ethereum.Router02_call_swapExactTokensForETHSupportingFeeOnTransferTokenswhere call_success union allselect call_tx_hash, path from uniswap_v2_ethereum.Router02_call_swapExactTokensForTokenswhere call_success union allselect call_tx_hash, path from uniswap_v2_ethereum.Router02_call_swapExactTokensForTokensSupportingFeeOnTransferTokenswhere call_success union allselect call_tx_hash, path from uniswap_v2_ethereum.Router02_call_swapTokensForExactETHwhere call_success union 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])orcontains_sequence(s.path,array[p.token1,p.token0]))),final as (SELECTconcat(coalesce(tk0.symbol,cast(first_token as varchar)),'/', coalesce(tk1.symbol,cast(last_token as varchar))) 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