Head-to-head trading duels and tournament brackets on Adrena Protocol. Traders stake USDC, compete in time-boxed matches scored by PnL%, and winners take the pot. No other perpetuals DEX offers real-time 1v1 competition.
Hackathon Submission | Adrena Protocol Bounty
| # | Deliverable | Status | Location |
|---|---|---|---|
| 1 | Competition Design Document | Complete | DESIGN.md |
| 2 | Working Prototype | Deployed on devnet | See below |
| 3 | Testing and Feedback | Tested with multiple wallets | See Testing Results |
| Resource | Address |
|---|---|
| Arena Program | 9YTkJapJ9K3hkdbhhERq1tEKHwvJTHPnRWBKCGqd8MP3 |
| ArenaConfig PDA | DftyGkRMQgpdkNKkd2uaJjvnVtigDZMmn6QNdDW2TtE1 |
| Mock USDC Mint | 6qwX7BqGqbp4cNHdg8jpAk69BW9AkR4cUC5x57PLzCpM |
| Adrena Data API | https://datapi.adrena.trade |
See DESIGN.md for the full competition design document covering:
- Duels (1v1) -- Two traders compete head-to-head over a fixed time window. Challenger sets market, duration, stake, max leverage, and scoring mode. Both sides deposit USDC to an on-chain escrow PDA. Winner takes both stakes minus 5% protocol fee.
- Tournaments (Brackets) -- Single-elimination brackets for 8, 16, or 32 participants with consolation rounds. Round durations decrease as the tournament progresses (4hr to 30min finals).
- Spectator Predictions -- Non-traders predict duel outcomes for additional engagement and Mutagen rewards.
- Mutagen, Quest, Streak, and Faction Integration -- Arena activity feeds into Adrena's existing points and engagement systems.
- Edge Cases and Abuse Prevention -- Wash trading mitigations, collusion detection, oracle manipulation safeguards, griefing prevention.
No other Solana perpetuals DEX offers real-time head-to-head competition. Current platforms rely on passive leaderboard models that lack urgency and social dynamics.
| Platform | Competition Model | Real-time H2H | Spectator Layer | Shareable Moments |
|---|---|---|---|---|
| Drift | Continuous linear points (FUEL) | No | No | No |
| Flash Trade | NFT-level-based perks | No | No | No |
| Jupiter Perps | None | No | No | No |
| Adrena (current) | Seasonal leaderboard + quests | No | No | Limited |
| Adrena Arena | Duels + Tournaments | Yes | Yes | Yes |
Key differentiators:
- Urgency: A 30-minute duel demands attention in a way a 10-week season cannot.
- Social content: "I challenged @trader and won" is inherently shareable.
- Spectator engagement: Non-traders can watch and predict, expanding the audience beyond active traders.
- Lower barrier: New traders can enter a single duel without committing to a full season.
- Volume driver: Every duel generates real trading volume on Adrena. Based on competition data, ~50% of platform volume comes from competitive features.
+--------------+ +------------------+ +--------------+
| Traders |---->| Adrena Program |---->| On-chain |
| (wallets) | | (existing perps)| | Events |
+--------------+ +------------------+ +------+-------+
| |
| +------------------+ |
| | Arena Program | |
+----------->| (escrow/settle) | |
| +------------------+ |
| ^ |
| | settle_duel() v
| +------------------+ +--------------+
| | Coordinator |<----| Adrena API |
| | (off-chain) | | datapi. |
| +--------+---------+ | adrena.trade |
| | +--------------+
v v
+--------------+ +------------------+
| Next.js 14 |<----| WebSocket Feed |
| Frontend | | (live scores) |
+--------------+ +------------------+
-
Arena Program (Anchor/Solana) -- On-chain escrow for duel stakes, tournament entry fees, and spectator predictions. Handles fund custody and settlement via PDAs. Deployed at
9YTkJapJ9K3hkdbhhERq1tEKHwvJTHPnRWBKCGqd8MP3. -
Coordinator Service (TypeScript/Node.js) -- Off-chain service that monitors active duels, queries Adrena position data via
datapi.adrena.trade, computes live PnL scores, and triggers settlement transactions. -
Frontend (Next.js 14 + Tailwind CSS + Solana Wallet Adapter) -- Full UI for creating duels, accepting challenges, viewing live scores, tournament brackets, and leaderboards.
- Create Duel: Challenger sets market, duration, stake, max leverage, and scoring mode. USDC deposited to escrow PDA.
- Accept Duel: Opponent matches stake. Duel timer begins.
- Cancel Duel: Challenger can cancel an unaccepted duel and reclaim stake.
- Settle Duel: Coordinator fetches position data from
datapi.adrena.trade, computes PnL scores, and submits settlement. Winner receives both stakes minus 5% protocol fee. - Tournaments: Bracket creation (8/16/32 participants), entry fee collection, round advancement, and elimination logic.
- Frontend UI: Challenge board, duel detail view with live countdown, tournament bracket visualization, leaderboard, wallet connection.
A recorded walkthrough of the full duel lifecycle is available at scripts/demo/output/adrena_arena_demo.mp4.
adrena-arena/
programs/
adrena-arena/
src/
lib.rs # Program entrypoint, instruction dispatch
state.rs # Account structs (Duel, Tournament, ArenaConfig)
instructions/ # create_duel, accept_duel, settle_duel, etc.
error.rs # Custom program errors
app/ # Next.js 14 frontend
src/
app/
page.tsx # Home / challenge board
duels/ # Duel detail pages
tournaments/ # Tournament bracket pages
leaderboard/ # Leaderboard page
components/
CreateDuelModal.tsx # Duel creation form
DuelCard.tsx # Duel summary card
DuelTimer.tsx # Live countdown timer
LiveDuelViewer.tsx # Real-time score display
TournamentBracket.tsx
Navbar.tsx
WalletProvider.tsx # Solana wallet adapter setup
hooks/ # Custom React hooks
lib/ # SDK client, PDA helpers
coordinator/ # Off-chain settlement service
src/ # Coordinator logic
tests/ # Anchor integration tests
scripts/ # Deployment and utility scripts
demo/ # Demo recording scripts and output
Anchor.toml # Anchor config (devnet + localnet)
.env.example # Environment variable template
DESIGN.md # Full competition design document
INTEGRATION.md # Adrena team integration guide
- Rust 1.75+ and Solana CLI 1.18+
- Anchor CLI 0.30.1
- Node.js 18+
- A Solana devnet wallet funded with SOL
- A QuickNode RPC endpoint (or other devnet RPC)
anchor build
anchor deploy --provider.cluster devnetThe program is already deployed at 9YTkJapJ9K3hkdbhhERq1tEKHwvJTHPnRWBKCGqd8MP3 on devnet.
cd app
cp ../.env.example .env.local
# Edit .env.local with your QuickNode RPC URL
npm install
npm run devThe frontend runs at http://localhost:3000. Connect a Solana wallet (Phantom, Backpack, etc.) on devnet.
cd coordinator
cp ../.env.example .env
# Edit .env with your RPC URL and coordinator wallet path
npm install
npm run devanchor testThe full duel and tournament lifecycle has been tested on Solana devnet with real transactions.
Wallets Used:
2bBDdbHAFgdJRDSGvAN9Tpy9p9BPTFbt9XMsavVM8krk8jgYRsFQT5FLuWrKYarbLSHvh67mcKddzNosLoH5VDTm
Duel Testing:
- Duels created, accepted, and settled on devnet with mock USDC
- Cancel flow tested (challenger reclaims stake from unaccepted duel)
- Bot opponent script used for automated accept-duel flow testing
- Settlement correctly computes PnL scores from
datapi.adrena.tradeposition data
Tournament Testing:
- Tournaments created and joined on devnet
- Bracket progression and elimination logic verified
Coordinator Testing:
- Adrena Data API at
https://datapi.adrena.tradeconfirmed live and returning position data - Coordinator polls position data every 10 seconds per active duel
- WebSocket live score streaming verified
- Settlement transactions submitted and confirmed on-chain
- Rate limiting: Confirm rate limits on
datapi.adrena.trade/positionendpoint for high-frequency polling during peak duel activity. - Real-time position data: Verify whether the API returns positions in real-time or with delay; latency affects score accuracy at settlement.
- Mutagen integration: Requires Adrena backend to add Arena as a Mutagen source (see INTEGRATION.md).
- Mainnet deployment: Switch from mock USDC to real USDC mint, audit escrow logic, and establish multisig upgrade authority.
- Oracle settlement: Production settlement should use TWAP over the final 60 seconds rather than spot price to prevent manipulation.
| Endpoint | Description |
|---|---|
GET /arena/health |
Health check |
GET /arena/duels |
Active and pending duels |
GET /arena/duels/:id |
Duel details with live scores |
GET /arena/tournaments |
Tournament listings |
GET /arena/tournaments/:id/bracket |
Tournament bracket state |
GET /arena/leaderboard |
Top arena duelists |
GET /arena/history/:wallet |
Duel history for a wallet |
WS ws://localhost:8080 |
Real-time score updates |
Primary metric: PnL % relative to collateral deployed
score = (realized_pnl + unrealized_pnl_at_close) / total_collateral_deployed * 100
- Only positions opened after duel start count
- Unrealized PnL evaluated at oracle price at duel end
- Tiebreakers: fewer trades > lower avg leverage > split pot
See INTEGRATION.md for what the Adrena team needs to do vs. what is already built and working.
- On-chain: Rust / Anchor 0.30.1 / Solana
- Frontend: Next.js 14 / React / Tailwind CSS / Solana Wallet Adapter
- Coordinator: TypeScript / Node.js / WebSocket
- Data Source: Adrena Data API at
https://datapi.adrena.trade - RPC: QuickNode (devnet)
- Token: USDC (mock on devnet, real on mainnet)