Files
smom-dbis-138/scripts/deployment/verify-mainnet-contracts.sh
defiQUG a780eff7c5 docs(deployment): update CCIPWETH10Bridge address across documentation and scripts
- Changed CCIPWETH10Bridge address from `0x8078A09637e47Fa5Ed34F626046Ea2094a5CDE5e` to `0xe0E93247376aa097dB308B92e6Ba36bA015535D0` in various deployment documents and scripts.
- Ensured consistency in bridge configuration and verification steps for ChainID 138 and Mainnet.

Made-with: Cursor
2026-03-24 22:49:50 -07:00

95 lines
3.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# Verify Ethereum Mainnet contracts on Etherscan
# This script checks verification status and provides verification commands
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
cd "$PROJECT_ROOT"
source .env 2>/dev/null || true
echo "=========================================="
echo "Ethereum Mainnet Contract Verification"
echo "=========================================="
echo ""
# Mainnet contract addresses (prefer env-backed canonical values)
CCIPWETH9BRIDGE_MAINNET="${MAINNET_CCIP_WETH9_BRIDGE:-0xc9901ce2Ddb6490FAA183645147a87496d8b20B6}"
CCIPWETH10BRIDGE_MAINNET="${MAINNET_CCIP_WETH10_BRIDGE:-0x04E1e22B0D41e99f4275bd40A50480219bc9A223}"
# Check verification status
check_verification() {
local contract_name=$1
local contract_address=$2
echo "Checking $contract_name ($contract_address)..."
if [ -z "${ETHERSCAN_API_KEY:-}" ]; then
echo " ⚠️ ETHERSCAN_API_KEY not set - cannot check via API"
echo " 📄 Check manually: https://etherscan.io/address/$contract_address#code"
return
fi
local response=$(curl -s "https://api.etherscan.io/api?module=contract&action=getsourcecode&address=$contract_address&apikey=$ETHERSCAN_API_KEY")
local sourcecode=$(echo "$response" | jq -r '.result[0].SourceCode' 2>/dev/null || echo "")
local contract_name_api=$(echo "$response" | jq -r '.result[0].ContractName' 2>/dev/null || echo "")
if [ -n "$sourcecode" ] && [ "$sourcecode" != "" ]; then
echo " ✅ Contract is VERIFIED"
if [ -n "$contract_name_api" ] && [ "$contract_name_api" != "" ]; then
echo " Contract Name: $contract_name_api"
fi
echo " 📄 View: https://etherscan.io/address/$contract_address#code"
else
echo " ❌ Contract is NOT VERIFIED"
echo " 📄 Verify at: https://etherscan.io/address/$contract_address#code"
echo ""
# Get contract name for verification
local contract_file=""
local contract_name_short=""
if [[ "$contract_name" == *"9Bridge"* ]]; then
contract_file="contracts/ccip/CCIPWETH9Bridge.sol:CCIPWETH9Bridge"
contract_name_short="CCIPWETH9Bridge"
elif [[ "$contract_name" == *"10Bridge"* ]]; then
contract_file="contracts/ccip/CCIPWETH10Bridge.sol:CCIPWETH10Bridge"
contract_name_short="CCIPWETH10Bridge"
else
contract_file="contracts/ccip/${contract_name}.sol:${contract_name}"
contract_name_short="$contract_name"
fi
echo " Verification Command (Foundry):"
echo " forge verify-contract \\"
echo " --chain-id 1 \\"
echo " --num-of-optimizations 200 \\"
echo " --watch \\"
echo " $contract_address \\"
echo " $contract_file \\"
if [ -n "${ETHERSCAN_API_KEY:-}" ]; then
echo " $ETHERSCAN_API_KEY"
else
echo " <ETHERSCAN_API_KEY>"
fi
echo ""
echo " Or verify via Etherscan UI:"
echo " https://etherscan.io/address/$contract_address#code"
fi
echo ""
}
# Check both contracts
check_verification "CCIPWETH9Bridge" "$CCIPWETH9BRIDGE_MAINNET"
check_verification "CCIPWETH10Bridge" "$CCIPWETH10BRIDGE_MAINNET"
echo "=========================================="
echo "Verification Check Complete"
echo "=========================================="
echo ""
echo "📋 Quick Links:"
echo " • CCIPWETH9Bridge: https://etherscan.io/address/$CCIPWETH9BRIDGE_MAINNET"
echo " • CCIPWETH10Bridge: https://etherscan.io/address/$CCIPWETH10BRIDGE_MAINNET"
echo " • Verify Contracts: https://etherscan.io/myverify_address"
echo ""