Files
smom-dbis-138/scripts/deployment/verify-contracts-parallel.sh
defiQUG 1fb7266469 Add Oracle Aggregator and CCIP Integration
- Introduced Aggregator.sol for Chainlink-compatible oracle functionality, including round-based updates and access control.
- Added OracleWithCCIP.sol to extend Aggregator with CCIP cross-chain messaging capabilities.
- Created .gitmodules to include OpenZeppelin contracts as a submodule.
- Developed a comprehensive deployment guide in NEXT_STEPS_COMPLETE_GUIDE.md for Phase 2 and smart contract deployment.
- Implemented Vite configuration for the orchestration portal, supporting both Vue and React frameworks.
- Added server-side logic for the Multi-Cloud Orchestration Portal, including API endpoints for environment management and monitoring.
- Created scripts for resource import and usage validation across non-US regions.
- Added tests for CCIP error handling and integration to ensure robust functionality.
- Included various new files and directories for the orchestration portal and deployment scripts.
2025-12-12 14:57:48 -08:00

120 lines
3.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Verify contract deployments in parallel
# Uses .env file for configuration
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/../lib/init.sh"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
cd "$PROJECT_ROOT"
# Load environment variables
if [ ! -f .env ]; then
log_error "Error: .env file not found"
echo "Please create .env file with required variables"
exit 1
fi
source .env
# Check required variables
if [ -z "$RPC_URL" ]; then
log_error "Error: RPC_URL not set in .env"
exit 1
fi
if ! command -v cast &> /dev/null; then
log_error "Error: cast (Foundry) not found. Install Foundry to verify on-chain deployments."
exit 1
fi
# Function to verify contract
verify_contract() {
local name=$1
local address=$2
local output_file=$3
if [ -z "$address" ] || [ "$address" = "0x0000000000000000000000000000000000000000" ] || [ "$address" = "" ]; then
echo "[${name}] ⚠️ Address not set" >> "$output_file"
return 1
fi
CODE=$(cast code "$address" --rpc-url "$RPC_URL" 2>/dev/null || echo "")
if [ -n "$CODE" ] && [ "$CODE" != "0x" ] && [ ${#CODE} -gt 2 ]; then
echo "[${name}] ✅ Deployed at: $address (code length: ${#CODE} chars)" >> "$output_file"
return 0
else
echo "[${name}] ❌ Not found at: $address" >> "$output_file"
return 1
fi
}
log_success "=== Parallel Contract Verification ==="
log_warn "Verifying contracts on RPC: $RPC_URL"
echo ""
# Create temp directory for parallel outputs
TEMP_DIR=$(mktemp -d)
declare -A VERIFY_PIDS
FAILED=0
# Verify all contracts in parallel
CONTRACTS=(
"MULTICALL_ADDRESS:Multicall"
"WETH9_ADDRESS:WETH9"
"WETH10_ADDRESS:WETH10"
"CCIP_ROUTER:CCIP Router"
"CCIPWETH9BRIDGE_ADDRESS:CCIPWETH9Bridge"
"CCIPWETH10BRIDGE_ADDRESS:CCIPWETH10Bridge"
"ORACLE_AGGREGATOR_ADDRESS:Oracle Aggregator"
"ORACLE_PROXY_ADDRESS:Oracle Proxy"
"MULTISIG_ADDRESS:MultiSig"
)
for contract_info in "${CONTRACTS[@]}"; do
IFS=':' read -r env_var name <<< "$contract_info"
address="${!env_var}"
if [ -n "$address" ]; then
output_file="${TEMP_DIR}/${env_var}.out"
(
verify_contract "$name" "$address" "$output_file"
) &
VERIFY_PIDS["$env_var"]=$!
fi
done
# Wait for all verifications to complete
for env_var in "${!VERIFY_PIDS[@]}"; do
if ! wait "${VERIFY_PIDS[$env_var]}"; then
((FAILED++))
fi
done
# Display results
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
for contract_info in "${CONTRACTS[@]}"; do
IFS=':' read -r env_var name <<< "$contract_info"
output_file="${TEMP_DIR}/${env_var}.out"
if [ -f "$output_file" ]; then
cat "$output_file"
fi
done
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
# Cleanup
rm -rf "$TEMP_DIR"
# Summary
TOTAL=${#VERIFY_PIDS[@]}
if [ $FAILED -eq 0 ]; then
log_success "✅ All ${TOTAL} contract(s) verified successfully"
exit 0
else
log_error "${FAILED} out of ${TOTAL} contract(s) failed verification"
exit 1
fi