Ticket Mechanics & 4-in-1 Entry
Understanding how tickets are minted, indexed, and evaluated across multiple concurrent draw tiers is essential to understanding QanVault's architectural elegance.
Ticket Fundamentals#
- Fixed Price: 100 QANX per ticket.
- Minimum Purchase: 1 ticket (100 QANX).
- Maximum Purchase per Transaction: Configurable by network gas limit (typically up to 5,000 tickets per transaction).
- Settlement Asset: Wrapped QANX on BNB Smart Chain.
Contiguous Integer Range Indexing#
Unlike legacy on-chain lotteries that push individual ticket structs into massive dynamic arrays, QanVault employs Contiguous Integer Range Indexing.
When a player buys N tickets in transaction k:
Example
If the contract's cumulative ticket counter is currently at 4,500 and a user buys 500 tickets:
- T_{\text{start}} = 4,501
- T_{\text{end}} = 5,000
- A single compact record is written to storage:
struct TicketBatch {
address owner;
uint64 startId;
uint64 endId;
uint32 purchaseTimestamp;
uint32 drawDateId;
}Why Contiguous Ranges Matter
- $O(1)$ Gas Efficiency: Minting 1,000 tickets consumes the same base gas as minting 1 ticket, because only one range record is written.
- Binary Search Winner Lookup: When a random winning ticket ID is drawn (e.g. ticket #4,723), the contract identifies the winning owner using binary search in O(\log B) time, where B is the number of purchase batches, requiring zero loop iterations.
- No Storage Bloat: Avoids storing millions of individual token IDs, keeping state growth minimal.
4-in-1 Multi-Draw Entry Matrix#
Every ticket purchased is automatically registered into four distinct draws:
Daily Draw (D)
First chance to win on the day of purchase
Daily Draw (D+1)
Free automatic re-entry the very next day
Weekly Jackpot (W)
Enters the week-long cumulative prize pool
Monthly Grand (M)
Enters the massive monthly community pot
1. Current Day Daily Draw (D)
- Eligibility: All tickets purchased between 00:00:00 UTC and 23:59:59 UTC on calendar day D.
- Pot Share: 50% of all ticket inflows during day D, plus any rollovers from day D-1.
- Draw Time: Triggered daily at 00:00:00 UTC.
2. Following Day Daily Draw (D+1)
- Eligibility: All tickets purchased on day D automatically re-enter the next daily draw (D+1).
- Pot Share: 30% of day D's ticket proceeds are reserved exclusively to fund this follow-up pot.
- Player Benefit: Every player gets two full daily opportunities to win with a single ticket purchase.
3. Weekly Jackpot (W)
- Eligibility: Every ticket purchased throughout the current ISO calendar week (Monday 00:00:00 UTC to Sunday 23:59:59 UTC).
- Pot Share: 7.5% of all ticket inflows over the 7-day period.
- Draw Time: Triggered every Monday at 00:00:00 UTC.
4. Monthly Grand Jackpot (M)
- Eligibility: Every ticket purchased during the entire calendar month.
- Pot Share: 5.0% of all monthly ticket inflows.
- Draw Time: Triggered at 00:00:00 UTC on the 1st of each month.
Zero Double Counting Invariant#
The protocol strictly guarantees that funds are never double counted or cross-contaminated:
Each pot operates as an independent balance ledger. Winning in Daily Draw D does not invalidate a ticket's eligibility for Daily D+1, Weekly W, or Monthly M. A single lucky ticket can theoretically win all four draws.
Next Steps#
- How randomness is verified: Provably Fair
- How to claim prizes: Prize Claims & Rollover
- Calculate your winning odds: Odds & Probabilities