WIP: HYBX OMNL and deployment documentation updates
This commit is contained in:
@@ -4,6 +4,19 @@
|
||||
|
||||
Production-grade CCIP integration that turns Chain-138 activity into verified, on-chain Ethereum transactions using Chainlink CCIP.
|
||||
|
||||
## Documentation map
|
||||
|
||||
Canonical CCIP docs for Chain 138 and cross-chain integration. Archive import material was consolidated here on **2026-06-02** (formerly under `docs/ccip/archive-import/`).
|
||||
|
||||
| Section | Contents |
|
||||
|---------|----------|
|
||||
| [chain138/](chain138/) | Chain 138 deployment guide, checklist, testing, chain selector |
|
||||
| [reference/](reference/) | API reference, implementation summary, security, bridge user guide, quick reference, review notes |
|
||||
| [operations/](operations/) | CCIP monitoring, runbooks, admin key management (supplements [operations/integrations/CCIP_*](../operations/integrations/)) |
|
||||
|
||||
Top-level guides: [DEPLOYMENT_GUIDE.md](DEPLOYMENT_GUIDE.md), [QUICK_START.md](QUICK_START.md).
|
||||
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
|
||||
202
docs/ccip-integration/chain138/CHAIN_SELECTOR.md
Normal file
202
docs/ccip-integration/chain138/CHAIN_SELECTOR.md
Normal file
@@ -0,0 +1,202 @@
|
||||
# CCIP Chain Selector Calculation for ChainID 138
|
||||
|
||||
**Date**: 2025-01-27
|
||||
**Chain ID**: 138
|
||||
**Network**: DeFi Oracle Meta Mainnet
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
CCIP chain selectors are unique identifiers used to route messages between chains in the Chainlink CCIP network. For ChainID 138, we need to calculate or define a chain selector that is consistent and unique.
|
||||
|
||||
---
|
||||
|
||||
## Calculation Methods
|
||||
|
||||
### Method 1: Simple ChainID (Recommended for Custom CCIP)
|
||||
|
||||
For custom CCIP router implementations, the simplest approach is to use the chain ID directly as the selector:
|
||||
|
||||
```
|
||||
Chain Selector = Chain ID (as uint64)
|
||||
Chain Selector = 138
|
||||
Hex Format: 0x000000000000008a
|
||||
```
|
||||
|
||||
**Advantages**:
|
||||
- Simple and deterministic
|
||||
- Easy to remember and verify
|
||||
- Compatible with custom CCIP implementations
|
||||
- No calculation required
|
||||
|
||||
**Usage**:
|
||||
```solidity
|
||||
uint64 chainSelector = 138; // or 0x000000000000008a
|
||||
```
|
||||
|
||||
### Method 2: Chainlink Official Format
|
||||
|
||||
If integrating with Chainlink's official CCIP network, chain selectors are calculated using a deterministic hash-based method. The exact formula used by Chainlink is:
|
||||
|
||||
```solidity
|
||||
uint64(uint256(keccak256(abi.encodePacked(chainId, "CCIP"))) >> 192)
|
||||
```
|
||||
|
||||
However, for custom chains not yet registered with Chainlink, you may need to:
|
||||
1. Register the chain with Chainlink
|
||||
2. Use Chainlink's assigned selector
|
||||
3. Or use a custom format for your implementation
|
||||
|
||||
### Method 3: Deterministic Hash-Based
|
||||
|
||||
For a deterministic but more complex selector, you can use:
|
||||
|
||||
```bash
|
||||
# Using cast (Foundry)
|
||||
cast keccak "$(printf '0x%064x' 138)CCIP"
|
||||
# Extract first 8 bytes (uint64) from the hash
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Recommended Selector for ChainID 138
|
||||
|
||||
**Selected Method**: Method 1 (Simple ChainID)
|
||||
|
||||
**Selector Value**:
|
||||
- **Decimal**: `138`
|
||||
- **Hex**: `0x000000000000008a`
|
||||
- **Type**: `uint64`
|
||||
|
||||
**Rationale**:
|
||||
- Simple and deterministic
|
||||
- Easy to verify and document
|
||||
- Compatible with custom CCIP router implementation
|
||||
- No external dependencies or calculations
|
||||
|
||||
---
|
||||
|
||||
## Implementation
|
||||
|
||||
### Environment Variable
|
||||
|
||||
```bash
|
||||
CHAIN138_SELECTOR=0x000000000000008a
|
||||
# Or simply:
|
||||
CHAIN138_SELECTOR=138
|
||||
```
|
||||
|
||||
### In Solidity
|
||||
|
||||
```solidity
|
||||
uint64 constant CHAIN138_SELECTOR = 138;
|
||||
// Or
|
||||
uint64 constant CHAIN138_SELECTOR = 0x000000000000008a;
|
||||
```
|
||||
|
||||
### In Scripts
|
||||
|
||||
```bash
|
||||
# Use the calculated selector
|
||||
CHAIN138_SELECTOR=138
|
||||
# Or hex format
|
||||
CHAIN138_SELECTOR=0x000000000000008a
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Usage in CCIP Configuration
|
||||
|
||||
### Router Configuration
|
||||
|
||||
When configuring the CCIP Router to support ChainID 138:
|
||||
|
||||
```solidity
|
||||
router.addSupportedChain(138); // or 0x000000000000008a
|
||||
```
|
||||
|
||||
### Bridge Configuration
|
||||
|
||||
When configuring bridges to send to ChainID 138:
|
||||
|
||||
```solidity
|
||||
bridge.addDestination(138, receiverBridgeAddress);
|
||||
```
|
||||
|
||||
### Message Sending
|
||||
|
||||
When sending CCIP messages to ChainID 138:
|
||||
|
||||
```solidity
|
||||
router.ccipSend(138, message);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Verification
|
||||
|
||||
To verify the selector is correct:
|
||||
|
||||
1. **Uniqueness**: Ensure no other chain uses selector `138`
|
||||
2. **Consistency**: Use the same selector across all configurations
|
||||
3. **Documentation**: Document the selector in all relevant files
|
||||
|
||||
### Verification Script
|
||||
|
||||
Run the calculation script to verify:
|
||||
|
||||
```bash
|
||||
./scripts/ccip/calculate-chain-selector.sh
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Integration with Other Chains
|
||||
|
||||
When configuring bidirectional bridges, ensure:
|
||||
|
||||
1. **ChainID 138 → Ethereum Mainnet**:
|
||||
- Source selector: `138`
|
||||
- Destination selector: `5009297550715157269` (Ethereum Mainnet)
|
||||
|
||||
2. **Ethereum Mainnet → ChainID 138**:
|
||||
- Source selector: `5009297550715157269`
|
||||
- Destination selector: `138`
|
||||
|
||||
---
|
||||
|
||||
## Chain Selector Reference Table
|
||||
|
||||
| Network | Chain ID | CCIP Chain Selector |
|
||||
|---------|----------|---------------------|
|
||||
| Ethereum Mainnet | 1 | `5009297550715157269` |
|
||||
| BSC | 56 | `11344663589394136015` |
|
||||
| Polygon | 137 | `4051577828743386545` |
|
||||
| Avalanche | 43114 | `6433500567565415381` |
|
||||
| Base | 8453 | `15971525489660198786` |
|
||||
| Arbitrum | 42161 | `4949039107694359620` |
|
||||
| Optimism | 10 | `3734403246176062136` |
|
||||
| **ChainID 138** | **138** | **`138`** (or `0x000000000000008a`) |
|
||||
|
||||
---
|
||||
|
||||
## Notes
|
||||
|
||||
- For custom CCIP implementations, you have flexibility in selector format
|
||||
- The selector must be consistent across all contracts and configurations
|
||||
- If integrating with Chainlink's official CCIP, you may need to register the chain
|
||||
- The selector is used in all CCIP message routing and bridge configurations
|
||||
|
||||
---
|
||||
|
||||
## Related Files
|
||||
|
||||
- `scripts/ccip/calculate-chain-selector.sh` - Calculation script
|
||||
- `docs/ETH_WETH_CHAINLINK_GUIDE.md` - Main guide with selector reference
|
||||
- `docs/deployment/ENV_EXAMPLE_CONTENT.md` - Environment variable examples
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: 2025-01-27
|
||||
|
||||
188
docs/ccip-integration/chain138/DEPLOYMENT_CHECKLIST.md
Normal file
188
docs/ccip-integration/chain138/DEPLOYMENT_CHECKLIST.md
Normal file
@@ -0,0 +1,188 @@
|
||||
# CCIP ChainID 138 Deployment Checklist
|
||||
|
||||
**Date**: 2025-01-27
|
||||
**Network**: ChainID 138 (DeFi Oracle Meta Mainnet)
|
||||
|
||||
---
|
||||
|
||||
## Pre-Deployment Checklist
|
||||
|
||||
### Environment Setup
|
||||
- [ ] ChainID 138 network is running and accessible
|
||||
- [ ] RPC endpoint configured (`RPC_URL_138` or `CHAIN138_RPC_URL`)
|
||||
- [ ] Private key configured (`PRIVATE_KEY`)
|
||||
- [ ] Sufficient native token balance for deployment
|
||||
- [ ] Foundry/Forge installed and working
|
||||
- [ ] `cast` command available
|
||||
|
||||
### Configuration
|
||||
- [ ] `.env` file exists and is configured
|
||||
- [ ] Chain selector calculated (run `./scripts/ccip/calculate-chain-selector.sh`)
|
||||
- [ ] Fee token decision made (LINK or native ETH)
|
||||
- [ ] Fee amounts configured (`CCIP_BASE_FEE`, `CCIP_DATA_FEE_PER_BYTE`)
|
||||
|
||||
---
|
||||
|
||||
## Phase 1: Core Infrastructure
|
||||
|
||||
### Chain Selector
|
||||
- [ ] Run chain selector calculation script
|
||||
- [ ] Verify selector value: `138` (or `0x000000000000008a`)
|
||||
- [ ] Update `.env` with `CHAIN138_SELECTOR`
|
||||
- [ ] Document selector in all relevant files
|
||||
|
||||
### Fee Token
|
||||
- [ ] Decide: LINK token or native ETH
|
||||
- [ ] If LINK: Deploy LINK token contract
|
||||
- [ ] Update `.env` with `CCIP_CHAIN138_LINK_TOKEN`
|
||||
- [ ] If native ETH: Set to `address(0)`
|
||||
|
||||
### CCIP Router
|
||||
- [ ] Deploy CCIPRouter contract
|
||||
- [ ] Verify deployment on explorer
|
||||
- [ ] Update `.env` with `CCIP_CHAIN138_ROUTER`
|
||||
- [ ] Configure router with supported chains
|
||||
- [ ] Add supported tokens
|
||||
- [ ] Verify configuration
|
||||
|
||||
---
|
||||
|
||||
## Phase 2: Bridge Deployment
|
||||
|
||||
### CCIPWETH9Bridge
|
||||
- [ ] Deploy CCIPWETH9Bridge contract
|
||||
- [ ] Verify deployment on explorer
|
||||
- [ ] Update `.env` with `CCIPWETH9_BRIDGE_CHAIN138`
|
||||
- [ ] Verify bridge configuration (router, WETH9, fee token)
|
||||
|
||||
### CCIPWETH10Bridge
|
||||
- [ ] Deploy CCIPWETH10Bridge contract
|
||||
- [ ] Verify deployment on explorer
|
||||
- [ ] Update `.env` with `CCIPWETH10_BRIDGE_CHAIN138`
|
||||
- [ ] Verify bridge configuration (router, WETH10, fee token)
|
||||
|
||||
---
|
||||
|
||||
## Phase 3: Bridge Configuration
|
||||
|
||||
### CCIPWETH9Bridge Destinations
|
||||
- [ ] Add Ethereum Mainnet as destination on ChainID 138 bridge
|
||||
- [ ] Add ChainID 138 as destination on Ethereum Mainnet bridge
|
||||
- [ ] Verify bidirectional configuration
|
||||
- [ ] Test connectivity
|
||||
|
||||
### CCIPWETH10Bridge Destinations
|
||||
- [ ] Add Ethereum Mainnet as destination on ChainID 138 bridge
|
||||
- [ ] Add ChainID 138 as destination on Ethereum Mainnet bridge
|
||||
- [ ] Verify bidirectional configuration
|
||||
- [ ] Test connectivity
|
||||
|
||||
---
|
||||
|
||||
## Phase 4: Verification
|
||||
|
||||
### Contract Verification
|
||||
- [ ] Verify CCIPRouter on explorer
|
||||
- [ ] Verify CCIPWETH9Bridge on explorer
|
||||
- [ ] Verify CCIPWETH10Bridge on explorer
|
||||
- [ ] Verify LINK token (if deployed) on explorer
|
||||
|
||||
### Configuration Verification
|
||||
- [ ] Run verification script: `./scripts/deployment/verify-ccip-deployment.sh`
|
||||
- [ ] Verify router supports Ethereum Mainnet
|
||||
- [ ] Verify bridges have destinations configured
|
||||
- [ ] Verify chain selector is correct
|
||||
|
||||
### Functional Testing
|
||||
- [ ] Test router message sending
|
||||
- [ ] Test bridge token transfer (WETH9)
|
||||
- [ ] Test bridge token transfer (WETH10)
|
||||
- [ ] Test fee payment
|
||||
- [ ] Test error handling
|
||||
|
||||
---
|
||||
|
||||
## Phase 5: Documentation
|
||||
|
||||
### Update Documentation
|
||||
- [ ] Update `docs/ETH_WETH_CHAINLINK_GUIDE.md` with deployed addresses
|
||||
- [ ] Update `docs/CCIP_CHAIN138_REVIEW.md` with deployment status
|
||||
- [ ] Update `docs/deployment/ENV_EXAMPLE_CONTENT.md` with actual values
|
||||
- [ ] Create deployment summary document
|
||||
|
||||
### Create Guides
|
||||
- [ ] Deployment guide (created)
|
||||
- [ ] User guide (created)
|
||||
- [ ] Developer guide (created)
|
||||
- [ ] Monitoring guide (created)
|
||||
- [ ] Security guide (created)
|
||||
- [ ] Runbooks (created)
|
||||
|
||||
---
|
||||
|
||||
## Phase 6: Operations
|
||||
|
||||
### Monitoring Setup
|
||||
- [ ] Set up event monitoring
|
||||
- [ ] Configure alerts
|
||||
- [ ] Create dashboards
|
||||
- [ ] Test alerting
|
||||
|
||||
### Security
|
||||
- [ ] Review security measures
|
||||
- [ ] Set up admin key management
|
||||
- [ ] Document security procedures
|
||||
- [ ] Schedule security audit
|
||||
|
||||
### Operational Procedures
|
||||
- [ ] Create deployment runbook
|
||||
- [ ] Create configuration runbook
|
||||
- [ ] Create troubleshooting guide
|
||||
- [ ] Create emergency response procedures
|
||||
|
||||
---
|
||||
|
||||
## Post-Deployment
|
||||
|
||||
### Testing
|
||||
- [ ] End-to-end cross-chain transfer test
|
||||
- [ ] Error handling tests
|
||||
- [ ] Load testing
|
||||
- [ ] Security testing
|
||||
|
||||
### Monitoring
|
||||
- [ ] Monitor for 24-48 hours
|
||||
- [ ] Review all events
|
||||
- [ ] Check for errors
|
||||
- [ ] Verify performance
|
||||
|
||||
### Documentation
|
||||
- [ ] Finalize all documentation
|
||||
- [ ] Update status in all files
|
||||
- [ ] Create deployment report
|
||||
- [ ] Archive deployment artifacts
|
||||
|
||||
---
|
||||
|
||||
## Success Criteria
|
||||
|
||||
- [ ] All contracts deployed and verified
|
||||
- [ ] All bridges configured with destinations
|
||||
- [ ] Cross-chain transfers working bidirectionally
|
||||
- [ ] All documentation updated
|
||||
- [ ] Monitoring and alerting operational
|
||||
- [ ] Security measures in place
|
||||
- [ ] Operational procedures documented
|
||||
|
||||
---
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- [Deployment Guide](DEPLOYMENT_GUIDE_CHAIN138.md)
|
||||
- [Chain Selector Calculation](CHAIN_SELECTOR_CALCULATION.md)
|
||||
- [CCIP Review](../CCIP_CHAIN138_REVIEW.md)
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: 2025-01-27
|
||||
|
||||
292
docs/ccip-integration/chain138/DEPLOYMENT_GUIDE.md
Normal file
292
docs/ccip-integration/chain138/DEPLOYMENT_GUIDE.md
Normal file
@@ -0,0 +1,292 @@
|
||||
# CCIP Deployment Guide for ChainID 138
|
||||
|
||||
**Date**: 2025-01-27
|
||||
**Network**: ChainID 138 (DeFi Oracle Meta Mainnet)
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
This guide provides step-by-step instructions for deploying and configuring Chainlink CCIP on ChainID 138. Follow these steps in order to ensure proper configuration.
|
||||
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- ChainID 138 network running and accessible
|
||||
- RPC endpoint configured (`RPC_URL_138` or `CHAIN138_RPC_URL`)
|
||||
- Private key configured (`PRIVATE_KEY`)
|
||||
- Sufficient native token balance for deployment
|
||||
- Foundry/Forge installed
|
||||
- `cast` command available (from Foundry)
|
||||
|
||||
---
|
||||
|
||||
## Phase 1: Calculate Chain Selector
|
||||
|
||||
### Step 1.1: Calculate Chain Selector
|
||||
|
||||
Run the chain selector calculation script:
|
||||
|
||||
```bash
|
||||
./scripts/ccip/calculate-chain-selector.sh
|
||||
```
|
||||
|
||||
This will:
|
||||
- Calculate the recommended chain selector for ChainID 138
|
||||
- Update `.env` with `CHAIN138_SELECTOR=0x000000000000008a` (or `138`)
|
||||
|
||||
**Result**: Chain selector is `138` (hex: `0x000000000000008a`)
|
||||
|
||||
---
|
||||
|
||||
## Phase 2: Deploy CCIP Router
|
||||
|
||||
### Step 2.1: Decide on Fee Token
|
||||
|
||||
Choose one:
|
||||
- **Option A**: Use native ETH (recommended for simplicity)
|
||||
- Set `CCIP_CHAIN138_LINK_TOKEN=0x0000000000000000000000000000000000000000`
|
||||
- **Option B**: Deploy LINK token
|
||||
- Deploy ERC-20 LINK token contract
|
||||
- Set `CCIP_CHAIN138_LINK_TOKEN=<deployed_link_address>`
|
||||
|
||||
### Step 2.2: Configure Environment Variables
|
||||
|
||||
Add to `.env`:
|
||||
|
||||
```bash
|
||||
# CCIP Router Configuration
|
||||
CCIP_CHAIN138_LINK_TOKEN=0x0000000000000000000000000000000000000000 # Use native ETH
|
||||
CCIP_BASE_FEE=1000000000000000 # 0.001 ETH (1e15 wei)
|
||||
CCIP_DATA_FEE_PER_BYTE=100000000 # 0.1 gwei per byte (1e8 wei)
|
||||
```
|
||||
|
||||
### Step 2.3: Deploy CCIP Router
|
||||
|
||||
```bash
|
||||
forge script script/DeployCCIPRouter.s.sol \
|
||||
--rpc-url $RPC_URL_138 \
|
||||
--broadcast \
|
||||
--private-key $PRIVATE_KEY
|
||||
```
|
||||
|
||||
### Step 2.4: Update Environment
|
||||
|
||||
After deployment, update `.env`:
|
||||
|
||||
```bash
|
||||
CCIP_CHAIN138_ROUTER=<deployed_router_address>
|
||||
```
|
||||
|
||||
### Step 2.5: Configure Router
|
||||
|
||||
Run the configuration script:
|
||||
|
||||
```bash
|
||||
./scripts/deployment/configure-ccip-router.sh
|
||||
```
|
||||
|
||||
This will:
|
||||
- Add Ethereum Mainnet as a supported chain
|
||||
- Add WETH9 and WETH10 as supported tokens
|
||||
|
||||
---
|
||||
|
||||
## Phase 3: Deploy CCIP Bridges
|
||||
|
||||
### Step 3.1: Deploy CCIPWETH9Bridge
|
||||
|
||||
```bash
|
||||
# Ensure CCIP_CHAIN138_ROUTER is set in .env
|
||||
forge script script/DeployCCIPWETH9Bridge.s.sol \
|
||||
--rpc-url $RPC_URL_138 \
|
||||
--broadcast \
|
||||
--private-key $PRIVATE_KEY
|
||||
```
|
||||
|
||||
Update `.env`:
|
||||
|
||||
```bash
|
||||
CCIPWETH9_BRIDGE_CHAIN138=<deployed_bridge_address>
|
||||
```
|
||||
|
||||
### Step 3.2: Deploy CCIPWETH10Bridge
|
||||
|
||||
```bash
|
||||
forge script script/DeployCCIPWETH10Bridge.s.sol \
|
||||
--rpc-url $RPC_URL_138 \
|
||||
--broadcast \
|
||||
--private-key $PRIVATE_KEY
|
||||
```
|
||||
|
||||
Update `.env`:
|
||||
|
||||
```bash
|
||||
CCIPWETH10_BRIDGE_CHAIN138=<deployed_bridge_address>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Phase 4: Configure Bridge Destinations
|
||||
|
||||
### Step 4.1: Configure CCIPWETH9Bridge
|
||||
|
||||
Run the configuration script:
|
||||
|
||||
```bash
|
||||
./scripts/deployment/configure-weth9-bridge.sh
|
||||
```
|
||||
|
||||
Or manually:
|
||||
|
||||
```bash
|
||||
# Add ChainID 138 destination on Ethereum Mainnet bridge
|
||||
cast send $CCIPWETH9_BRIDGE_MAINNET \
|
||||
"addDestination(uint64,address)" \
|
||||
138 \
|
||||
$CCIPWETH9_BRIDGE_CHAIN138 \
|
||||
--rpc-url $ETHEREUM_MAINNET_RPC \
|
||||
--private-key $PRIVATE_KEY
|
||||
|
||||
# Add Ethereum Mainnet destination on ChainID 138 bridge
|
||||
cast send $CCIPWETH9_BRIDGE_CHAIN138 \
|
||||
"addDestination(uint64,address)" \
|
||||
5009297550715157269 \
|
||||
$CCIPWETH9_BRIDGE_MAINNET \
|
||||
--rpc-url $RPC_URL_138 \
|
||||
--private-key $PRIVATE_KEY
|
||||
```
|
||||
|
||||
### Step 4.2: Configure CCIPWETH10Bridge
|
||||
|
||||
Run the configuration script:
|
||||
|
||||
```bash
|
||||
./scripts/deployment/configure-weth10-bridge.sh
|
||||
```
|
||||
|
||||
Or manually (similar to WETH9 above).
|
||||
|
||||
---
|
||||
|
||||
## Phase 5: Verification
|
||||
|
||||
### Step 5.1: Verify Deployment
|
||||
|
||||
Run the verification script:
|
||||
|
||||
```bash
|
||||
./scripts/deployment/verify-ccip-deployment.sh
|
||||
```
|
||||
|
||||
This will check:
|
||||
- All contracts are deployed
|
||||
- Router configuration
|
||||
- Bridge configuration
|
||||
- Chain selector
|
||||
|
||||
### Step 5.2: Manual Verification
|
||||
|
||||
Verify each contract on the explorer:
|
||||
|
||||
```bash
|
||||
# Check router
|
||||
cast code $CCIP_CHAIN138_ROUTER --rpc-url $RPC_URL_138
|
||||
|
||||
# Check bridges
|
||||
cast code $CCIPWETH9_BRIDGE_CHAIN138 --rpc-url $RPC_URL_138
|
||||
cast code $CCIPWETH10_BRIDGE_CHAIN138 --rpc-url $RPC_URL_138
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Phase 6: Testing
|
||||
|
||||
### Step 6.1: Test Router Message Sending
|
||||
|
||||
```solidity
|
||||
// Test sending a message via router
|
||||
router.ccipSend(
|
||||
5009297550715157269, // Ethereum Mainnet selector
|
||||
message
|
||||
);
|
||||
```
|
||||
|
||||
### Step 6.2: Test Bridge Token Transfer
|
||||
|
||||
```bash
|
||||
# Test WETH9 bridge transfer
|
||||
# 1. Approve bridge to spend WETH9
|
||||
# 2. Call sendCrossChain()
|
||||
# 3. Verify on destination chain
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Environment Variables Summary
|
||||
|
||||
After complete deployment, your `.env` should include:
|
||||
|
||||
```bash
|
||||
# ChainID 138 CCIP Configuration
|
||||
CHAIN138_SELECTOR=0x000000000000008a
|
||||
CCIP_CHAIN138_ROUTER=<deployed_router_address>
|
||||
CCIP_CHAIN138_LINK_TOKEN=0x0000000000000000000000000000000000000000 # or LINK address
|
||||
CCIPWETH9_BRIDGE_CHAIN138=<deployed_bridge_address>
|
||||
CCIPWETH10_BRIDGE_CHAIN138=<deployed_bridge_address>
|
||||
|
||||
# Router Configuration
|
||||
CCIP_BASE_FEE=1000000000000000
|
||||
CCIP_DATA_FEE_PER_BYTE=100000000
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Issue: Router deployment fails
|
||||
|
||||
**Solution**:
|
||||
- Check RPC connectivity
|
||||
- Verify sufficient balance
|
||||
- Check gas price settings
|
||||
|
||||
### Issue: Bridge deployment fails
|
||||
|
||||
**Solution**:
|
||||
- Ensure router is deployed first
|
||||
- Verify router address in environment
|
||||
- Check WETH addresses match genesis
|
||||
|
||||
### Issue: Configuration fails
|
||||
|
||||
**Solution**:
|
||||
- Verify contract addresses
|
||||
- Check chain selectors are correct
|
||||
- Ensure admin key has permissions
|
||||
|
||||
---
|
||||
|
||||
## Next Steps
|
||||
|
||||
After deployment:
|
||||
|
||||
1. **Update Documentation**: Update all docs with deployed addresses
|
||||
2. **Contract Verification**: Verify contracts on explorer
|
||||
3. **Testing**: Run comprehensive tests
|
||||
4. **Monitoring**: Set up monitoring and alerting
|
||||
5. **Security**: Review security measures
|
||||
|
||||
---
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- [Chain Selector Calculation](CHAIN_SELECTOR_CALCULATION.md)
|
||||
- [CCIP Review](../CCIP_CHAIN138_REVIEW.md)
|
||||
- [Main Guide](../ETH_WETH_CHAINLINK_GUIDE.md)
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: 2025-01-27
|
||||
|
||||
194
docs/ccip-integration/chain138/TESTING.md
Normal file
194
docs/ccip-integration/chain138/TESTING.md
Normal file
@@ -0,0 +1,194 @@
|
||||
# CCIP Testing Guide for ChainID 138
|
||||
|
||||
**Date**: 2025-01-27
|
||||
**Network**: ChainID 138 (DeFi Oracle Meta Mainnet)
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
This guide provides testing procedures and examples for CCIP infrastructure on ChainID 138.
|
||||
|
||||
---
|
||||
|
||||
## Test Categories
|
||||
|
||||
### 1. Unit Tests
|
||||
|
||||
Test individual contract functions in isolation.
|
||||
|
||||
**Files**:
|
||||
- `test/CCIPWETH9Bridge.t.sol`
|
||||
- `test/CCIPWETH10Bridge.t.sol`
|
||||
- `test/ccip/CCIPIntegration.t.sol`
|
||||
- `test/ccip/CCIPErrorHandling.t.sol`
|
||||
- `test/ccip/CCIPFees.t.sol`
|
||||
|
||||
### 2. Integration Tests
|
||||
|
||||
Test end-to-end cross-chain flows.
|
||||
|
||||
**Files**:
|
||||
- `test/ccip/CCIPIntegration.t.sol`
|
||||
|
||||
### 3. Functional Tests
|
||||
|
||||
Test real-world usage scenarios.
|
||||
|
||||
---
|
||||
|
||||
## Running Tests
|
||||
|
||||
### Run All CCIP Tests
|
||||
|
||||
```bash
|
||||
forge test --match-path "test/ccip/**" -vvv
|
||||
forge test --match-path "test/CCIP*.t.sol" -vvv
|
||||
```
|
||||
|
||||
### Run Specific Test File
|
||||
|
||||
```bash
|
||||
forge test --match-path "test/CCIPWETH9Bridge.t.sol" -vvv
|
||||
```
|
||||
|
||||
### Run Specific Test Function
|
||||
|
||||
```bash
|
||||
forge test --match-test "testSendCrossChain" -vvv
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Test Scenarios
|
||||
|
||||
### Router Tests
|
||||
|
||||
```solidity
|
||||
function testRouterMessageSending() public {
|
||||
// Test sending message via router
|
||||
IRouterClient.EVM2AnyMessage memory message = ...;
|
||||
(bytes32 messageId, uint256 fee) = router.ccipSend(destinationSelector, message);
|
||||
assertTrue(messageId != bytes32(0));
|
||||
}
|
||||
|
||||
function testRouterFeeCalculation() public {
|
||||
// Test fee calculation
|
||||
uint256 fee = router.getFee(destinationSelector, message);
|
||||
assertTrue(fee > 0);
|
||||
}
|
||||
```
|
||||
|
||||
### Bridge Tests
|
||||
|
||||
```solidity
|
||||
function testBridgeTransfer() public {
|
||||
// Approve bridge
|
||||
weth9.approve(address(bridge), amount);
|
||||
|
||||
// Send cross-chain
|
||||
bytes32 messageId = bridge.sendCrossChain(destinationSelector, recipient, amount);
|
||||
|
||||
// Verify
|
||||
assertTrue(messageId != bytes32(0));
|
||||
}
|
||||
|
||||
function testBridgeFeeCalculation() public {
|
||||
uint256 fee = bridge.calculateFee(destinationSelector, amount);
|
||||
assertTrue(fee > 0);
|
||||
}
|
||||
```
|
||||
|
||||
### Integration Tests
|
||||
|
||||
```solidity
|
||||
function testEndToEndTransfer() public {
|
||||
// 1. Lock tokens on source chain
|
||||
// 2. Send cross-chain message
|
||||
// 3. Verify unlock on destination chain
|
||||
// 4. Verify balances
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Test Data
|
||||
|
||||
### Test Addresses
|
||||
|
||||
```solidity
|
||||
address constant TEST_USER = address(0x1111);
|
||||
address constant TEST_RECIPIENT = address(0x2222);
|
||||
address constant TEST_ADMIN = address(0x3333);
|
||||
```
|
||||
|
||||
### Test Amounts
|
||||
|
||||
```solidity
|
||||
uint256 constant TEST_AMOUNT = 1 ether;
|
||||
uint256 constant TEST_FEE = 0.001 ether;
|
||||
```
|
||||
|
||||
### Test Chain Selectors
|
||||
|
||||
```solidity
|
||||
uint64 constant CHAIN138_SELECTOR = 138;
|
||||
uint64 constant ETH_MAINNET_SELECTOR = 5009297550715157269;
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Mock Contracts
|
||||
|
||||
For testing without actual cross-chain connectivity:
|
||||
|
||||
```solidity
|
||||
contract MockRouter is IRouterClient {
|
||||
function ccipSend(...) external payable returns (bytes32, uint256) {
|
||||
// Mock implementation
|
||||
}
|
||||
|
||||
function getFee(...) external view returns (uint256) {
|
||||
// Mock fee calculation
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Test Coverage Goals
|
||||
|
||||
- **Unit Tests**: >90% coverage
|
||||
- **Integration Tests**: All critical paths
|
||||
- **Error Handling**: All error cases
|
||||
- **Edge Cases**: Boundary conditions
|
||||
|
||||
---
|
||||
|
||||
## Continuous Integration
|
||||
|
||||
### GitHub Actions Example
|
||||
|
||||
```yaml
|
||||
name: CCIP Tests
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: foundry-actions/setup-foundry@v1
|
||||
- run: forge test --match-path "test/ccip/**"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- [Deployment Guide](DEPLOYMENT_GUIDE_CHAIN138.md)
|
||||
- [Developer Integration Guide](../developer-guides/CCIP_INTEGRATION_GUIDE.md)
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: 2025-01-27
|
||||
|
||||
231
docs/ccip-integration/operations/ADMIN_KEY_MANAGEMENT.md
Normal file
231
docs/ccip-integration/operations/ADMIN_KEY_MANAGEMENT.md
Normal file
@@ -0,0 +1,231 @@
|
||||
# Admin Key Management for CCIP Contracts
|
||||
|
||||
**Date**: 2025-01-27
|
||||
**Network**: ChainID 138 (DeFi Oracle Meta Mainnet)
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
This document outlines best practices for managing admin keys for CCIP contracts on ChainID 138.
|
||||
|
||||
---
|
||||
|
||||
## Admin Functions
|
||||
|
||||
### CCIP Router Admin Functions
|
||||
|
||||
- `addSupportedChain(uint64 chainSelector)`
|
||||
- `removeSupportedChain(uint64 chainSelector)`
|
||||
- `addSupportedToken(uint64 chainSelector, address token)`
|
||||
- `updateFees(uint256 baseFee, uint256 dataFeePerByte)`
|
||||
- `changeAdmin(address newAdmin)`
|
||||
- `withdrawFees(uint256 amount)`
|
||||
- `withdrawNativeFees()`
|
||||
|
||||
### Bridge Admin Functions
|
||||
|
||||
- `addDestination(uint64 chainSelector, address receiverBridge)`
|
||||
- `removeDestination(uint64 chainSelector)`
|
||||
- `updateDestination(uint64 chainSelector, address receiverBridge)`
|
||||
- `updateFeeToken(address newFeeToken)`
|
||||
- `changeAdmin(address newAdmin)`
|
||||
|
||||
---
|
||||
|
||||
## Key Management Best Practices
|
||||
|
||||
### 1. Key Storage
|
||||
|
||||
**DO**:
|
||||
- Use hardware wallets (Ledger, Trezor)
|
||||
- Use secure key management systems (HSM, AWS KMS, Azure Key Vault)
|
||||
- Store keys in encrypted format
|
||||
- Use separate keys for different environments (testnet/mainnet)
|
||||
- Implement key rotation procedures
|
||||
|
||||
**DON'T**:
|
||||
- Store keys in plain text files
|
||||
- Commit keys to version control
|
||||
- Share keys via insecure channels
|
||||
- Use same key for multiple purposes
|
||||
- Store keys on shared systems
|
||||
|
||||
### 2. Access Control
|
||||
|
||||
**DO**:
|
||||
- Implement multi-sig for admin functions
|
||||
- Use role-based access control
|
||||
- Require multiple approvals for critical changes
|
||||
- Log all admin actions
|
||||
- Monitor for unauthorized access
|
||||
|
||||
**DON'T**:
|
||||
- Grant admin access to untrusted parties
|
||||
- Skip approval processes
|
||||
- Ignore access logs
|
||||
- Allow unmonitored admin access
|
||||
|
||||
### 3. Key Rotation
|
||||
|
||||
**Procedure**:
|
||||
|
||||
1. **Generate New Key**
|
||||
- Create new key pair
|
||||
- Store securely
|
||||
- Verify key works
|
||||
|
||||
2. **Transfer Admin**
|
||||
```bash
|
||||
cast send $CONTRACT \
|
||||
"changeAdmin(address)" \
|
||||
$NEW_ADMIN \
|
||||
--rpc-url $RPC_URL \
|
||||
--private-key $OLD_ADMIN_KEY
|
||||
```
|
||||
|
||||
3. **Verify Transfer**
|
||||
```bash
|
||||
cast call $CONTRACT "admin()" --rpc-url $RPC_URL
|
||||
```
|
||||
|
||||
4. **Revoke Old Key**
|
||||
- Securely delete old key
|
||||
- Update documentation
|
||||
- Notify team
|
||||
|
||||
### 4. Emergency Procedures
|
||||
|
||||
**If Key is Compromised**:
|
||||
|
||||
1. **Immediate Actions**:
|
||||
- Transfer admin to new secure key
|
||||
- Review recent transactions
|
||||
- Check for unauthorized changes
|
||||
- Notify team and stakeholders
|
||||
|
||||
2. **Investigation**:
|
||||
- Analyze access logs
|
||||
- Identify compromise source
|
||||
- Document incident
|
||||
|
||||
3. **Recovery**:
|
||||
- Restore from backup if needed
|
||||
- Revert unauthorized changes
|
||||
- Implement additional security
|
||||
|
||||
---
|
||||
|
||||
## Multi-Sig Setup
|
||||
|
||||
### Recommended: Use Multi-Sig Wallet
|
||||
|
||||
For production deployments, use a multi-sig wallet:
|
||||
|
||||
1. **Deploy Multi-Sig**
|
||||
- Use OpenZeppelin's MultiSigWallet
|
||||
- Set required confirmations (e.g., 2 of 3)
|
||||
- Add trusted signers
|
||||
|
||||
2. **Set Multi-Sig as Admin**
|
||||
```bash
|
||||
cast send $CONTRACT \
|
||||
"changeAdmin(address)" \
|
||||
$MULTISIG_ADDRESS \
|
||||
--rpc-url $RPC_URL \
|
||||
--private-key $DEPLOYER_KEY
|
||||
```
|
||||
|
||||
3. **Use Multi-Sig for Admin Functions**
|
||||
- Submit transactions through multi-sig
|
||||
- Require multiple approvals
|
||||
- Track all proposals
|
||||
|
||||
---
|
||||
|
||||
## Key Rotation Schedule
|
||||
|
||||
### Recommended Schedule
|
||||
|
||||
- **Quarterly**: Review key security
|
||||
- **Annually**: Rotate keys (if no issues)
|
||||
- **Immediately**: Rotate if compromised
|
||||
- **After Incidents**: Rotate as part of recovery
|
||||
|
||||
---
|
||||
|
||||
## Monitoring
|
||||
|
||||
### Monitor Admin Actions
|
||||
|
||||
Track all admin function calls:
|
||||
|
||||
```bash
|
||||
# Monitor admin changes
|
||||
cast logs --address $CONTRACT \
|
||||
"AdminChanged(address,address)" \
|
||||
--rpc-url $RPC_URL
|
||||
|
||||
# Monitor configuration changes
|
||||
cast logs --address $CONTRACT \
|
||||
"DestinationAdded(uint64,address)" \
|
||||
--rpc-url $RPC_URL
|
||||
```
|
||||
|
||||
### Alerts
|
||||
|
||||
Set up alerts for:
|
||||
- Admin changes
|
||||
- Configuration changes
|
||||
- Unusual admin activity
|
||||
- Failed admin operations
|
||||
|
||||
---
|
||||
|
||||
## Documentation
|
||||
|
||||
### Required Documentation
|
||||
|
||||
1. **Key Inventory**: List all admin keys and their purposes
|
||||
2. **Access Logs**: Maintain logs of all admin actions
|
||||
3. **Rotation Records**: Document all key rotations
|
||||
4. **Incident Reports**: Document security incidents
|
||||
|
||||
### Key Information to Document
|
||||
|
||||
- Key purpose (router admin, bridge admin, etc.)
|
||||
- Key location (hardware wallet, HSM, etc.)
|
||||
- Key holders (who has access)
|
||||
- Last rotation date
|
||||
- Next rotation date
|
||||
|
||||
---
|
||||
|
||||
## Compliance
|
||||
|
||||
### Audit Requirements
|
||||
|
||||
- Regular security audits
|
||||
- Key management reviews
|
||||
- Access control audits
|
||||
- Incident response reviews
|
||||
|
||||
### Regulatory Considerations
|
||||
|
||||
- Follow industry best practices
|
||||
- Maintain audit trails
|
||||
- Implement proper controls
|
||||
- Document procedures
|
||||
|
||||
---
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- [CCIP Security Guide](../security/CCIP_SECURITY.md)
|
||||
- [CCIP Runbooks](CCIP_RUNBOOKS.md)
|
||||
- [CCIP Monitoring](CCIP_MONITORING.md)
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: 2025-01-27
|
||||
|
||||
252
docs/ccip-integration/operations/CCIP_MONITORING.md
Normal file
252
docs/ccip-integration/operations/CCIP_MONITORING.md
Normal file
@@ -0,0 +1,252 @@
|
||||
# CCIP Monitoring Guide for ChainID 138
|
||||
|
||||
**Date**: 2025-01-27
|
||||
**Network**: ChainID 138 (DeFi Oracle Meta Mainnet)
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
This guide provides monitoring setup and best practices for CCIP infrastructure on ChainID 138.
|
||||
|
||||
---
|
||||
|
||||
## Monitoring Components
|
||||
|
||||
### 1. CCIP Router Monitoring
|
||||
|
||||
#### Events to Monitor
|
||||
|
||||
- `MessageSent`: Track all outgoing messages
|
||||
- Parameters: `messageId`, `destinationChainSelector`, `sender`, `receiver`, `data`, `tokenAmounts`, `feeToken`, `extraArgs`
|
||||
- `MessageReceived`: Track all incoming messages
|
||||
- Parameters: `messageId`, `sourceChainSelector`, `sender`, `data`, `tokenAmounts`
|
||||
|
||||
#### Metrics to Track
|
||||
|
||||
- Message volume (sent/received per hour/day)
|
||||
- Fee collection amounts
|
||||
- Average message size
|
||||
- Success/failure rates
|
||||
- Destination chain distribution
|
||||
|
||||
#### Alerts
|
||||
|
||||
- High message failure rate (>5%)
|
||||
- Unusual fee collection patterns
|
||||
- Router contract errors
|
||||
- Unsupported chain access attempts
|
||||
|
||||
### 2. Bridge Monitoring
|
||||
|
||||
#### Events to Monitor
|
||||
|
||||
**CCIPWETH9Bridge & CCIPWETH10Bridge**:
|
||||
- `CrossChainTransferInitiated`: Track outgoing transfers
|
||||
- Parameters: `messageId`, `sender`, `destinationChainSelector`, `recipient`, `amount`, `nonce`
|
||||
- `CrossChainTransferCompleted`: Track completed transfers
|
||||
- Parameters: `messageId`, `sourceChainSelector`, `recipient`, `amount`
|
||||
- `DestinationAdded`: Track configuration changes
|
||||
- `DestinationRemoved`: Track configuration changes
|
||||
- `DestinationUpdated`: Track configuration changes
|
||||
|
||||
#### Metrics to Track
|
||||
|
||||
- Transfer volume (amount and count)
|
||||
- Average transfer size
|
||||
- Transfer success rate
|
||||
- Time to completion
|
||||
- Fee costs per transfer
|
||||
- Destination chain usage
|
||||
|
||||
#### Alerts
|
||||
|
||||
- Failed transfers
|
||||
- Stuck transfers (no completion after X hours)
|
||||
- Unusual transfer patterns
|
||||
- Configuration changes
|
||||
- Insufficient fee errors
|
||||
|
||||
---
|
||||
|
||||
## Monitoring Setup
|
||||
|
||||
### Option 1: Event Logging Script
|
||||
|
||||
Create a script to monitor events:
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# Monitor CCIP events
|
||||
|
||||
RPC_URL="${RPC_URL_138:-http://localhost:8545}"
|
||||
ROUTER="${CCIP_CHAIN138_ROUTER:-}"
|
||||
BRIDGE9="${CCIPWETH9_BRIDGE_CHAIN138:-}"
|
||||
BRIDGE10="${CCIPWETH10_BRIDGE_CHAIN138:-}"
|
||||
|
||||
# Monitor router events
|
||||
cast logs --from-block latest \
|
||||
--address "$ROUTER" \
|
||||
--rpc-url "$RPC_URL" \
|
||||
"MessageSent(bytes32,uint64,address,bytes,tuple[],address,bytes)"
|
||||
|
||||
# Monitor bridge events
|
||||
cast logs --from-block latest \
|
||||
--address "$BRIDGE9" \
|
||||
--rpc-url "$RPC_URL" \
|
||||
"CrossChainTransferInitiated(bytes32,address,uint64,address,uint256,uint256)"
|
||||
```
|
||||
|
||||
### Option 2: Prometheus Integration
|
||||
|
||||
Set up Prometheus to scrape CCIP metrics:
|
||||
|
||||
```yaml
|
||||
# prometheus.yml
|
||||
scrape_configs:
|
||||
- job_name: 'ccip-router'
|
||||
static_configs:
|
||||
- targets: ['localhost:9545']
|
||||
metrics_path: '/metrics'
|
||||
```
|
||||
|
||||
### Option 3: Grafana Dashboards
|
||||
|
||||
Create dashboards for:
|
||||
- Message volume over time
|
||||
- Transfer amounts and counts
|
||||
- Fee collection
|
||||
- Success/failure rates
|
||||
- Destination chain distribution
|
||||
|
||||
---
|
||||
|
||||
## Alerting Rules
|
||||
|
||||
### Critical Alerts
|
||||
|
||||
1. **Router Down**: Router contract becomes unresponsive
|
||||
2. **Bridge Failure**: Bridge fails to process transfers
|
||||
3. **High Failure Rate**: >10% message/transfer failures
|
||||
4. **Configuration Change**: Unauthorized configuration changes
|
||||
|
||||
### Warning Alerts
|
||||
|
||||
1. **High Volume**: Unusual message/transfer volume
|
||||
2. **Fee Anomaly**: Unusual fee collection patterns
|
||||
3. **Slow Processing**: Messages taking longer than expected
|
||||
|
||||
---
|
||||
|
||||
## Logging
|
||||
|
||||
### Recommended Log Levels
|
||||
|
||||
- **INFO**: Normal operations (messages sent/received, transfers)
|
||||
- **WARN**: Recoverable errors, configuration changes
|
||||
- **ERROR**: Failed operations, contract errors
|
||||
- **DEBUG**: Detailed operation logs (for troubleshooting)
|
||||
|
||||
### Log Retention
|
||||
|
||||
- **Event Logs**: Retain for 90 days
|
||||
- **Error Logs**: Retain for 180 days
|
||||
- **Audit Logs**: Retain for 1 year
|
||||
|
||||
---
|
||||
|
||||
## Health Checks
|
||||
|
||||
### Router Health Check
|
||||
|
||||
```bash
|
||||
# Check router is responsive
|
||||
cast call "$ROUTER" "feeToken()" --rpc-url "$RPC_URL"
|
||||
|
||||
# Check supported chains
|
||||
cast call "$ROUTER" "supportedChains(uint64)" "5009297550715157269" --rpc-url "$RPC_URL"
|
||||
```
|
||||
|
||||
### Bridge Health Check
|
||||
|
||||
```bash
|
||||
# Check bridge router connection
|
||||
cast call "$BRIDGE9" "ccipRouter()" --rpc-url "$RPC_URL"
|
||||
|
||||
# Check destinations
|
||||
cast call "$BRIDGE9" "destinations(uint64)" "5009297550715157269" --rpc-url "$RPC_URL"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Performance Metrics
|
||||
|
||||
### Key Performance Indicators (KPIs)
|
||||
|
||||
1. **Message Throughput**: Messages per second
|
||||
2. **Transfer Throughput**: Transfers per hour
|
||||
3. **Average Latency**: Time from send to receive
|
||||
4. **Success Rate**: Percentage of successful operations
|
||||
5. **Fee Efficiency**: Average fee per operation
|
||||
|
||||
### Target Metrics
|
||||
|
||||
- Message success rate: >99%
|
||||
- Average latency: <5 minutes
|
||||
- Transfer success rate: >99.5%
|
||||
- System uptime: >99.9%
|
||||
|
||||
---
|
||||
|
||||
## Incident Response
|
||||
|
||||
### Escalation Procedures
|
||||
|
||||
1. **Level 1**: Automated alerts → On-call engineer
|
||||
2. **Level 2**: Critical failures → Team lead
|
||||
3. **Level 3**: System-wide issues → CTO/Management
|
||||
|
||||
### Response Playbook
|
||||
|
||||
1. **Router Failure**:
|
||||
- Check contract status
|
||||
- Verify RPC connectivity
|
||||
- Review recent transactions
|
||||
- Check for configuration changes
|
||||
|
||||
2. **Bridge Failure**:
|
||||
- Verify router connectivity
|
||||
- Check destination configuration
|
||||
- Review transfer logs
|
||||
- Verify fee payment
|
||||
|
||||
3. **High Failure Rate**:
|
||||
- Analyze failure patterns
|
||||
- Check network conditions
|
||||
- Review recent changes
|
||||
- Escalate if needed
|
||||
|
||||
---
|
||||
|
||||
## Monitoring Tools
|
||||
|
||||
### Recommended Tools
|
||||
|
||||
- **Prometheus**: Metrics collection
|
||||
- **Grafana**: Visualization and dashboards
|
||||
- **ELK Stack**: Log aggregation
|
||||
- **PagerDuty**: Alerting and on-call
|
||||
- **Custom Scripts**: Event monitoring
|
||||
|
||||
---
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- [CCIP Deployment Guide](../ccip/DEPLOYMENT_GUIDE_CHAIN138.md)
|
||||
- [CCIP Review](../CCIP_CHAIN138_REVIEW.md)
|
||||
- [Operations Runbooks](CCIP_RUNBOOKS.md)
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: 2025-01-27
|
||||
|
||||
367
docs/ccip-integration/operations/CCIP_RUNBOOKS.md
Normal file
367
docs/ccip-integration/operations/CCIP_RUNBOOKS.md
Normal file
@@ -0,0 +1,367 @@
|
||||
# CCIP Operational Runbooks for ChainID 138
|
||||
|
||||
**Date**: 2025-01-27
|
||||
**Network**: ChainID 138 (DeFi Oracle Meta Mainnet)
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
This document provides operational runbooks for common CCIP operations, troubleshooting, and emergency procedures.
|
||||
|
||||
---
|
||||
|
||||
## Table of Contents
|
||||
|
||||
1. [Deployment Runbook](#deployment-runbook)
|
||||
2. [Configuration Runbook](#configuration-runbook)
|
||||
3. [Troubleshooting Guide](#troubleshooting-guide)
|
||||
4. [Emergency Response](#emergency-response)
|
||||
|
||||
---
|
||||
|
||||
## Deployment Runbook
|
||||
|
||||
### Prerequisites Check
|
||||
|
||||
```bash
|
||||
# 1. Verify network connectivity
|
||||
cast block-number --rpc-url $RPC_URL_138
|
||||
|
||||
# 2. Verify account balance
|
||||
cast balance $DEPLOYER_ADDRESS --rpc-url $RPC_URL_138
|
||||
|
||||
# 3. Verify environment variables
|
||||
grep -E "CCIP_CHAIN138|CHAIN138_SELECTOR" .env
|
||||
```
|
||||
|
||||
### Deployment Steps
|
||||
|
||||
1. **Calculate Chain Selector**
|
||||
```bash
|
||||
./scripts/ccip/calculate-chain-selector.sh
|
||||
```
|
||||
|
||||
2. **Deploy CCIP Router**
|
||||
```bash
|
||||
forge script script/DeployCCIPRouter.s.sol \
|
||||
--rpc-url $RPC_URL_138 \
|
||||
--broadcast \
|
||||
--private-key $PRIVATE_KEY
|
||||
```
|
||||
|
||||
3. **Configure Router**
|
||||
```bash
|
||||
./scripts/deployment/configure-ccip-router.sh
|
||||
```
|
||||
|
||||
4. **Deploy Bridges**
|
||||
```bash
|
||||
forge script script/DeployCCIPWETH9Bridge.s.sol \
|
||||
--rpc-url $RPC_URL_138 \
|
||||
--broadcast \
|
||||
--private-key $PRIVATE_KEY
|
||||
|
||||
forge script script/DeployCCIPWETH10Bridge.s.sol \
|
||||
--rpc-url $RPC_URL_138 \
|
||||
--broadcast \
|
||||
--private-key $PRIVATE_KEY
|
||||
```
|
||||
|
||||
5. **Configure Bridges**
|
||||
```bash
|
||||
./scripts/deployment/configure-weth9-bridge.sh
|
||||
./scripts/deployment/configure-weth10-bridge.sh
|
||||
```
|
||||
|
||||
6. **Verify Deployment**
|
||||
```bash
|
||||
./scripts/deployment/verify-ccip-deployment.sh
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Configuration Runbook
|
||||
|
||||
### Adding a New Destination Chain
|
||||
|
||||
1. **Get Chain Selector**
|
||||
- Look up selector from Chainlink docs or calculate
|
||||
|
||||
2. **Add to Router**
|
||||
```bash
|
||||
cast send $CCIP_CHAIN138_ROUTER \
|
||||
"addSupportedChain(uint64)" \
|
||||
$DESTINATION_SELECTOR \
|
||||
--rpc-url $RPC_URL_138 \
|
||||
--private-key $PRIVATE_KEY
|
||||
```
|
||||
|
||||
3. **Add Supported Tokens**
|
||||
```bash
|
||||
cast send $CCIP_CHAIN138_ROUTER \
|
||||
"addSupportedToken(uint64,address)" \
|
||||
$DESTINATION_SELECTOR \
|
||||
$TOKEN_ADDRESS \
|
||||
--rpc-url $RPC_URL_138 \
|
||||
--private-key $PRIVATE_KEY
|
||||
```
|
||||
|
||||
4. **Configure Bridge**
|
||||
```bash
|
||||
cast send $BRIDGE_ADDRESS \
|
||||
"addDestination(uint64,address)" \
|
||||
$DESTINATION_SELECTOR \
|
||||
$DESTINATION_BRIDGE_ADDRESS \
|
||||
--rpc-url $RPC_URL_138 \
|
||||
--private-key $PRIVATE_KEY
|
||||
```
|
||||
|
||||
### Updating Fee Configuration
|
||||
|
||||
```bash
|
||||
cast send $CCIP_CHAIN138_ROUTER \
|
||||
"updateFees(uint256,uint256)" \
|
||||
$NEW_BASE_FEE \
|
||||
$NEW_DATA_FEE_PER_BYTE \
|
||||
--rpc-url $RPC_URL_138 \
|
||||
--private-key $PRIVATE_KEY
|
||||
```
|
||||
|
||||
### Changing Admin
|
||||
|
||||
```bash
|
||||
# Router
|
||||
cast send $CCIP_CHAIN138_ROUTER \
|
||||
"changeAdmin(address)" \
|
||||
$NEW_ADMIN \
|
||||
--rpc-url $RPC_URL_138 \
|
||||
--private-key $PRIVATE_KEY
|
||||
|
||||
# Bridge
|
||||
cast send $BRIDGE_ADDRESS \
|
||||
"changeAdmin(address)" \
|
||||
$NEW_ADMIN \
|
||||
--rpc-url $RPC_URL_138 \
|
||||
--private-key $PRIVATE_KEY
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting Guide
|
||||
|
||||
### Issue: Router Not Responding
|
||||
|
||||
**Symptoms**:
|
||||
- Cannot send messages
|
||||
- Contract calls fail
|
||||
|
||||
**Diagnosis**:
|
||||
```bash
|
||||
# Check contract code
|
||||
cast code $CCIP_CHAIN138_ROUTER --rpc-url $RPC_URL_138
|
||||
|
||||
# Check recent transactions
|
||||
cast tx $LAST_TX_HASH --rpc-url $RPC_URL_138
|
||||
```
|
||||
|
||||
**Solutions**:
|
||||
1. Verify RPC connectivity
|
||||
2. Check contract is deployed
|
||||
3. Verify network is synced
|
||||
4. Check for contract upgrades
|
||||
|
||||
### Issue: Bridge Transfer Fails
|
||||
|
||||
**Symptoms**:
|
||||
- Transfer initiated but not completed
|
||||
- Error messages in logs
|
||||
|
||||
**Diagnosis**:
|
||||
```bash
|
||||
# Check bridge configuration
|
||||
cast call $BRIDGE "destinations(uint64)" $DEST_SELECTOR --rpc-url $RPC_URL_138
|
||||
|
||||
# Check router connection
|
||||
cast call $BRIDGE "ccipRouter()" --rpc-url $RPC_URL_138
|
||||
|
||||
# Check message status
|
||||
cast logs --address $BRIDGE "CrossChainTransferInitiated" --rpc-url $RPC_URL_138
|
||||
```
|
||||
|
||||
**Solutions**:
|
||||
1. Verify destination is configured
|
||||
2. Check router is accessible
|
||||
3. Verify sufficient fees
|
||||
4. Check destination chain status
|
||||
|
||||
### Issue: High Failure Rate
|
||||
|
||||
**Symptoms**:
|
||||
- Many failed messages/transfers
|
||||
- Error events in logs
|
||||
|
||||
**Diagnosis**:
|
||||
```bash
|
||||
# Analyze failure patterns
|
||||
cast logs --address $ROUTER "MessageSent" --rpc-url $RPC_URL_138 | grep -i error
|
||||
|
||||
# Check fee configuration
|
||||
cast call $ROUTER "baseFee()" --rpc-url $RPC_URL_138
|
||||
```
|
||||
|
||||
**Solutions**:
|
||||
1. Review error logs
|
||||
2. Check fee configuration
|
||||
3. Verify destination chains
|
||||
4. Check network conditions
|
||||
|
||||
### Issue: Configuration Changes Not Applied
|
||||
|
||||
**Symptoms**:
|
||||
- Configuration calls succeed but changes not visible
|
||||
|
||||
**Diagnosis**:
|
||||
```bash
|
||||
# Verify current configuration
|
||||
cast call $CONTRACT "destinations(uint64)" $SELECTOR --rpc-url $RPC_URL_138
|
||||
|
||||
# Check transaction status
|
||||
cast tx $TX_HASH --rpc-url $RPC_URL_138
|
||||
```
|
||||
|
||||
**Solutions**:
|
||||
1. Verify transaction was mined
|
||||
2. Check correct contract address
|
||||
3. Verify admin permissions
|
||||
4. Check for event emissions
|
||||
|
||||
---
|
||||
|
||||
## Emergency Response
|
||||
|
||||
### Emergency Pause (if implemented)
|
||||
|
||||
If contracts have pause functionality:
|
||||
|
||||
```bash
|
||||
# Pause router (if function exists)
|
||||
cast send $ROUTER "pause()" --rpc-url $RPC_URL_138 --private-key $PRIVATE_KEY
|
||||
|
||||
# Pause bridge
|
||||
cast send $BRIDGE "pause()" --rpc-url $RPC_URL_138 --private-key $PRIVATE_KEY
|
||||
```
|
||||
|
||||
### Disable Destination Chain
|
||||
|
||||
```bash
|
||||
# Remove destination from bridge
|
||||
cast send $BRIDGE \
|
||||
"removeDestination(uint64)" \
|
||||
$PROBLEMATIC_SELECTOR \
|
||||
--rpc-url $RPC_URL_138 \
|
||||
--private-key $PRIVATE_KEY
|
||||
|
||||
# Remove from router
|
||||
cast send $ROUTER \
|
||||
"removeSupportedChain(uint64)" \
|
||||
$PROBLEMATIC_SELECTOR \
|
||||
--rpc-url $RPC_URL_138 \
|
||||
--private-key $PRIVATE_KEY
|
||||
```
|
||||
|
||||
### Withdraw Fees (Emergency)
|
||||
|
||||
```bash
|
||||
# Withdraw native ETH fees
|
||||
cast send $ROUTER \
|
||||
"withdrawNativeFees()" \
|
||||
--rpc-url $RPC_URL_138 \
|
||||
--private-key $PRIVATE_KEY
|
||||
|
||||
# Withdraw ERC20 fees
|
||||
cast send $ROUTER \
|
||||
"withdrawFees(uint256)" \
|
||||
$AMOUNT \
|
||||
--rpc-url $RPC_URL_138 \
|
||||
--private-key $PRIVATE_KEY
|
||||
```
|
||||
|
||||
### Incident Response Checklist
|
||||
|
||||
1. **Identify Issue**
|
||||
- Check monitoring alerts
|
||||
- Review recent logs
|
||||
- Verify contract status
|
||||
|
||||
2. **Assess Impact**
|
||||
- How many users affected?
|
||||
- What operations are failing?
|
||||
- Is data at risk?
|
||||
|
||||
3. **Contain Issue**
|
||||
- Disable affected destinations
|
||||
- Pause operations if needed
|
||||
- Notify stakeholders
|
||||
|
||||
4. **Resolve Issue**
|
||||
- Apply fixes
|
||||
- Verify resolution
|
||||
- Monitor for recurrence
|
||||
|
||||
5. **Post-Incident**
|
||||
- Document incident
|
||||
- Review root cause
|
||||
- Update procedures
|
||||
|
||||
---
|
||||
|
||||
## Common Operations
|
||||
|
||||
### Check Contract Status
|
||||
|
||||
```bash
|
||||
# Router status
|
||||
cast call $ROUTER "feeToken()" --rpc-url $RPC_URL_138
|
||||
cast call $ROUTER "baseFee()" --rpc-url $RPC_URL_138
|
||||
cast call $ROUTER "supportedChains(uint64)" $SELECTOR --rpc-url $RPC_URL_138
|
||||
|
||||
# Bridge status
|
||||
cast call $BRIDGE "ccipRouter()" --rpc-url $RPC_URL_138
|
||||
cast call $BRIDGE "destinations(uint64)" $SELECTOR --rpc-url $RPC_URL_138
|
||||
cast call $BRIDGE "getDestinationChains()" --rpc-url $RPC_URL_138
|
||||
```
|
||||
|
||||
### View Recent Events
|
||||
|
||||
```bash
|
||||
# Router events
|
||||
cast logs --address $ROUTER --from-block latest --rpc-url $RPC_URL_138
|
||||
|
||||
# Bridge events
|
||||
cast logs --address $BRIDGE --from-block latest --rpc-url $RPC_URL_138
|
||||
```
|
||||
|
||||
### Calculate Fees
|
||||
|
||||
```bash
|
||||
# Estimate fee for message
|
||||
cast call $ROUTER \
|
||||
"getFee(uint64,tuple)" \
|
||||
$DEST_SELECTOR \
|
||||
$MESSAGE \
|
||||
--rpc-url $RPC_URL_138
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- [CCIP Deployment Guide](../ccip/DEPLOYMENT_GUIDE_CHAIN138.md)
|
||||
- [CCIP Monitoring](CCIP_MONITORING.md)
|
||||
- [CCIP Review](../CCIP_CHAIN138_REVIEW.md)
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: 2025-01-27
|
||||
|
||||
296
docs/ccip-integration/reference/API_REFERENCE.md
Normal file
296
docs/ccip-integration/reference/API_REFERENCE.md
Normal file
@@ -0,0 +1,296 @@
|
||||
# CCIP API Reference for ChainID 138
|
||||
|
||||
**Date**: 2025-01-27
|
||||
**Network**: ChainID 138 (DeFi Oracle Meta Mainnet)
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
This document provides API reference for CCIP contracts on ChainID 138.
|
||||
|
||||
---
|
||||
|
||||
## CCIP Router API
|
||||
|
||||
### Functions
|
||||
|
||||
#### `ccipSend(uint64 destinationChainSelector, EVM2AnyMessage memory message)`
|
||||
|
||||
Send a message to a destination chain.
|
||||
|
||||
**Parameters**:
|
||||
- `destinationChainSelector`: Chain selector of destination chain
|
||||
- `message`: CCIP message structure
|
||||
|
||||
**Returns**:
|
||||
- `bytes32 messageId`: Unique message identifier
|
||||
- `uint256 fees`: Fees paid for the message
|
||||
|
||||
**Example**:
|
||||
```solidity
|
||||
IRouterClient.EVM2AnyMessage memory message = IRouterClient.EVM2AnyMessage({
|
||||
receiver: abi.encode(receiverAddress),
|
||||
data: messageData,
|
||||
tokenAmounts: new IRouterClient.TokenAmount[](0),
|
||||
feeToken: address(0), // Native ETH
|
||||
extraArgs: ""
|
||||
});
|
||||
|
||||
(bytes32 messageId, uint256 fees) = router.ccipSend{value: fee}(
|
||||
destinationSelector,
|
||||
message
|
||||
);
|
||||
```
|
||||
|
||||
#### `getFee(uint64 destinationChainSelector, EVM2AnyMessage memory message)`
|
||||
|
||||
Calculate fee for sending a message.
|
||||
|
||||
**Parameters**:
|
||||
- `destinationChainSelector`: Chain selector of destination chain
|
||||
- `message`: CCIP message structure
|
||||
|
||||
**Returns**:
|
||||
- `uint256 fee`: Required fee amount
|
||||
|
||||
**Example**:
|
||||
```solidity
|
||||
uint256 fee = router.getFee(destinationSelector, message);
|
||||
```
|
||||
|
||||
#### `getSupportedTokens(uint64 destinationChainSelector)`
|
||||
|
||||
Get list of supported tokens for a destination chain.
|
||||
|
||||
**Parameters**:
|
||||
- `destinationChainSelector`: Chain selector
|
||||
|
||||
**Returns**:
|
||||
- `address[] tokens`: Array of supported token addresses
|
||||
|
||||
#### `addSupportedChain(uint64 chainSelector)` (Admin Only)
|
||||
|
||||
Add a supported destination chain.
|
||||
|
||||
**Parameters**:
|
||||
- `chainSelector`: Chain selector to add
|
||||
|
||||
#### `removeSupportedChain(uint64 chainSelector)` (Admin Only)
|
||||
|
||||
Remove a supported destination chain.
|
||||
|
||||
#### `addSupportedToken(uint64 chainSelector, address token)` (Admin Only)
|
||||
|
||||
Add a supported token for a chain.
|
||||
|
||||
**Parameters**:
|
||||
- `chainSelector`: Chain selector
|
||||
- `token`: Token address
|
||||
|
||||
#### `updateFees(uint256 baseFee, uint256 dataFeePerByte)` (Admin Only)
|
||||
|
||||
Update fee configuration.
|
||||
|
||||
**Parameters**:
|
||||
- `baseFee`: New base fee
|
||||
- `dataFeePerByte`: New data fee per byte
|
||||
|
||||
---
|
||||
|
||||
## CCIPWETH9Bridge API
|
||||
|
||||
### Functions
|
||||
|
||||
#### `sendCrossChain(uint64 destinationChainSelector, address recipient, uint256 amount)`
|
||||
|
||||
Send WETH9 tokens to another chain.
|
||||
|
||||
**Parameters**:
|
||||
- `destinationChainSelector`: Destination chain selector
|
||||
- `recipient`: Recipient address on destination chain
|
||||
- `amount`: Amount of WETH9 to send
|
||||
|
||||
**Returns**:
|
||||
- `bytes32 messageId`: Message ID for tracking
|
||||
|
||||
**Example**:
|
||||
```solidity
|
||||
// Approve first
|
||||
weth9.approve(address(bridge), amount);
|
||||
|
||||
// Send
|
||||
bytes32 messageId = bridge.sendCrossChain(
|
||||
5009297550715157269, // Ethereum Mainnet
|
||||
recipientAddress,
|
||||
amount
|
||||
);
|
||||
```
|
||||
|
||||
#### `ccipReceive(Any2EVMMessage calldata message)` (Router Only)
|
||||
|
||||
Receive WETH9 tokens from another chain. Called by router.
|
||||
|
||||
#### `calculateFee(uint64 destinationChainSelector, uint256 amount)`
|
||||
|
||||
Calculate fee for cross-chain transfer.
|
||||
|
||||
**Parameters**:
|
||||
- `destinationChainSelector`: Destination chain selector
|
||||
- `amount`: Transfer amount
|
||||
|
||||
**Returns**:
|
||||
- `uint256 fee`: Required fee
|
||||
|
||||
#### `addDestination(uint64 chainSelector, address receiverBridge)` (Admin Only)
|
||||
|
||||
Add destination chain configuration.
|
||||
|
||||
#### `removeDestination(uint64 chainSelector)` (Admin Only)
|
||||
|
||||
Remove destination chain.
|
||||
|
||||
#### `updateDestination(uint64 chainSelector, address receiverBridge)` (Admin Only)
|
||||
|
||||
Update destination receiver bridge address.
|
||||
|
||||
#### `getDestinationChains()`
|
||||
|
||||
Get list of configured destination chains.
|
||||
|
||||
**Returns**:
|
||||
- `uint64[]`: Array of chain selectors
|
||||
|
||||
#### `getUserNonce(address user)`
|
||||
|
||||
Get user's current nonce.
|
||||
|
||||
**Returns**:
|
||||
- `uint256`: User nonce
|
||||
|
||||
---
|
||||
|
||||
## CCIPWETH10Bridge API
|
||||
|
||||
Same as CCIPWETH9Bridge, but for WETH10 tokens.
|
||||
|
||||
---
|
||||
|
||||
## Events
|
||||
|
||||
### Router Events
|
||||
|
||||
```solidity
|
||||
event MessageSent(
|
||||
bytes32 indexed messageId,
|
||||
uint64 indexed destinationChainSelector,
|
||||
address indexed sender,
|
||||
bytes receiver,
|
||||
bytes data,
|
||||
TokenAmount[] tokenAmounts,
|
||||
address feeToken,
|
||||
bytes extraArgs
|
||||
);
|
||||
|
||||
event MessageReceived(
|
||||
bytes32 indexed messageId,
|
||||
uint64 indexed sourceChainSelector,
|
||||
address indexed sender,
|
||||
bytes data,
|
||||
TokenAmount[] tokenAmounts
|
||||
);
|
||||
```
|
||||
|
||||
### Bridge Events
|
||||
|
||||
```solidity
|
||||
event CrossChainTransferInitiated(
|
||||
bytes32 indexed messageId,
|
||||
address indexed sender,
|
||||
uint64 indexed destinationChainSelector,
|
||||
address recipient,
|
||||
uint256 amount,
|
||||
uint256 nonce
|
||||
);
|
||||
|
||||
event CrossChainTransferCompleted(
|
||||
bytes32 indexed messageId,
|
||||
uint64 indexed sourceChainSelector,
|
||||
address indexed recipient,
|
||||
uint256 amount
|
||||
);
|
||||
|
||||
event DestinationAdded(uint64 chainSelector, address receiverBridge);
|
||||
event DestinationRemoved(uint64 chainSelector);
|
||||
event DestinationUpdated(uint64 chainSelector, address receiverBridge);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Data Structures
|
||||
|
||||
### EVM2AnyMessage
|
||||
|
||||
```solidity
|
||||
struct EVM2AnyMessage {
|
||||
bytes receiver; // Encoded receiver address
|
||||
bytes data; // Message data
|
||||
TokenAmount[] tokenAmounts; // Token amounts to transfer
|
||||
address feeToken; // Fee token address (0 for native)
|
||||
bytes extraArgs; // Extra arguments
|
||||
}
|
||||
```
|
||||
|
||||
### Any2EVMMessage
|
||||
|
||||
```solidity
|
||||
struct Any2EVMMessage {
|
||||
bytes32 messageId; // Unique message ID
|
||||
uint64 sourceChainSelector; // Source chain selector
|
||||
bytes sender; // Encoded sender address
|
||||
bytes data; // Message data
|
||||
TokenAmount[] tokenAmounts; // Token amounts received
|
||||
}
|
||||
```
|
||||
|
||||
### TokenAmount
|
||||
|
||||
```solidity
|
||||
struct TokenAmount {
|
||||
address token; // Token address
|
||||
uint256 amount; // Amount
|
||||
TokenAmountType amountType; // Fiat or Native
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Error Codes
|
||||
|
||||
### Router Errors
|
||||
|
||||
- `CCIPRouter: chain not supported`
|
||||
- `CCIPRouter: insufficient native token fee`
|
||||
- `CCIPRouter: duplicate message`
|
||||
- `CCIPRouter: empty receiver`
|
||||
|
||||
### Bridge Errors
|
||||
|
||||
- `CCIPWETH9Bridge: destination not enabled`
|
||||
- `CCIPWETH9Bridge: transfer failed`
|
||||
- `CCIPWETH9Bridge: transfer already processed`
|
||||
- `CCIPWETH9Bridge: invalid amount`
|
||||
- `CCIPWETH9Bridge: zero recipient`
|
||||
|
||||
---
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- [Developer Integration Guide](../developer-guides/CCIP_INTEGRATION_GUIDE.md)
|
||||
- [User Guide](../user-guides/CCIP_BRIDGE_USER_GUIDE.md)
|
||||
- [Deployment Guide](DEPLOYMENT_GUIDE_CHAIN138.md)
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: 2025-01-27
|
||||
|
||||
282
docs/ccip-integration/reference/CCIP_BRIDGE_USER_GUIDE.md
Normal file
282
docs/ccip-integration/reference/CCIP_BRIDGE_USER_GUIDE.md
Normal file
@@ -0,0 +1,282 @@
|
||||
# CCIP Bridge User Guide
|
||||
|
||||
**Date**: 2025-01-27
|
||||
**Network**: ChainID 138 (DeFi Oracle Meta Mainnet)
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
This guide explains how to use the CCIP bridges to transfer WETH9 and WETH10 tokens between ChainID 138 and other supported chains.
|
||||
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Wallet connected to ChainID 138
|
||||
- WETH9 or WETH10 tokens in your wallet
|
||||
- LINK tokens (if using LINK for fees) or native ETH (if using native fees)
|
||||
- Sufficient balance for gas fees
|
||||
|
||||
---
|
||||
|
||||
## Bridge Addresses
|
||||
|
||||
### ChainID 138
|
||||
|
||||
- **CCIPWETH9Bridge**: See `.env` or documentation for deployed address
|
||||
- **CCIPWETH10Bridge**: See `.env` or documentation for deployed address
|
||||
|
||||
### Ethereum Mainnet
|
||||
|
||||
- **CCIPWETH9Bridge**: `0x3304b747E565a97ec8AC220b0B6A1f6ffDB837e6`
|
||||
- **CCIPWETH10Bridge**: `0x8078A09637e47Fa5Ed34F626046Ea2094a5CDE5e`
|
||||
|
||||
---
|
||||
|
||||
## Step-by-Step Guide
|
||||
|
||||
### Step 1: Prepare Tokens
|
||||
|
||||
#### Option A: You have native ETH
|
||||
|
||||
Wrap ETH to WETH:
|
||||
|
||||
```solidity
|
||||
// For WETH9
|
||||
weth9.deposit{value: amount}();
|
||||
|
||||
// For WETH10
|
||||
weth10.deposit{value: amount}();
|
||||
```
|
||||
|
||||
#### Option B: You already have WETH
|
||||
|
||||
Ensure you have sufficient WETH balance.
|
||||
|
||||
### Step 2: Approve Bridge
|
||||
|
||||
Approve the bridge to spend your tokens:
|
||||
|
||||
```solidity
|
||||
// For WETH9
|
||||
weth9.approve(bridgeAddress, amount);
|
||||
|
||||
// For WETH10
|
||||
weth10.approve(bridgeAddress, amount);
|
||||
```
|
||||
|
||||
### Step 3: Calculate Fees
|
||||
|
||||
Estimate the CCIP fee:
|
||||
|
||||
```solidity
|
||||
uint256 fee = bridge.calculateFee(destinationChainSelector, amount);
|
||||
```
|
||||
|
||||
### Step 4: Approve Fee Token
|
||||
|
||||
If using LINK for fees:
|
||||
|
||||
```solidity
|
||||
linkToken.approve(bridgeAddress, fee);
|
||||
```
|
||||
|
||||
If using native ETH, ensure you have sufficient balance.
|
||||
|
||||
### Step 5: Send Cross-Chain
|
||||
|
||||
Send tokens to destination chain:
|
||||
|
||||
```solidity
|
||||
bytes32 messageId = bridge.sendCrossChain(
|
||||
destinationChainSelector, // e.g., 5009297550715157269 for Ethereum Mainnet
|
||||
recipientAddress, // Address on destination chain
|
||||
amount // Amount to transfer
|
||||
);
|
||||
```
|
||||
|
||||
### Step 6: Monitor Transfer
|
||||
|
||||
Track the transfer using the `messageId`:
|
||||
|
||||
- Check events: `CrossChainTransferInitiated`
|
||||
- Wait for confirmation on destination chain
|
||||
- Check events: `CrossChainTransferCompleted`
|
||||
|
||||
---
|
||||
|
||||
## Example: Transfer WETH9 from ChainID 138 to Ethereum Mainnet
|
||||
|
||||
```solidity
|
||||
// 1. Wrap ETH to WETH9
|
||||
weth9.deposit{value: 1 ether}();
|
||||
|
||||
// 2. Approve bridge
|
||||
weth9.approve(bridgeAddress, 1 ether);
|
||||
|
||||
// 3. Calculate fee
|
||||
uint256 fee = bridge.calculateFee(5009297550715157269, 1 ether);
|
||||
|
||||
// 4. Approve fee (if using LINK)
|
||||
linkToken.approve(bridgeAddress, fee);
|
||||
|
||||
// 5. Send cross-chain
|
||||
bytes32 messageId = bridge.sendCrossChain(
|
||||
5009297550715157269, // Ethereum Mainnet selector
|
||||
recipientAddress, // Your address on Ethereum Mainnet
|
||||
1 ether
|
||||
);
|
||||
|
||||
// 6. Monitor transfer
|
||||
// Check events or use messageId to track
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Using with Web3 Libraries
|
||||
|
||||
### ethers.js
|
||||
|
||||
```javascript
|
||||
const bridge = new ethers.Contract(bridgeAddress, bridgeABI, signer);
|
||||
|
||||
// Approve
|
||||
await weth9.approve(bridgeAddress, amount);
|
||||
|
||||
// Calculate fee
|
||||
const fee = await bridge.calculateFee(destinationSelector, amount);
|
||||
|
||||
// Approve fee token (if LINK)
|
||||
await linkToken.approve(bridgeAddress, fee);
|
||||
|
||||
// Send cross-chain
|
||||
const tx = await bridge.sendCrossChain(
|
||||
destinationSelector,
|
||||
recipientAddress,
|
||||
amount
|
||||
);
|
||||
const receipt = await tx.wait();
|
||||
const messageId = receipt.events.find(e => e.event === 'CrossChainTransferInitiated').args.messageId;
|
||||
```
|
||||
|
||||
### web3.js
|
||||
|
||||
```javascript
|
||||
// Approve
|
||||
await weth9.methods.approve(bridgeAddress, amount).send({ from: account });
|
||||
|
||||
// Calculate fee
|
||||
const fee = await bridge.methods.calculateFee(destinationSelector, amount).call();
|
||||
|
||||
// Approve fee token (if LINK)
|
||||
await linkToken.methods.approve(bridgeAddress, fee).send({ from: account });
|
||||
|
||||
// Send cross-chain
|
||||
const tx = await bridge.methods.sendCrossChain(
|
||||
destinationSelector,
|
||||
recipientAddress,
|
||||
amount
|
||||
).send({ from: account });
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Supported Destination Chains
|
||||
|
||||
| Network | Chain ID | Chain Selector |
|
||||
|---------|----------|---------------|
|
||||
| Ethereum Mainnet | 1 | `5009297550715157269` |
|
||||
| BSC | 56 | `11344663589394136015` |
|
||||
| Polygon | 137 | `4051577828743386545` |
|
||||
| Avalanche | 43114 | `6433500567565415381` |
|
||||
| Base | 8453 | `15971525489660198786` |
|
||||
| Arbitrum | 42161 | `4949039107694359620` |
|
||||
| Optimism | 10 | `3734403246176062136` |
|
||||
|
||||
---
|
||||
|
||||
## Fees
|
||||
|
||||
### Fee Structure
|
||||
|
||||
- **Base Fee**: Fixed fee per message
|
||||
- **Data Fee**: Fee per byte of message data
|
||||
- **Token Fee**: Percentage of token amount (if applicable)
|
||||
|
||||
### Fee Payment
|
||||
|
||||
- **Native ETH**: Fees paid in native token (if configured)
|
||||
- **LINK Token**: Fees paid in LINK token (if configured)
|
||||
|
||||
### Estimating Fees
|
||||
|
||||
Always calculate fees before sending:
|
||||
|
||||
```solidity
|
||||
uint256 fee = bridge.calculateFee(destinationSelector, amount);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Issue: Transfer Fails
|
||||
|
||||
**Possible Causes**:
|
||||
- Insufficient token balance
|
||||
- Insufficient fee balance
|
||||
- Destination not configured
|
||||
- Invalid recipient address
|
||||
|
||||
**Solutions**:
|
||||
1. Check token and fee balances
|
||||
2. Verify destination is enabled
|
||||
3. Verify recipient address is valid
|
||||
4. Check recent bridge events
|
||||
|
||||
### Issue: Transfer Stuck
|
||||
|
||||
**Possible Causes**:
|
||||
- Destination chain issues
|
||||
- Router problems
|
||||
- Network congestion
|
||||
|
||||
**Solutions**:
|
||||
1. Check destination chain status
|
||||
2. Monitor bridge events
|
||||
3. Contact support if persistent
|
||||
|
||||
### Issue: High Fees
|
||||
|
||||
**Possible Causes**:
|
||||
- Large transfer amount
|
||||
- Network congestion
|
||||
- Fee configuration
|
||||
|
||||
**Solutions**:
|
||||
1. Check fee calculation
|
||||
2. Consider smaller amounts
|
||||
3. Wait for lower network activity
|
||||
|
||||
---
|
||||
|
||||
## Security Considerations
|
||||
|
||||
1. **Verify Addresses**: Always verify bridge and token addresses
|
||||
2. **Check Fees**: Verify fee calculations before sending
|
||||
3. **Monitor Transfers**: Track your transfers using messageId
|
||||
4. **Use Official Sources**: Only use addresses from official documentation
|
||||
|
||||
---
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- [CCIP Deployment Guide](../ccip/DEPLOYMENT_GUIDE_CHAIN138.md)
|
||||
- [CCIP Review](../CCIP_CHAIN138_REVIEW.md)
|
||||
- [Main Guide](../ETH_WETH_CHAINLINK_GUIDE.md)
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: 2025-01-27
|
||||
|
||||
126
docs/ccip-integration/reference/CCIP_CHAIN138_QUICK_REFERENCE.md
Normal file
126
docs/ccip-integration/reference/CCIP_CHAIN138_QUICK_REFERENCE.md
Normal file
@@ -0,0 +1,126 @@
|
||||
# CCIP ChainID 138 - Quick Reference
|
||||
|
||||
**Status**: ⚠️ **NOT FULLY ENABLED** - Deployment Required
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Quick Status
|
||||
|
||||
| Component | Status | Action Required |
|
||||
|-----------|--------|-----------------|
|
||||
| **CCIP Router** | ❌ Not Deployed | Deploy `CCIPRouter` contract |
|
||||
| **LINK Token** | ❌ Not Deployed | Deploy LINK or use native ETH |
|
||||
| **CCIP Chain Selector** | ✅ Calculated | `138` (or `0x000000000000008a`) |
|
||||
| **CCIPWETH9Bridge** | ❌ Not Deployed | Deploy bridge contract |
|
||||
| **CCIPWETH10Bridge** | ❌ Not Deployed | Deploy bridge contract |
|
||||
| **WETH9** | ✅ Pre-deployed | Already in genesis |
|
||||
| **WETH10** | ✅ Pre-deployed | Already in genesis |
|
||||
|
||||
---
|
||||
|
||||
## 📋 Deployment Order
|
||||
|
||||
1. **Calculate CCIP Chain Selector** (✅ Script ready)
|
||||
2. **Deploy CCIPRouter** (or use native ETH fees)
|
||||
3. **Deploy LINK Token** (optional - can use native ETH)
|
||||
4. **Deploy CCIPWETH9Bridge**
|
||||
5. **Deploy CCIPWETH10Bridge**
|
||||
6. **Configure Bridges** with destination chains
|
||||
|
||||
**Or use the complete deployment script:**
|
||||
```bash
|
||||
./scripts/deployment/deploy-ccip-chain138-complete.sh
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Quick Deployment Commands
|
||||
|
||||
### 1. Deploy CCIPRouter
|
||||
|
||||
```bash
|
||||
# Set environment variables
|
||||
export CCIP_FEE_TOKEN=0x0000000000000000000000000000000000000000 # Use native ETH
|
||||
export CCIP_BASE_FEE=1000000000000000 # 0.001 ETH
|
||||
export CCIP_DATA_FEE_PER_BYTE=100000000 # 0.1 gwei per byte
|
||||
|
||||
# Deploy
|
||||
forge script script/DeployCCIPRouter.s.sol \
|
||||
--rpc-url $RPC_URL_138 \
|
||||
--broadcast \
|
||||
--private-key $PRIVATE_KEY
|
||||
```
|
||||
|
||||
### 2. Deploy CCIPWETH9Bridge
|
||||
|
||||
```bash
|
||||
# Set environment variables
|
||||
export CCIP_ROUTER=<deployed_router_address>
|
||||
export CCIP_FEE_TOKEN=0x0000000000000000000000000000000000000000 # Or LINK address
|
||||
|
||||
# Deploy
|
||||
forge script script/DeployCCIPWETH9Bridge.s.sol \
|
||||
--rpc-url $RPC_URL_138 \
|
||||
--broadcast \
|
||||
--private-key $PRIVATE_KEY
|
||||
```
|
||||
|
||||
### 3. Deploy CCIPWETH10Bridge
|
||||
|
||||
```bash
|
||||
# Set environment variables (same as above)
|
||||
export CCIP_ROUTER=<deployed_router_address>
|
||||
export CCIP_FEE_TOKEN=0x0000000000000000000000000000000000000000
|
||||
|
||||
# Deploy
|
||||
forge script script/DeployCCIPWETH10Bridge.s.sol \
|
||||
--rpc-url $RPC_URL_138 \
|
||||
--broadcast \
|
||||
--private-key $PRIVATE_KEY
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ⚙️ Configuration
|
||||
|
||||
### Update Environment Variables
|
||||
|
||||
After deployment, update `.env`:
|
||||
|
||||
```bash
|
||||
# CCIP Infrastructure
|
||||
CCIP_CHAIN138_ROUTER=<deployed_router_address>
|
||||
CCIP_CHAIN138_LINK_TOKEN=<link_address_or_zero>
|
||||
CHAIN138_SELECTOR=<calculated_selector>
|
||||
|
||||
# Bridges
|
||||
CCIPWETH9_BRIDGE_CHAIN138=<deployed_bridge_address>
|
||||
CCIPWETH10_BRIDGE_CHAIN138=<deployed_bridge_address>
|
||||
```
|
||||
|
||||
### Configure Bridge Destinations
|
||||
|
||||
```bash
|
||||
# Add Ethereum Mainnet as destination
|
||||
cast send $CCIPWETH9_BRIDGE_CHAIN138 \
|
||||
"addDestination(uint64,address)" \
|
||||
5009297550715157269 \
|
||||
$CCIPWETH9_BRIDGE_MAINNET \
|
||||
--rpc-url $RPC_URL_138 \
|
||||
--private-key $PRIVATE_KEY
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📚 Full Documentation
|
||||
|
||||
- **Complete Review**: [`docs/CCIP_CHAIN138_REVIEW.md`](CCIP_CHAIN138_REVIEW.md)
|
||||
- **Implementation Summary**: [`docs/ccip/IMPLEMENTATION_SUMMARY.md`](ccip/IMPLEMENTATION_SUMMARY.md)
|
||||
- **Deployment Guide**: [`docs/ccip/DEPLOYMENT_GUIDE_CHAIN138.md`](ccip/DEPLOYMENT_GUIDE_CHAIN138.md)
|
||||
- **Chain Selector**: [`docs/ccip/CHAIN_SELECTOR_CALCULATION.md`](ccip/CHAIN_SELECTOR_CALCULATION.md)
|
||||
- **Main Guide**: [`docs/ETH_WETH_CHAINLINK_GUIDE.md`](ETH_WETH_CHAINLINK_GUIDE.md)
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: 2025-01-27
|
||||
|
||||
347
docs/ccip-integration/reference/CCIP_CHAIN138_REVIEW.md
Normal file
347
docs/ccip-integration/reference/CCIP_CHAIN138_REVIEW.md
Normal file
@@ -0,0 +1,347 @@
|
||||
# CCIP Enablement Review for ChainID 138
|
||||
|
||||
**Date**: 2025-01-27
|
||||
**Reviewer**: AI Assistant
|
||||
**Status**: ✅ **IMPLEMENTATION COMPLETE** - Ready for Deployment
|
||||
|
||||
---
|
||||
|
||||
## Executive Summary
|
||||
|
||||
ChainID 138 (DeFi Oracle Meta Mainnet) has **all CCIP infrastructure, scripts, and documentation implemented**. The project is **ready for deployment** when network access is available. All deployment scripts, configuration tools, verification scripts, and comprehensive documentation have been created.
|
||||
|
||||
---
|
||||
|
||||
## ✅ What's Complete
|
||||
|
||||
### 1. CCIP Smart Contracts
|
||||
- ✅ **CCIPWETH9Bridge.sol** - Cross-chain WETH9 bridge contract
|
||||
- ✅ **CCIPWETH10Bridge.sol** - Cross-chain WETH10 bridge contract
|
||||
- ✅ **CCIPSender.sol** - Oracle data sender via CCIP
|
||||
- ✅ **CCIPReceiver.sol** - Oracle data receiver via CCIP
|
||||
- ✅ **CCIPRouter.sol** - Custom CCIP router implementation
|
||||
- ✅ **CCIPRouterOptimized.sol** - Optimized router variant
|
||||
- ✅ **CCIPMessageValidator.sol** - Message validation utilities
|
||||
- ✅ **IRouterClient.sol** - CCIP router interface
|
||||
|
||||
### 2. Deployment Scripts
|
||||
- ✅ `script/DeployCCIPWETH9Bridge.s.sol`
|
||||
- ✅ `script/DeployCCIPWETH10Bridge.s.sol`
|
||||
- ✅ `script/DeployCCIPRouter.s.sol`
|
||||
- ✅ `script/DeployCCIPSender.s.sol`
|
||||
- ✅ `script/DeployCCIPReceiver.s.sol`
|
||||
- ✅ `script/DeployWETHWithCCIP.s.sol`
|
||||
|
||||
### 3. Supporting Infrastructure
|
||||
- ✅ WETH9 pre-deployed in genesis.json (`0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2`)
|
||||
- ✅ WETH10 pre-deployed in genesis.json (`0xf4BB2e28688e89fCcE3c0580D37d36A7672E8A9f`)
|
||||
- ✅ Deployment automation scripts
|
||||
- ✅ Bridge configuration scripts
|
||||
- ✅ Documentation structure
|
||||
|
||||
---
|
||||
|
||||
## ❌ What's Missing (Critical Gaps)
|
||||
|
||||
### 1. CCIP Router Deployment
|
||||
**Status**: ❌ **NOT DEPLOYED**
|
||||
|
||||
- **Issue**: The `CCIPRouter` contract exists but is not deployed on ChainID 138
|
||||
- **Current State**:
|
||||
- Environment variable `CCIP_CHAIN138_ROUTER` points to Ethereum Mainnet router address (`0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D`)
|
||||
- This is incorrect - ChainID 138 needs its own router deployment
|
||||
- **Required Action**:
|
||||
1. Deploy `CCIPRouter` contract to ChainID 138
|
||||
2. Configure fee token (LINK or native ETH)
|
||||
3. Set base fee and data fee per byte
|
||||
4. Update `CCIP_CHAIN138_ROUTER` environment variable
|
||||
5. Register supported destination chains
|
||||
|
||||
**Deployment Command**:
|
||||
```bash
|
||||
forge script script/DeployCCIPRouter.s.sol \
|
||||
--rpc-url $RPC_URL_138 \
|
||||
--broadcast \
|
||||
--private-key $PRIVATE_KEY
|
||||
```
|
||||
|
||||
**Configuration Required**:
|
||||
- `CCIP_FEE_TOKEN`: LINK token address (or `address(0)` for native ETH)
|
||||
- `CCIP_BASE_FEE`: Base fee amount
|
||||
- `CCIP_DATA_FEE_PER_BYTE`: Fee per byte of message data
|
||||
|
||||
### 2. LINK Token Deployment
|
||||
**Status**: ❌ **NOT DEPLOYED**
|
||||
|
||||
- **Issue**: No LINK token contract deployed on ChainID 138
|
||||
- **Impact**: CCIP bridges require LINK token for fee payments (unless using native ETH)
|
||||
- **Current State**: No LINK token address configured for ChainID 138
|
||||
- **Required Action**:
|
||||
1. Deploy LINK token contract (or use native ETH for fees)
|
||||
2. If using LINK: Deploy ERC-20 LINK token compatible with Chainlink's LINK
|
||||
3. Update `CCIP_CHAIN138_LINK_TOKEN` environment variable
|
||||
4. Fund bridges with LINK tokens for operations
|
||||
|
||||
**Alternative**: Use native ETH for fees by setting `feeToken = address(0)` in CCIPRouter
|
||||
|
||||
### 3. CCIP Chain Selector
|
||||
**Status**: ⚠️ **PLACEHOLDER VALUE**
|
||||
|
||||
- **Issue**: Chain selector was set to placeholder value `0x000000000000008a` (138 in hex)
|
||||
- **Current State**:
|
||||
- Selector calculated and documented: `138` (decimal) or `0x000000000000008a` (hex)
|
||||
- Calculation method documented in `docs/ccip/CHAIN_SELECTOR_CALCULATION.md`
|
||||
- Calculation script available: `scripts/ccip/calculate-chain-selector.sh`
|
||||
- **Status**: ✅ **RESOLVED**
|
||||
- Selector calculated using simple chainId method (recommended for custom CCIP)
|
||||
- All documentation updated with calculated selector
|
||||
- Scripts configured to use selector `138`
|
||||
|
||||
**Note**: For custom CCIP router implementations, using chainId directly as selector is the recommended approach. If integrating with Chainlink's official CCIP network, you may need to register the chain and use their assigned selector.
|
||||
|
||||
### 4. CCIP Bridge Deployments
|
||||
**Status**: ❌ **NOT DEPLOYED**
|
||||
|
||||
- **Issue**: CCIPWETH9Bridge and CCIPWETH10Bridge are not deployed on ChainID 138
|
||||
- **Current State**:
|
||||
- Documentation shows status as "Deployable" or "Pending"
|
||||
- No deployed addresses in environment variables
|
||||
- **Required Action**:
|
||||
1. Deploy `CCIPWETH9Bridge` to ChainID 138
|
||||
2. Deploy `CCIPWETH10Bridge` to ChainID 138
|
||||
3. Configure bridges with:
|
||||
- CCIP Router address (from step 1)
|
||||
- WETH9/WETH10 addresses (already in genesis)
|
||||
- LINK token address (from step 2)
|
||||
4. Update environment variables:
|
||||
- `CCIPWETH9_BRIDGE_CHAIN138`
|
||||
- `CCIPWETH10_BRIDGE_CHAIN138`
|
||||
|
||||
**Deployment Commands**:
|
||||
```bash
|
||||
# Deploy WETH9 Bridge
|
||||
forge script script/DeployCCIPWETH9Bridge.s.sol \
|
||||
--rpc-url $RPC_URL_138 \
|
||||
--broadcast \
|
||||
--private-key $PRIVATE_KEY
|
||||
|
||||
# Deploy WETH10 Bridge
|
||||
forge script script/DeployCCIPWETH10Bridge.s.sol \
|
||||
--rpc-url $RPC_URL_138 \
|
||||
--broadcast \
|
||||
--private-key $PRIVATE_KEY
|
||||
```
|
||||
|
||||
### 5. Bridge Configuration
|
||||
**Status**: ❌ **NOT CONFIGURED**
|
||||
|
||||
- **Issue**: Bridges need destination chain selectors configured
|
||||
- **Required Action**:
|
||||
1. Configure CCIPWETH9Bridge with destination chains:
|
||||
- Add Ethereum Mainnet as destination
|
||||
- Add other supported chains (BSC, Polygon, etc.)
|
||||
2. Configure CCIPWETH10Bridge with destination chains
|
||||
3. Configure corresponding bridges on other chains to point back to ChainID 138
|
||||
|
||||
**Configuration Example**:
|
||||
```bash
|
||||
# Add Ethereum Mainnet as destination
|
||||
cast send $CCIPWETH9_BRIDGE_CHAIN138 \
|
||||
"addDestination(uint64,address)" \
|
||||
$ETH_MAINNET_SELECTOR \
|
||||
$CCIPWETH9_BRIDGE_MAINNET \
|
||||
--rpc-url $RPC_URL_138 \
|
||||
--private-key $PRIVATE_KEY
|
||||
```
|
||||
|
||||
### 6. CCIP Infrastructure Documentation
|
||||
**Status**: ⚠️ **INCOMPLETE**
|
||||
|
||||
- **Issue**: Documentation shows ChainID 138 as "Pending" or "TBD" for CCIP components
|
||||
- **Required Updates**:
|
||||
1. Update `docs/ETH_WETH_CHAINLINK_GUIDE.md`:
|
||||
- Add ChainID 138 CCIP Router address (after deployment)
|
||||
- Add ChainID 138 LINK token address
|
||||
- Add ChainID 138 CCIP chain selector (calculated value)
|
||||
- Add ChainID 138 bridge addresses
|
||||
- Update status from "Pending" to "Deployed"
|
||||
2. Update `docs/deployment/ENV_EXAMPLE_CONTENT.md`:
|
||||
- Add `CCIP_CHAIN138_LINK_TOKEN` variable
|
||||
- Update `CCIP_CHAIN138_ROUTER` with actual deployed address
|
||||
- Update `CHAIN138_SELECTOR` with calculated value
|
||||
3. Create deployment guide for ChainID 138 CCIP setup
|
||||
|
||||
---
|
||||
|
||||
## 📋 Deployment Checklist
|
||||
|
||||
### Phase 1: Core Infrastructure
|
||||
- [ ] Deploy LINK token (or configure native ETH fees)
|
||||
- [ ] Deploy CCIPRouter contract
|
||||
- [ ] Configure CCIPRouter with fee settings
|
||||
- [ ] Register supported destination chains in router
|
||||
- [ ] Calculate and document CCIP chain selector
|
||||
|
||||
### Phase 2: Bridge Deployment
|
||||
- [ ] Deploy CCIPWETH9Bridge
|
||||
- [ ] Deploy CCIPWETH10Bridge
|
||||
- [ ] Configure bridges with router, WETH, and LINK addresses
|
||||
- [ ] Verify bridge contracts on explorer
|
||||
|
||||
### Phase 3: Bridge Configuration
|
||||
- [ ] Configure CCIPWETH9Bridge destinations
|
||||
- [ ] Configure CCIPWETH10Bridge destinations
|
||||
- [ ] Configure corresponding bridges on other chains
|
||||
- [ ] Test bidirectional bridge connectivity
|
||||
|
||||
### Phase 4: Documentation & Testing
|
||||
- [ ] Update all documentation with deployed addresses
|
||||
- [ ] Update environment variable examples
|
||||
- [ ] Create deployment verification script
|
||||
- [ ] Test cross-chain message sending
|
||||
- [ ] Test cross-chain token transfers
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Configuration Requirements
|
||||
|
||||
### Environment Variables Needed
|
||||
|
||||
```bash
|
||||
# ChainID 138 CCIP Configuration
|
||||
CCIP_CHAIN138_ROUTER=<deployed_router_address>
|
||||
CCIP_CHAIN138_LINK_TOKEN=<deployed_link_address_or_zero>
|
||||
CHAIN138_SELECTOR=<calculated_chain_selector>
|
||||
CCIPWETH9_BRIDGE_CHAIN138=<deployed_bridge_address>
|
||||
CCIPWETH10_BRIDGE_CHAIN138=<deployed_bridge_address>
|
||||
|
||||
# CCIP Router Configuration
|
||||
CCIP_BASE_FEE=<base_fee_amount>
|
||||
CCIP_DATA_FEE_PER_BYTE=<fee_per_byte>
|
||||
```
|
||||
|
||||
### CCIP Router Constructor Parameters
|
||||
|
||||
```solidity
|
||||
CCIPRouter(
|
||||
address _feeToken, // LINK token or address(0) for native ETH
|
||||
uint256 _baseFee, // Base fee in feeToken units
|
||||
uint256 _dataFeePerByte // Fee per byte of message data
|
||||
)
|
||||
```
|
||||
|
||||
### Bridge Constructor Parameters
|
||||
|
||||
```solidity
|
||||
// CCIPWETH9Bridge
|
||||
CCIPWETH9Bridge(
|
||||
address _ccipRouter, // Deployed CCIPRouter address
|
||||
address _weth9, // 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 (from genesis)
|
||||
address _feeToken // LINK token or address(0)
|
||||
)
|
||||
|
||||
// CCIPWETH10Bridge
|
||||
CCIPWETH10Bridge(
|
||||
address _ccipRouter, // Deployed CCIPRouter address
|
||||
address _weth10, // 0xf4BB2e28688e89fCcE3c0580D37d36A7672E8A9f (from genesis)
|
||||
address _feeToken // LINK token or address(0)
|
||||
)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔗 Cross-Chain Integration
|
||||
|
||||
### Connecting to Ethereum Mainnet
|
||||
|
||||
1. **On Ethereum Mainnet**:
|
||||
- CCIPWETH9Bridge: `0x3304b747E565a97ec8AC220b0B6A1f6ffDB837e6` ✅ Deployed
|
||||
- CCIPWETH10Bridge: `0x8078A09637e47Fa5Ed34F626046Ea2094a5CDE5e` ✅ Deployed
|
||||
- CCIP Router: `0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D` ✅ Official Chainlink
|
||||
|
||||
2. **On ChainID 138** (After Deployment):
|
||||
- Deploy CCIPWETH9Bridge
|
||||
- Deploy CCIPWETH10Bridge
|
||||
- Deploy CCIPRouter (custom or connect to Chainlink)
|
||||
|
||||
3. **Configuration**:
|
||||
- Add ChainID 138 as destination on Mainnet bridges
|
||||
- Add Ethereum Mainnet as destination on ChainID 138 bridges
|
||||
- Use correct chain selectors for each chain
|
||||
|
||||
---
|
||||
|
||||
## 📊 Current Status Summary
|
||||
|
||||
| Component | Status | Address | Notes |
|
||||
|-----------|--------|---------|-------|
|
||||
| **CCIP Router** | ❌ Not Deployed | - | ✅ Script ready - Ready to deploy |
|
||||
| **LINK Token** | ❌ Not Deployed | - | Optional - Can use native ETH |
|
||||
| **CCIP Chain Selector** | ✅ Calculated | `138` (or `0x000000000000008a`) | ✅ Calculation complete |
|
||||
| **CCIPWETH9Bridge** | ❌ Not Deployed | - | ✅ Script ready - Ready to deploy |
|
||||
| **CCIPWETH10Bridge** | ❌ Not Deployed | - | ✅ Script ready - Ready to deploy |
|
||||
| **WETH9** | ✅ Pre-deployed | `0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2` | In genesis.json |
|
||||
| **WETH10** | ✅ Pre-deployed | `0xf4BB2e28688e89fCcE3c0580D37d36A7672E8A9f` | In genesis.json |
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Next Steps
|
||||
|
||||
1. **Immediate Actions**:
|
||||
- Deploy CCIPRouter to ChainID 138
|
||||
- Decide on fee token (LINK or native ETH)
|
||||
- Calculate proper CCIP chain selector
|
||||
- Deploy CCIP bridges
|
||||
|
||||
2. **Configuration**:
|
||||
- Configure router with supported chains
|
||||
- Configure bridges with destinations
|
||||
- Update all documentation
|
||||
|
||||
3. **Testing**:
|
||||
- Test router message sending
|
||||
- Test bridge token transfers
|
||||
- Verify cross-chain connectivity
|
||||
|
||||
4. **Documentation**:
|
||||
- Update deployment guides
|
||||
- Document all addresses
|
||||
- Create operational runbooks
|
||||
|
||||
---
|
||||
|
||||
## 📝 Notes
|
||||
|
||||
- **Custom vs Official CCIP**: The project includes a custom `CCIPRouter` implementation. If using Chainlink's official CCIP, you would need to use their router addresses instead.
|
||||
|
||||
- **Native ETH Fees**: The CCIPRouter supports native ETH fees by setting `feeToken = address(0)`. This eliminates the need for LINK token deployment.
|
||||
|
||||
- **Chain Selector Calculation**: CCIP chain selectors are typically calculated using a deterministic method. For custom chains, you may define your own format, but it should be consistent across all integrations.
|
||||
|
||||
- **Bridge Reciprocity**: For bidirectional transfers, bridges on both chains must be configured with each other's addresses and chain selectors.
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: 2025-01-27
|
||||
**Review Status**: ✅ **IMPLEMENTATION COMPLETE** - Ready for Deployment
|
||||
|
||||
---
|
||||
|
||||
## Implementation Status
|
||||
|
||||
All required infrastructure, scripts, and documentation have been implemented:
|
||||
|
||||
- ✅ Chain selector calculation script and documentation
|
||||
- ✅ Enhanced deployment scripts for ChainID 138
|
||||
- ✅ Router configuration script
|
||||
- ✅ Bridge configuration scripts (updated with correct selectors)
|
||||
- ✅ Deployment verification script
|
||||
- ✅ Complete deployment guide
|
||||
- ✅ User and developer guides
|
||||
- ✅ Monitoring and operational documentation
|
||||
- ✅ Security documentation
|
||||
|
||||
**See**: [Implementation Summary](ccip/IMPLEMENTATION_SUMMARY.md) for complete details.
|
||||
|
||||
**Next Step**: Deploy contracts when network is ready using the provided scripts.
|
||||
|
||||
256
docs/ccip-integration/reference/CCIP_SECURITY.md
Normal file
256
docs/ccip-integration/reference/CCIP_SECURITY.md
Normal file
@@ -0,0 +1,256 @@
|
||||
# CCIP Security Guide for ChainID 138
|
||||
|
||||
**Date**: 2025-01-27
|
||||
**Network**: ChainID 138 (DeFi Oracle Meta Mainnet)
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
This document outlines security measures, best practices, and audit considerations for CCIP infrastructure on ChainID 138.
|
||||
|
||||
---
|
||||
|
||||
## Security Architecture
|
||||
|
||||
### Access Control
|
||||
|
||||
#### Admin Functions
|
||||
|
||||
All CCIP contracts implement admin-only functions:
|
||||
|
||||
- **Router**: `addSupportedChain()`, `removeSupportedChain()`, `updateFees()`, `changeAdmin()`
|
||||
- **Bridges**: `addDestination()`, `removeDestination()`, `updateDestination()`, `changeAdmin()`
|
||||
|
||||
**Security Measures**:
|
||||
- Admin address is set at deployment
|
||||
- Only admin can modify configuration
|
||||
- Admin can be transferred (with proper verification)
|
||||
|
||||
#### Oracle Functions
|
||||
|
||||
- **CCIPSender**: Only oracle aggregator can send updates
|
||||
- **CCIPReceiver**: Only router can call `ccipReceive()`
|
||||
|
||||
### Replay Protection
|
||||
|
||||
#### Message Replay Protection
|
||||
|
||||
- **Message ID Tracking**: Each message has unique ID
|
||||
- **Processed Messages Mapping**: Prevents duplicate processing
|
||||
- **Nonce Tracking**: Per-user nonces for additional protection
|
||||
|
||||
#### Transfer Replay Protection
|
||||
|
||||
- **Message ID Validation**: Checks if transfer already processed
|
||||
- **Nonce Validation**: Ensures ordered processing
|
||||
- **Source Chain Validation**: Verifies message source
|
||||
|
||||
---
|
||||
|
||||
## Security Best Practices
|
||||
|
||||
### 1. Admin Key Management
|
||||
|
||||
**DO**:
|
||||
- Use hardware wallets for admin keys
|
||||
- Implement multi-sig for admin functions
|
||||
- Store keys securely (HSM, secure enclave)
|
||||
- Rotate keys periodically
|
||||
- Use separate keys for different functions
|
||||
|
||||
**DON'T**:
|
||||
- Store private keys in plain text
|
||||
- Use same key for multiple purposes
|
||||
- Share admin keys
|
||||
- Leave keys in version control
|
||||
|
||||
### 2. Configuration Security
|
||||
|
||||
**DO**:
|
||||
- Verify all configuration changes
|
||||
- Use testnet for testing changes
|
||||
- Document all configuration changes
|
||||
- Review changes before applying
|
||||
- Monitor for unauthorized changes
|
||||
|
||||
**DON'T**:
|
||||
- Make changes without verification
|
||||
- Skip testing on testnet
|
||||
- Allow unverified addresses
|
||||
- Ignore configuration change events
|
||||
|
||||
### 3. Fee Management
|
||||
|
||||
**DO**:
|
||||
- Monitor fee collection
|
||||
- Set appropriate fee levels
|
||||
- Withdraw fees regularly
|
||||
- Document fee changes
|
||||
- Alert on unusual patterns
|
||||
|
||||
**DON'T**:
|
||||
- Set fees too low (risk of spam)
|
||||
- Set fees too high (user impact)
|
||||
- Ignore fee anomalies
|
||||
- Leave fees uncollected
|
||||
|
||||
### 4. Destination Chain Security
|
||||
|
||||
**DO**:
|
||||
- Verify destination chain selectors
|
||||
- Validate receiver addresses
|
||||
- Test destinations before enabling
|
||||
- Monitor destination chain status
|
||||
- Disable problematic destinations
|
||||
|
||||
**DON'T**:
|
||||
- Add unverified destinations
|
||||
- Use placeholder addresses
|
||||
- Skip destination validation
|
||||
- Ignore destination errors
|
||||
|
||||
---
|
||||
|
||||
## Common Vulnerabilities
|
||||
|
||||
### 1. Reentrancy
|
||||
|
||||
**Protection**:
|
||||
- Contracts use checks-effects-interactions pattern
|
||||
- No external calls before state updates
|
||||
- Replay protection prevents duplicate processing
|
||||
|
||||
### 2. Access Control
|
||||
|
||||
**Protection**:
|
||||
- Admin-only modifiers on sensitive functions
|
||||
- Router-only modifier on `ccipReceive()`
|
||||
- Aggregator-only modifier on sender functions
|
||||
|
||||
### 3. Integer Overflow/Underflow
|
||||
|
||||
**Protection**:
|
||||
- Solidity 0.8.19 has built-in overflow protection
|
||||
- Safe math operations
|
||||
- Input validation
|
||||
|
||||
### 4. Front-running
|
||||
|
||||
**Protection**:
|
||||
- Nonce-based ordering
|
||||
- Message ID uniqueness
|
||||
- Transaction ordering protection (network-level)
|
||||
|
||||
---
|
||||
|
||||
## Audit Checklist
|
||||
|
||||
### Contract Security
|
||||
|
||||
- [ ] Access control properly implemented
|
||||
- [ ] Replay protection in place
|
||||
- [ ] Input validation on all functions
|
||||
- [ ] Error handling comprehensive
|
||||
- [ ] No reentrancy vulnerabilities
|
||||
- [ ] Integer overflow protection
|
||||
- [ ] Event emissions for all state changes
|
||||
|
||||
### Configuration Security
|
||||
|
||||
- [ ] Admin key management secure
|
||||
- [ ] Configuration change procedures documented
|
||||
- [ ] Emergency procedures in place
|
||||
- [ ] Monitoring and alerting configured
|
||||
- [ ] Access logs maintained
|
||||
|
||||
### Operational Security
|
||||
|
||||
- [ ] Deployment procedures documented
|
||||
- [ ] Testing procedures in place
|
||||
- [ ] Incident response plan ready
|
||||
- [ ] Backup and recovery procedures
|
||||
- [ ] Regular security reviews scheduled
|
||||
|
||||
---
|
||||
|
||||
## Security Monitoring
|
||||
|
||||
### Events to Monitor
|
||||
|
||||
1. **Configuration Changes**
|
||||
- `DestinationAdded`
|
||||
- `DestinationRemoved`
|
||||
- `DestinationUpdated`
|
||||
- `AdminChanged`
|
||||
|
||||
2. **Unusual Activity**
|
||||
- High volume of failed messages
|
||||
- Unusual fee patterns
|
||||
- Configuration changes outside business hours
|
||||
- Access from unknown addresses
|
||||
|
||||
### Alerts
|
||||
|
||||
- **Critical**: Unauthorized configuration changes
|
||||
- **High**: High failure rate
|
||||
- **Medium**: Unusual activity patterns
|
||||
- **Low**: Configuration changes (informational)
|
||||
|
||||
---
|
||||
|
||||
## Incident Response
|
||||
|
||||
### Security Incident Types
|
||||
|
||||
1. **Unauthorized Access**
|
||||
- Detect: Monitor admin function calls
|
||||
- Respond: Revoke access, investigate
|
||||
- Recover: Restore from backup if needed
|
||||
|
||||
2. **Configuration Tampering**
|
||||
- Detect: Monitor configuration events
|
||||
- Respond: Revert changes, investigate
|
||||
- Recover: Restore correct configuration
|
||||
|
||||
3. **Exploit Attempt**
|
||||
- Detect: Monitor for unusual patterns
|
||||
- Respond: Disable affected functions
|
||||
- Recover: Patch and redeploy if needed
|
||||
|
||||
### Response Procedures
|
||||
|
||||
1. **Immediate**: Contain the threat
|
||||
2. **Short-term**: Investigate and document
|
||||
3. **Long-term**: Implement fixes and improvements
|
||||
|
||||
---
|
||||
|
||||
## Compliance
|
||||
|
||||
### Documentation Requirements
|
||||
|
||||
- Security architecture documentation
|
||||
- Access control procedures
|
||||
- Incident response procedures
|
||||
- Audit logs and records
|
||||
|
||||
### Regular Reviews
|
||||
|
||||
- Quarterly security reviews
|
||||
- Annual comprehensive audits
|
||||
- Post-incident reviews
|
||||
- Configuration change reviews
|
||||
|
||||
---
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- [CCIP Deployment Guide](../ccip/DEPLOYMENT_GUIDE_CHAIN138.md)
|
||||
- [CCIP Monitoring](../operations/CCIP_MONITORING.md)
|
||||
- [CCIP Runbooks](../operations/CCIP_RUNBOOKS.md)
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: 2025-01-27
|
||||
|
||||
262
docs/ccip-integration/reference/IMPLEMENTATION_SUMMARY.md
Normal file
262
docs/ccip-integration/reference/IMPLEMENTATION_SUMMARY.md
Normal file
@@ -0,0 +1,262 @@
|
||||
# CCIP ChainID 138 Implementation Summary
|
||||
|
||||
**Date**: 2025-01-27
|
||||
**Status**: ✅ **IMPLEMENTATION COMPLETE** - Ready for Deployment
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
All required infrastructure, scripts, and documentation have been implemented for fully enabling Chainlink CCIP on ChainID 138. The implementation includes deployment scripts, configuration tools, verification scripts, and comprehensive documentation.
|
||||
|
||||
---
|
||||
|
||||
## Implementation Status
|
||||
|
||||
### ✅ Phase 1: Core Infrastructure Setup
|
||||
|
||||
#### 1.1 Chain Selector Calculation
|
||||
- ✅ Calculation script created: `scripts/ccip/calculate-chain-selector.sh`
|
||||
- ✅ Documentation created: `docs/ccip/CHAIN_SELECTOR_CALCULATION.md`
|
||||
- ✅ Selector value: `138` (decimal) or `0x000000000000008a` (hex)
|
||||
- ✅ All scripts updated with correct selector
|
||||
|
||||
#### 1.2 Fee Token Decision
|
||||
- ✅ Documentation updated with options (LINK or native ETH)
|
||||
- ✅ Deployment scripts support both options
|
||||
- ✅ Environment variables configured
|
||||
|
||||
#### 1.3 CCIP Router Deployment
|
||||
- ✅ Deployment script updated: `script/DeployCCIPRouter.s.sol`
|
||||
- ✅ Supports ChainID 138 specific environment variables
|
||||
- ✅ Includes helpful deployment output
|
||||
- ✅ Configuration script created: `scripts/deployment/configure-ccip-router.sh`
|
||||
|
||||
#### 1.4 Router Configuration
|
||||
- ✅ Configuration script created
|
||||
- ✅ Supports adding destination chains
|
||||
- ✅ Supports adding supported tokens
|
||||
- ✅ Includes verification steps
|
||||
|
||||
### ✅ Phase 2: Bridge Deployment
|
||||
|
||||
#### 2.1 CCIPWETH9Bridge Deployment
|
||||
- ✅ Deployment script updated: `script/DeployCCIPWETH9Bridge.s.sol`
|
||||
- ✅ Uses ChainID 138 specific environment variables
|
||||
- ✅ Includes deployment verification
|
||||
|
||||
#### 2.2 CCIPWETH10Bridge Deployment
|
||||
- ✅ Deployment script updated: `script/DeployCCIPWETH10Bridge.s.sol`
|
||||
- ✅ Uses ChainID 138 specific environment variables
|
||||
- ✅ Includes deployment verification
|
||||
|
||||
### ✅ Phase 3: Bridge Configuration
|
||||
|
||||
#### 3.1 Bridge Configuration Scripts
|
||||
- ✅ `scripts/deployment/configure-weth9-bridge.sh` - Updated with correct selectors
|
||||
- ✅ `scripts/deployment/configure-weth10-bridge.sh` - Updated with correct selectors
|
||||
- ✅ `scripts/deployment/execute-bridge-config.sh` - Updated with correct selectors
|
||||
- ✅ `scripts/deployment/configure-bridge-destinations.sh` - Updated with correct selectors
|
||||
|
||||
### ✅ Phase 4: Environment & Documentation
|
||||
|
||||
#### 4.1 Environment Variables
|
||||
- ✅ `docs/deployment/ENV_EXAMPLE_CONTENT.md` - Updated with ChainID 138 placeholders
|
||||
- ✅ All required variables documented
|
||||
- ✅ Fee configuration variables added
|
||||
|
||||
#### 4.2 Documentation
|
||||
- ✅ `docs/ETH_WETH_CHAINLINK_GUIDE.md` - Updated with chain selector
|
||||
- ✅ `docs/CCIP_CHAIN138_REVIEW.md` - Updated with selector status
|
||||
- ✅ `docs/ccip/CHAIN_SELECTOR_CALCULATION.md` - Complete calculation guide
|
||||
- ✅ `docs/ccip/DEPLOYMENT_GUIDE_CHAIN138.md` - Complete deployment guide
|
||||
- ✅ `docs/ccip/DEPLOYMENT_CHECKLIST.md` - Deployment checklist
|
||||
|
||||
### ✅ Phase 5: Testing & Verification
|
||||
|
||||
#### 5.1 Verification Scripts
|
||||
- ✅ `scripts/deployment/verify-ccip-deployment.sh` - Complete verification script
|
||||
- ✅ Checks contract deployment
|
||||
- ✅ Verifies configuration
|
||||
- ✅ Generates status report
|
||||
|
||||
#### 5.2 Testing Documentation
|
||||
- ✅ Testing procedures documented
|
||||
- ✅ Integration test examples provided
|
||||
- ✅ Error handling documented
|
||||
|
||||
### ✅ Phase 6: Security & Operations
|
||||
|
||||
#### 6.1 Security Documentation
|
||||
- ✅ `docs/security/CCIP_SECURITY.md` - Complete security guide
|
||||
- ✅ Security best practices documented
|
||||
- ✅ Audit checklist provided
|
||||
- ✅ Incident response procedures
|
||||
|
||||
#### 6.2 Operational Documentation
|
||||
- ✅ `docs/operations/CCIP_MONITORING.md` - Monitoring guide
|
||||
- ✅ `docs/operations/CCIP_RUNBOOKS.md` - Operational runbooks
|
||||
- ✅ `docs/operations/ADMIN_KEY_MANAGEMENT.md` - Key management guide
|
||||
|
||||
### ✅ Phase 7: Advanced Features
|
||||
|
||||
#### 7.1 User Documentation
|
||||
- ✅ `docs/user-guides/CCIP_BRIDGE_USER_GUIDE.md` - User guide
|
||||
- ✅ Step-by-step instructions
|
||||
- ✅ Code examples
|
||||
- ✅ Troubleshooting guide
|
||||
|
||||
#### 7.2 Developer Documentation
|
||||
- ✅ `docs/developer-guides/CCIP_INTEGRATION_GUIDE.md` - Developer guide
|
||||
- ✅ Integration patterns
|
||||
- ✅ Code examples
|
||||
- ✅ Best practices
|
||||
|
||||
---
|
||||
|
||||
## Created Files
|
||||
|
||||
### Scripts
|
||||
1. `scripts/ccip/calculate-chain-selector.sh` - Chain selector calculation
|
||||
2. `scripts/deployment/configure-ccip-router.sh` - Router configuration
|
||||
3. `scripts/deployment/verify-ccip-deployment.sh` - Deployment verification
|
||||
4. `scripts/deployment/deploy-ccip-chain138-complete.sh` - Complete deployment script
|
||||
|
||||
### Documentation
|
||||
1. `docs/ccip/CHAIN_SELECTOR_CALCULATION.md` - Chain selector guide
|
||||
2. `docs/ccip/DEPLOYMENT_GUIDE_CHAIN138.md` - Deployment guide
|
||||
3. `docs/ccip/DEPLOYMENT_CHECKLIST.md` - Deployment checklist
|
||||
4. `docs/ccip/IMPLEMENTATION_SUMMARY.md` - This file
|
||||
5. `docs/operations/CCIP_MONITORING.md` - Monitoring guide
|
||||
6. `docs/operations/CCIP_RUNBOOKS.md` - Operational runbooks
|
||||
7. `docs/operations/ADMIN_KEY_MANAGEMENT.md` - Key management
|
||||
8. `docs/security/CCIP_SECURITY.md` - Security guide
|
||||
9. `docs/user-guides/CCIP_BRIDGE_USER_GUIDE.md` - User guide
|
||||
10. `docs/developer-guides/CCIP_INTEGRATION_GUIDE.md` - Developer guide
|
||||
|
||||
### Updated Files
|
||||
1. `script/DeployCCIPRouter.s.sol` - Enhanced for ChainID 138
|
||||
2. `script/DeployCCIPWETH9Bridge.s.sol` - Enhanced for ChainID 138
|
||||
3. `script/DeployCCIPWETH10Bridge.s.sol` - Enhanced for ChainID 138
|
||||
4. `scripts/deployment/configure-weth9-bridge.sh` - Updated selectors
|
||||
5. `scripts/deployment/configure-weth10-bridge.sh` - Updated selectors
|
||||
6. `scripts/deployment/execute-bridge-config.sh` - Updated selectors
|
||||
7. `scripts/deployment/configure-bridge-destinations.sh` - Updated selectors
|
||||
8. `docs/ETH_WETH_CHAINLINK_GUIDE.md` - Updated chain selector
|
||||
9. `docs/CCIP_CHAIN138_REVIEW.md` - Updated selector status
|
||||
10. `docs/deployment/ENV_EXAMPLE_CONTENT.md` - Updated with ChainID 138 config
|
||||
|
||||
---
|
||||
|
||||
## Deployment Readiness
|
||||
|
||||
### Ready for Deployment
|
||||
- ✅ All deployment scripts ready
|
||||
- ✅ All configuration scripts ready
|
||||
- ✅ All verification scripts ready
|
||||
- ✅ All documentation complete
|
||||
- ✅ Environment variables documented
|
||||
- ✅ Chain selector calculated
|
||||
|
||||
### Pending Deployment
|
||||
- ⏳ CCIP Router deployment (requires network access)
|
||||
- ⏳ LINK token deployment (optional - can use native ETH)
|
||||
- ⏳ CCIPWETH9Bridge deployment
|
||||
- ⏳ CCIPWETH10Bridge deployment
|
||||
- ⏳ Bridge destination configuration
|
||||
- ⏳ Contract verification on explorer
|
||||
|
||||
---
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Complete Deployment
|
||||
|
||||
Run the complete deployment script:
|
||||
|
||||
```bash
|
||||
./scripts/deployment/deploy-ccip-chain138-complete.sh
|
||||
```
|
||||
|
||||
This will:
|
||||
1. Calculate chain selector
|
||||
2. Deploy CCIP Router
|
||||
3. Configure router
|
||||
4. Deploy CCIPWETH9Bridge
|
||||
5. Deploy CCIPWETH10Bridge
|
||||
6. Verify deployment
|
||||
|
||||
### Manual Deployment
|
||||
|
||||
Follow the step-by-step guide:
|
||||
|
||||
```bash
|
||||
# 1. Calculate selector
|
||||
./scripts/ccip/calculate-chain-selector.sh
|
||||
|
||||
# 2. Deploy router
|
||||
forge script script/DeployCCIPRouter.s.sol --rpc-url $RPC_URL_138 --broadcast --private-key $PRIVATE_KEY
|
||||
|
||||
# 3. Configure router
|
||||
./scripts/deployment/configure-ccip-router.sh
|
||||
|
||||
# 4. Deploy bridges
|
||||
forge script script/DeployCCIPWETH9Bridge.s.sol --rpc-url $RPC_URL_138 --broadcast --private-key $PRIVATE_KEY
|
||||
forge script script/DeployCCIPWETH10Bridge.s.sol --rpc-url $RPC_URL_138 --broadcast --private-key $PRIVATE_KEY
|
||||
|
||||
# 5. Configure bridges
|
||||
./scripts/deployment/configure-weth9-bridge.sh
|
||||
./scripts/deployment/configure-weth10-bridge.sh
|
||||
|
||||
# 6. Verify
|
||||
./scripts/deployment/verify-ccip-deployment.sh
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Documentation Index
|
||||
|
||||
### Core Documentation
|
||||
- [CCIP Review](../CCIP_CHAIN138_REVIEW.md) - Complete enablement review
|
||||
- [Chain Selector Calculation](CHAIN_SELECTOR_CALCULATION.md) - Selector calculation guide
|
||||
- [Deployment Guide](DEPLOYMENT_GUIDE_CHAIN138.md) - Step-by-step deployment
|
||||
- [Deployment Checklist](DEPLOYMENT_CHECKLIST.md) - Deployment checklist
|
||||
|
||||
### User Guides
|
||||
- [Bridge User Guide](../user-guides/CCIP_BRIDGE_USER_GUIDE.md) - How to use bridges
|
||||
|
||||
### Developer Guides
|
||||
- [Integration Guide](../developer-guides/CCIP_INTEGRATION_GUIDE.md) - Developer integration
|
||||
|
||||
### Operations
|
||||
- [Monitoring Guide](../operations/CCIP_MONITORING.md) - Monitoring setup
|
||||
- [Runbooks](../operations/CCIP_RUNBOOKS.md) - Operational procedures
|
||||
- [Key Management](../operations/ADMIN_KEY_MANAGEMENT.md) - Admin key management
|
||||
|
||||
### Security
|
||||
- [Security Guide](../security/CCIP_SECURITY.md) - Security best practices
|
||||
|
||||
---
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. **Deploy Infrastructure**: Run deployment scripts when network is ready
|
||||
2. **Configure Bridges**: Set up destination chains
|
||||
3. **Verify Contracts**: Verify on explorer
|
||||
4. **Test Functionality**: Test cross-chain transfers
|
||||
5. **Monitor Operations**: Set up monitoring and alerting
|
||||
|
||||
---
|
||||
|
||||
## Success Criteria
|
||||
|
||||
All implementation tasks are complete. The project is ready for deployment when:
|
||||
- Network is accessible
|
||||
- Deployment keys are configured
|
||||
- Sufficient balance is available
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: 2025-01-27
|
||||
**Implementation Status**: ✅ **COMPLETE**
|
||||
|
||||
Reference in New Issue
Block a user