> ## Documentation Index
> Fetch the complete documentation index at: https://docs.predictaa.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Todo

# Predicta Technical TODO 🛠️

A granular checklist of remaining engineering tasks and technical debt.

***

## 🔐 Security & Infrastructure

* [ ] **Privy JWT Verification**: Implement server-side session validation using `privy-node` SDK or JWKS public keys for all protected routes.
* [ ] **Farcaster Auth**: Full cryptographic signature verification for Frame-based POST requests in `api/frame/route.ts`.
* [ ] **Secret Management**: Migrate `SIMULATION_SECRET` and `PRIVY_APP_SECRET` to Firebase Secrets for Cloud Functions.
* [ ] **CORS Hardening**: Strict origin validation for the `pimlicoProxy` Cloud Function.

## 🪪 Identity & Persona

* [ ] **Real Wallet Scanning**: Replace stubs with real-time on-chain footprint analysis via Alchemy/Etherscan to seed adaptive risk profiles.
* [ ] **Preon NFT Metadata**: Dynamic SVG generation for Preon identities that updates purely based on on-chain stats.
* [ ] **Achievement Oracle**: Verify achievement eligibility on-chain vs relying on Firestore state.

## 📊 Market Data & Oracle

* [ ] **Real Volume Data**: Replace stubs in `marketService.ts` with real-time 24h volume from Polymarket.
* [ ] **Cortex Rejection Logging**: Implement specific error codes for *why* a trade was rejected (E1 fail, E3 fail, etc.) and expose via `API`.
* [ ] **Resolution Refactor**: Move `resolutionService.ts` to use Next.js Server Actions for better performance.

## 👯‍♂️ Mimic Mode (Social)

* [ ] **Farcaster Following**: Connect `mimic_relay.py` to real-time Farcaster hubs to detect new "Follows" and trigger vault setup.
* [ ] **Relay Latency**: Optimize mimic execution loop to \< 30 seconds from Leader trade detection.

## ⚖️ Governance & PRED

* [ ] **PRED Staking**: Implement the staking contract for PRED tokens to unlock higher tier archetypes.
* [ ] **Governance Portal**: Simple UI for voting on Cortex risk-gate thresholds (E5/E6 levels).

***

## 🧪 Persona Simulation (QA)

* [ ] **Multi-step Flows**: Implement simulation tests for faction joins and copy-trading follower onboarding.
* [ ] **Observer Analysis**: Automate the export of "Observer" summaries to a centralized dashboard for regression tracking.
* [ ] **Network Stress**: Simulating "Gas Spike" conditions to test paymaster fallback logic between CDP and Pimlico.

## 🧪 Documentation & Testing

* [ ] **Unit Tests**: Coverage for `mimic_relay.py` and `unified-auth.tsx`.
* [ ] **Integration Tests**: End-to-end flow for `PreonVault` -> `PredictaCoreV2` via Privy MPC signer.
* [ ] **API Docs**: Document the `Cortex API` endpoints using Swagger.
