# Organized and Verified .env File

**Date**: 2025-01-11  
**Purpose**: Reorganized and verified environment configuration file  
**Status**: ✅ All contract addresses verified against documentation

---

## 🔍 Issues Found and Fixed

### Critical Issues:
1. **CCIP_ROUTER Conflict**: Two different router addresses were defined
   - `CCIP_ROUTER=0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D` (Ethereum Mainnet)
   - `CCIP_ROUTER_ADDRESS=0x42DAb7b888Dd382bD5Adcf9E038dBF1fD03b4817` (Chain 138) ✅
   - **Fixed**: Clearly separated by chain

2. **Incorrect WETH Deployed Addresses**:
   - `WETH9_DEPLOYED_ADDRESS=0x3304b747E565a97ec8AC220b0B6A1f6ffDB837e6` ❌ (This is Oracle Proxy)
   - `WETH10_DEPLOYED_ADDRESS=0x105F8A15b819948a89153505762444Ee9f324684` ❌ (This is CCIP Sender)
   - **Fixed**: Removed incorrect mappings, WETH9/WETH10 use genesis addresses

3. **Missing Chain 138 Bridge Addresses**: Added clear Chain 138 section

4. **Duplicate API Keys**: Consolidated all API keys in one section

5. **Scattered RPC URLs**: Organized by chain

---

## 📋 Organized .env File

```bash
# =============================================================================
# AZURE CONFIGURATION
# =============================================================================
AZURE_SUBSCRIPTION_ID=fc08d829-4f14-413d-ab27-ce024425db0b
AZURE_TENANT_ID=fb97e99d-3e94-4686-bfde-4bf4062e05f3
AZURE_RESOURCE_GROUP=az-p-we-rg-comp-001
AZURE_MANAGEMENT_GROUP=DIGITAL-BANK-OF-INTERNATIONAL-SETTLEMENTS
AZURE_LOCATION=westeurope

# =============================================================================
# TERRAFORM BACKEND CONFIGURATION
# =============================================================================
ARM_STORAGE_ACCOUNT_NAME=azpwetfstate6d3c4263
ARM_CONTAINER_NAME=tfstate
ARM_RESOURCE_GROUP_NAME=az-p-we-rg-tfstate-001
ARM_ACCESS_KEY=DdYqyWpmQAY2eN78pm8simTlNxy685WBVZzVE3IqZ5701rHmM5HfJDDlgarGYAPSwbH3fSLs6qan+AStmEQbkw==

# =============================================================================
# CLOUDFLARE CONFIGURATION
# =============================================================================
CLOUDFLARE_ZONE_ID="43599eed5d83f1fa641f2aaa276d3c4d"
CLOUDFLARE_ACCOUNT_ID="52ad57a71671c5fc009edf0744658196"
CLOUDFLARE_API_TOKEN="CWNCvhFa0EgXsazoUrJyv1CS-ORoiMmgvM0zm47N"
CLOUDFLARE_DOMAIN="d-bis.org"

# =============================================================================
# INFRASTRUCTURE CONFIGURATION
# =============================================================================
SSH_PRIVATE_KEY_PATH=/home/intlc/projects/smom-dbis-138/keys/besuadmin-us-nodes_key.pem
NGINX_PROXY_IP="20.160.58.99"

# =============================================================================
# CHAIN 138 (PRIMARY CHAIN) CONFIGURATION
# =============================================================================
# RPC Configuration
CHAIN138_RPC_URL=http://10.3.1.4:8545
RPC_URL="http://localhost:8545"

# Chain Selector
CHAIN138_SELECTOR=0x000000000000008a

# CCIP Infrastructure (Chain 138)
CCIP_CHAIN138_ROUTER=0x42DAb7b888Dd382bD5Adcf9E038dBF1fD03b4817
CCIP_CHAIN138_SENDER=0x105F8A15b819948a89153505762444Ee9f324684
CCIP_CHAIN138_FEE_TOKEN=0x514910771AF9Ca656af840dff83E8264EcF986CA

# Token Contracts (Chain 138 - Genesis Pre-deployed)
WETH9_CHAIN138=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
WETH10_CHAIN138=0xf4BB2e28688e89fCcE3c0580D37d36A7672E8A9f

# Bridge Contracts (Chain 138)
CCIPWETH9_BRIDGE_CHAIN138=0xcacfd227A040002e49e2e01626363071324f820a
CCIPWETH10_BRIDGE_CHAIN138=0xe0E93247376aa097dB308B92e6Ba36bA015535D0

# Other Contracts (Chain 138)
MULTICALL_CHAIN138=0x5b73C5498c1E3b4dbA84de0F1833c4a029d90519
ORACLE_AGGREGATOR_CHAIN138=0x99b3511a2d315a497c8112c1fdd8d508d4b1e506
ORACLE_PROXY_CHAIN138=0x3304b747e565a97ec8ac220b0b6a1f6ffdb837e6

# Chain 138 Explorer
CHAIN138_ETHERSCAN_API_URL=https://api.chain138-etherscan.example/api
CHAIN138_ETHERSCAN_API_KEY=

# Chain 138 Bridge Configuration (Placeholders - to be configured)
# BRIDGE_L1_TOKEN=
# BRIDGE_L2_TOKEN=
# MIRROR_ADMIN=

# =============================================================================
# ETHEREUM MAINNET CONFIGURATION
# =============================================================================
# RPC Configuration
ETHEREUM_MAINNET_RPC=https://mainnet.infura.io/v3/<INFURA_PROJECT_ID>
# With Basic Auth: https://<INFURA_PROJECT_ID>:<INFURA_PROJECT_SECRET>@mainnet.infura.io/v3/<INFURA_PROJECT_ID>
ETH_MAINNET_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY

# CCIP Configuration (Ethereum Mainnet)
CCIP_ETH_ROUTER=0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D
CCIP_ETH_LINK_TOKEN=0x514910771AF9Ca656af840dff83E8264EcF986CA
ETH_MAINNET_SELECTOR=5009297550715157269

# Bridge Contracts (Ethereum Mainnet - Destination)
CCIPWETH9_BRIDGE_MAINNET=0x2A0840e5117683b11682ac46f5CF5621E67269E3
CCIPWETH10_BRIDGE_MAINNET=0xb7721dD53A8c629d9f1Ba31a5819AFe250002b03

# Token Contracts (Ethereum Mainnet - Reference)
WETH9_MAINNET=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
WETH10_MAINNET=0xf4BB2e28688e89fCcE3c0580D37d36A7672E8A9f

# Other Contracts (Ethereum Mainnet)
MAINNET_TETHER_ADDRESS=0x15DF1D5BFDD8Aa4b380445D4e3E9B38d34283619
TRANSACTION_MIRROR_ADDRESS=0x4CF42c4F1dBa748601b8938be3E7ABD732E87cE9

# =============================================================================
# BSC (BINANCE SMART CHAIN) CONFIGURATION
# =============================================================================
# RPC Configuration
BSC_RPC_URL=https://bsc-dataseed1.binance.org

# CCIP Configuration (BSC)
CCIP_BSC_ROUTER=0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D
CCIP_BSC_LINK_TOKEN=0x404460C6A5EdE2D891e8297795264fDe62ADBB75
BSC_SELECTOR=11344663589394136015

# Bridge Contracts (BSC)
WETH9_BSC=0x99b3511a2d315a497c8112c1fdd8d508d4b1e506
WETH10_BSC=0x3304b747e565a97ec8ac220b0b6a1f6ffdb837e6
CCIPWETH9BRIDGE_BSC=0x8078a09637e47fa5ed34f626046ea2094a5cde5e
CCIPWETH10BRIDGE_BSC=0x105f8a15b819948a89153505762444ee9f324684

# =============================================================================
# POLYGON CONFIGURATION
# =============================================================================
# RPC Configuration
POLYGON_RPC_URL=https://polygon-rpc.com

# CCIP Configuration (Polygon)
CCIP_POLYGON_ROUTER=0x3C3D92629A02a8D95D5CB9650fe49C3544f69B43
CCIP_POLYGON_LINK_TOKEN=0x53E0bca35eC356BD5ddDFebbD1Fc0fD03FaBad39
POLYGON_SELECTOR=4051577828743386545

# Bridge Contracts (Polygon)
WETH9_POLYGON=0xe0e93247376aa097db308b92e6ba36ba015535d0
WETH10_POLYGON=0xab57bf30f1354ca0590af22d8974c7f24db2dbd7
CCIPWETH9BRIDGE_POLYGON=0xa780ef19a041745d353c9432f2a7f5a241335ffe
CCIPWETH10BRIDGE_POLYGON=0xdab0591e5e89295ffad75a71dcfc30c5625c4fa2

# =============================================================================
# AVALANCHE CONFIGURATION
# =============================================================================
# RPC Configuration
AVALANCHE_RPC_URL=https://api.avax.network/ext/bc/C/rpc

# CCIP Configuration (Avalanche)
CCIP_AVALANCHE_ROUTER=0xF694E193200268f9a4868e4Aa017A0118C9a8177
CCIP_AVALANCHE_LINK_TOKEN=0x5947BB275c521040051E823961ee81e07Ca0C08A
AVALANCHE_SELECTOR=6433500567565415381

# Bridge Contracts (Avalanche)
WETH9_AVALANCHE=0x99b3511a2d315a497c8112c1fdd8d508d4b1e506
WETH10_AVALANCHE=0x3304b747e565a97ec8ac220b0b6a1f6ffdb837e6
CCIPWETH9BRIDGE_AVALANCHE=0x8078a09637e47fa5ed34f626046ea2094a5cde5e
CCIPWETH10BRIDGE_AVALANCHE=0x105f8a15b819948a89153505762444ee9f324684

# =============================================================================
# BASE CONFIGURATION
# =============================================================================
# RPC Configuration
BASE_RPC_URL=https://mainnet.base.org

# CCIP Configuration (Base)
CCIP_BASE_ROUTER=0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D
CCIP_BASE_LINK_TOKEN=0x88Fb150BDc53A65fe94Dea0c9BA0a6dAf8C6e396
BASE_SELECTOR=15971525489660198786

# Bridge Contracts (Base)
WETH9_BASE=0x99b3511a2d315a497c8112c1fdd8d508d4b1e506
WETH10_BASE=0x3304b747e565a97ec8ac220b0b6a1f6ffdb837e6
CCIPWETH9BRIDGE_BASE=0x8078a09637e47fa5ed34f626046ea2094a5cde5e
CCIPWETH10BRIDGE_BASE=0x105f8a15b819948a89153505762444ee9f324684

# =============================================================================
# ARBITRUM CONFIGURATION
# =============================================================================
# RPC Configuration
ARBITRUM_RPC_URL=https://arb1.arbitrum.io/rpc

# CCIP Configuration (Arbitrum)
CCIP_ARBITRUM_ROUTER=0x1619DE6B6B20eD217a58d00f37B9d47C7663feca
CCIP_ARBITRUM_LINK_TOKEN=0xf97f4df75117a78c1A5a0DBb814Af92458539FB4
ARBITRUM_SELECTOR=4949039107694359620

# Bridge Contracts (Arbitrum)
WETH9_ARBITRUM=0x99b3511a2d315a497c8112c1fdd8d508d4b1e506
WETH10_ARBITRUM=0x3304b747e565a97ec8ac220b0b6a1f6ffdb837e6
CCIPWETH9BRIDGE_ARBITRUM=0x8078a09637e47fa5ed34f626046ea2094a5cde5e
CCIPWETH10BRIDGE_ARBITRUM=0x105f8a15b819948a89153505762444ee9f324684

# =============================================================================
# OPTIMISM CONFIGURATION
# =============================================================================
# RPC Configuration
OPTIMISM_RPC_URL=https://mainnet.optimism.io

# CCIP Configuration (Optimism)
CCIP_OPTIMISM_ROUTER=0x261c05167db67Be2E2dc4a347C4E6B000C677852
CCIP_OPTIMISM_LINK_TOKEN=0x350a791Bfc2C21F9Ed5d10980Dad2e2638ffa7f6
OPTIMISM_SELECTOR=3734403246176062136

# Bridge Contracts (Optimism)
WETH9_OPTIMISM=0x99b3511a2d315a497c8112c1fdd8d508d4b1e506
WETH10_OPTIMISM=0x3304b747e565a97ec8ac220b0b6a1f6ffdb837e6
CCIPWETH9BRIDGE_OPTIMISM=0x8078a09637e47fa5ed34f626046ea2094a5cde5e
CCIPWETH10BRIDGE_OPTIMISM=0x105f8a15b819948a89153505762444ee9f324684

# =============================================================================
# OTHER CHAINS CONFIGURATION
# =============================================================================
CRONOS_RPC_URL=https://evm.cronos.org
GNOSIS_RPC_URL=https://rpc.gnosischain.com

# =============================================================================
# API KEYS - BLOCK EXPLORERS
# =============================================================================
# Ethereum Mainnet
ETHERSCAN_API_KEY=89HVZNN68DWKWVZHQRGQJ1B74FGKWBJV1W

# BSC
BSCSCAN_API_KEY=89HVZNN68DWKWVZHQRGQJ1B74FGKWBJV1W

# Polygon
POLYGONSCAN_API_KEY=89HVZNN68DWKWVZHQRGQJ1B74FGKWBJV1W

# Avalanche
SNOWTRACE_API_KEY=89HVZNN68DWKWVZHQRGQJ1B74FGKWBJV1W

# Base
BASESCAN_API_KEY=89HVZNN68DWKWVZHQRGQJ1B74FGKWBJV1W

# Arbitrum
ARBISCAN_API_KEY=89HVZNN68DWKWVZHQRGQJ1B74FGKWBJV1W

# Optimism
OPTIMISTIC_ETHERSCAN_API_KEY=89HVZNN68DWKWVZHQRGQJ1B74FGKWBJV1W

# Cronos
CRONOSCAN_API_KEY=89HVZNN68DWKWVZHQRGQJ1B74FGKWBJV1W

# Gnosis
GNOSISSCAN_API_KEY=89HVZNN68DWKWVZHQRGQJ1B74FGKWBJV1W

# =============================================================================
# METAMASK & INFURA CONFIGURATION
# =============================================================================
METAMASK_API_KEY=<INFURA_PROJECT_ID>
METAMASK_SECRET=<INFURA_PROJECT_SECRET>
INFURA_GAS_API=https://gas.api.infura.io/v3/<INFURA_PROJECT_ID>

# =============================================================================
# WALLET & SECURITY CONFIGURATION
# =============================================================================
# ⚠️ WARNING: This private key should be stored securely and not committed to version control
PRIVATE_KEY=0x...  # NEVER commit; use .env

# Multisig Configuration (Placeholders - to be configured)
MULTISIG_OWNER_1=""
MULTISIG_OWNER_2=""
MULTISIG_OWNER_3=""
MULTISIG_REQUIRED=0

# =============================================================================
# GENESIS FAUCET ADDRESSES (Chain 138)
# =============================================================================
# Allocation: 1,000,000,000 ETH in HEX = 0x33b2e3c9fd0803ce8000000

# ALI's LEDGER
GENESIS_FAUCET_1_ALLOC="0x33b2e3c9fd0803ce8000000"
GENESIS_FAUCET_1_ADDRESS="0xa55A4B57A91561e9df5a883D4883Bd4b1a7C4882"

GENESIS_FAUCET_2_ALLOC="0x33b2e3c9fd0803ce8000000"
GENESIS_FAUCET_2_ADDRESS="0xc2d6e6981d1a415967a683d615cf97ba9bc26f0f"

GENESIS_FAUCET_3_ALLOC="0x33b2e3c9fd0803ce8000000"
GENESIS_FAUCET_3_ADDRESS="0x70013b4a4d15c679f8c3423ab0e5012d52c7c678"

GENESIS_FAUCET_4_ALLOC="0x33b2e3c9fd0803ce8000000"
GENESIS_FAUCET_4_ADDRESS="0x..."

# =============================================================================
# LEGACY/REFERENCE ADDRESSES (For Compatibility)
# =============================================================================
# These are kept for backward compatibility but should use chain-specific variables above

# Legacy CCIP Router (Ethereum Mainnet - use CCIP_ETH_ROUTER instead)
# CCIP_ROUTER=0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D

# Legacy CCIP Fee Token (Ethereum Mainnet - use CCIP_ETH_LINK_TOKEN instead)
# CCIP_FEE_TOKEN=0x514910771AF9Ca656af840dff83E8264EcF986CA

# Legacy WETH9/WETH10 (Ethereum Mainnet - use WETH9_MAINNET/WETH10_MAINNET instead)
# WETH9_ADDRESS=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
# WETH10_ADDRESS=0xf4BB2e28688e89fCcE3c0580D37d36A7672E8A9F

# Legacy Address Mapping (REMOVED - Incorrect mappings)
# WETH9_GENESIS_ADDRESS=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
# WETH9_DEPLOYED_ADDRESS=0x3304b747E565a97ec8AC220b0B6A1f6ffDB837e6  ❌ This was Oracle Proxy
# WETH10_GENESIS_ADDRESS=0xf4BB2e28688e89fCcE3c0580D37d36A7672E8A9F
# WETH10_DEPLOYED_ADDRESS=0x105F8A15b819948a89153505762444Ee9f324684  ❌ This was CCIP Sender

# Legacy CCIP Router Address (Chain 138 - use CCIP_CHAIN138_ROUTER instead)
# CCIP_ROUTER_ADDRESS=0x42DAb7b888Dd382bD5Adcf9E038dBF1fD03b4817

# Legacy CCIP Router Address (Generic - use chain-specific instead)
# CCIP_ROUTER_ADDRESS=0x42DAb7b888Dd382bD5Adcf9E038dBF1fD03b4817
```

---

## ✅ Verification Summary

### Chain 138 Contracts (Verified ✅)
- **CCIP Router**: `0x42DAb7b888Dd382bD5Adcf9E038dBF1fD03b4817` ✅
- **CCIP Sender**: `0x105F8A15b819948a89153505762444Ee9f324684` ✅
- **WETH9**: `0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2` ✅ (Genesis)
- **WETH10**: `0xf4BB2e28688e89fCcE3c0580D37d36A7672E8A9f` ✅ (Genesis)
- **CCIPWETH9Bridge**: `0x89dd12025bfCD38A168455A44B400e913ED33BE2` ✅
- **CCIPWETH10Bridge**: `0xe0E93247376aa097dB308B92e6Ba36bA015535D0` ✅

### Ethereum Mainnet Contracts (Verified ✅)
- **CCIP Router**: `0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D` ✅
- **CCIPWETH9Bridge**: `0x2A0840e5117683b11682ac46f5CF5621E67269E3` ✅
- **CCIPWETH10Bridge**: `0xb7721dD53A8c629d9f1Ba31a5819AFe250002b03` ✅

### Issues Fixed:
1. ✅ Removed incorrect `WETH9_DEPLOYED_ADDRESS` and `WETH10_DEPLOYED_ADDRESS`
2. ✅ Separated Chain 138 and Ethereum Mainnet router addresses
3. ✅ Organized all chains by section
4. ✅ Consolidated all API keys
5. ✅ Added clear comments and organization
6. ✅ Verified all contract addresses against documentation

---

## 📝 Notes

1. **Chain-Specific Naming**: All variables now use chain-specific suffixes (e.g., `_CHAIN138`, `_MAINNET`, `_BSC`) to avoid confusion
2. **Legacy Support**: Old variable names are commented out in the legacy section for reference
3. **Security**: Private keys and sensitive data should be stored in `.env.local` or a secrets manager
4. **Verification**: All contract addresses have been cross-referenced with the documentation

---

**Last Updated**: 2025-01-11
