# Environment Variables Checklist

Quick reference for all environment variables needed for deployment.

## ✅ Required Variables (Must Be Set Before Deployment)

### 1. Deployment Account
```bash
PRIVATE_KEY=0x...  # Your deployer private key
```

### 2. RPC Endpoints
```bash
ETHEREUM_MAINNET_RPC=https://eth.llamarpc.com  # Or your preferred RPC
RPC_URL_138=http://chain138.example.com:8545    # ChainID 138 RPC
```

### 3. Etherscan Verification
```bash
ETHERSCAN_API_KEY=your_etherscan_api_key  # For contract verification
```

### 4. Reserve System (Required for Phase 4+)
```bash
RESERVE_SYSTEM=0x...  # ReserveSystem contract address on ChainID 138
```

## 📝 Contract Addresses (Populated During Deployment)

These will be set automatically as you deploy, but you need to add them to `.env`:

### Phase 2 - Core Contracts
```bash
LOCKBOX_138=0x...              # From ChainID 138 deployment
BOND_MANAGER=0x...             # From Ethereum deployment
CHALLENGE_MANAGER=0x...        # From Ethereum deployment
LIQUIDITY_POOL=0x...           # From Ethereum deployment
INBOX_ETH=0x...                # From Ethereum deployment
SWAP_ROUTER=0x...              # From Ethereum deployment
BRIDGE_SWAP_COORDINATOR=0x...  # From Ethereum deployment
```

### Phase 3 - Enhanced Router
```bash
ENHANCED_SWAP_ROUTER=0x...     # From Phase 3 deployment
```

### Phase 4 - Integration Contracts
```bash
STABLECOIN_PEG_MANAGER=0x...      # From Phase 4 deployment
COMMODITY_PEG_MANAGER=0x...       # From Phase 4 deployment
ISO_CURRENCY_MANAGER=0x...        # From Phase 4 deployment
BRIDGE_RESERVE_COORDINATOR=0x...  # From Phase 4 deployment
```

## ⚙️ Optional Configuration (Defaults Provided)

### Bridge Configuration
```bash
BOND_MULTIPLIER_BPS=11000              # Default: 110%
MIN_BOND=1000000000000000000          # Default: 1 ETH
CHALLENGE_WINDOW_SECONDS=1800         # Default: 30 minutes
LP_FEE_BPS=5                          # Default: 0.05%
MIN_LIQUIDITY_RATIO_BPS=11000         # Default: 110%
```

### Peg Configuration
```bash
USD_PEG_THRESHOLD_BPS=50              # Default: 0.5%
ETH_PEG_THRESHOLD_BPS=10              # Default: 0.1%
COMMODITY_PEG_THRESHOLD_BPS=100       # Default: 1.0%
MIN_RESERVE_RATIO_BPS=11000           # Default: 110%
```

### Liquidity Configuration
```bash
LIQUIDITY_AMOUNT=100                  # Default: 100 ETH
RESERVE_AMOUNT=100000                 # Default: 100,000 USDT
```

### Other Optional
```bash
XAU_ADDRESS=0x...                     # XAU token address (if tokenized)
MARKET_REPORTING_API_KEY=...          # API key for market reporting service
```

## 🔍 Quick Check Command

Run this to check your environment:

```bash
./scripts/deployment/check-env-requirements.sh
```

## 📋 Phase-by-Phase Checklist

### Before Starting
- [ ] `PRIVATE_KEY` set
- [ ] `ETHEREUM_MAINNET_RPC` set and accessible
- [ ] `RPC_URL_138` set (or will be set)
- [ ] `ETHERSCAN_API_KEY` set
- [ ] Deployer has sufficient ETH (5-10 ETH recommended)

### Before Phase 2
- [ ] All "Before Starting" items complete

### Before Phase 3
- [ ] Phase 2 completed
- [ ] `BRIDGE_SWAP_COORDINATOR` added to `.env`

### Before Phase 4
- [ ] Phase 2 completed
- [ ] `BRIDGE_SWAP_COORDINATOR` in `.env`
- [ ] `RESERVE_SYSTEM` set in `.env`

### Before Phase 5
- [ ] Phase 3 completed
- [ ] `ENHANCED_SWAP_ROUTER` added to `.env`

### Before Phase 6
- [ ] Phase 2 completed
- [ ] `LIQUIDITY_POOL` in `.env`
- [ ] `RESERVE_SYSTEM` in `.env`
- [ ] Sufficient ETH and USDT balance

### Before Phase 7
- [ ] Phases 3 and 5 completed
- [ ] All contract addresses in `.env`

### Before Phase 8
- [ ] All previous phases completed
- [ ] Contract addresses in `.env`

### Before Phase 9
- [ ] All previous phases completed
- [ ] Contract addresses in `.env`

### Before Phase 10
- [ ] All previous phases completed
- [ ] All contract addresses in `.env`

## 🚨 Common Issues

### "Variable not found"
- Check `.env` file exists
- Verify variable name spelling (case-sensitive)
- Ensure no spaces around `=`
- Check for comments (lines starting with `#`)

### "RPC not accessible"
- Test RPC endpoint manually: `cast block-number --rpc-url $ETHEREUM_MAINNET_RPC`
- Verify RPC URL is correct
- Check network connectivity

### "Insufficient balance"
- Check balance: `cast balance <address> --rpc-url $ETHEREUM_MAINNET_RPC`
- Ensure deployer has 5-10 ETH
- Account for gas price fluctuations

## 📚 Related Documentation

- `ENV_VARIABLES_REFERENCE.md` - Complete reference with all variables
- `DEPLOYMENT_GUIDE.md` - Full deployment guide
- `DEPLOYMENT_AUTOMATION.md` - Automated deployment scripts

