Query editor
with pcs_pools as (select pair as pool, 0 as fee, 'bnb' as chain, evt_block_time as dtfrom pancakeswap_v2_bnb.pancakefactory_evt_paircreated aUNION ALLselect pool as pool, fee as fee, 'bnb' as chain, evt_block_time as dtfrom pancakeswap_v3_bnb.pancakev3factory_evt_poolcreated b)selectsum(amount_usd) as volume, count(distinct tx_from) as user, count(distinct tx_hash) as tx, sum(case when version = '2' then amount_usd*0.25/100when version = '3' then amount_usd * cast(fee as double)/1e6end) as total_feefrom dex.trades ainner join pcs_pools bon a.project_contract_address = b.pool and a.blockchain = b.chainwhereblock_date >= cast(timestamp '{{start_date}}' as date) and block_date < cast(timestamp '{{end_date}}' as date)and project = 'pancakeswap'and version in ('2','3')and-- PCS web version(blockchain = 'bnb' and tx_to in( 0xd9c500dff816a1da21a48a732d3498bf09dc9aeb)--0x1A0A18AC4BECDDbd6389559687d1A73d8927E416,--or (blockchain = 'zksync'and tx_to = 0x582854b63251FD246545D1da70e3313D217336a3))and((token_bought_address in (0xF970706063b7853877F39515C96932D49d5AC9Cd) -- YALAand token_sold_address in (select token_address from dune.chef_butterbeer.dataset_eligible_base_tokens_alpha_trading_competition))or (token_sold_address in (0xF970706063b7853877F39515C96932D49d5AC9Cd)-- YALAand token_bought_address in (select token_address from dune.chef_butterbeer.dataset_eligible_base_tokens_alpha_trading_competition)) -- BR)-- having sum(amount_usd) >= 2000