# Etherscan Verification - No Via IR Option Available

**Issue**: Etherscan verification form doesn't have "Via IR" option  
**Solution**: Use **Standard JSON Input** method instead

---

## ✅ Solution: Standard JSON Input Method

Since Etherscan doesn't show a "Via IR" option in the single-file form, use the **Standard JSON Input** method which allows full compiler configuration.

---

## 📋 Step-by-Step Instructions

### Step 1: Generate Standard JSON Input

1. **Compile the contract with via-ir**:
   ```bash
   cd /home/intlc/projects/smom-dbis-138
   forge build --via-ir --force
   ```

2. **Find the Standard JSON**:
   - Look in `out/ccip/CCIPWETH9Bridge.sol/CCIPWETH9Bridge.json`
   - Or use `forge build --via-ir` and check the output

### Step 2: Use Standard JSON on Etherscan

1. **Go to Etherscan**:
   - https://etherscan.io/address/0x89dd12025bfcd38a168455a44b400e913ed33be2#code
   - Click **"Contract"** tab → **"Verify and Publish"**

2. **Select Compiler Type**:
   - Choose **"Standard JSON Input"** (not "Single file")

3. **Upload Standard JSON**:
   - Copy the Standard JSON from the build artifacts
   - Paste into the Standard JSON Input field

4. **Enter Constructor Arguments**:
   ```
   0x00000000000000000000000080226fc0ee2b096224eeac085bb9a8cba1146f7d000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca
   ```

5. **Submit for verification**

---

## 🔄 Alternative: Try Without Via IR

If Standard JSON Input doesn't work, try verification **without via-ir**:

**Settings**:
- **Compiler Type**: `SINGLE FILE / CONCATENATED METHOD`
- **Compiler Version**: `v0.8.20+commit.a1b79de6`
- **License**: `MIT License (MIT)`
- **Optimization**: `Yes` (200 runs)
- **Via IR**: Not available (leave default/No)

**Note**: This may fail if the bytecode truly requires via-ir, but it's worth trying.

---

## 🛠️ Manual Standard JSON Creation

If build artifacts aren't available, you can create a Standard JSON manually:

```json
{
  "language": "Solidity",
  "sources": {
    "CCIPWETH9Bridge.sol": {
      "content": "[paste flattened contract code here]"
    }
  },
  "settings": {
    "optimizer": {
      "enabled": true,
      "runs": 200
    },
    "viaIR": true,
    "evmVersion": "london",
    "outputSelection": {
      "*": {
        "*": ["abi", "evm.bytecode", "evm.deployedBytecode"]
      }
    }
  }
}
```

**Important**: 
- Set `"viaIR": true` in the settings
- Include the flattened contract code in the `content` field
- Use compiler version `0.8.20`

---

## 📝 Constructor Arguments

**ABI-Encoded**:
```
0x00000000000000000000000080226fc0ee2b096224eeac085bb9a8cba1146f7d000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca
```

**Decoded**:
1. `_ccipRouter`: `0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D`
2. `_weth9`: `0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2`
3. `_feeToken`: `0x514910771AF9Ca656af840dff83E8264EcF986CA`

---

## 🔍 Why Standard JSON Input?

- **Full Control**: Allows specifying `viaIR: true` in compiler settings
- **Exact Match**: Can match the exact deployment compiler configuration
- **More Options**: Provides access to all compiler settings

---

## ⚠️ Troubleshooting

### If Standard JSON Input fails:

1. **Check compiler version**: Ensure it matches exactly
2. **Verify viaIR setting**: Make sure `"viaIR": true` is set
3. **Check source code**: Ensure flattened code is complete
4. **Try different compiler version**: Some versions may handle via-ir differently

### If all methods fail:

- The contract may have been deployed with settings that Etherscan doesn't support
- Consider using Sourcify (alternative verification service)
- Or contact Etherscan support with deployment transaction details

---

## 📚 References

- **Flattened Contract**: `docs/CCIPWETH9Bridge_flattened.sol`
- **Etherscan Docs**: https://docs.etherscan.io/etherscan-v2/api-endpoints/contracts#verify-source-code
- **Standard JSON Format**: Solidity compiler documentation

---

**Last Updated**: $(date)  
**Status**: ✅ **USE STANDARD JSON INPUT METHOD**

