207 lines
4.2 KiB
Markdown
207 lines
4.2 KiB
Markdown
|
|
# Trustless Bridge Operations Guide
|
||
|
|
|
||
|
|
Complete guide for operating and maintaining the trustless bridge system.
|
||
|
|
|
||
|
|
## Table of Contents
|
||
|
|
|
||
|
|
1. [Daily Operations](#daily-operations)
|
||
|
|
2. [Monitoring](#monitoring)
|
||
|
|
3. [Maintenance Tasks](#maintenance-tasks)
|
||
|
|
4. [Emergency Procedures](#emergency-procedures)
|
||
|
|
5. [Troubleshooting](#troubleshooting)
|
||
|
|
|
||
|
|
## Daily Operations
|
||
|
|
|
||
|
|
### 1. System Health Checks
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Check all services
|
||
|
|
./scripts/verify-deployment.sh
|
||
|
|
|
||
|
|
# Check service logs
|
||
|
|
docker logs liquidity-engine-service --tail 100
|
||
|
|
docker logs market-reporting-service --tail 100
|
||
|
|
|
||
|
|
# Check contract status
|
||
|
|
cast call $LIQUIDITY_POOL "totalLiquidity()" --rpc-url $ETHEREUM_MAINNET_RPC
|
||
|
|
```
|
||
|
|
|
||
|
|
### 2. Monitor Bridge Activity
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Check recent deposits
|
||
|
|
cast logs --from-block latest-1000 \
|
||
|
|
--address $LOCKBOX_138 \
|
||
|
|
"DepositCreated(uint256,address,uint256)" \
|
||
|
|
--rpc-url $RPC_URL_138
|
||
|
|
|
||
|
|
# Check recent claims
|
||
|
|
cast logs --from-block latest-1000 \
|
||
|
|
--address $INBOX_ETH \
|
||
|
|
"ClaimSubmitted(uint256,address,uint256)" \
|
||
|
|
--rpc-url $ETHEREUM_MAINNET_RPC
|
||
|
|
```
|
||
|
|
|
||
|
|
### 3. Monitor Peg Status
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Check USD peg
|
||
|
|
cast call $STABLECOIN_PEG_MANAGER \
|
||
|
|
"checkUSDpeg(address)" \
|
||
|
|
$USDT \
|
||
|
|
--rpc-url $ETHEREUM_MAINNET_RPC
|
||
|
|
|
||
|
|
# Check ETH peg
|
||
|
|
cast call $STABLECOIN_PEG_MANAGER \
|
||
|
|
"checkETHpeg(address)" \
|
||
|
|
$WETH \
|
||
|
|
--rpc-url $ETHEREUM_MAINNET_RPC
|
||
|
|
```
|
||
|
|
|
||
|
|
## Monitoring
|
||
|
|
|
||
|
|
### Key Metrics to Monitor
|
||
|
|
|
||
|
|
1. **Liquidity Pool Balance**
|
||
|
|
- Minimum: 100 ETH
|
||
|
|
- Alert threshold: 50 ETH
|
||
|
|
|
||
|
|
2. **Reserve Ratio**
|
||
|
|
- Target: 110%+
|
||
|
|
- Alert threshold: 105%
|
||
|
|
|
||
|
|
3. **Peg Deviations**
|
||
|
|
- USD stablecoins: ±0.5%
|
||
|
|
- ETH/WETH: ±0.1%
|
||
|
|
- Commodities: ±1.0%
|
||
|
|
|
||
|
|
4. **Bridge Volume**
|
||
|
|
- Daily volume tracking
|
||
|
|
- Average transaction size
|
||
|
|
- Peak usage times
|
||
|
|
|
||
|
|
5. **Service Health**
|
||
|
|
- API response times
|
||
|
|
- Error rates
|
||
|
|
- Service uptime
|
||
|
|
|
||
|
|
### Setting Up Alerts
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Example: Monitor liquidity pool
|
||
|
|
watch -n 60 'cast call $LIQUIDITY_POOL "totalLiquidity()" --rpc-url $ETHEREUM_MAINNET_RPC'
|
||
|
|
```
|
||
|
|
|
||
|
|
## Maintenance Tasks
|
||
|
|
|
||
|
|
### Weekly Tasks
|
||
|
|
|
||
|
|
1. **Review Bridge Metrics**
|
||
|
|
- Analyze transaction patterns
|
||
|
|
- Check for anomalies
|
||
|
|
- Review service logs
|
||
|
|
|
||
|
|
2. **Update Price Feeds**
|
||
|
|
- Verify oracle prices
|
||
|
|
- Update commodity rates if needed
|
||
|
|
- Check ISO currency rates
|
||
|
|
|
||
|
|
3. **Liquidity Management**
|
||
|
|
- Assess liquidity needs
|
||
|
|
- Add/remove liquidity as needed
|
||
|
|
- Rebalance if necessary
|
||
|
|
|
||
|
|
### Monthly Tasks
|
||
|
|
|
||
|
|
1. **Security Audit**
|
||
|
|
- Review access control
|
||
|
|
- Check for unauthorized access
|
||
|
|
- Verify contract permissions
|
||
|
|
|
||
|
|
2. **Performance Review**
|
||
|
|
- Analyze gas costs
|
||
|
|
- Optimize routing if needed
|
||
|
|
- Review service performance
|
||
|
|
|
||
|
|
3. **Documentation Update**
|
||
|
|
- Update operational procedures
|
||
|
|
- Document incidents
|
||
|
|
- Review and update runbooks
|
||
|
|
|
||
|
|
## Emergency Procedures
|
||
|
|
|
||
|
|
### 1. Pause Bridge Operations
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Pause liquidity pool (if pause function exists)
|
||
|
|
cast send $LIQUIDITY_POOL \
|
||
|
|
"pause()" \
|
||
|
|
--rpc-url $ETHEREUM_MAINNET_RPC \
|
||
|
|
--private-key $PRIVATE_KEY
|
||
|
|
```
|
||
|
|
|
||
|
|
### 2. Emergency Withdrawal
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Withdraw liquidity (if emergency withdrawal exists)
|
||
|
|
cast send $LIQUIDITY_POOL \
|
||
|
|
"emergencyWithdraw()" \
|
||
|
|
--rpc-url $ETHEREUM_MAINNET_RPC \
|
||
|
|
--private-key $PRIVATE_KEY
|
||
|
|
```
|
||
|
|
|
||
|
|
### 3. Update Configuration
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Update routing configuration
|
||
|
|
cast send $ENHANCED_SWAP_ROUTER \
|
||
|
|
"setRoutingConfig(uint256,uint8[])" \
|
||
|
|
0 \
|
||
|
|
"[0,2]" \
|
||
|
|
--rpc-url $ETHEREUM_MAINNET_RPC \
|
||
|
|
--private-key $PRIVATE_KEY
|
||
|
|
```
|
||
|
|
|
||
|
|
## Troubleshooting
|
||
|
|
|
||
|
|
### Common Issues
|
||
|
|
|
||
|
|
1. **Service Not Responding**
|
||
|
|
```bash
|
||
|
|
# Restart service
|
||
|
|
docker restart liquidity-engine-service
|
||
|
|
|
||
|
|
# Check logs
|
||
|
|
docker logs liquidity-engine-service --tail 100
|
||
|
|
```
|
||
|
|
|
||
|
|
2. **High Gas Costs**
|
||
|
|
- Review routing configuration
|
||
|
|
- Consider using different DEX protocols
|
||
|
|
- Optimize swap routes
|
||
|
|
|
||
|
|
3. **Peg Deviation**
|
||
|
|
- Check oracle prices
|
||
|
|
- Trigger rebalancing if needed
|
||
|
|
- Review reserve status
|
||
|
|
|
||
|
|
4. **Insufficient Liquidity**
|
||
|
|
- Add liquidity to pool
|
||
|
|
- Check reserve system
|
||
|
|
- Review bridge volume
|
||
|
|
|
||
|
|
### Getting Help
|
||
|
|
|
||
|
|
1. Check logs: `docker logs <service-name>`
|
||
|
|
2. Review documentation: `docs/bridge/trustless/`
|
||
|
|
3. Check contract status: `./scripts/verify-deployment.sh`
|
||
|
|
4. Contact support team
|
||
|
|
|
||
|
|
## Next Steps
|
||
|
|
|
||
|
|
- Set up automated monitoring
|
||
|
|
- Configure alerting system
|
||
|
|
- Train operations team
|
||
|
|
- Establish incident response procedures
|
||
|
|
|