-
Notifications
You must be signed in to change notification settings - Fork 46
Closed
Labels
ai-readyReady for AI implementationReady for AI implementationarea:uiFrontend/UI changesFrontend/UI changespriority:highHigh priorityHigh priorityrisk:lowLow risk - safe for AILow risk - safe for AItype:featureNew feature (creates feature/* branch)New feature (creates feature/* branch)
Description
Overview
Feature flag and community-level configuration for prediction markets.
Size: Medium
Depends on: PM-8 through PM-16
Blocks: nothing
Files to Create
libs/schemas/src/entities/community-prediction-market-settings.schemas.ts(or extend community schemas)
Files to Modify
packages/commonwealth/client/scripts/helpers/feature-flags.ts(addprediction_marketsflag)packages/commonwealth/client/vite.config.ts(exposeFLAG_PREDICTION_MARKETS)packages/commonwealth/server/config.ts(addFLAG_PREDICTION_MARKETSenv var)
Acceptance Criteria
Feature Flag Setup
- Feature flag
FLAG_PREDICTION_MARKETSdefined infeature-flags.tsusingbuildFlag - Flag exposed in
vite.config.tsfor frontend access - Flag toggleable per environment (dev/staging/prod)
UI Gating
All PM UI surfaces gated by useFlag('prediction_markets'):
- Thread sidebar card (ViewThreadPage)
- Thread creation button (NewThreadForm)
- Explore page tab + AllTabContent section
- Homepage + Community homepage sections
- Sidebar navigation entries (governance + admin)
- Routing (CommonDomainRoutes + CustomDomainRoutes)
- Admin settings page
- App page
- Thread list badge/tag
Backend Behavior
- API routes still functional when flag is off (flag only gates UI, not backend)
Community-Level Settings
- Community-level setting: admin can enable/disable prediction markets per community
- Default collateral token configurable per community (USDC default)
Implementation Pattern
Feature Flag Definition
// feature-flags.ts
export const predictionMarketsEnabled = buildFlag(
'prediction_markets',
false // default off
);Frontend Usage
import { useFlag } from 'hooks/useFlag';
const Component = () => {
const predictionMarketsEnabled = useFlag('prediction_markets');
if (!predictionMarketsEnabled) return null;
return <PredictionMarketsFeature />;
};Community Settings Schema
// community-prediction-market-settings.schemas.ts
export const CommunityPredictionMarketSettings = z.object({
enabled: z.boolean().default(false),
default_collateral_token: z.string().default('USDC'),
max_duration_days: z.number().min(1).max(90).default(90),
});Related
Part of the Prediction Markets (Futarchy) Integration Plan. See common_knowledge/Prediction-Markets.md for full specification.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
ai-readyReady for AI implementationReady for AI implementationarea:uiFrontend/UI changesFrontend/UI changespriority:highHigh priorityHigh priorityrisk:lowLow risk - safe for AILow risk - safe for AItype:featureNew feature (creates feature/* branch)New feature (creates feature/* branch)