Solvency & Escrow Proofs
This document presents the formal mathematical proofs establishing protocol solvency, non-custodial asset conservation, and constant-time gas scaling for QanVault.
Theorem 1: Conservation of Protocol Solvency#
Statement
For all valid states S_t of the protocol at block time t, total liquid escrow assets held by the PrizeEscrowVault contract are strictly greater than or equal to total outstanding protocol liabilities:
Proof
- Base Case ($t=0$):
Prior to ticket purchases, \text{Balance}_0 = 0, \text{Reserve}_j(0) = 0, and \text{Unclaimed}_0 = 0. The equality holds trivially ($0 \ge 0$).
- Inductive Step (Ticket Purchase):
Assume the condition holds at state S_t. At state S_{t+1}, a player purchases N tickets, transferring $100 \times N$ QANX into the vault.
The smart contract partitions the inflow across the accounting variables according to the fixed basis point vector:
The change in assets is:
The change in liabilities is:
The platform operations fee is:
Because \Delta \text{Assets} = \Delta \text{Liabilities} + \Delta \text{Ops}, and \Delta \text{Ops} \ge 0:
Therefore, solvency is preserved across every purchase transaction. \blacksquare
Theorem 2: Zero Double-Counting of Ticket Entries#
Statement
No ticket ID T_i can ever be credited more than once within the same draw tier.
Proof
- Each ticket batch transaction records a contiguous interval of tickets:
- The global counter increments strictly monotonically:
- Therefore:
- Because all intervals are mutually disjoint, each ticket integer T_i \in \mathbb{N} maps to exactly one owner address and exactly one purchase timestamp. Double counting is impossible by construction. \blacksquare
Theorem 3: Rollover Asset Conservation#
Statement
When a prize goes unclaimed past the 72-hour window, the rollover transition preserves total protocol equity without loss or leakage:
Proof
When triggerRollover(drawId) executes:
- The unclaimed prize balance \text{Prize}_k is deducted from the pending claim ledger:
- The exact same quantity \text{Prize}_k is credited to the seed reserve of draw k+1:
- The net change in total protocol obligations is:
No tokens leave the vault, no new claims are manufactured, and zero fees are extracted during rollover. \blacksquare
Theorem 4: Logarithmic Winner Resolution#
Statement
Given B total purchase batches, the gas cost of identifying the winning wallet address for an arbitrary winning ticket ID T_{\text{win}} scales as:
Proof
Because batch ranges are strictly sorted and monotonically increasing:
The contract searches for the interval containing T_{\text{win}} using binary search:
- At each comparison step, the search interval is halved:
- The maximum number of comparisons is bounded by \lceil \log_2 B \rceil.
- For a draw with 10,000 separate purchase batches, winner identification requires at most 14 storage reads, guaranteeing safe execution within standard block gas limits. \blacksquare
Next Steps#
- Verified smart contract addresses: Contract Registry
- Keeper setup and deployment instructions: Deployment & Keepers