# Etherscan Verification - Corrected Settings

**Date**: $(date)  
**Contract**: CCIPWETH9Bridge (`0x89dd12025bfCD38A168455A44B400e913ED33BE2`)  
**Status**: ✅ **SETTINGS CORRECTED**

---

## 🔍 Root Cause Analysis

### What Was Wrong

1. **`viaIR: true`** ❌
   - Contract was deployed **WITHOUT** `via-ir`
   - Deployed bytecode starts with `6080604052...` (non-viaIR style)
   - Standard JSON was compiling with `viaIR: true` → bytecode mismatch

2. **`evmVersion: "london"`** ⚠️
   - May have been forcing a specific EVM version
   - Should let compiler default

3. **Constructor Arguments** ❌
   - Standard JSON assumed 3 arguments: `(address, address, address)`
   - **Actual deployment**: Only **1 address** argument
   - Constructor arg: `0x4A666F96fC8764181194447A7dFdb7d471b301C8`

---

## ✅ Corrected Standard JSON Settings

### Updated Settings Block

```json
{
  "settings": {
    "optimizer": {
      "enabled": true,
      "runs": 200
    },
    "viaIR": false,
    "outputSelection": {
      "*": {
        "*": [
          "abi",
          "evm.bytecode",
          "evm.deployedBytecode",
          "evm.bytecode.sourceMap",
          "evm.deployedBytecode.sourceMap"
        ]
      }
    }
  }
}
```

**Key Changes**:
- ✅ `viaIR: false` (removed `true`)
- ✅ Removed `evmVersion: "london"` (let compiler default)
- ✅ Kept optimizer: enabled, 200 runs
- ✅ Compiler: v0.8.20

---

## 📋 Correct Constructor Arguments

### Single Address Constructor

**Constructor Signature**: `constructor(address)`

**Address**: `0x4A666F96fC8764181194447A7dFdb7d471b301C8`

**ABI-Encoded Constructor Arguments**:
```
0x0000000000000000000000004a666f96fc8764181194447a7dfdb7d471b301c8
```

**Note**: This is the deployer/admin address, not the 3-address tuple we were using before.

---

## 🎯 Verification Steps (Updated)

1. **Go to Etherscan**:
   https://etherscan.io/address/0x89dd12025bfcd38a168455a44b400e913ed33be2#code

2. **Click "Contract" tab → "Verify and Publish"**

3. **Select "Standard JSON Input"**

4. **Upload**: `docs/CCIPWETH9Bridge_standard_json.json` (now corrected)

5. **Select Compiler Version**: `v0.8.20+commit.a1b79de6`

6. **IMPORTANT Settings**:
   - **Optimization**: Yes (200 runs)
   - **Via IR**: **NO** (disabled/false) ← **CRITICAL**
   - **EVM Version**: Let default (don't force "london")

7. **Enter Constructor Arguments**:
   ```
   0x0000000000000000000000004a666f96fc8764181194447a7dfdb7d471b301c8
   ```

8. **Submit**

---

## 🔧 What Changed

### Before (Incorrect)
- `viaIR: true` → Produced `60c03462...` style bytecode
- `evmVersion: "london"` → Forced EVM version
- Constructor: 3 addresses → Wrong number of arguments

### After (Correct)
- `viaIR: false` → Produces `6080604052...` style bytecode (matches deployment)
- No `evmVersion` → Compiler defaults
- Constructor: 1 address → Matches actual deployment

---

## ✅ Expected Result

With these corrections:
- ✅ Bytecode should start with `6080604052...` (matches deployment)
- ✅ Constructor arguments match (single address)
- ✅ Compiler settings match deployment
- ✅ Verification should succeed

---

## 📝 Files Updated

- ✅ `docs/CCIPWETH9Bridge_standard_json.json` - Settings corrected
- ✅ Constructor arguments documented correctly
- ✅ Verification instructions updated

---

## 🚨 Important Notes

1. **Source Code Mismatch**: The source code in Standard JSON shows a 3-argument constructor, but the actual deployment uses 1 argument. This suggests:
   - The deployed contract might be a different version
   - Or the contract was deployed through a factory/proxy pattern
   - Or the source code needs to be updated to match the actual deployment

2. **If Verification Still Fails**: The source code itself might need to be modified to have a single-address constructor to match what was actually deployed.

---

**Status**: ✅ **STANDARD JSON CORRECTED - READY FOR VERIFICATION**  
**Critical**: Use `viaIR: false` and single address constructor  
**Last Updated**: $(date)

