Query editor
-- Exact 10,000-bps STONX Ve33 allocation plan.-- Production uses capped proportional allocation over current gross-fee opportunity.WITHparams AS (SELECT CAST({{anchor_bps}} AS bigint) AS anchor_bps,CAST({{exploration_bps}} AS bigint) AS exploration_bps,10000 - CAST({{anchor_bps}} AS bigint) - CAST({{exploration_bps}} AS bigint)AS production_bps,CAST({{hub_cap_bps}} AS bigint) AS hub_cap_bps,CAST({{spoke_cap_bps}} AS bigint) AS spoke_cap_bps,CAST({{candidate_count}} AS bigint) AS candidate_count,CAST({{experiment_count}} AS bigint) AS experiment_count,CAST({{anchor_fee_bps}} AS double) AS anchor_fee_bps,CAST({{fee_discount_pct}} AS double) AS fee_discount_pct),opportunity_fee AS (SELECT r.*,round(least(CASE WHEN r.pool_role = 'hub' THEN 5.0 ELSE 100.0 END,greatest(CASE WHEN r.pool_role = 'hub' THEN 1.25 ELSE 5.0 END,r.observed_recent_fee_bps * (100.0 - p.fee_discount_pct) / 100.0)),2) AS plan_swap_fee_bpsFROM dune.sendmoodz.result_stonx_opportunity_snapshot rCROSS JOIN params p),opportunity AS (SELECT f.*,CAST(CAST(floor(CAST(f.plan_swap_fee_bps AS decimal(18, 2))* DECIMAL '18446744073709551616'/ DECIMAL '10000') AS decimal(38, 0)) AS varchar) AS plan_swap_fee_q64FROM opportunity_fee f),candidates AS (SELECT o.*,CASEWHEN o.pool_role = 'hub' THEN p.hub_cap_bpsELSE p.spoke_cap_bpsEND AS allocation_cap_bpsFROM opportunity oCROSS JOIN params pWHERE (o.pool_role = 'hub'OR (o.pool_role = 'production_spoke' AND o.opportunity_rank <= p.candidate_count))AND o.evidence_confidence <> 'low'AND o.opportunity_score > 0),candidate_totals AS (