Design slippage protection mechanisms for trading protocols.
Protection Requirements:
- Trade Types: ${{TRADE_TYPES}}
- Volume Range: ${{VOLUME_RANGE}}
- User Experience Goals: ${{UX_GOALS}}
- MEV Considerations: ${{MEV_CONCERNS}}
Slippage Protection:
1. **Slippage Calculation**
```solidity
// Expected output calculation
// Minimum output enforcement
// Dynamic slippage suggestions
// Price impact estimation
```
2. **Protection Mechanisms**
- Minimum output amounts
- Deadline enforcement
- Price bounds
- Partial fill options
3. **Dynamic Slippage**
- Volatility-based adjustment
- Liquidity-based calculation
- Historical analysis
- User preference learning
4. **Trade Routing**
- Multi-hop optimization
- Split routing
- Cross-DEX routing
- Gas-adjusted routing
5. **MEV Protection**
- Private submission
- Flashbots integration
- Deadline optimization
- Sandwich resistance
6. **User Experience**
- Clear warnings
- Impact visualization
- Alternative suggestions
- Confirmation flows
7. **Monitoring & Analytics**
- Slippage tracking
- Failed transaction analysis
- User behavior patterns
- Optimization opportunities
Include router contract and slippage calculator.Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[{TRADE_TYPES][{VOLUME_RANGE][{UX_GOALS][{MEV_CONCERNS]