Add full monorepo: virtual-banker, backend, frontend, docs, scripts, deployment
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
279
docs/DEPLOYMENT_GUIDE.md
Normal file
279
docs/DEPLOYMENT_GUIDE.md
Normal file
@@ -0,0 +1,279 @@
|
||||
# Smart Contract Deployment Guide
|
||||
|
||||
**RPC Endpoint**: `http://192.168.11.250:8545`
|
||||
**Chain ID**: 138
|
||||
**Date**: 2025-12-24
|
||||
|
||||
---
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Automated Deployment
|
||||
|
||||
```bash
|
||||
cd /home/intlc/projects/proxmox/explorer-monorepo
|
||||
./scripts/deploy-all-contracts.sh
|
||||
```
|
||||
|
||||
This script will:
|
||||
- Verify RPC connectivity
|
||||
- Check deployer balance
|
||||
- Build all contracts
|
||||
- Deploy contracts interactively
|
||||
|
||||
### Manual Deployment
|
||||
|
||||
For individual contract deployment:
|
||||
|
||||
```bash
|
||||
cd /home/intlc/projects/smom-dbis-138
|
||||
|
||||
# Deploy LINK Token
|
||||
forge script script/DeployMockLinkToken.s.sol:DeployMockLinkToken \
|
||||
--rpc-url http://192.168.11.250:8545 \
|
||||
--broadcast \
|
||||
--legacy \
|
||||
--gas-price 20000000000
|
||||
|
||||
# Deploy CCIP Receiver
|
||||
forge script script/DeployCCIPReceiver.s.sol:DeployCCIPReceiver \
|
||||
--rpc-url http://192.168.11.250:8545 \
|
||||
--broadcast \
|
||||
--legacy \
|
||||
--gas-price 20000000000
|
||||
|
||||
# Deploy CCIP Logger
|
||||
forge script script/DeployCCIPLoggerOnly.s.sol:DeployCCIPLoggerOnly \
|
||||
--rpc-url http://192.168.11.250:8545 \
|
||||
--broadcast \
|
||||
--legacy \
|
||||
--gas-price 20000000000
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
|
||||
### 1. Environment Variables
|
||||
|
||||
Ensure `.env` file contains:
|
||||
|
||||
```bash
|
||||
PRIVATE_KEY=0x...
|
||||
RPC_URL_138=http://192.168.11.250:8545
|
||||
```
|
||||
|
||||
### 2. Deployer Balance
|
||||
|
||||
Check balance:
|
||||
```bash
|
||||
cast balance <DEPLOYER_ADDRESS> --rpc-url http://192.168.11.250:8545
|
||||
```
|
||||
|
||||
Minimum recommended: 0.1 ETH
|
||||
|
||||
### 3. RPC Connectivity
|
||||
|
||||
Test RPC:
|
||||
```bash
|
||||
cast block-number --rpc-url http://192.168.11.250:8545
|
||||
cast chain-id --rpc-url http://192.168.11.250:8545
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Deployment Order
|
||||
|
||||
### 1. LINK Token (MockLinkToken)
|
||||
|
||||
**Purpose**: ERC20 token for CCIP fee payments
|
||||
|
||||
**Deployment**:
|
||||
```bash
|
||||
forge script script/DeployMockLinkToken.s.sol:DeployMockLinkToken \
|
||||
--rpc-url http://192.168.11.250:8545 \
|
||||
--broadcast \
|
||||
--legacy \
|
||||
--gas-price 20000000000
|
||||
```
|
||||
|
||||
**Post-Deployment**:
|
||||
- Mint initial supply (1M LINK)
|
||||
- Update `.env` with `LINK_TOKEN=<deployed_address>`
|
||||
- Fund bridge contracts with LINK
|
||||
|
||||
### 2. CCIP Receiver
|
||||
|
||||
**Purpose**: Receives cross-chain messages via CCIP
|
||||
|
||||
**Requirements**:
|
||||
- `CCIP_ROUTER_ADDRESS` in `.env`
|
||||
- `ORACLE_AGGREGATOR_ADDRESS` in `.env`
|
||||
|
||||
**Deployment**:
|
||||
```bash
|
||||
forge script script/DeployCCIPReceiver.s.sol:DeployCCIPReceiver \
|
||||
--rpc-url http://192.168.11.250:8545 \
|
||||
--broadcast \
|
||||
--legacy \
|
||||
--gas-price 20000000000
|
||||
```
|
||||
|
||||
### 3. CCIP Logger
|
||||
|
||||
**Purpose**: Logs CCIP messages for monitoring
|
||||
|
||||
**Deployment**:
|
||||
```bash
|
||||
forge script script/DeployCCIPLoggerOnly.s.sol:DeployCCIPLoggerOnly \
|
||||
--rpc-url http://192.168.11.250:8545 \
|
||||
--broadcast \
|
||||
--legacy \
|
||||
--gas-price 20000000000
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Gas Configuration
|
||||
|
||||
### Default Gas Price
|
||||
|
||||
Default: 20 gwei (20000000000 wei)
|
||||
|
||||
### Custom Gas Price
|
||||
|
||||
```bash
|
||||
# 10 gwei
|
||||
./scripts/deploy-all-contracts.sh 10000000000
|
||||
|
||||
# 30 gwei
|
||||
./scripts/deploy-all-contracts.sh 30000000000
|
||||
```
|
||||
|
||||
### Stack Too Deep Issues
|
||||
|
||||
If you encounter "Stack too deep" errors:
|
||||
|
||||
```bash
|
||||
forge build --via-ir
|
||||
forge script <script> --via-ir --rpc-url http://192.168.11.250:8545 --broadcast --legacy
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Verification
|
||||
|
||||
### Check Deployment
|
||||
|
||||
```bash
|
||||
# Get contract code
|
||||
cast code <CONTRACT_ADDRESS> --rpc-url http://192.168.11.250:8545
|
||||
|
||||
# Call contract function
|
||||
cast call <CONTRACT_ADDRESS> "name()(string)" --rpc-url http://192.168.11.250:8545
|
||||
```
|
||||
|
||||
### Transaction Receipt
|
||||
|
||||
```bash
|
||||
cast receipt <TX_HASH> --rpc-url http://192.168.11.250:8545
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### RPC Not Accessible
|
||||
|
||||
```bash
|
||||
# Test connectivity
|
||||
curl -X POST -H "Content-Type: application/json" \
|
||||
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \
|
||||
http://192.168.11.250:8545
|
||||
```
|
||||
|
||||
### Insufficient Balance
|
||||
|
||||
```bash
|
||||
# Check balance
|
||||
cast balance <DEPLOYER> --rpc-url http://192.168.11.250:8545
|
||||
|
||||
# Get balance in ETH
|
||||
cast balance <DEPLOYER> --rpc-url http://192.168.11.250:8545 --ether
|
||||
```
|
||||
|
||||
### Transaction Failed
|
||||
|
||||
1. Check transaction receipt:
|
||||
```bash
|
||||
cast receipt <TX_HASH> --rpc-url http://192.168.11.250:8545
|
||||
```
|
||||
|
||||
2. If DEBUG API is enabled, get revert reason:
|
||||
```bash
|
||||
curl -X POST -H "Content-Type: application/json" \
|
||||
--data '{"jsonrpc":"2.0","method":"debug_traceTransaction","params":["<TX_HASH>",{"tracer":"callTracer"}],"id":1}' \
|
||||
http://192.168.11.250:8545 | jq
|
||||
```
|
||||
|
||||
### Compilation Errors
|
||||
|
||||
```bash
|
||||
# Standard build
|
||||
forge build
|
||||
|
||||
# With via-ir (for stack too deep)
|
||||
forge build --via-ir
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Post-Deployment Steps
|
||||
|
||||
### 1. Update Configuration Files
|
||||
|
||||
- Update `.env` with deployed addresses
|
||||
- Update token lists
|
||||
- Update database migrations
|
||||
|
||||
### 2. Verify Contracts
|
||||
|
||||
- Check contract code exists
|
||||
- Test contract functions
|
||||
- Verify events
|
||||
|
||||
### 3. Fund Contracts
|
||||
|
||||
- Fund bridge contracts with LINK
|
||||
- Approve token transfers
|
||||
- Configure CCIP destinations
|
||||
|
||||
---
|
||||
|
||||
## Deployment Logs
|
||||
|
||||
All deployment logs are saved to:
|
||||
- `/tmp/deploy-<ContractName>.log`
|
||||
|
||||
Check logs for:
|
||||
- Deployed addresses
|
||||
- Transaction hashes
|
||||
- Error messages
|
||||
|
||||
---
|
||||
|
||||
## Support
|
||||
|
||||
For issues:
|
||||
1. Check deployment logs
|
||||
2. Verify RPC connectivity
|
||||
3. Check deployer balance
|
||||
4. Review transaction receipts
|
||||
5. Enable DEBUG API for detailed error messages
|
||||
|
||||
---
|
||||
|
||||
**Status**: Ready for deployment
|
||||
**RPC**: http://192.168.11.250:8545
|
||||
**Chain ID**: 138
|
||||
|
||||
Reference in New Issue
Block a user