PARROT TWAP
SOLANA GRAVEYARD HACKATHON 2026
01 / 09
SPACE / → to advance  ·  ← to go back
Solana Graveyard Hackathon

Parrot TWAP

A time-weighted average price bot revived from a dead Solana protocol. Now powered by Jupiter — the most used DEX aggregator on Solana.

Original: Parrot Protocol (2021)
Language: Go
Lines: 1,359
Track: Overall Prizes
The Problem

Every dependency
was dead.

Parrot Protocol built a solid TWAP bot in 2021. Then the infrastructure underneath it collapsed — and nobody ever fixed it.

📉

Serum DEX

Sunset after FTX collapse (Nov 2022). Order book gone.

🔴

Raydium AMM v4

Deprecated. New pools use concentrated liquidity (CLMM).

🦜

Parrot Protocol

Protocol shut down. PRT token, PAI stablecoin — all gone.

The Revival

Replaced dead infrastructure with Jupiter

Jupiter v1 API

Optimal routing across every Solana DEX — Raydium CLMM, Orca Whirlpools, Meteora, and 30+ more. One API call.

🌐

Any Token Pair

Not limited to PRT anymore. SOL, USDC, BONK, JUP, WIF — or paste any mint address. Universal DCA.

🏗️

Original Architecture

Preserved the scheduler, balance tracking, stop conditions, and auto-transfer system. Just replaced the swap engine.

Code Changes

Raydium/Serum → Jupiter

swap/raydium.go — DEAD
func (r *RaydiumSwap) Swap(ctx, pool, amount) {   // Build Serum DEX instruction   serumProgramID := "9xQeW..."   inst := raydium.NewSwapInstruction(     pool.AmmID,     pool.SerumMarket, // ← DEAD     pool.SerumBids,   // ← DEAD     pool.SerumAsks,   // ← DEAD   )   // Hard-coded pool configs per pair   // Only PRT:USDC supported }
swap/jupiter.go — NEW
func (j *JupiterSwap) Swap(ctx, in, out, amt) {   // 1. Get optimal quote from Jupiter   quote := j.GetQuote(in, out, amt, slippage)     // 2. Get serialized swap transaction   swapTx := POST(JupiterSwapURL, quote)     // 3. Decode, sign, send   tx := base64.Decode(swapTx)   tx.Sign(privateKey)   sig := rpc.SendTransaction(tx) }
Live Demo

Real Jupiter Quote

Fetched from mainnet right now — same API the bot uses.

jupiter v1 / mainnet-beta
Connected
0.1 SOL
... USDC
Output
Price Impact
Route
Slippage
2.00%
Why DCA?

The Economics of Automated DCA

Swap Size Value (USD) Fee Overhead
0.001 SOL ~$0.09 $0.008 ~9.4%
0.01 SOL ~$0.85 $0.008 ~0.9%
0.1 SOL ~$8.50 $0.008 ~0.09%
1 SOL ~$85 $0.008 ~0.01%
10 SOL ~$850 $0.008 ~0.001%

Key Insight

💡 Fixed fee per swap: ~95K lamports ($0.008). Doesn't scale with size.
📊 Sweet spot: 0.1 SOL+ per swap. Fee becomes rounding error.
🎯 DCA advantage: Removes timing risk. Spreads entry across dozens of price points.
🔐 Self-custodied. Your keys, your wallet. No third-party platform risk.
Usage

Drop-in CLI for DCA Strategies

Terminal
# DCA into USDC every 5 minutes
$ go run cmd/cli.go --pair SOL:USDC --amount 0.1 --interval 5m

# Sell BONK for SOL every hour
$ go run cmd/cli.go --pair BONK:SOL --amount 1000000 --interval 1h --side sell

# DCA with stop condition
$ go run cmd/cli.go --pair SOL:JUP --amount 0.05 --interval 30m --stopAmount 1000

# Use raw mint addresses for any token
$ go run cmd/cli.go --pair So111...112:EPjFW...Dt1v --amount 0.1 --interval 10m
Architecture

Clean Go Module Structure

⌨️

CLI

Parse args
Load .env

⏱️

Scheduler

gocron
Interval loop

💰

Balance Check

RPC query
Stop conditions

🔄

Jupiter Quote

Best route
Price + impact

✍️

Sign & Send

Decode tx
Broadcast

📋

Log

JSON store
Swap history

cmd/cli.go
Entry point, args
swap/jupiter.go
Jupiter v1 API
swap/swap.go
TWAP core logic
config/jupiter.go
Token resolution
swap/rpc.go
Solana helpers
From the Graveyard

Dead Protocol.
Alive Again.

Parrot Protocol's TWAP bot — revived with Jupiter, ready for any Solana token pair.

10
Go files
1,359
Lines of code
12
Token symbols
30+
DEXes via Jupiter
Live Mainnet Swap Proof
0.01 SOL → 0.849 USDC  |  Slot 400858601  |  Fee: 0.000095 SOL
TX: 5EbCToSVwDaMeQ12irKZorj86CembESq43z8236YLYaRrgpKuBxC8F3EMRW3wYrGgnFsTNRQ5dyQVHiUZwpg4Jyf