# CCIP Router Configuration Documentation

**Date**: 2025-01-12  
**Network**: ChainID 138  
**Router Address**: `0x42DAb7b888Dd382bD5Adcf9E038dBF1fD03b4817`

---

## Router Overview

The CCIP Router is the central component of the Chainlink CCIP (Cross-Chain Interoperability Protocol) infrastructure. It handles routing of cross-chain messages between different blockchain networks.

---

## Configuration Details

### Router Address
- **Address**: `0x42DAb7b888Dd382bD5Adcf9E038dBF1fD03b4817`
- **Network**: ChainID 138
- **RPC Endpoint**: `http://192.168.11.250:8545` or `https://rpc-core.d-bis.org`
- **Block Explorer**: `https://explorer.d-bis.org` (Blockscout)

### Fee Configuration
- **Fee Token**: `0x514910771AF9Ca656af840dff83E8264EcF986CA` (LINK)
- **Base Fee**: 1000000000000000 wei (0.001 LINK)
- **Data Fee Per Byte**: 100000000 wei (0.0000001 LINK per byte)

### Supported Destination Chains

| Chain | Chain Selector | Status |
|-------|---------------|--------|
| BSC | 11344663589394136015 | ✅ Supported |
| Polygon | 4051577828743386545 | ✅ Supported |
| Avalanche | 6433500567565415381 | ✅ Supported |
| Base | 15971525489660198786 | ✅ Supported |
| Arbitrum | 4949039107694359620 | ✅ Supported |
| Optimism | 3734403246176062136 | ✅ Supported |
| Ethereum Mainnet | 5009297550715157269 | ✅ Supported |

---

## Router Functions

### Core Functions

#### `ccipSend()`
Sends a CCIP message to a destination chain.

**Parameters**:
- `destinationChainSelector`: uint64 - Destination chain selector
- `receiver`: address - Receiver address on destination chain
- `data`: bytes - Message data
- `feeToken`: address - Token to pay fees with (LINK or native ETH)
- `extraArgs`: bytes - Additional arguments

#### `getFee()`
Gets the fee for sending a CCIP message.

**Parameters**:
- `destinationChainSelector`: uint64 - Destination chain selector
- `data`: bytes - Message data

**Returns**: uint256 - Fee amount in fee token

#### `getOnRamp()`
Gets the OnRamp address for a destination chain.

**Parameters**:
- `destinationChainSelector`: uint64 - Destination chain selector

**Returns**: address - OnRamp contract address

---

## Integration with Other Contracts

### CCIP Sender
- **Address**: `0x105F8A15b819948a89153505762444Ee9f324684`
- **Relationship**: Sender contract interacts with Router to send messages

### Bridge Contracts
- **CCIPWETH9Bridge**: `0xcacfd227A040002e49e2e01626363071324f820a`
- **CCIPWETH10Bridge**: `0xe0E93247376aa097dB308B92e6Ba36bA015535D0`
- **Relationship**: Bridge contracts call Router to send cross-chain messages

---

## Verification

### Verify Router Deployment
```bash
./scripts/verify-ccip-router.sh
```

### Check Router Status
```bash
cast code 0x42DAb7b888Dd382bD5Adcf9E038dBF1fD03b4817 --rpc-url http://192.168.11.250:8545
```

### Get Fee Token
```bash
cast call 0x42DAb7b888Dd382bD5Adcf9E038dBF1fD03b4817 "getFeeToken()" --rpc-url http://192.168.11.250:8545
```

---

## Configuration Status

| Component | Status | Notes |
|-----------|--------|-------|
| Router Deployment | ✅ Complete | Contract deployed and verified |
| Fee Configuration | ✅ Complete | LINK token configured |
| OnRamp Mapping | ⚠️ Unknown | Cannot verify without admin access |
| Destination Allowlist | ⚠️ Unknown | Cannot verify without admin access |

---

## Troubleshooting

### Router Not Responding
1. Check RPC endpoint connectivity
2. Verify Router contract address
3. Check network status

### Fee Calculation Failing
1. Verify LINK token balance
2. Check fee token configuration
3. Verify destination chain selector

### Message Not Routing
1. Verify destination chain selector
2. Check OnRamp configuration
3. Verify destination allowlist

---

## Related Documentation

- [CCIP Configuration Status](./CCIP_CONFIGURATION_STATUS.md)
- [CCIP Sender Contract Reference](../../docs/07-ccip/CCIP_SENDER_CONTRACT_REFERENCE.md)
- [Complete Task Catalog](./CCIP_COMPLETE_TASK_CATALOG.md)

---

**Last Updated**: 2025-01-12
