- Resolve stash: merge load_deployment_env path with secure-secrets and CR/LF RPC strip - create-pmm-full-mesh-chain138.sh delegates to sync-chain138-pmm-pools-from-json.sh - env.additions.example: canonical PMM pool defaults (cUSDT/USDT per crosscheck) - Include Chain138 scripts, official mirror deploy scaffolding, and prior staged changes Made-with: Cursor
12 KiB
Complete Integration Guide: Reserve Backing + DODO PMM
Date: 2025-01-12
Status: Complete Implementation Guide
Purpose: End-to-end guide for implementing 1:1 backing and exchangeability
Executive Summary
This guide provides a complete implementation path for making CompliantUSDT (cUSDT) and CompliantUSDC (cUSDC) exchangeable with official Tether USDT and Circle USDC tokens through:
- Reserve Backing Mechanism: 1:1 backing with official tokens
- DODO PMM Integration: Liquidity pools for exchangeability
Architecture Overview
┌─────────────────────────────────────────────────────────────────┐
│ Reserve Backing Layer │
├─────────────────────────────────────────────────────────────────┤
│ Ethereum Mainnet (Official Tokens) │
│ ┌──────────────────┐ ┌──────────────────┐ │
│ │ Official USDT │ │ Official USDC │ │
│ └────────┬─────────┘ └────────┬─────────┘ │
│ │ │ │
│ │ Lock │ Lock │
│ ▼ ▼ │
│ ┌─────────────────────────────────────────┐ │
│ │ StablecoinReserveVault │ │
│ │ - Locks official tokens │ │
│ │ - Maintains 1:1 backing │ │
│ └────────┬────────────────────────────┬───┘ │
│ │ │ │
│ │ Mint │ Mint │
│ ▼ ▼ │
│ ┌──────────────────┐ ┌──────────────────┐ │
│ │ Compliant USDT │ │ Compliant USDC │ │
│ │ (cUSDT) │ │ (cUSDC) │ │
│ └────────┬─────────┘ └────────┬─────────┘ │
│ │ │ │
└───────────┼───────────────────────────┼─────────────────────────┘
│ │
│ Chain 138 │
│ │
┌───────────▼───────────────────────────▼─────────────────────────┐
│ DODO PMM Liquidity Layer │
├─────────────────────────────────────────────────────────────────┤
│ ┌─────────────────────────────────────────┐ │
│ │ DODOPMMIntegration │ │
│ │ - Pool management │ │
│ │ - Swap execution │ │
│ └────────┬────────────────────────────┬───┘ │
│ │ │ │
│ ┌────────▼────────┐ ┌────────▼────────┐ │
│ │ Pool: cUSDT │ │ Pool: cUSDC │ │
│ │ ↔ USDT │ │ ↔ USDC │ │
│ └─────────────────┘ └─────────────────┘ │
│ │
│ Benefits: │
│ • Price stability via PMM │
│ • Efficient liquidity │
│ • Market-driven peg maintenance │
│ • Exchangeability │
└───────────────────────────────────────────────────────────────┘
Implementation Phases
Phase 1: Reserve Backing Setup
Goal: Establish 1:1 backing mechanism
Steps:
-
Deploy StablecoinReserveVault on Ethereum Mainnet
# Set environment export ETH_MAINNET_RPC_URL=https://... export PRIVATE_KEY=0x... export COMPLIANT_USDT_ADDRESS=0x... export COMPLIANT_USDC_ADDRESS=0x... # Deploy forge script script/reserve/DeployStablecoinReserveVault.s.sol:DeployStablecoinReserveVault \ --rpc-url $ETH_MAINNET_RPC_URL \ --broadcast \ --legacy \ --gas-price 30000000000 \ --via-ir -
Initial Funding
- Deposit official USDT/USDC to vault
- Verify reserves match token supply
- Enable deposit/redemption functions
-
Verification
- Check backing ratios
- Test deposit/redemption flows
- Monitor reserve balances
Timeline: 1-2 days
Cost: ~0.05 ETH (deployment + initial funding gas)
Phase 2: DODO PMM Integration
Goal: Create liquidity pools for exchangeability
Steps:
-
Deploy DODOPMMIntegration
# Set environment export RPC_URL=https://... export DODO_VENDING_MACHINE_ADDRESS=0x... export COMPLIANT_USDT_ADDRESS=0x... export COMPLIANT_USDC_ADDRESS=0x... # On Chain 138, use the live local quote-side mirror stables export OFFICIAL_USDT_ADDRESS=0x004b63A7B5b0E06f6bB6adb4a5F9f590BF3182D1 export OFFICIAL_USDC_ADDRESS=0x71D6687F38b93CCad569Fa6352c876eea967201b # Deploy forge script script/dex/DeployDODOPMMIntegration.s.sol:DeployDODOPMMIntegration \ --rpc-url $RPC_URL \ --broadcast \ --legacy \ --gas-price 30000000000 \ --via-ir -
Create Pools
- Create cUSDT/USDT pool
- Create cUSDC/USDC pool
- Configure optimal parameters
-
Seed Liquidity
- Add initial liquidity to pools
- Balance base/quote reserves
- Monitor pool health
Timeline: 2-3 days
Cost: ~0.03 ETH (deployment + pool creation gas)
Phase 3: Integration & Testing
Goal: Integrate systems and test end-to-end
Steps:
-
Integration Testing
- Test reserve vault operations
- Test DODO pool swaps
- Test price stability
- Test arbitrage flows
-
Monitoring Setup
- Set up reserve monitoring
- Monitor pool prices
- Track liquidity depth
- Alert on deviations
-
Documentation
- User guides
- API documentation
- Integration examples
Timeline: 3-5 days
Cost: Gas for testing transactions
Phase 4: Production Launch
Goal: Launch to production with safety measures
Steps:
-
Security Review
- Audit contracts
- Review access controls
- Test emergency procedures
-
Gradual Rollout
- Start with limited deposits
- Monitor for 24-48 hours
- Gradually increase limits
-
Ongoing Operations
- Monitor reserves
- Maintain liquidity
- Adjust parameters as needed
Timeline: 1-2 weeks
Cost: Audit fees (~$10k-50k)
Configuration Parameters
Reserve Vault
| Parameter | Recommended Value | Notes |
|---|---|---|
| Initial Reserve | 10M+ tokens | For stability |
| Reserve Ratio | 100%+ | Always maintain 1:1+ |
| Pause Threshold | 95% backing | Safety margin |
DODO Pools
| Parameter | Recommended Value | Notes |
|---|---|---|
| Initial Price (i) | 1e18 ($1) | For stablecoins |
| K Factor | 0.3e18 - 0.5e18 | Lower = less slippage |
| LP Fee Rate | 3-10 bps | 0.03% - 0.1% |
| TWAP | Enabled | Price stability |
| Initial Liquidity | 1M+ tokens | For each pool |
Security Considerations
Reserve Vault
- Multi-sig Admin: Use multi-sig wallet for admin role
- Access Control: Limit operator roles
- Pause Mechanism: Test emergency pause
- Audit: Professional security audit
- Monitoring: Real-time reserve monitoring
DODO Pools
- Pool Parameters: Carefully set k and fees
- Liquidity Depth: Maintain sufficient liquidity
- Price Monitoring: Monitor for manipulation
- Slippage Protection: Use appropriate limits
- Emergency Procedures: Plan for pool issues
Monitoring & Maintenance
Key Metrics
-
Reserve Vault:
- Reserve balances (USDT/USDC)
- Token supply (cUSDT/cUSDC)
- Backing ratio (target: 100%+)
- Deposit/redemption volumes
-
DODO Pools:
- Pool reserves (base/quote)
- Pool price vs. peg
- Swap volumes
- LP fee accumulation
- Slippage rates
Monitoring Tools
- Custom dashboards (Grafana, etc.)
- On-chain monitoring (The Graph, etc.)
- Alert systems (PagerDuty, etc.)
- Automated scripts (check reserves, etc.)
Cost Estimates
Deployment Costs
| Item | Estimated Cost |
|---|---|
| Reserve Vault Deployment | ~0.05 ETH |
| DODO Integration Deployment | ~0.03 ETH |
| Pool Creation (2 pools) | ~0.02 ETH |
| Initial Funding Gas | ~0.01 ETH |
| Total Deployment | ~0.11 ETH |
Ongoing Costs
| Item | Estimated Cost |
|---|---|
| Gas for operations | Variable |
| Monitoring infrastructure | $50-200/month |
| Security audits | $10k-50k (one-time) |
Success Criteria
Phase 1 Success
- ✅ Reserve vault deployed and verified
- ✅ Initial reserves deposited
- ✅ Backing ratio = 100%+
- ✅ Deposit/redemption tested
Phase 2 Success
- ✅ DODO integration deployed
- ✅ Pools created with optimal parameters
- ✅ Initial liquidity seeded
- ✅ Pools operational
Phase 3 Success
- ✅ End-to-end testing completed
- ✅ Monitoring systems operational
- ✅ Documentation complete
- ✅ Security review passed
Phase 4 Success
- ✅ Production launch successful
- ✅ Reserves maintained at 100%+
- ✅ Pools maintain 1:1 peg
- ✅ User adoption growing
Troubleshooting
Reserve Backing Issues
Problem: Backing ratio < 100%
Solution:
- Deposit more official tokens
- Pause minting if needed
- Investigate unauthorized minting
Pool Price Deviation
Problem: Pool price deviates from $1
Solution:
- Check pool reserves balance
- Add/remove liquidity as needed
- Monitor for large trades
- Allow arbitrage to correct
Liquidity Issues
Problem: Insufficient liquidity for swaps
Solution:
- Add more liquidity to pools
- Adjust k factor if needed
- Incentivize LPs if necessary
Next Steps After Implementation
- Marketing: Promote exchangeability features
- Liquidity Mining: Incentivize liquidity providers
- Partnerships: Integrate with DeFi protocols
- Cross-Chain: Expand to more chains
- Governance: Consider DAO governance
Resources
- Reserve Backing Documentation
- DODO PMM Documentation
- DODO Official Documentation
- Setup Scripts:
scripts/setup-reserve-vault.sh,scripts/setup-dodo-pools.sh
Support
For issues or questions:
- Review documentation
- Check troubleshooting section
- Review contract code comments
- Contact development team