Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands - CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround - CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check - NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere - MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates - LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference Co-authored-by: Cursor <cursoragent@cursor.com>
160 lines
3.7 KiB
Markdown
160 lines
3.7 KiB
Markdown
# Gas API Integration - Summary
|
|
|
|
**Last Updated:** 2026-01-31
|
|
**Document Version:** 1.0
|
|
**Status:** Active Documentation
|
|
|
|
---
|
|
|
|
**Date**: 2026-01-18
|
|
**Status**: ✅ **COMPLETE - READY FOR DEPLOYMENT**
|
|
|
|
---
|
|
|
|
## ✅ What Was Accomplished
|
|
|
|
### Gas Price Calculation Script Created
|
|
|
|
**File**: `scripts/calculate-chain138-gas-price.sh`
|
|
|
|
**Features**:
|
|
- ✅ Fetches current gas price from ChainID 138 RPC API
|
|
- ✅ Respects minimum gas price from config (1 gwei)
|
|
- ✅ Applies 10% safety buffer
|
|
- ✅ Returns optimal gas price in wei
|
|
|
|
**Test Result**:
|
|
```bash
|
|
$ bash scripts/calculate-chain138-gas-price.sh
|
|
1100000000
|
|
|
|
$ GAS_PRICE=$(bash scripts/calculate-chain138-gas-price.sh)
|
|
$ echo "Gas price: $GAS_PRICE wei ($(echo "scale=2; $GAS_PRICE / 1000000000" | bc) gwei)"
|
|
Gas price: 1100000000 wei (1.10 gwei)
|
|
```
|
|
|
|
### Automated Deployment Script Created
|
|
|
|
**File**: `scripts/deploy-phase3-bridges-with-gas-api.sh`
|
|
|
|
**Features**:
|
|
- ✅ Automatically calculates gas price using API
|
|
- ✅ Deploys WETH9 bridge
|
|
- ✅ Deploys WETH10 bridge
|
|
- ✅ Verifies deployments
|
|
- ✅ Provides summary
|
|
|
|
---
|
|
|
|
## 🔧 How It Works
|
|
|
|
### Calculation Logic
|
|
|
|
```
|
|
1. Fetch current gas price from RPC → 1000 wei (too low)
|
|
2. Apply minimum from config → 1,000,000,000 wei (1 gwei)
|
|
3. Apply safety multiplier (1.1) → 1,100,000,000 wei (1.1 gwei)
|
|
4. Return optimal gas price → 1100000000 wei
|
|
```
|
|
|
|
### Why 1.1 gwei?
|
|
|
|
- **Network Minimum**: ChainID 138 requires minimum 1 gwei
|
|
- **Current RPC Price**: 1000 wei (below minimum, so ignored)
|
|
- **Safety Buffer**: 10% added to ensure transaction success
|
|
- **Final**: 1.1 gwei (1,100,000,000 wei)
|
|
|
|
---
|
|
|
|
## 🚀 Usage
|
|
|
|
### Option 1: Automated Deployment (Recommended)
|
|
|
|
```bash
|
|
cd /home/intlc/projects/proxmox
|
|
./scripts/deploy-phase3-bridges-with-gas-api.sh
|
|
```
|
|
|
|
This will:
|
|
1. Calculate optimal gas price (1.1 gwei)
|
|
2. Deploy WETH9 bridge
|
|
3. Deploy WETH10 bridge
|
|
4. Verify both deployments
|
|
5. Display summary
|
|
|
|
### Option 2: Manual Calculation
|
|
|
|
```bash
|
|
cd /home/intlc/projects/proxmox
|
|
|
|
# Get gas price
|
|
GAS_PRICE=$(bash scripts/calculate-chain138-gas-price.sh)
|
|
|
|
# Deploy WETH9
|
|
cd smom-dbis-138
|
|
forge script script/DeployCCIPWETH9Bridge.s.sol:DeployCCIPWETH9Bridge \
|
|
--rpc-url "$RPC_URL_138" \
|
|
--broadcast \
|
|
--private-key "$PRIVATE_KEY" \
|
|
--gas-price "$GAS_PRICE" \
|
|
--slow \
|
|
-vvvv
|
|
|
|
# Deploy WETH10
|
|
forge script script/DeployCCIPWETH10Bridge.s.sol:DeployCCIPWETH10Bridge \
|
|
--rpc-url "$RPC_URL_138" \
|
|
--broadcast \
|
|
--private-key "$PRIVATE_KEY" \
|
|
--gas-price "$GAS_PRICE" \
|
|
--slow \
|
|
-vvvv
|
|
```
|
|
|
|
---
|
|
|
|
## ✅ Benefits
|
|
|
|
### Before
|
|
- ❌ Hardcoded gas price (often wrong)
|
|
- ❌ Transactions failed due to low gas price
|
|
- ❌ Manual gas price calculation required
|
|
|
|
### After
|
|
- ✅ Dynamic gas price from API
|
|
- ✅ Respects network minimums
|
|
- ✅ Safety buffer prevents failures
|
|
- ✅ Automated calculation
|
|
|
|
---
|
|
|
|
## 📝 Files Created
|
|
|
|
1. ✅ `scripts/calculate-chain138-gas-price.sh` - Gas price calculation
|
|
2. ✅ `scripts/deploy-phase3-bridges-with-gas-api.sh` - Automated deployment
|
|
3. ✅ `docs/06-besu/GAS_API_INTEGRATION_COMPLETE.md` - Detailed documentation
|
|
4. ✅ `docs/06-besu/GAS_API_INTEGRATION_SUMMARY.md` - This document
|
|
|
|
## 📝 Files Updated
|
|
|
|
1. ✅ `docs/06-besu/GAS_PRICE_RESOLUTION.md` - Added gas API integration options
|
|
|
|
---
|
|
|
|
## 🎯 Next Steps
|
|
|
|
1. ✅ **Gas API Integration**: Complete
|
|
2. ⏭️ **Execute Deployment**: Run `./scripts/deploy-phase3-bridges-with-gas-api.sh`
|
|
3. ⏭️ **Verify Deployments**: Check deployed addresses
|
|
4. ⏭️ **Configure Destinations**: Phase 3.4
|
|
5. ⏭️ **Test Bidirectional**: Phase 3.5
|
|
|
|
---
|
|
|
|
**Status**: ✅ **GAS API INTEGRATION COMPLETE - READY TO DEPLOY**
|
|
|
|
**Recommended Action**: Execute `./scripts/deploy-phase3-bridges-with-gas-api.sh` to deploy bridges with optimal gas price.
|
|
|
|
---
|
|
|
|
**Last Updated**: 2026-01-18
|