A Solana program for automated DCA (Dollar Cost Averaging) trading using Jupiter's DCA program.
This program provides functionality for:
- Setting up DCA (Dollar Cost Averaging) strategies
- Managing token swaps through Jupiter
- Handling token escrow accounts
- Airdrop distribution for participants
-
Instructions
setup_dca
: Create new DCA strategyclose
: Close DCA positions and accountsairdrop
: Handle airdrop distribution
-
State Management
Escrow
: Manages user tokens and DCA state- Handles token accounts and permissions
-
Integration
- Jupiter DCA program integration
- Token account management
- Secure fund handling
- Rust and Cargo
- Solana Tool Suite
- Anchor Framework
anchor build
anchor test
anchor deploy
Program Id: 7Jg27CTDL38Pq3ErvTbxwc3FSjz9oqZN5GMXUAjnt9Dz
Signature: 3L9MkyLhfUbrkj7wF7g24StMFcawMA8TftRG3ejRAPGQfxpVZSdKZATn83kViQh2kGDhydSFwYgk2pzLtjeDw8D9
src/
├── lib.rs # Program entry point and instruction handlers
├── instructions/ # Instruction implementation
│ ├── setup_dca.rs # DCA setup logic
│ ├── close.rs # Position closing logic
│ └── airdrop.rs # Airdrop distribution
├── state/ # Program state definitions
│ └── escrow.rs # Escrow account structure
└── errors/ # Custom error definitions
- Initialize DCA Strategy:
await program.methods
.setupDca(
applicationIdx,
inAmount,
inAmountPerCycle,
cycleFrequency,
minOutAmount,
maxOutAmount,
startAt
)
.accounts({...})
.rpc();
- Close Position:
await program.methods
.close()
.accounts({...})
.rpc();
- Handle Airdrop:
await program.methods
.airdrop()
.accounts({...})
.rpc();
- All token transfers use PDAs
- Input validation on amounts and intervals
- Proper permission checks
- Secure escrow account management
MIT