Files
smom-dbis-138/docs/deployment/BRIDGE_CONFIGURATION.md
2026-03-02 12:14:09 -08:00

180 lines
4.2 KiB
Markdown

# Cross-Chain Bridge Configuration Guide
**Date**: 2025-12-11
**Status**: Ready for Configuration
---
## 🌉 Bridge Overview
Each chain has two CCIP bridges deployed:
- **CCIPWETH9Bridge**: For WETH9 cross-chain transfers
- **CCIPWETH10Bridge**: For WETH10 cross-chain transfers
---
## 📋 Deployed Bridges by Chain
### BSC (Chain ID: 56)
- **CCIPWETH9Bridge**: `0x8078a09637e47fa5ed34f626046ea2094a5cde5e`
- **CCIPWETH10Bridge**: `0x105f8a15b819948a89153505762444ee9f324684`
### Polygon (Chain ID: 137)
- **CCIPWETH9Bridge**: `0xa780ef19a041745d353c9432f2a7f5a241335ffe`
- **CCIPWETH10Bridge**: `0xdab0591e5e89295ffad75a71dcfc30c5625c4fa2`
### Avalanche (Chain ID: 43114)
- **CCIPWETH9Bridge**: `0x8078a09637e47fa5ed34f626046ea2094a5cde5e`
- **CCIPWETH10Bridge**: `0x105f8a15b819948a89153505762444ee9f324684`
### Base (Chain ID: 8453)
- **CCIPWETH9Bridge**: `0x8078a09637e47fa5ed34f626046ea2094a5cde5e`
- **CCIPWETH10BRIDGE**: `0x105f8a15b819948a89153505762444ee9f324684`
### Arbitrum (Chain ID: 42161)
- **CCIPWETH9Bridge**: `0x8078a09637e47fa5ed34f626046ea2094a5cde5e`
- **CCIPWETH10Bridge**: `0x105f8a15b819948a89153505762444ee9f324684`
### Optimism (Chain ID: 10)
- **CCIPWETH9Bridge**: `0x8078a09637e47fa5ed34f626046ea2094a5cde5e`
- **CCIPWETH10Bridge**: `0x105f8a15b819948a89153505762444ee9f324684`
---
## ⚙️ Configuration Steps
### 1. Set Destination Chains
For each bridge, configure destination chain selectors:
```solidity
// Example: Configure BSC bridge to send to Polygon
bridge.setDestinationChain(
POLYGON_SELECTOR, // 4051577828743386545
polygonBridgeAddress
);
```
### 2. Fund Bridges with LINK
Each bridge needs LINK tokens for CCIP fees:
```bash
# Transfer LINK to bridge
cast send $LINK_TOKEN \
"transfer(address,uint256)" \
$BRIDGE_ADDRESS \
$AMOUNT \
--rpc-url $RPC_URL \
--private-key $PRIVATE_KEY
```
**Recommended**: 10 LINK per bridge for initial operations
### 3. Enable Bridges
Enable bridges for cross-chain operations:
```solidity
bridge.enable();
```
### 4. Set Fee Configuration
Configure fee parameters if needed:
```solidity
bridge.setFeeConfig(...);
```
---
## 🔗 Chain Selectors Reference
| Chain | Chain Selector |
|-------|---------------|
| **Ethereum Mainnet** | 5009297550715157269 |
| **BSC** | 11344663589394136015 |
| **Polygon** | 4051577828743386545 |
| **Avalanche** | 6433500567565415381 |
| **Base** | 15971525489660198786 |
| **Arbitrum** | 4949039107694359620 |
| **Optimism** | 3734403246176062136 |
| **Cronos** | TBD |
| **Gnosis Chain** | 465200170687744372 |
| **Celo** | 1346049177634351622 |
| **Wemix** | 5142893604156789321 |
| **Chain-138** | TBD |
---
## 📝 Configuration Scripts
### Example: Configure BSC → Polygon Bridge
```bash
# Set Polygon as destination for BSC WETH9 bridge
cast send $CCIPWETH9BRIDGE_BSC \
"setDestinationChain(uint64,address)" \
4051577828743386545 \
$CCIPWETH9BRIDGE_POLYGON \
--rpc-url $BSC_RPC_URL \
--private-key $PRIVATE_KEY
# Fund bridge with LINK
cast send $CCIP_BSC_LINK_TOKEN \
"transfer(address,uint256)" \
$CCIPWETH9BRIDGE_BSC \
10000000000000000000 \
--rpc-url $BSC_RPC_URL \
--private-key $PRIVATE_KEY
# Enable bridge
cast send $CCIPWETH9BRIDGE_BSC \
"enable()" \
--rpc-url $BSC_RPC_URL \
--private-key $PRIVATE_KEY
```
---
## 🧪 Testing Bridge Configuration
### Test Cross-Chain Transfer
```bash
# On source chain: Lock and send
cast send $CCIPWETH9BRIDGE_BSC \
"lockAndSend(uint256,uint64)" \
$AMOUNT \
4051577828743386545 \
--rpc-url $BSC_RPC_URL \
--private-key $PRIVATE_KEY
# On destination chain: Check for received message
# (CCIP will automatically deliver)
```
---
## ⚠️ Important Notes
1. **LINK Tokens**: Ensure bridges have sufficient LINK for CCIP fees
2. **Chain Selectors**: Use correct selectors from CCIP documentation
3. **Gas Limits**: Set appropriate gas limits for cross-chain messages
4. **Security**: Verify all destination addresses before enabling
5. **Testing**: Test with small amounts first
---
## 📚 Additional Resources
- [CCIP Documentation](https://docs.chain.link/ccip)
- [Chain Selectors](https://docs.chain.link/ccip/supported-networks)
- [Bridge Contract Documentation](../contracts/ccip/)
---
**Last Updated**: 2025-12-11