# Run Deployment Now - Complete Command Set

**Date**: 2025-12-24  
**PRIVATE_KEY**: `0x5373d11ee2cad4ed82b9208526a8c358839cbfe325919fb250f062a25153d1c8`

---

## Quick Start - Copy and Paste All Commands

Open a **fresh terminal** and run these commands in order:

### Step 1: Setup Environment

```bash
cd /home/intlc/projects/proxmox/smom-dbis-138

# Create .env file
cat > .env << 'EOF'
# Chain 138 RPC Configuration
RPC_URL_138=http://192.168.11.250:8545
RPC_URL=http://192.168.11.250:8545
PRIVATE_KEY=0x5373d11ee2cad4ed82b9208526a8c358839cbfe325919fb250f062a25153d1c8
EOF

chmod 600 .env

# Load environment
source .env

# Verify
echo "Deployer: $(cast wallet address $PRIVATE_KEY)"
echo "RPC Block: $(cast block-number --rpc-url $RPC_URL)"
```

### Step 2: Deploy ComplianceRegistry

```bash
cd /home/intlc/projects/proxmox/smom-dbis-138
source .env

forge script script/DeployComplianceRegistry.s.sol:DeployComplianceRegistry \
  --rpc-url $RPC_URL \
  --broadcast \
  --legacy \
  --gas-price 20000000000 \
  --via-ir \
  -vv
```

**Save the deployed address** from the output (look for "ComplianceRegistry deployed at: 0x...")

### Step 3: Deploy CompliantUSDT

```bash
cd /home/intlc/projects/proxmox/smom-dbis-138
source .env

forge script script/DeployCompliantUSDT.s.sol:DeployCompliantUSDT \
  --rpc-url $RPC_URL \
  --broadcast \
  --legacy \
  --gas-price 20000000000 \
  --via-ir \
  -vv
```

**Save the deployed address** from the output

### Step 4: Deploy CompliantUSDC

```bash
cd /home/intlc/projects/proxmox/smom-dbis-138
source .env

forge script script/DeployCompliantUSDC.s.sol:DeployCompliantUSDC \
  --rpc-url $RPC_URL \
  --broadcast \
  --legacy \
  --gas-price 20000000000 \
  --via-ir \
  -vv
```

**Save the deployed address** from the output

### Step 5: Deploy TokenRegistry

```bash
cd /home/intlc/projects/proxmox/smom-dbis-138
source .env

forge script script/DeployTokenRegistry.s.sol:DeployTokenRegistry \
  --rpc-url $RPC_URL \
  --broadcast \
  --legacy \
  --gas-price 20000000000 \
  -vv
```

**Save the deployed address** from the output

### Step 6: Deploy FeeCollector

```bash
cd /home/intlc/projects/proxmox/smom-dbis-138
source .env

forge script script/DeployFeeCollector.s.sol:DeployFeeCollector \
  --rpc-url $RPC_URL \
  --broadcast \
  --legacy \
  --gas-price 20000000000 \
  -vv
```

**Save the deployed address** from the output

### Step 7: Register Contracts

After all deployments, register them (replace addresses with actual deployed addresses):

```bash
cd /home/intlc/projects/proxmox/smom-dbis-138
source .env

# Set addresses (replace with actual addresses from deployment)
COMPLIANCE_REGISTRY=0x...  # From Step 2
COMPLIANT_USDT=0x...       # From Step 3
COMPLIANT_USDC=0x...       # From Step 4
TOKEN_REGISTRY=0x...       # From Step 5

# Register CompliantUSDT in ComplianceRegistry
cast send $COMPLIANCE_REGISTRY \
  "registerContract(address)" \
  $COMPLIANT_USDT \
  --rpc-url $RPC_URL \
  --private-key $PRIVATE_KEY \
  --legacy \
  --gas-price 20000000000

# Register CompliantUSDC in ComplianceRegistry
cast send $COMPLIANCE_REGISTRY \
  "registerContract(address)" \
  $COMPLIANT_USDC \
  --rpc-url $RPC_URL \
  --private-key $PRIVATE_KEY \
  --legacy \
  --gas-price 20000000000

# Register CompliantUSDT in TokenRegistry
cast send $TOKEN_REGISTRY \
  "registerToken(address,string,string,uint8,bool,address)" \
  $COMPLIANT_USDT \
  "Tether USD (Compliant)" \
  "cUSDT" \
  6 \
  false \
  0x0000000000000000000000000000000000000000 \
  --rpc-url $RPC_URL \
  --private-key $PRIVATE_KEY \
  --legacy \
  --gas-price 20000000000

# Register CompliantUSDC in TokenRegistry
cast send $TOKEN_REGISTRY \
  "registerToken(address,string,string,uint8,bool,address)" \
  $COMPLIANT_USDC \
  "USD Coin (Compliant)" \
  "cUSDC" \
  6 \
  false \
  0x0000000000000000000000000000000000000000 \
  --rpc-url $RPC_URL \
  --private-key $PRIVATE_KEY \
  --legacy \
  --gas-price 20000000000
```

---

## Alternative: Use the Automated Script

If you can run bash scripts, use:

```bash
cd /home/intlc/projects/proxmox/smom-dbis-138

# Create .env first
cat > .env << 'EOF'
RPC_URL_138=http://192.168.11.250:8545
RPC_URL=http://192.168.11.250:8545
PRIVATE_KEY=0x5373d11ee2cad4ed82b9208526a8c358839cbfe325919fb250f062a25153d1c8
EOF

chmod 600 .env

# Run deployment script
bash scripts/run-deployment-direct.sh
```

---

## Verify Deployments

After deployment, verify all contracts:

```bash
cd /home/intlc/projects/proxmox/smom-dbis-138
source .env

# Check each contract has code
cast code $COMPLIANCE_REGISTRY_ADDRESS --rpc-url $RPC_URL
cast code $COMPLIANT_USDT_ADDRESS --rpc-url $RPC_URL
cast code $COMPLIANT_USDC_ADDRESS --rpc-url $RPC_URL
cast code $TOKEN_REGISTRY_ADDRESS --rpc-url $RPC_URL
cast code $FEE_COLLECTOR_ADDRESS --rpc-url $RPC_URL
```

Each should return bytecode (not empty).

---

## Troubleshooting

### If forge commands fail:
- Check Foundry is installed: `forge --version`
- Check RPC is accessible: `cast block-number --rpc-url http://192.168.11.250:8545`
- Check balance: `cast balance $(cast wallet address $PRIVATE_KEY) --rpc-url $RPC_URL`

### If deployment fails:
- Check gas price is sufficient
- Check deployer has enough balance (0.1+ ETH recommended)
- Check contract compilation: `forge build --via-ir`

---

**All commands are ready to copy and paste!**

