Files
smom-dbis-138/docs/deployment/TESTNET_DEPLOYMENT_GUIDE.md
2026-03-02 12:14:09 -08:00

266 lines
5.6 KiB
Markdown

# Testnet Deployment Guide
**Date**: 2026-01-24
**Status**: Ready for Testnet Deployment
---
## 📋 **Pre-Deployment Checklist**
### **1. Environment Setup**
- [x] All contracts compile successfully
- [x] Test suites created and passing
- [x] Deployment scripts ready
- [ ] Testnet RPC endpoints configured
- [ ] Testnet accounts funded
- [ ] Environment variables set
### **2. Configuration**
- [ ] Testnet chain IDs configured
- [ ] Testnet contract addresses documented
- [ ] Testnet CCIP router addresses
- [ ] Testnet LINK token addresses
- [ ] Testnet WETH addresses
### **3. Security**
- [ ] Security checklist reviewed
- [ ] Access control verified
- [ ] Upgrade paths tested
- [ ] Emergency procedures documented
---
## 🚀 **Deployment Steps**
### **Step 1: Deploy Core Infrastructure**
```bash
# Set environment variables
export PRIVATE_KEY="your_testnet_private_key"
export RPC_URL="https://sepolia.infura.io/v3/YOUR_KEY" # Example testnet
# Deploy Universal Asset Registry and Chain Registry
forge script script/deploy/01_DeployCore.s.sol:DeployCore \
--rpc-url $RPC_URL \
--broadcast \
--verify \
--etherscan-api-key $ETHERSCAN_API_KEY
```
### **Step 2: Deploy Vault System**
```bash
# Deploy complete vault system
forge script script/deploy/vault/DeployVaultSystem.s.sol:DeployVaultSystem \
--rpc-url $RPC_URL \
--broadcast \
--verify \
--etherscan-api-key $ETHERSCAN_API_KEY
```
**Expected Output**:
- RegulatedEntityRegistry
- XAU Oracle
- Rate Accrual
- Ledger
- Liquidation Module
- Collateral Adapter
- eMoney Join
- Vault Factory
### **Step 3: Deploy ISO-4217W Token System**
```bash
# Set additional environment variables
export CUSTODIAN_ADDRESS="0x..."
export RESERVE_MANAGER_ADDRESS="0x..."
export RESERVE_TRANSMITTER_1="0x..."
export RESERVE_TRANSMITTER_2="0x..."
# Deploy ISO-4217W system
forge script script/deploy/iso4217w/DeployISO4217WSystem.s.sol:DeployISO4217WSystem \
--rpc-url $RPC_URL \
--broadcast \
--verify \
--etherscan-api-key $ETHERSCAN_API_KEY
```
**Expected Output**:
- Compliance Guard
- Reserve Oracle
- Mint Controller
- Burn Controller
- Token Registry
- Token Factory
- USDW, EURW, GBPW tokens
### **Step 4: Deploy Bridge System**
```bash
# Deploy Universal CCIP Bridge
forge script script/deploy/02_DeployBridges.s.sol:DeployBridges \
--rpc-url $RPC_URL \
--broadcast \
--verify \
--etherscan-api-key $ETHERSCAN_API_KEY
# Deploy WETH bridges
export CCIP_ROUTER_ADDRESS="0x..."
export WETH9_ADDRESS="0x..."
export WETH10_ADDRESS="0x..."
export LINK_TOKEN_ADDRESS="0x..."
forge script script/deploy/bridge/DeployWETHBridges.s.sol:DeployWETHBridges \
--rpc-url $RPC_URL \
--broadcast \
--verify \
--etherscan-api-key $ETHERSCAN_API_KEY
```
### **Step 5: Deploy Chain Adapters**
```bash
# Deploy all chain adapters
forge script script/deploy/chains/DeployAllAdapters.s.sol:DeployAllAdapters \
--rpc-url $RPC_URL \
--broadcast \
--verify \
--etherscan-api-key $ETHERSCAN_API_KEY
```
### **Step 6: Configure Bridge Destinations**
```bash
# Set bridge addresses from deployment
export WETH9_BRIDGE_138="0x..."
export WETH10_BRIDGE_138="0x..."
# Configure destinations
./scripts/deployment/configure-bridge-destinations.sh
```
### **Step 7: Initialize Systems**
```bash
# Register assets in Universal Asset Registry
# Register chains in Chain Registry
# Configure risk parameters in Ledger
# Initialize reserve oracle with initial reserves
```
---
## ✅ **Post-Deployment Verification**
### **1. Contract Verification**
```bash
# Verify all contracts on Etherscan
forge verify-contract <CONTRACT_ADDRESS> <CONTRACT_NAME> \
--chain-id <CHAIN_ID> \
--etherscan-api-key $ETHERSCAN_API_KEY
```
### **2. Functional Testing**
```bash
# Run integration tests on testnet
forge test --fork-url $RPC_URL
# Test bridge functionality
# Test vault operations
# Test ISO-4217W token operations
```
### **3. Monitoring Setup**
- [ ] Set up event monitoring
- [ ] Configure alerts
- [ ] Create monitoring dashboard
- [ ] Set up logging
---
## 📊 **Deployment Addresses**
Document all deployed addresses:
```markdown
## Testnet Deployment Addresses
### Core Infrastructure
- Universal Asset Registry: `0x...`
- Chain Registry: `0x...`
- Universal CCIP Bridge: `0x...`
### Vault System
- Regulated Entity Registry: `0x...`
- XAU Oracle: `0x...`
- Ledger: `0x...`
- Vault Factory: `0x...`
### ISO-4217W System
- Compliance Guard: `0x...`
- Reserve Oracle: `0x...`
- Token Factory: `0x...`
- USDW Token: `0x...`
### Bridge System
- WETH9 Bridge: `0x...`
- WETH10 Bridge: `0x...`
- Polygon Adapter: `0x...`
- XDC Adapter: `0x...`
```
---
## 🔧 **Troubleshooting**
### **Common Issues**
1. **Out of Gas**
- Increase gas limit: `--gas-limit 5000000`
- Optimize contract size
2. **Verification Failures**
- Check compiler version matches
- Verify constructor arguments
- Use `--constructor-args` if needed
3. **Transaction Failures**
- Check account balance
- Verify nonce
- Check contract addresses
---
## 📝 **Next Steps After Testnet Deployment**
1. **Testing**
- Run comprehensive test suite
- Test all user flows
- Test edge cases
- Test failure scenarios
2. **Monitoring**
- Monitor contract activity
- Track gas usage
- Monitor bridge transfers
- Check oracle updates
3. **Iteration**
- Fix any issues discovered
- Optimize gas usage
- Improve user experience
- Update documentation
4. **Production Preparation**
- Complete security audit
- Finalize production configuration
- Prepare production deployment scripts
- Schedule production deployment
---
**Status**: ✅ **Ready for Testnet Deployment**