12 KiB
Ranger Build-A-Bear Hackathon Plan
Deadline: April 6, 2026 Today: March 20, 2026 Days remaining: 17
The Honest Assessment
We have a LOT of code (150K+ lines) but need to be clear about what's real vs reference:
| Category | Files | Lines | Status |
|---|---|---|---|
| Strategy engine + modules | 170 TS files | 50K | Working, tested (325/325 pass) |
| Scripts (vault, lending, LP, ops) | 107 TS files | 15K | Ready to run |
| Rust programs (on-chain) | 4 programs | 17K | 1 deployed on devnet, 1 = Drift reference |
| Plugin reference code | ~900 files | ~35K | Most ported, rest = SDK reference |
What Actually Works Right Now
npm run agent— starts the full strategy engine with JIT/Filler/FloatingMakernpm run backtest:v2-s3— 3-year backtest on real Drift S3 datanpm run devnet:dry-run— end-to-end pipeline test on devnetnpm run rebalance-bot— Voltr-compatible rebalance loop- 29/29 test suites, 388/388 tests pass, zero TS errors
What's NOT Working
- No mainnet trades (only devnet adaptor txs)
- Realistic backtest not yet run
- Demo video not recorded
- Many plugin integrations are imports + method stubs (real API calls but no live wallet signing)
Our Strategy: Multi-Layer Yield Vault
We don't have ONE strategy — we have 5 layers that stack:
Layer 1: Delta-Neutral Funding Capture (Core)
What: Long spot + short perp on Drift — collect funding payments
Yield: ~15-45% APY (varies with market regime)
Files: engine.ts (2,328 lines), executor.ts (1,498 lines)
Backtest: +45.76% CAGR over 3 years on real Drift data
Layer 2: DLOB Market Making (FloatingPerpMaker)
What: Oracle-offset bid/ask orders on Drift DLOB — earn spread + maker rebates (0.02%)
Yield: ~10-30% APY (depends on volume)
Files: floating-maker.ts (450 lines)
Source: Ported from keeper-bots-v2/floatingMaker.ts
Layer 3: JIT Auction Fills
What: Fill taker auction orders at optimal slot timing — maker rebates
Yield: Variable (depends on order flow)
Files: jit-maker.ts (726 lines)
Source: Ported from jit-proxy/jitterSniper.ts
Layer 4: DLOB Order Filling
What: Match makers with takers on DLOB — earn filler rewards
Yield: Variable
Files: filler.ts (599 lines)
Source: Ported from keeper-bots-v2/filler.ts
Layer 5: LST Yield Stacking
What: Use JitoSOL/mSOL/bSOL as collateral instead of raw SOL — earn staking APY
Yield: ~6-8% APY on top of funding
Files: lst.ts, lending/sanctum.ts
Layer 6: Grid Orders (NEW — from Drift Workshop)
What: Scale buy/sell orders at evenly spaced oracle offsets — captures volatility
Yield: Variable (mean-reversion + maker rebates)
Files: grid-orders.ts (228 lines)
Source: Drift Workshop recommendation
Layer 7: Oracle Basis Arbitrage (NEW — from Drift Workshop)
What: Exploit mark-oracle divergence with Pyth cross-validation
Yield: Variable (basis spread capture)
Files: oracle-arb.ts (266 lines)
Source: Drift Workshop recommendation
Combined Expected Yield
Conservative: 20-30% APY (funding only) Moderate: 35-50% APY (funding + market making + grid) Aggressive: 50-70% APY (all 7 layers active)
What We Submit
Ranger Main Track (up to $500K seeding)
Vault: Ranger Earn vault with Drift earn adaptor Strategy: Delta-neutral funding capture + DLOB market making Architecture:
User deposits USDC into Ranger Earn Vault (Voltr)
|
Custom Drift Adaptor (our Anchor program on-chain)
| CPI
Drift Protocol
|-- 50% USDC spot lending (earn deposit APY)
+-- 50% delta-neutral (long spot + short perp)
|-- Funding rate income
|-- FloatingPerpMaker spread capture
+-- JIT auction fills
What judges see:
- Vault creation via voltrxyz/base-scripts pattern
- Drift adaptor init via voltrxyz/drift-scripts pattern
- Custom rebalance_loop.ts (our delta-neutral strategy)
- On-chain custom adaptor (driftbear_custom_adaptor deployed on devnet)
- Strategy documentation with backtest results
- 3-minute demo video
Drift Side Track (up to $100K seeding)
Same strategy but emphasized as 100% Drift-native:
- Oracle-offset orders (auto-track oracle)
- DLOB market making (FloatingPerpMaker)
- JIT auction participation
- Cross-margin for capital efficiency
- Spot lending for idle yield
- Insurance fund staking
Do We Need Rust?
Short answer: We already have it.
The workshop shows the expected pattern:
- TypeScript rebalance bot (keeper) — we have this
- On-chain Anchor adaptor (Rust) for CPI to Drift — we have this, deployed on devnet
- The vault program itself is Voltr's — we don't build this
Our Rust code:
| Program | Lines | Status |
|---|---|---|
| driftbear_custom_adaptor | 1,058 | Deployed on devnet with verified txs |
| custom_adaptor_completed | ~200 | Workshop 2 solution (completed template) |
| ctoken_market_program | 345 | Deployed on devnet |
| drift_vaults | 15,243 | Reference (Drift Labs' program) |
| raydium_clmm | 20,909 | Reference (Raydium's program) |
| drift_rs_sdk | 55,940 | Reference (Drift Rust SDK) |
The judges want to see: our adaptor program + our TypeScript keeper bot. The reference programs show we understand the full stack.
Backtest Plan
Already done:
- V2-S3 backtest: 68,072 hourly bars, 3 years, real Drift S3 data
- Result: +45.76% CAGR, 0.32% max DD, Sharpe 9.58
Realistic backtest (completed):
- 0.30% round-trip costs (3.4x higher than ideal)
- Result: +44.88% CAGR, 0.60% max DD, Sharpe 9.37
- Total return: +208.87% ($10K → $30.9K)
- Cost/income: 2.3% (vs 0.9% ideal)
$500K Scale backtest — 5 assets, 3 years (completed):
- Real Drift on-chain data: SOL, BTC, ETH, JTO, INJ — 119K+ hourly bars
- Result: +41.39% CAGR, 1.01% max DD, Sharpe 11.02, Sortino 49.17
- $500K → $1,440,652 (+$940K net P&L)
- 2023: +39.32% | 2024: +85.08% | 2025: +9.03% | 2026 Q1: +2.48%
- Gross funding: $1,039K, Trading fees: $40K, Market impact: $58K
- Cost/income: 9.5% — 90.5% of gross funding flows to equity
- Capital ramp: started at $50K, ramped to $500K over 7 days
- Win rate: 88.3%, Direction flips: 33
- Market impact model: √(size/$1M) per asset
- JTO capped at $150K max order, INJ at $200K
$500K 1-year backtest (completed — bear market stress test):
- SOL-only (API rate limited other assets), 2025-03 → 2026-03
- Result: +4.54% return, 0.05% max DD, 98.3% win rate, 0 flips
- Net P&L: +$22,691 — profitable even in worst-case bear market regime
- With full 5-asset portfolio (JTO/INJ 20-28% APY), return would be 3-4x higher
Monte Carlo simulations (completed):
- 5,000 runs × 1-year horizon at $500K
- Markov chain regime model (bull/neutral/bear/crisis transitions)
-
80% probability of exceeding 10% APY
- 0% probability of total wipeout
- Extreme price scenarios: SOL $0-$1000, correlated crashes
- Circuit breaker limits worst-case loss to < 15%
What the backtest tests:
- 5 assets (SOL 22%, BTC 20%, ETH 13%, JTO 23%, INJ 22%)
- 2x leverage, 7% APY entry threshold
- 48h flip confirmation + 48h cooldown
- 0.088% round-trip fees (ideal) or 0.30% (realistic)
Helius Integration
We use Helius for:
- Priority fees —
src/utils/helius-enhanced.tsforgetPriorityFeeEstimate()per transaction - Webhooks —
scripts/create-helius-webhook.tsmonitors vault account changes - DAS API — token balances, parsed transaction history
- RPC — all Drift SDK calls go through Helius RPC
Config: HELIUS_RPC_URL in .env
Simulation / Devnet Plan
To demonstrate live execution:
npm run devnet:setup # Create wallet, airdrop SOL, init Drift account
npm run devnet:dry-run # Full strategy pipeline (fetch rates -> signal -> execute)
npm run devnet:strategy # Extended multi-cycle test
Adaptor CPI (already verified on devnet):
Initialize tx: 3o8rLDXGQUyyyq...
Deposit tx: 5C1eN2yctzq4B2...
Withdraw tx: vp7hBrvnCqL5QV...
Remaining Tasks (Priority Order)
Must Do (before April 6)
| # | Task | Time | Status |
|---|---|---|---|
| 1 | Run realistic backtest | 10 min | DONE (+44.88% CAGR) |
| 2 | Run devnet dry run | 30 min | DONE (live tx on devnet) |
| 3 | Build grid orders + oracle arb | 2 hours | DONE (from Drift Workshop) |
| 4 | Record 3-min demo video | 1-2 hours | NOT DONE |
| 5 | Deploy vault on mainnet + share in TG | 1 hour | DONE (Vault: GWawesKM7..., Drift Vault: HtMPaMXzJ..., agent live, JIT fill verified) |
| 6 | Submit on Superteam Earn (both tracks) | 30 min | NOT DONE |
Should Do
| # | Task | Time | Status |
|---|---|---|---|
| 6 | Confirm 216/216 tests pass | 1 min | DONE |
| 7 | Clean up submission docs | 30 min | DONE |
| 8 | Create strategies.json for vault | 5 min | DONE |
| 9 | Document on-chain adaptor | 30 min | DONE |
| 10 | $500K hardening (capital ramp, slippage guard, venue failover) | 2 hours | DONE |
Nice to Have
| # | Task | Time | Status |
|---|---|---|---|
| 11 | Try mainnet with $10-20 for real transactions | 1 hour | NOT DONE |
| 12 | Deploy custom_adaptor_completed to devnet | 30 min | NOT DONE |
Key Files (What Judges Should Look At)
Strategy (the brain):
src/strategy/engine.ts— 2,328 lines, core strategy enginesrc/strategy/floating-maker.ts— 450 lines, DLOB market makingsrc/drift/jit-maker.ts— 726 lines, JIT auction fillssrc/drift/filler.ts— 599 lines, DLOB order filling
Execution:
src/drift/executor.ts— 1,498 lines, atomic txs + Jito bundles + simulationsrc/agent/index.ts— 954 lines, orchestration + lifecyclescripts/rebalance-bot/rebalance_loop.ts— Voltr-compatible rebalance
On-Chain:
programs/driftbear_custom_adaptor/src/lib.rs— 1,058 lines Rust, CPI to Driftprograms/custom_adaptor_completed/src/lib.rs— Workshop 2 completed solutionAnchor.toml— program IDs + devnet config
Risk & $500K Hardening:
src/strategy/circuit-breaker.ts— 6-trigger emergency stopsrc/risk/manager.ts— health/drawdown/leveragesrc/risk/oracle-guard.ts— oracle staleness detectionsrc/strategy/capital-ramp.ts— phased deployment (10% → 100% over 10 days)src/strategy/slippage-guard.ts— per-asset liquidity tiers + DLOB depth checkssrc/strategy/venue-health.ts— Drift uptime tracking + Binance failover
Documentation:
docs/ON_CHAIN_PROGRAMS.md— deployed programs + verified txsMAIN_TRACK_SUBMISSION.md— Ranger track submissionDRIFT_TRACK_SUBMISSION.md— Drift track submission
Infrastructure — Running 24/7
The strategy agent runs off-chain (npm run agent). It needs a server running 24/7 to submit transactions.
Server Setup
Recommended: Hetzner VPS (€4/mo) or DigitalOcean ($6/mo) — 1 CPU, 1GB RAM is enough.
# 1. SSH into server
ssh root@your-server-ip
# 2. Install Node.js
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt install -y nodejs git
# 3. Clone repo & install
git clone <repo-url> ranger && cd ranger
npm install
# 4. Set up environment (.env with wallet key, RPC, etc)
nano .env
# 5. Install pm2 & start agent
npm install -g pm2
pm2 start "npm run agent" --name ranger-agent
# 6. Auto-restart on crash + server reboot
pm2 save
pm2 startup
Monitoring
pm2 status # Check if running
pm2 logs ranger-agent # View logs
pm2 monit # CPU/RAM usage
Security Checklist
- Use a dedicated wallet (not your main)
- SSH key-only login (disable password auth)
- Keep server updated (
apt update && apt upgrade) - Firewall: only allow SSH (port 22)
Available Commands
# Strategy
npm run agent # Start full strategy engine
npm run rebalance-bot # Voltr-compatible rebalance loop
# Backtesting
npm run backtest:v2-s3 # Ideal assumptions (+45.76% CAGR)
npm run backtest:v2-s3-realistic # Worst-case assumptions (~+30% CAGR)
# Monitoring
npm run funding-monitor # Funding rate dashboard
npm run health-guard # Health monitoring
npm run dashboard # Web dashboard (:3000)
# Vault
npm run vault:init / deposit / withdraw / status
# Devnet
npm run devnet:setup / dry-run / strategy
# Testing
npm test # 20 suites, 181 tests