# Mainnet Deployment Status

## Overview

This document tracks the status of smart contract deployments to Ethereum Mainnet.

## Contracts Requiring Mainnet Deployment

### Primary Contracts (Required)

1. **CCIPWETH9Bridge**
   - **Status**: ❌ Not Deployed
   - **Dependencies**: CCIP Router (using Chainlink's official router)
   - **WETH9**: Already exists at `0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2`
   - **Deployment Script**: `script/DeployCCIPWETH9Bridge.s.sol`

2. **CCIPWETH10Bridge**
   - **Status**: ❌ Not Deployed
   - **Dependencies**: CCIP Router (using Chainlink's official router)
   - **WETH10**: Already exists at `0xf4BB2e28688e89fCcE3c0580D37d36A7672E8A9f`
   - **Deployment Script**: `script/DeployCCIPWETH10Bridge.s.sol`

3. **CCIPLogger** ⭐ NEW
   - **Status**: ❌ Not Deployed
   - **Purpose**: Receives and logs Chain-138 transactions via CCIP
   - **Dependencies**: CCIP Router (using Chainlink's official router)
   - **Deployment Script**: `scripts/ccip-deployment/deploy-ccip-logger.js`
   - **Location**: `contracts/ccip-integration/CCIPLogger.sol`

### Optional Contracts (If Needed)

4. **CCIPRouter** (Custom)
   - **Status**: ⚠️ Not Required (using Chainlink's official router)
   - **Official Router**: `0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D`
   - **Note**: Only deploy if custom router is needed

5. **CCIPSender**
   - **Status**: ⚠️ Optional (for oracle cross-chain sync)
   - **Dependencies**: CCIP Router, Oracle Aggregator
   - **Deployment Script**: Needs to be created

6. **CCIPReceiver**
   - **Status**: ⚠️ Optional (for oracle cross-chain sync)
   - **Dependencies**: CCIP Router, Oracle Aggregator
   - **Deployment Script**: Needs to be created

7. **OracleAggregator**
   - **Status**: ⚠️ Optional (if oracle needed on Mainnet)
   - **Deployment Script**: `script/DeployOracle.s.sol`

## CCIP Integration Contracts

### New Production-Grade CCIP System

**CCIPLogger** (Ethereum Mainnet)
- Receives Chain-138 transactions via CCIP
- Implements replay protection
- Supports batch verification
- Optional signature validation

**CCIPTxReporter** (Chain-138)
- Reports Chain-138 transactions to Ethereum
- Supports single and batch reporting
- Automatic fee estimation and refund

**Watcher/Relayer Service** (Off-chain)
- Monitors Chain-138 for transactions
- Batches and relays via CCIP
- Postgres outbox pattern for reliability
- Full monitoring and alerting

## Deployment Configuration

### CCIP Router
- **Official Chainlink Router (Ethereum)**: `0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D`
- **Chain-138 Router**: Check CCIP Directory or deploy custom router
- **LINK Token**: `0x514910771AF9Ca656af840dff83E8264EcF986CA`

### WETH Addresses
- **WETH9**: `0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2` (already deployed)
- **WETH10**: `0xf4BB2e28688e89fCcE3c0580D37d36A7672E8A9f` (already deployed)

### Chain Selectors (from CCIP Directory)
- **Ethereum Mainnet**: Update from CCIP Directory
- **Chain-138**: Update from CCIP Directory

## Current Deployment Status

### Wallet Status
- **Address**: `0x4A666F96fC8764181194447A7dFdb7d471b301C8`
- **ETH Balance**: 0.002811732488743541 ETH
- **Required**: 0.025 ETH (minimum)
- **Status**: ❌ Insufficient funds

### Deployment Blockers
1. **Insufficient ETH**: Wallet needs at least 0.025 ETH for gas fees
2. **Gas Price**: Using conservative 2.5 gwei maximum cap
3. **CCIP Router Addresses**: Need to verify Chain-138 router address

## Deployment Steps

### Step 1: Fund Wallet
```bash
# Send at least 0.025 ETH to deployer wallet
# Address: 0x4A666F96fC8764181194447A7dFdb7d471b301C8
```

### Step 2: Deploy CCIP Contracts

#### Option A: Deploy All CCIP Contracts
```bash
# Deploy CCIPLogger to Ethereum Mainnet
npm run deploy:logger:mainnet

# Reuse the historical CCIPTxReporter deployment on Chain-138
export CHAIN138_CCIP_REPORTER=0x...
```

#### Option B: Deploy WETH Bridges
```bash
./scripts/deployment/deploy-all-mainnet.sh
```

### Step 3: Verify Contracts
```bash
# Verify CCIPLogger on Etherscan
npx hardhat verify --network mainnet <ADDRESS> <ROUTER> <SIGNER> <SELECTOR>

# Verify CCIPTxReporter (if explorer available)
npx hardhat verify --network chain138 <ADDRESS> <ROUTER> <SELECTOR> <RECEIVER>
```

### Step 4: Set Up Watcher/Relayer
```bash
cd watcher
npm install
npm run build
npm start
```

## Deployment Scripts

- `scripts/deployment/deploy-all-mainnet.sh` - Deploy WETH bridges
- `scripts/ccip-deployment/deploy-ccip-logger.js` - Deploy CCIPLogger
- `scripts/ccip-deployment/deploy-ccip-reporter.js` - Deploy CCIPTxReporter
- `scripts/ccip-deployment/deploy-all-ccip-mainnet.sh` - Deploy all CCIP contracts
- `scripts/deployment/check-mainnet-deployment-status.sh` - Check deployment status
- `scripts/deployment/check-wallet-balances.sh` - Check wallet funding

## Next Steps

1. ✅ Identify all contracts needing Mainnet deployment
2. ✅ Create deployment scripts
3. ✅ Create CCIP integration system
4. ⏳ Fund wallet with sufficient ETH
5. ⏳ Deploy CCIPLogger to Ethereum Mainnet
6. ⏳ Deploy CCIPTxReporter to Chain-138
7. ⏳ Deploy CCIPWETH9Bridge
8. ⏳ Deploy CCIPWETH10Bridge
9. ⏳ Verify contracts on Etherscan
10. ⏳ Configure bridge destinations
11. ⏳ Set up watcher/relayer service
12. ⏳ Test cross-chain transfers

## Notes

- WETH9 and WETH10 are already deployed on Mainnet at canonical addresses
- Using Chainlink's official CCIP Router (no custom router needed)
- Gas estimates use conservative 2.5 gwei maximum cap
- All deployment addresses will be saved to `.env` file
- CCIP integration provides production-grade transaction logging from Chain-138 to Ethereum
