# Smart Contract Deployment Checklist

## 📋 Contracts to Deploy (19 total)

### ✅ Deployment Status
- Total Contracts: 19
- Deployed: 0
- Remaining: 19

---

## **Phase 1: Core Utilities** (5 contracts - Parallel Deployment)

### 1. Multicall
- [ ] Deploy script: `script/DeployMulticall.s.sol`
- [ ] Dependencies: None
- [ ] Address in .env: `MULTICALL_ADDRESS=`
- [ ] Verify on explorer

### 2. CREATE2Factory
- [ ] Deploy script: `script/Deploy.s.sol` (included) or create standalone
- [ ] Dependencies: None
- [ ] Address in .env: `CREATE2FACTORY_ADDRESS=`
- [ ] Verify on explorer

### 3. WETH9
- [ ] Deploy script: `script/DeployWETH.s.sol` or `DeployWETHWithCREATE2.s.sol`
- [ ] Dependencies: None
- [ ] Address in .env: `WETH9_ADDRESS=` (ChainID 138, not mainnet)
- [ ] Verify on explorer

### 4. WETH10
- [ ] Deploy script: `script/DeployWETH10.s.sol` or `DeployWETH10WithCREATE2.s.sol`
- [ ] Dependencies: None
- [ ] Address in .env: `WETH10_ADDRESS=` (ChainID 138, not mainnet)
- [ ] Verify on explorer

### 5. Oracle Aggregator + Proxy
- [ ] Deploy script: `script/DeployOracle.s.sol`
- [ ] Dependencies: None
- [ ] Addresses in .env: `ORACLE_AGGREGATOR_ADDRESS=`, `ORACLE_PROXY_ADDRESS=`
- [ ] Verify on explorer

---

## **Phase 2: Governance** (1-2 contracts)

### 6. MultiSig
- [ ] Set `MULTISIG_OWNERS` in .env (comma-separated addresses)
- [ ] Set `MULTISIG_REQUIRED` in .env (number of confirmations)
- [ ] Deploy script: `script/DeployMultiSig.s.sol`
- [ ] Dependencies: MULTISIG_OWNERS env var
- [ ] Address in .env: `MULTISIG_ADDRESS=`
- [ ] Verify on explorer

### 7. Voting (Optional - No script found)
- [ ] Create deployment script if needed
- [ ] Deploy if governance voting is required
- [ ] Address in .env: `VOTING_ADDRESS=`
- [ ] Verify on explorer

---

## **Phase 3: CCIP Infrastructure** (1-6 contracts)

### 8. CCIP Router (If Custom)
- [ ] Determine if using Chainlink CCIP or custom router
- [ ] If custom: Deploy script: `script/DeployCCIPRouter.s.sol`
- [ ] Set `CCIP_FEE_TOKEN` in .env
- [ ] Dependencies: None (if custom)
- [ ] Address in .env: `CCIP_ROUTER=`
- [ ] Verify on explorer

### 9. CCIPWETH9Bridge
- [ ] Requires: CCIP_ROUTER, WETH9_ADDRESS
- [ ] Deploy script: `script/DeployCCIPWETH9Bridge.s.sol`
- [ ] Dependencies: CCIP_ROUTER, WETH9_ADDRESS
- [ ] Address in .env: `CCIPWETH9BRIDGE_ADDRESS=`
- [ ] Verify on explorer
- [ ] Test cross-chain functionality

### 10. CCIPWETH10Bridge
- [ ] Requires: CCIP_ROUTER, WETH10_ADDRESS
- [ ] Deploy script: `script/DeployCCIPWETH10Bridge.s.sol`
- [ ] Dependencies: CCIP_ROUTER, WETH10_ADDRESS
- [ ] Address in .env: `CCIPWETH10BRIDGE_ADDRESS=`
- [ ] Verify on explorer
- [ ] Test cross-chain functionality

### 11-13. CCIPSender, CCIPReceiver, CCIPMessageValidator (No scripts found)
- [ ] Create deployment scripts if needed
- [ ] Deploy if required for CCIP functionality
- [ ] Addresses in .env: `CCIPSENDER_ADDRESS=`, `CCIPRECEIVER_ADDRESS=`, etc.
- [ ] Verify on explorer

### 14. CCIPRouterOptimized (No script found)
- [ ] Create deployment script if using optimized router
- [ ] Deploy if required
- [ ] Address in .env: `CCIPROUTER_OPTIMIZED_ADDRESS=`
- [ ] Verify on explorer

### 15. OracleWithCCIP (No script found)
- [ ] Create deployment script if CCIP oracle integration needed
- [ ] Requires: Oracle + CCIP infrastructure
- [ ] Address in .env: `ORACLE_CCIP_ADDRESS=`
- [ ] Verify on explorer

---

## **Phase 4: Advanced Features** (3 contracts)

### 16-17. TwoWayTokenBridge (L1/L2)
- [ ] Deploy script: `script/DeployTwoWayBridge.s.sol`
- [ ] Dependencies: CCIP infrastructure
- [ ] Addresses in .env: `BRIDGE_L1_ADDRESS=`, `BRIDGE_L2_ADDRESS=`
- [ ] Verify on explorer
- [ ] Test bridge functionality

### 18. MirrorManager
- [ ] Deploy script: `script/DeployMirrorManager.s.sol`
- [ ] Dependencies: CCIP infrastructure
- [ ] Address in .env: `MIRRORMANAGER_ADDRESS=`
- [ ] Verify on explorer

### 19. MockLinkToken (Testing Only - Optional)
- [ ] Deploy script: `script/DeployMockLinkToken.s.sol`
- [ ] Dependencies: None
- [ ] Address in .env: `MOCK_LINK_TOKEN_ADDRESS=`
- [ ] Note: For testing only, remove before production

---

## 📝 Pre-Deployment Checklist

- [ ] RPC endpoint is accessible and responding
- [ ] Deployer account has sufficient balance (ETH for gas)
- [ ] `.env` file has all required variables:
  - [ ] `PRIVATE_KEY` - Deployer private key
  - [ ] `RPC_URL` - Besu RPC endpoint (http://<proxy-ip>:8545 or direct)
  - [ ] `MULTISIG_OWNERS` - For MultiSig deployment (comma-separated)
  - [ ] `MULTISIG_REQUIRED` - For MultiSig deployment (number)
  - [ ] `CCIP_ROUTER` - Chainlink CCIP Router address (if using existing)
  - [ ] `CCIP_FEE_TOKEN` - Fee token address (if custom CCIP)
  - [ ] `ORACLE_DESCRIPTION` - Oracle description (default: "ETH/USD Price Feed")
  - [ ] `ORACLE_HEARTBEAT` - Oracle heartbeat in seconds (default: 60)
  - [ ] `ORACLE_DEVIATION_THRESHOLD` - Oracle deviation threshold (default: 50)

---

## 🚀 Deployment Commands

### Quick Deploy (Parallel)
```bash
# Deploy all contracts in parallel
./scripts/deployment/deploy-contracts-parallel.sh
```

### Manual Deploy (Step by step)
```bash
# Load environment
source .env

# Phase 1: Core (parallel)
forge script script/DeployMulticall.s.sol:DeployMulticall --rpc-url $RPC_URL --broadcast --private-key $PRIVATE_KEY
forge script script/DeployWETH.s.sol:DeployWETH --rpc-url $RPC_URL --broadcast --private-key $PRIVATE_KEY
forge script script/DeployWETH10.s.sol:DeployWETH10 --rpc-url $RPC_URL --broadcast --private-key $PRIVATE_KEY

# Phase 2: Oracle
forge script script/DeployOracle.s.sol:DeployOracle --rpc-url $RPC_URL --broadcast --private-key $PRIVATE_KEY

# Phase 3: MultiSig (if owners configured)
forge script script/DeployMultiSig.s.sol:DeployMultiSig --rpc-url $RPC_URL --broadcast --private-key $PRIVATE_KEY

# Phase 4: CCIP (after dependencies)
forge script script/DeployCCIPWETH9Bridge.s.sol:DeployCCIPWETH9Bridge --rpc-url $RPC_URL --broadcast --private-key $PRIVATE_KEY
forge script script/DeployCCIPWETH10Bridge.s.sol:DeployCCIPWETH10Bridge --rpc-url $RPC_URL --broadcast --private-key $PRIVATE_KEY
```

---

## ✅ Post-Deployment Verification

After each deployment:
- [ ] Contract address recorded in `.env`
- [ ] Contract verified on Blockscout explorer
- [ ] Contract functions tested (if applicable)
- [ ] Documentation updated with address

