# Comprehensive List of Missing Contracts - ChainID 138 & Mainnet

**Date**: 2025-12-24  
**Status**: Complete inventory of missing contracts and recommendations

---

## 📋 Executive Summary

This document provides a comprehensive list of all missing contracts for ChainID 138 and other mainnet networks, including:
- Stablecoins (USDT, USDC)
- CCIP contracts
- OpenZeppelin dependencies
- Governance contracts
- Reserve system contracts
- eMoney system contracts
- Cross-chain bridge contracts
- Additional recommendations

---

## 🔴 CRITICAL - Missing CCIP Contracts (ChainID 138)

### 1. CCIPSender
- **Status**: ❌ **NOT DEPLOYED**
- **Address**: Expected but not deployed
- **Purpose**: Send CCIP messages from ChainID 138 to other chains
- **Dependencies**: CCIP Router, Oracle Aggregator, LINK Token
- **Deployment Script**: `script/DeployCCIPSender.s.sol`
- **OpenZeppelin Required**: ✅ Yes (SafeERC20, IERC20)
- **Priority**: 🔴 **HIGH** - Required for cross-chain operations

### 2. CCIPReceiver (Re-deployment)
- **Status**: ⚠️ **DEPLOYED BUT NOT VERIFIED**
- **Address**: `0x95007eC50d0766162F77848Edf7bdC4eBA147fb4`
- **Issue**: Code not found on-chain (needs re-deployment)
- **Purpose**: Receive CCIP messages from other chains
- **Dependencies**: CCIP Router, Oracle Aggregator
- **Deployment Script**: `script/DeployCCIPReceiver.s.sol`
- **Priority**: 🔴 **CRITICAL** - Needs immediate re-deployment

### 3. CCIPWETH9Bridge
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: Cross-chain bridge for WETH9 tokens
- **Dependencies**: CCIP Router, WETH9, LINK Token
- **Deployment Script**: `script/DeployCCIPWETH9Bridge.s.sol`
- **Note**: Bridge address exists in .env but contract not deployed
- **Priority**: 🔴 **HIGH** - Required for WETH9 bridging

### 4. CCIPWETH10Bridge
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: Cross-chain bridge for WETH10 tokens
- **Dependencies**: CCIP Router, WETH10, LINK Token
- **Deployment Script**: `script/DeployCCIPWETH10Bridge.s.sol`
- **Note**: Bridge address exists in .env but contract not deployed
- **Priority**: 🔴 **HIGH** - Required for WETH10 bridging

### 5. CCIPRouter (Custom - Optional)
- **Status**: ⚠️ **OPTIONAL** (Using Chainlink's official router)
- **Purpose**: Custom CCIP router implementation
- **Dependencies**: LINK Token
- **Deployment Script**: `script/DeployCCIPRouter.s.sol`
- **OpenZeppelin Required**: ✅ Yes (SafeERC20, IERC20)
- **Note**: Currently using official Chainlink router at `0x8078A09637e47Fa5Ed34F626046Ea2094a5CDE5e`
- **Priority**: 🟡 **LOW** - Only if custom router needed

### 6. CCIPRouterOptimized
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: Optimized CCIP router implementation
- **Dependencies**: LINK Token
- **Deployment Script**: None (needs creation)
- **OpenZeppelin Required**: ✅ Yes (SafeERC20, IERC20)
- **Priority**: 🟡 **LOW** - Optional optimization

### 7. CCIPMessageValidator
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: Validate CCIP messages
- **Dependencies**: CCIP Router
- **Deployment Script**: None (needs creation)
- **Priority**: 🟡 **MEDIUM** - Recommended for security

---

## 💰 Missing Stablecoin Contracts

### 8. USDT (Tether)
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: Tether USD stablecoin on ChainID 138
- **Type**: ERC20 token
- **Deployment Script**: ✅ `script/DeployUSDT.s.sol` (created)
- **Options**:
  - ✅ Native USDT: Standard ERC20 with pausable (recommended for independence)
  - ✅ Wrapped USDT: CCIP bridge pattern, 1:1 backing with Ethereum Mainnet (recommended for trust)
  - ✅ Hybrid: Both native and wrapped (recommended for flexibility)
- **Decimals**: 6 (standard USDT)
- **Recommendations**: See `docs/STABLECOIN_AND_TOKEN_RECOMMENDATIONS.md`
- **Priority**: 🟡 **MEDIUM** - Important for DeFi ecosystem

### 9. USDC (USD Coin)
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: USD Coin stablecoin on ChainID 138
- **Type**: ERC20 token
- **Deployment Script**: ✅ `script/DeployUSDC.s.sol` (created)
- **Options**:
  - ✅ Native USDC: Standard ERC20 with pausable (recommended for independence)
  - ✅ Wrapped USDC: CCIP bridge pattern, 1:1 backing with Ethereum Mainnet (recommended for trust)
  - ✅ Hybrid: Both native and wrapped (recommended for flexibility)
- **Decimals**: 6 (standard USDC)
- **Recommendations**: See `docs/STABLECOIN_AND_TOKEN_RECOMMENDATIONS.md`
- **Priority**: 🟡 **MEDIUM** - Important for DeFi ecosystem

### 10. MainnetTether
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: Tether contract for state anchoring on Ethereum Mainnet
- **Dependencies**: None
- **Deployment Script**: `script/DeployMainnetTether.s.sol`
- **Location**: Ethereum Mainnet (ChainID 1)
- **Priority**: 🟡 **MEDIUM** - For cross-chain state anchoring

---

## 🏛️ Missing Governance Contracts

### 11. MultiSig
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: Multi-signature wallet for governance
- **Dependencies**: None
- **Deployment Script**: `script/DeployMultiSig.s.sol`
- **OpenZeppelin Required**: ✅ Yes (Ownable)
- **Environment Variables**: `MULTISIG_OWNERS` (comma-separated addresses)
- **Priority**: 🟡 **MEDIUM** - Recommended for production

### 12. Voting
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: Voting contract for governance decisions
- **Dependencies**: MultiSig (optional)
- **Deployment Script**: None (needs creation)
- **OpenZeppelin Required**: ✅ Yes (Ownable)
- **Priority**: 🟡 **LOW** - Optional governance feature

---

## 💎 Missing Reserve System Contracts

### 13. ReserveSystem
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: Reserve system for asset management
- **Dependencies**: Price feeds, supported assets
- **Deployment Script**: `script/reserve/DeployReserveSystem.s.sol`
- **Priority**: 🟡 **MEDIUM** - For reserve-backed tokens

### 14. PriceFeedKeeper
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: Keeper contract for price feed updates
- **Dependencies**: Reserve system, price feeds
- **Deployment Script**: `script/reserve/DeployKeeper.s.sol`
- **Priority**: 🟡 **MEDIUM** - For automated price updates

---

## 💳 Missing eMoney System Contracts

### 15. TokenFactory138
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: Factory for creating eMoney tokens on ChainID 138
- **Dependencies**: None
- **Deployment Script**: `script/emoney/DeployChain138.s.sol`
- **Note**: Requires `--via-ir` compilation due to stack too deep
- **Priority**: 🟡 **MEDIUM** - For eMoney token creation

### 16. AccountWalletRegistry
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: Registry for account wallet linking
- **Dependencies**: TokenFactory138
- **Deployment Script**: Part of eMoney deployment
- **Priority**: 🟡 **MEDIUM** - For eMoney system

### 17. ISO20022Router
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: ISO 20022 compliant payment router
- **Dependencies**: TokenFactory138
- **Deployment Script**: Part of eMoney deployment
- **Priority**: 🟡 **MEDIUM** - For ISO 20022 compliance

### 18. RailEscrowVault
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: Escrow vault for payment rails
- **Dependencies**: TokenFactory138
- **Deployment Script**: Part of eMoney deployment
- **Priority**: 🟡 **MEDIUM** - For payment rails

### 19. RailTriggerRegistry
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: Registry for payment rail triggers
- **Dependencies**: TokenFactory138
- **Deployment Script**: Part of eMoney deployment
- **Priority**: 🟡 **MEDIUM** - For payment rails

### 20. SettlementOrchestrator
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: Orchestrates settlement operations
- **Dependencies**: TokenFactory138
- **Deployment Script**: Part of eMoney deployment
- **Priority**: 🟡 **MEDIUM** - For settlement operations

---

## 🔄 Missing Cross-Chain Contracts

### 21. TransactionMirror
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: Mirror transactions from ChainID 138 to Ethereum Mainnet
- **Dependencies**: MainnetTether
- **Deployment Script**: `script/DeployTransactionMirror.s.sol`
- **Location**: Ethereum Mainnet (ChainID 1)
- **Priority**: 🟡 **MEDIUM** - For transaction mirroring

### 22. AddressMapper
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: Map addresses between chains
- **Dependencies**: None
- **Deployment Script**: `script/DeployAddressMapper.s.sol`
- **Priority**: 🟡 **LOW** - Optional address mapping

### 23. MirrorManager
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: Manage transaction mirroring
- **Dependencies**: TransactionMirror
- **Deployment Script**: `script/DeployMirrorManager.s.sol`
- **Priority**: 🟡 **LOW** - Optional mirroring management

---

## 📚 OpenZeppelin Contracts (Dependencies)

### Required OpenZeppelin Contracts

These are **library dependencies**, not contracts to deploy, but must be installed:

#### 24. SafeERC20
- **Status**: ❌ **NOT INSTALLED**
- **Purpose**: Safe ERC20 token operations
- **Used By**: CCIPSender, CCIPRouter, CCIPRouterOptimized
- **Installation**: `forge install OpenZeppelin/openzeppelin-contracts`
- **Priority**: 🔴 **HIGH** - Required for CCIP contracts

#### 25. IERC20
- **Status**: ❌ **NOT INSTALLED**
- **Purpose**: ERC20 token interface
- **Used By**: CCIPSender, CCIPRouter, CCIPRouterOptimized
- **Installation**: Part of OpenZeppelin contracts
- **Priority**: 🔴 **HIGH** - Required for CCIP contracts

#### 26. Ownable
- **Status**: ❌ **NOT INSTALLED**
- **Purpose**: Access control for ownership
- **Used By**: MultiSig, Voting
- **Installation**: Part of OpenZeppelin contracts
- **Priority**: 🟡 **MEDIUM** - Required for governance contracts

---

## 🌐 Missing Contracts for Other Mainnet Networks

### Ethereum Mainnet (ChainID 1)

#### 27. CCIPWETH9Bridge (Mainnet)
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: Bridge WETH9 from Mainnet to ChainID 138
- **Dependencies**: CCIP Router (official Chainlink), WETH9, LINK Token
- **Deployment Script**: `script/DeployCCIPWETH9Bridge.s.sol`
- **Priority**: 🔴 **HIGH** - Required for cross-chain WETH9

#### 28. CCIPWETH10Bridge (Mainnet)
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: Bridge WETH10 from Mainnet to ChainID 138
- **Dependencies**: CCIP Router (official Chainlink), WETH10, LINK Token
- **Deployment Script**: `script/DeployCCIPWETH10Bridge.s.sol`
- **Priority**: 🔴 **HIGH** - Required for cross-chain WETH10

#### 29. CCIPLogger (Mainnet)
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: Log CCIP messages received from ChainID 138
- **Dependencies**: CCIP Router (official Chainlink)
- **Deployment Script**: `script/DeployCCIPLoggerOnly.s.sol` (needs ChainID 138 version)
- **Note**: Current script is hardcoded for Mainnet only
- **Priority**: 🟡 **MEDIUM** - For monitoring

### Other Networks (Cronos, BSC, Polygon, Gnosis)

#### 30-34. CCIP Bridges for Other Chains
- **Status**: ❌ **NOT DEPLOYED**
- **Chains**: Cronos (25), BSC (56), Polygon (137), Gnosis (100)
- **Contracts Needed**:
  - CCIPWETH9Bridge (each chain)
  - CCIPWETH10Bridge (each chain)
  - CCIPLogger (each chain) - Optional
- **Priority**: 🟡 **MEDIUM** - For multi-chain support

---

## 🔧 Additional Recommendations

### Infrastructure Contracts

#### 35. Multicall
- **Status**: ✅ **PRE-DEPLOYED** (Genesis)
- **Address**: `0x99b3511a2d315a497c8112c1fdd8d508d4b1e506`
- **Note**: Already exists, no deployment needed

#### 36. CREATE2Factory
- **Status**: ✅ **PRE-DEPLOYED** (Genesis)
- **Note**: Already exists, no deployment needed

### Oracle Contracts

#### 37. Oracle Aggregator
- **Status**: ✅ **DEPLOYED**
- **Address**: `0x99b3511a2d315a497c8112c1fdd8d508d4b1e506`
- **Note**: Already deployed

#### 38. Oracle Proxy
- **Status**: ✅ **DEPLOYED**
- **Address**: `0x3304b747e565a97ec8ac220b0b6a1f6ffdb837e6`
- **Note**: Already deployed

### Recommended Additional Contracts

#### 39. Price Feed Aggregator (Multi-Asset)
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: Aggregate price feeds for multiple assets (ETH, USDT, USDC, etc.)
- **Priority**: 🟡 **MEDIUM** - For comprehensive price feeds

#### 40. Token Registry
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: Registry for all tokens on ChainID 138
- **Priority**: 🟡 **LOW** - Optional for token management

#### 41. Fee Collector
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: Collect and distribute protocol fees
- **Priority**: 🟡 **LOW** - Optional for fee management

#### 42. Pausable Controller
- **Status**: ❌ **NOT DEPLOYED**
- **Purpose**: Emergency pause mechanism for all contracts
- **Priority**: 🟡 **MEDIUM** - Recommended for production

---

## 📊 Priority Summary

### 🔴 CRITICAL Priority (Deploy Immediately)
1. CCIPReceiver (re-deployment and verification)
2. CCIPSender
3. CCIPWETH9Bridge (ChainID 138)
4. CCIPWETH10Bridge (ChainID 138)
5. OpenZeppelin Contracts (installation)

### 🟡 HIGH Priority (Deploy Soon)
6. CCIPWETH9Bridge (Ethereum Mainnet)
7. CCIPWETH10Bridge (Ethereum Mainnet)
8. CCIPMessageValidator
9. USDT Token ✅ (Deployment script ready - see recommendations)
10. USDC Token ✅ (Deployment script ready - see recommendations)
11. Governance Token ✅ (Deployment script ready - see recommendations)

### 🟡 MEDIUM Priority (Recommended)
11. MultiSig
12. ReserveSystem
13. PriceFeedKeeper
14. TokenFactory138
15. eMoney system contracts (AccountWalletRegistry, ISO20022Router, etc.)
16. TransactionMirror
17. MainnetTether
18. CCIPLogger (Ethereum Mainnet)
19. Price Feed Aggregator (Multi-Asset)
20. Pausable Controller

### 🟢 LOW Priority (Optional)
21. Voting
22. CCIPRouter (Custom)
23. CCIPRouterOptimized
24. AddressMapper
25. MirrorManager
26. Token Registry
27. Fee Collector
28. CCIP Bridges for other chains (Cronos, BSC, Polygon, Gnosis)

---

## 🔧 Installation Requirements

### OpenZeppelin Installation

```bash
cd /home/intlc/projects/smom-dbis-138

# Initialize git if not already
git init

# Install OpenZeppelin
forge install OpenZeppelin/openzeppelin-contracts

# Verify installation
ls -la lib/openzeppelin-contracts

# Test compilation
forge build
```

### Required OpenZeppelin Contracts
- `@openzeppelin/contracts/token/ERC20/IERC20.sol`
- `@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol`
- `@openzeppelin/contracts/access/Ownable.sol`

---

## 📋 Deployment Checklist

### Phase 1: Critical CCIP Infrastructure
- [ ] Install OpenZeppelin contracts
- [ ] Re-deploy CCIPReceiver
- [ ] Deploy CCIPSender
- [ ] Deploy CCIPWETH9Bridge (ChainID 138)
- [ ] Deploy CCIPWETH10Bridge (ChainID 138)

### Phase 2: Cross-Chain Bridges
- [ ] Deploy CCIPWETH9Bridge (Ethereum Mainnet)
- [ ] Deploy CCIPWETH10Bridge (Ethereum Mainnet)
- [ ] Deploy CCIPLogger (Ethereum Mainnet)

### Phase 3: Stablecoins
- [ ] Deploy USDT token
- [ ] Deploy USDC token
- [ ] Deploy MainnetTether (Ethereum Mainnet)

### Phase 4: Governance & Security
- [ ] Deploy MultiSig
- [ ] Deploy CCIPMessageValidator
- [ ] Deploy Pausable Controller

### Phase 5: Advanced Features
- [ ] Deploy ReserveSystem
- [ ] Deploy TokenFactory138
- [ ] Deploy eMoney system contracts
- [ ] Deploy TransactionMirror

---

## 💰 Estimated Costs

### ChainID 138 Deployment Costs
- CCIPSender: ~0.01 ETH
- CCIPReceiver: ~0.01 ETH
- CCIPWETH9Bridge: ~0.02 ETH
- CCIPWETH10Bridge: ~0.02 ETH
- USDT Token: ~0.01 ETH
- USDC Token: ~0.01 ETH
- **Total**: ~0.08 ETH

### Ethereum Mainnet Deployment Costs
- CCIPWETH9Bridge: ~$50-100
- CCIPWETH10Bridge: ~$50-100
- CCIPLogger: ~$30-50
- MainnetTether: ~$50-100
- **Total**: ~$180-350

### LINK Token Requirements
- Bridge contracts: 10 LINK each (20 LINK total)
- CCIPSender: 10 LINK
- **Total**: ~30 LINK for initial operations

---

## 📄 Documentation References

- `docs/E2E_TESTING_AND_DEPLOYMENT_STATUS.md` - Complete deployment status
- `docs/guides/OPENZEPPELIN_DEPENDENCY_ASSESSMENT.md` - OpenZeppelin requirements
- `docs/deployment/MAINNET_DEPLOYMENT_STATUS.md` - Mainnet deployment status
- `docs/CCIP_COMPLETE_TASK_CATALOG.md` - CCIP task catalog

---

## ✅ Summary

**Total Missing Contracts**: 42+ contracts

**Critical**: 5 contracts
**High Priority**: 5 contracts
**Medium Priority**: 10 contracts
**Low Priority**: 22+ contracts

**Immediate Actions Required**:
1. Install OpenZeppelin contracts
2. Re-deploy CCIPReceiver
3. Deploy CCIPSender
4. Deploy bridge contracts

**Estimated Total Deployment Cost**: ~0.08 ETH (ChainID 138) + ~$180-350 (Ethereum Mainnet)

---

**Last Updated**: 2025-12-24

