300 lines
8.1 KiB
Markdown
300 lines
8.1 KiB
Markdown
# Complete Bridge Setup Guide
|
|
|
|
**Date**: $(date)
|
|
**Purpose**: Complete guide for setting up and using the bridge system
|
|
|
|
---
|
|
|
|
## Overview
|
|
|
|
This guide covers the complete setup and usage of the WETH9/WETH10 bridging system from ChainID 138 to Ethereum Mainnet and other chains.
|
|
|
|
---
|
|
|
|
## Quick Start
|
|
|
|
### 1. Complete Setup (Recommended)
|
|
|
|
Run the master setup script:
|
|
|
|
```bash
|
|
./scripts/setup-complete-bridge.sh [private_key] [weth9_eth_mainnet] [weth10_eth_mainnet]
|
|
```
|
|
|
|
This will:
|
|
- ✅ Check all prerequisites
|
|
- ✅ Verify WETH9/WETH10 contracts
|
|
- ✅ Configure all bridge destinations
|
|
- ✅ Verify configuration
|
|
- ✅ Run dry run test
|
|
|
|
### 2. Manual Setup
|
|
|
|
If you prefer step-by-step:
|
|
|
|
```bash
|
|
# Step 1: Check current status
|
|
./scripts/check-bridge-config.sh
|
|
|
|
# Step 2: Configure all destinations
|
|
./scripts/configure-all-bridge-destinations.sh [private_key]
|
|
|
|
# Step 3: Configure Ethereum Mainnet (if needed)
|
|
./scripts/fix-bridge-errors.sh [private_key] [ethereum_mainnet_bridge_address]
|
|
|
|
# Step 4: Verify
|
|
./scripts/check-bridge-config.sh
|
|
./scripts/dry-run-bridge-to-ethereum.sh 0.1 [address]
|
|
```
|
|
|
|
---
|
|
|
|
## Available Scripts
|
|
|
|
### Bridge Configuration
|
|
|
|
1. **`check-bridge-config.sh`**
|
|
- Check which destinations are configured
|
|
- No private key needed
|
|
- Usage: `./scripts/check-bridge-config.sh`
|
|
|
|
2. **`configure-all-bridge-destinations.sh`**
|
|
- Configure all known destinations
|
|
- Requires private key
|
|
- Usage: `./scripts/configure-all-bridge-destinations.sh [private_key] [weth9_eth] [weth10_eth]`
|
|
|
|
3. **`fix-bridge-errors.sh`**
|
|
- Fix Ethereum Mainnet specifically
|
|
- Requires private key and bridge address
|
|
- Usage: `./scripts/fix-bridge-errors.sh [private_key] [bridge_address]`
|
|
|
|
### Bridge Operations
|
|
|
|
4. **`dry-run-bridge-to-ethereum.sh`**
|
|
- Simulate bridging without sending transactions
|
|
- Requires address (or private key)
|
|
- Usage: `./scripts/dry-run-bridge-to-ethereum.sh [amount] [address_or_key]`
|
|
|
|
5. **`wrap-and-bridge-to-ethereum.sh`**
|
|
- Actually wrap ETH and bridge to Ethereum Mainnet
|
|
- Requires private key
|
|
- Usage: `./scripts/wrap-and-bridge-to-ethereum.sh [amount] [private_key]`
|
|
|
|
### Verification
|
|
|
|
6. **`verify-weth9-ratio.sh`**
|
|
- Verify 1:1 ratio with real transaction
|
|
- Requires private key
|
|
- Usage: `./scripts/verify-weth9-ratio.sh [private_key] [amount]`
|
|
|
|
7. **`test-weth9-deposit.sh`**
|
|
- Comprehensive test suite
|
|
- Requires private key
|
|
- Usage: `./scripts/test-weth9-deposit.sh [private_key] [amounts...]`
|
|
|
|
### Contract Inspection
|
|
|
|
8. **`inspect-weth9-contract.sh`**
|
|
- Inspect WETH9 contract
|
|
- No private key needed
|
|
- Usage: `./scripts/inspect-weth9-contract.sh`
|
|
|
|
9. **`inspect-weth10-contract.sh`**
|
|
- Inspect WETH10 contract
|
|
- No private key needed
|
|
- Usage: `./scripts/inspect-weth10-contract.sh`
|
|
|
|
10. **`compare-weth9-standard.sh`**
|
|
- Compare with standard WETH9
|
|
- No private key needed
|
|
- Usage: `./scripts/compare-weth9-standard.sh`
|
|
|
|
### Token Information
|
|
|
|
11. **`get-token-info.sh`**
|
|
- Get correct token information
|
|
- No private key needed
|
|
- Usage: `./scripts/get-token-info.sh [weth9|weth10|both]`
|
|
|
|
12. **`fix-wallet-display.sh`**
|
|
- Wallet display fix instructions
|
|
- No private key needed
|
|
- Usage: `./scripts/fix-wallet-display.sh [weth9|weth10|both]`
|
|
|
|
### Master Script
|
|
|
|
13. **`setup-complete-bridge.sh`**
|
|
- Complete setup automation
|
|
- Requires private key
|
|
- Usage: `./scripts/setup-complete-bridge.sh [private_key] [weth9_eth] [weth10_eth]`
|
|
|
|
---
|
|
|
|
## Complete Workflow
|
|
|
|
### Phase 1: Initial Setup
|
|
|
|
1. **Check Current Status**
|
|
```bash
|
|
./scripts/check-bridge-config.sh
|
|
```
|
|
|
|
2. **Verify Contracts**
|
|
```bash
|
|
./scripts/inspect-weth9-contract.sh
|
|
./scripts/inspect-weth10-contract.sh
|
|
```
|
|
|
|
3. **Get Token Information**
|
|
```bash
|
|
./scripts/get-token-info.sh both
|
|
```
|
|
|
|
### Phase 2: Configure Bridges
|
|
|
|
1. **Configure All Destinations**
|
|
```bash
|
|
./scripts/configure-all-bridge-destinations.sh [private_key]
|
|
```
|
|
|
|
2. **Configure Ethereum Mainnet** (if address available)
|
|
```bash
|
|
./scripts/fix-bridge-errors.sh [private_key] [ethereum_mainnet_bridge_address]
|
|
```
|
|
|
|
3. **Verify Configuration**
|
|
```bash
|
|
./scripts/check-bridge-config.sh
|
|
```
|
|
|
|
### Phase 3: Test and Verify
|
|
|
|
1. **Run Dry Run**
|
|
```bash
|
|
./scripts/dry-run-bridge-to-ethereum.sh 0.1 [address]
|
|
```
|
|
|
|
2. **Verify 1:1 Ratio** (optional)
|
|
```bash
|
|
./scripts/verify-weth9-ratio.sh [private_key] 0.001
|
|
```
|
|
|
|
3. **Run Test Suite** (optional)
|
|
```bash
|
|
./scripts/test-weth9-deposit.sh [private_key] 0.001 0.01 0.1
|
|
```
|
|
|
|
### Phase 4: Bridge Tokens
|
|
|
|
1. **Bridge to Ethereum Mainnet**
|
|
```bash
|
|
./scripts/wrap-and-bridge-to-ethereum.sh 1.0 [private_key]
|
|
```
|
|
|
|
---
|
|
|
|
## Contract Addresses Reference
|
|
|
|
### ChainID 138 (Source)
|
|
|
|
- **WETH9**: `0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2`
|
|
- **WETH10**: `0xf4BB2e28688e89fCcE3c0580D37d36A7672E8A9f`
|
|
- **WETH9 Bridge**: `0x89dd12025bfCD38A168455A44B400e913ED33BE2`
|
|
- **WETH10 Bridge**: `0xe0E93247376aa097dB308B92e6Ba36bA015535D0`
|
|
|
|
### Destination Chains
|
|
|
|
| Chain | Selector | WETH9 Bridge | WETH10 Bridge |
|
|
|-------|----------|--------------|---------------|
|
|
| BSC | 11344663589394136015 | `0x8078a09637e47fa5ed34f626046ea2094a5cde5e` | `0x105f8a15b819948a89153505762444ee9f324684` |
|
|
| Polygon | 4051577828743386545 | `0xa780ef19a041745d353c9432f2a7f5a241335ffe` | `0xdab0591e5e89295ffad75a71dcfc30c5625c4fa2` |
|
|
| Avalanche | 6433500567565415381 | `0x8078a09637e47fa5ed34f626046ea2094a5cde5e` | `0x105f8a15b819948a89153505762444ee9f324684` |
|
|
| Base | 15971525489660198786 | `0x8078a09637e47fa5ed34f626046ea2094a5cde5e` | `0x105f8a15b819948a89153505762444ee9f324684` |
|
|
| Arbitrum | 4949039107694359620 | `0x8078a09637e47fa5ed34f626046ea2094a5cde5e` | `0x105f8a15b819948a89153505762444ee9f324684` |
|
|
| Optimism | 3734403246176062136 | `0x8078a09637e47fa5ed34f626046ea2094a5cde5e` | `0x105f8a15b819948a89153505762444ee9f324684` |
|
|
| Ethereum Mainnet | 5009297550715157269 | **TBD** | **TBD** |
|
|
|
|
---
|
|
|
|
## Troubleshooting
|
|
|
|
### Issue: All Destinations Missing
|
|
|
|
**Solution**: Run configuration script:
|
|
```bash
|
|
./scripts/configure-all-bridge-destinations.sh [private_key]
|
|
```
|
|
|
|
### Issue: Ethereum Mainnet Not Configured
|
|
|
|
**Solution**: Configure with bridge address:
|
|
```bash
|
|
./scripts/fix-bridge-errors.sh [private_key] [ethereum_mainnet_bridge_address]
|
|
```
|
|
|
|
### Issue: WETH9 Display Shows Wrong Amount
|
|
|
|
**Solution**: Use token metadata or fix wallet:
|
|
```bash
|
|
./scripts/fix-wallet-display.sh weth9
|
|
./scripts/get-token-info.sh weth9
|
|
```
|
|
|
|
### Issue: Dry Run Shows Errors
|
|
|
|
**Solution**:
|
|
1. Check bridge configuration: `./scripts/check-bridge-config.sh`
|
|
2. Fix missing destinations: `./scripts/configure-all-bridge-destinations.sh [key]`
|
|
3. Re-run dry run: `./scripts/dry-run-bridge-to-ethereum.sh [amount] [address]`
|
|
|
|
---
|
|
|
|
## Documentation Index
|
|
|
|
### Setup and Configuration
|
|
- [Complete Setup Guide](./COMPLETE_SETUP_GUIDE.md) - This document
|
|
- [Fix Bridge Errors](./FIX_BRIDGE_ERRORS.md) - Fix guide
|
|
- [Complete Bridge Fix Guide](./COMPLETE_BRIDGE_FIX_GUIDE.md) - Complete fix guide
|
|
|
|
### Verification
|
|
- [WETH9 1:1 Ratio Verification](./WETH9_1_TO_1_RATIO_VERIFICATION.md) - Ratio verification
|
|
- [Verification Results](./VERIFICATION_RESULTS.md) - Verification results
|
|
- [Complete Verification Report](./COMPLETE_VERIFICATION_REPORT.md) - Complete report
|
|
|
|
### Issues and Fixes
|
|
- [WETH9/WETH10 Issues and Fixes](./WETH9_WETH10_ISSUES_AND_FIXES.md) - Issues guide
|
|
- [All Issues Fixed](./ALL_ISSUES_FIXED.md) - Issues summary
|
|
- [Review and Fixes Complete](./REVIEW_AND_FIXES_COMPLETE.md) - Review summary
|
|
|
|
### Operations
|
|
- [Wrap and Bridge to Ethereum](./WRAP_AND_BRIDGE_TO_ETHEREUM.md) - Bridge guide
|
|
- [Quick Reference](./QUICK_REFERENCE_WRAP_BRIDGE.md) - Quick reference
|
|
- [Dry Run Results](./DRY_RUN_BRIDGE_RESULTS.md) - Dry run results
|
|
|
|
---
|
|
|
|
## Summary
|
|
|
|
### ✅ Complete System
|
|
|
|
- ✅ All scripts created and verified
|
|
- ✅ All parsing issues fixed
|
|
- ✅ All configuration scripts ready
|
|
- ✅ Complete documentation
|
|
- ✅ Master setup script available
|
|
|
|
### 🚀 Ready to Use
|
|
|
|
Run the master setup script to configure everything:
|
|
|
|
```bash
|
|
./scripts/setup-complete-bridge.sh [private_key] [weth9_eth_mainnet] [weth10_eth_mainnet]
|
|
```
|
|
|
|
Or use individual scripts for step-by-step setup.
|
|
|
|
---
|
|
|
|
**Last Updated**: $(date)
|
|
|