Security Overview
Internal self-audit engine (running air-gapped on localhost) validates code quality, test coverage, dharmic compliance, and architecture integrity.
Hardhat Solidity tests + Vitest TypeScript tests. Zero failures across all LAYER_3_DEFI_SUITE components as of April 2026.
Third-party security audit targeting bridge contracts (highest risk surface). Scheduled post-testnet launch, Q3 2026.
Layer 1 — Reentrancy Protection
All state-changing entry points are protected against reentrancy attacks:
QuantumRouter: 8×nonReentrantmodifier on all swap/liquidity entry pointsQuantumPair.swap(): Custom lock modifier preventing flash loan reentrancyQuantumFlashLoan:ReentrancyGuard+_flashLoanInProgressstate flagFlashLoanArbitrage:nonReentrantonexecuteArbitrage()
Layer 2 — Oracle Security
QuantumDEX uses TWAP (Time-Weighted Average Price) oracles rather than spot price feeds to prevent manipulation:
QuantumPerpsmark price sourced fromIQuantumTWAPOracle.getMarkPrice()— TWAP, not spotQuantumPair._update()accumulates cumulative prices for on-chain TWAP calculationKarmaOraclecalls wrapped intry/catch— precompile failure degrades gracefully rather than blocking swaps
Layer 3 — Post-Quantum Cryptography
QuantumDEX is the only DEX built on a chain with quantum-safe signatures from genesis:
| Component | Algorithm | Key Size | Standard |
|---|---|---|---|
| ThiChain L1 transactions | ML-DSA-65 (Dilithium3) | SK: 4,032 bytes / Sig: 3,309 bytes | NIST FIPS 204 |
| Bridge cross-chain proofs | ML-DSA-65 via @noble/post-quantum | 3,309-byte signatures | NIST FIPS 204 |
| ECDSA comparison | secp256k1 (legacy) | 65-byte signatures | Vulnerable to quantum Shor's algorithm |
Layer 4 — Dharmic Validation Gates
The Dharmic Validator precompile (0x0423) enforces ethical constraints at the contract level:
- Ahimsa gate:
MAX_LIQUIDATION_BPS = 5000— liquidations capped at 50% to prevent total destruction of counterparty position - Satya gate: Flash loan fees enforce
MIN_FEE_BPSfloor — preventing zero-cost predatory loops - Asteya gate: Commit-reveal arbitrage uses 2-block
REVEAL_DELAYpreventing front-running by the protocol itself - Aparigraha gate: Governor proposals require 48h timelock before execution
Layer 5 — AI Agent Security
The QAL Fundraising Agent and AI sales systems include additional defences against LLM-specific attacks:
detectPromptInjection()— scans for Thai and English injection patternscontainsSensitiveOutput()— blocks accidental key/secret leakage in AI responses- 2,000-character input limit on all AI-processed user inputs
- Immutable audit log: every AI decision is TX-logged on ThiChain with Satya score
Responsible Disclosure
If you discover a security vulnerability in QuantumDEX smart contracts, ThiChain RPC endpoints, or related infrastructure, please do not disclose it publicly before contacting us.
- Email security@qubismic.io with a detailed description
- We will acknowledge receipt within 48 hours
- We will provide a remediation timeline within 7 days
- Eligible disclosures are rewarded via our Bug Bounty programme