Skip to content

Add Qassandra prediction market scaffold#905

Open
Qubic-CPU wants to merge 3 commits into
qubic:mainfrom
Qubic-CPU:feature/qassandra-qubic-native-minimal
Open

Add Qassandra prediction market scaffold#905
Qubic-CPU wants to merge 3 commits into
qubic:mainfrom
Qubic-CPU:feature/qassandra-qubic-native-minimal

Conversation

@Qubic-CPU
Copy link
Copy Markdown

Summary

This PR adds the first minimal Qassandra scaffold to core as Qubic-native prediction market infrastructure.

Qassandra is being designed as an oracle-first forecasting layer for both human users and autonomous agents. The initial focus is QUBIC/USD forecasting, but the structure is intentionally typed, deterministic, and modular so it can later support stablecoin rails, bridges, external oracle providers, UI/API layers, broader market categories, and direct agent integrations.

This PR adds only inert primitives and helper logic. It does not register a contract, add procedures, introduce storage, touch runtime behavior, or wire in settlement flows.


Why this matters

Most prediction markets are built around human-facing UI flows first, then later expose APIs for automation.

Qassandra takes the opposite path.

It starts from deterministic, contract-safe primitives that can become readable and usable by both humans and agents from the beginning. Markets should not only be displayed to users; they should be structured so software agents can discover them, reason about them, price them, execute against them, and eventually settle through Qubic-native oracle logic.

This matters because future demand will not only come from people clicking buttons. It will come from AI agents needing reliable forecast markets for price signals, risk checks, hedging, routing decisions, automated treasury actions, and machine-to-machine coordination.

Qassandra should be built for that future at the base layer.


Design intent

This scaffold is designed to be:

  • Qubic-native: aligned with deterministic smart contract execution instead of external market infrastructure.
  • Oracle-first: built around verifiable price/outcome settlement rather than UI-first speculation.
  • Agent-readable: typed market descriptors and outcomes can later be exposed cleanly to autonomous systems.
  • Deterministic: scaled integer comparison avoids floating-point behavior.
  • Modular: future commits can add storage, market lifecycle, settlement, stablecoin rails, bridges, APIs, and agent interfaces without redesigning the base types.
  • Minimal: no runtime behavior is changed in this PR.

Added

This PR introduces:

  • QASSANDRA_QUBIC_USD_PRICE_SCALE
  • QassandraMarketStatus
  • QassandraOutcome
  • QassandraComparisonDirection
  • QassandraMarketId
  • QassandraOracleSettlement
  • QassandraMarketDescriptor
  • qassandraIsValidPriceReply
  • qassandraCompareScaledPrice

Oracle price comparison behavior

The helper logic supports deterministic comparison of scaled oracle price replies against market thresholds.

This is intended for future QUBIC/USD forecast markets where an oracle reply can provide a rational price through numerator/denominator fields while the market stores a scaled threshold.

This keeps future settlement logic compatible with deterministic execution and avoids floating-point ambiguity.


Agentic roadmap alignment

This PR does not add agent functionality yet, but it creates the structure needed for it.

Future Qassandra layers can expose markets in formats that are easy for agents to parse, query, and act on. That includes:

  • market descriptors
  • market status
  • comparison direction
  • threshold values
  • oracle settlement metadata
  • outcome states
  • deterministic validation helpers

Longer term, Qassandra can support agent interaction through APIs, indexers, wallet-controlled agents, strategy bots, bridge-aware execution, and eventual direct integration paths with Qubic AI infrastructure such as Aigarth and Neuraxon once those rails mature.

The goal is not just a prediction market frontend.

The goal is forecasting infrastructure that autonomous agents can use as a native market signal layer.


Scope intentionally excluded

This PR does not add:

  • market creation procedures
  • user orders
  • positions/shares
  • escrow/accounting logic
  • oracle query submission
  • oracle subscriptions
  • settlement execution
  • stablecoin logic
  • bridge logic
  • frontend/API behavior
  • persistent Qassandra state
  • new contract registration
  • agent execution logic

Those should come in separate PRs with clean review boundaries.


Validation

Completed:

  • Confirmed no pre-existing Qassandra symbols before adding.
  • Added focused Qassandra symbols only.
  • Ran focused symbol search after implementation.
  • Ran git diff --check.
  • Ran a narrow syntax probe against contract_def.h.

The narrow syntax probe confirmed the Qassandra-specific issue was fixed. Remaining local probe failures are from existing macOS/clang platform issues, including MSVC-style integer suffixes and intrinsic helpers, not from the Qassandra scaffold itself.

Full build was not run because the local workspace does not have an existing build directory, the documented test CMake path fetches GoogleTest, and EFI/full build setup is platform-sensitive in this environment.


Risk profile

Low.

This PR adds inert types, constants, and helper functions only. It does not alter existing contract behavior, does not execute at runtime, does not change consensus behavior, and does not introduce storage layout changes.

Future PRs can build from this scaffold incrementally across storage, procedures, oracle queries, settlement, market lifecycle, stablecoin rails, and agent-facing interfaces.

@Qubic-CPU
Copy link
Copy Markdown
Author

Additional context:

This scaffold is intentionally minimal. The goal is not to introduce a full prediction market contract in one PR, but to establish typed, deterministic primitives that future Qassandra layers can build on safely.

The broader design direction is oracle-first and agent-readable:

  • QUBIC/USD forecasting first
  • deterministic scaled-price comparison
  • no floating-point settlement ambiguity
  • no runtime behavior changes in this PR
  • no storage or contract registration yet
  • future support for market lifecycle, settlement, stablecoin rails, bridge-aware execution, APIs, and agent-facing interfaces

The agent-facing angle matters because future forecast demand may come from autonomous systems as much as human users. Qassandra should eventually expose markets in a structure that agents can discover, parse, evaluate, and execute against.

This PR keeps that future path open without increasing current review risk.

@Qubic-CPU
Copy link
Copy Markdown
Author

Qubic-CPU commented May 29, 2026

This update only touches src/contracts/Qassandra.h and keeps the PR intentionally narrow:
No storage.
No procedures.
No hooks.
No registration.
No runtime behavior changes.
Typed deterministic primitives only.

The added metadata preserves the oracle-first and agent-readable direction while keeping review risk low. It gives future Qassandra layers clearer typed primitives for market type, settlement status, settlement timing, oracle query linkage, and agent-readable market discovery.

@Qubic-CPU
Copy link
Copy Markdown
Author

Pushed a minimal cleanup commit addressing scaffold safety and review concerns:

  • Added #pragma once to Qassandra.h
  • Replaced bool canAgentRead with uint8 canAgentRead
  • Changed settlement threshold from signed sint64 to unsigned uint64
  • Removed the now-unneeded negative threshold guard
  • Added a fail-closed comment for unknown comparison directions

No storage, procedures, hooks, registration, settlement flow, or runtime behavior were added. The PR remains an inert typed scaffold for future oracle-settled Qassandra markets.

@Qubic-CPU
Copy link
Copy Markdown
Author

Final external review completed after ce9032e.

Verdict: safe.

The only remaining note was conditional: if the old thresholdValue < 0 guard still existed after converting thresholdValue to uint64, it should be removed. The current diff confirms that guard has already been removed.

Current scaffold status:

  • No storage layout changes
  • No procedures
  • No hooks
  • No contract registration
  • No runtime or consensus behavior
  • Qassandra.h now has #pragma once
  • No bool fields remain
  • thresholdValue is uint64
  • Price comparison uses deterministic uint128 cross-products
  • Unknown comparison directions fail closed

This PR is ready for review as a minimal inert Qassandra scaffold.

@Qubic-CPU
Copy link
Copy Markdown
Author

One design note for future layers: Qassandra should remain Qubic-native at the settlement layer. Future payouts, incentives, and market reward flows should be denominated in $QUBIC by default, with any later stablecoin or bridge integrations treated as external abstraction layers rather than replacing native settlement.

No payout, reward, custody, liquidity, or accounting logic is introduced in this PR.

@Qubic-CPU
Copy link
Copy Markdown
Author

  • integration paths for multi-collateralized stablecoin infrastructure, where stable assets can be oracle-settled against QUBIC-denominated price references, with settlement and reward distribution occurring 100% in $QUBIC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants