USDT Payments & DEX Swaps
QanVault allows participants to purchase jackpot entries using virtually any token on BNB Smart Chain or Ethereum, including native gas tokens (BNB, ETH), stablecoins (USDT, USDC), or any BEP-20 / ERC-20 token with decentralized exchange liquidity. This document describes the automated DEX routing, single-transaction execution, and automatic dust refund mechanics.
Single-Transaction Execution Flow#
Legacy decentralized applications often force users through multiple tedious steps: approving a token, executing a swap, waiting for tokens to arrive, and then calling a separate lottery deposit method.
QanVault streamlines this into a single, cohesive user experience:
One-Time Token Approval
Player approves QanVault swap router to spend USDT or selected token (skipped for native BNB/ETH)
Exact-Output DEX Swap
Router pulls input token and executes swap on PancakeSwap v3 (BSC) or Uniswap v3 (ETH)
Exact 100 QANX Minting
Exact integer ticket proceeds enter the non-custodial prize vault and mint sequential ticket IDs
Automatic Dust Refund
100% of unspent input tokens from slippage guard are refunded to the player in the same transaction
Universal Token Support (Any BEP-20 or ERC-20)#
Participants are never restricted to only one or two arbitrary currencies. QanVault supports any liquid token on BNB Smart Chain or Ethereum:
- BNB Smart Chain: Pay with native BNB, BEP-20 USDT, BEP-20 QANX, or any BEP-20 asset that trades with liquidity on PancakeSwap v3.
- Ethereum Mainnet: Pay with native ETH, ERC-20 USDT, ERC-20 QANX, or any ERC-20 asset with DEX liquidity on Uniswap v3.
- Dynamic Multihop Routing: If a token does not have a direct QANX pair, the router automatically computes the optimal multihop path (e.g. Token -> WBNB -> QANX, or Token -> USDT -> QANX) in real time.
Exact-Output Swap Routing#
When a player chooses to buy N tickets (requiring N \times 100 QANX), the router uses an Exact-Output swap:
- Exact Output Desired: N \times 100 QANX
- Maximum Input Permitted: Computed dynamically with a 1.0% slippage guard
Why Exact-Output?
If the protocol used an Exact-Input swap, minor price fluctuations would yield uneven quantities of QANX (e.g. 998.4 QANX instead of 1,000 QANX), leaving fractional tickets unminted. Exact-Output guarantees that the player receives exactly the integer number of tickets requested.
How Unspent Dust Refunds Work#
A common question from players is:
If the quote specifies a maximum input, what happens to the remaining tokens? Does refunding dust cost double gas?
The Answer: Zero Extra Gas & Automatic Refund
- Single Transaction Execution: The dust refund is built directly into the very same transaction. There is no second transaction and no double gas fee.
- How It Operates On-Chain:
- Suppose you want to buy 10 tickets (1,000 QANX, worth ~$12.40).
- The contract requests a maximum input of 12.52 USDT to guard against millisecond price movements.
- When the swap executes on PancakeSwap v3, the actual cost turns out to be only 12.38 USDT.
- The swap router immediately sends the remaining 0.14 USDT back to your wallet within the exact same atomic transaction block.
- You only pay for the exact tokens consumed.
Supported DEX Pools & Routing Contracts#
| Network | DEX Protocol | Pool Fee Tier | Quoter Contract |
|---|---|---|---|
| BNB Smart Chain | PancakeSwap v3 | 0.25% / 0.05% | PancakeV3Quoter |
| Ethereum Mainnet | Uniswap v3 | 0.30% / 1.00% | UniswapV3QuoterV2 |
Next Steps#
- Explore the complete smart contract architecture: System Architecture
- Verify contract proofs and invariants: Solvency & Escrow Proofs