Duel wager protocol on Solana. Two parties stake equal amounts of SPL tokens, a trusted authority declares the winner, and the loser's stake goes to the winner minus a platform fee.
Built with Quasar — zero-copy, zero-allocation.
Challenger creates a duel, depositing their stake into a PDA-owned vault.
Args: stake: u64, fee_bps: u16, expiry: i64
Opponent accepts the duel by depositing a matching stake.
Trusted authority declares a winner (0 = challenger, 1 = opponent). Platform fee is deducted from the total pot, remainder goes to the winner. Closes the duel and vault.
Args: winner: u8
- Pending: Challenger can cancel anytime. Stake returned.
- Active: Either party (challenger or opponent) can cancel. Each gets their stake back.
Duel PDA — seeds = [b"duel", challenger]
| Field | Type | Description |
|---|---|---|
| challenger | Address | Duel creator |
| opponent | Address | Accepting party (zeroed until accept) |
| mint | Address | SPL token mint |
| authority | Address | Trusted third party for resolution |
| fee_account | Address | Platform fee token account |
| stake | u64 | Amount each party deposits |
| expiry | i64 | Optional expiry timestamp (0 = none) |
| fee_bps | u16 | Platform fee in basis points |
| status | u8 | 0 = pending, 1 = active |
| bump | u8 | PDA bump seed |
- One active duel per challenger under the current PDA scheme (
[b"duel", challenger])
# check compilation (native)
cargo check -p cinis
# compile tests
cargo test --no-run -p cinis
# run tests (requires SBF build)
cargo build-sbf
cargo test -p cinisMIT