Query editor
with aggv2_txs as (selectaffected_account_id as user,contract_account_id as token_id,md.symbol as token_symbol,md.last_price_usd as aprox_price,delta_amount as amount,delta_amount / pow(10, md.decimal) * md.last_price_usd as volume,block_time,receipt_id,event_memoFROM near.ft_transfers tINNER JOIN dune.csp88g.near_tokens_metadata mdON t.contract_account_id = md.token_idwhere block_time >= timestamp '2026-01-09 00:00'and block_time < timestamp '2026-01-16 00:00'and involved_account_id = 'aggregatedex.near'and affected_account_id not in ('v2.ref-finance.near', 'dclv2.ref-labs.near')and delta_amount > 0-- NEAR ZEC RHEA BLACKDRAGON SHITZU USDT USDCand contract_account_id in ('wrap.near', 'zec.omft.near', 'token.rhealab.near', 'blackdragon.tkn.near', 'token.0xshitzu.near', 'usdt.tether-token.near', '17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1')and status = 'SUCCESS_VALUE'),traders_volume as (select user, sum(volume) as volume from aggv2_txsgroup by user),traders_total_volume as (select sum(volume) as total_volumefrom traders_volume),tickets as (selectROW_NUMBER() OVER (ORDER BY volume DESC) as place,user,volume,floor(volume / 50) as ticketsfrom traders_volume)selectplace,user,volume,casewhen place > 10then ticketsend as tickets,casewhen place = 1then 90when place = 2then 75when place = 3then 65when place = 4then 50