Files
smom-dbis-138/scripts/deployment/export-cronos-verification-sources.sh
defiQUG fc3a95de08
Some checks failed
Verify Deployment / Verify Deployment (push) Has been cancelled
CI/CD Pipeline / Solidity Contracts (push) Has been cancelled
CI/CD Pipeline / Security Scanning (push) Has been cancelled
CI/CD Pipeline / Lint and Format (push) Has been cancelled
CI/CD Pipeline / Terraform Validation (push) Has been cancelled
CI/CD Pipeline / Kubernetes Validation (push) Has been cancelled
Deploy ChainID 138 / Deploy ChainID 138 (push) Has been cancelled
Validation / validate-genesis (push) Has been cancelled
Validation / validate-terraform (push) Has been cancelled
Validation / validate-kubernetes (push) Has been cancelled
Validation / validate-smart-contracts (push) Has been cancelled
Validation / validate-security (push) Has been cancelled
Validation / validate-documentation (push) Has been cancelled
docs(cronos): refresh explorer ops and verification runbooks; ignore .verify-dodo cache
- Tweak cronos check/export/verify scripts for current workflow
- Gitignore .verify-dodo/ alongside .cronos-verify/

Made-with: Cursor
2026-03-24 18:11:08 -07:00

57 lines
2.8 KiB
Bash
Executable File

#!/usr/bin/env bash
# Export flattened Solidity source for Cronos manual verification.
# Paste each file at https://explorer.cronos.org/verifyContract
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
OUT_DIR="$PROJECT_ROOT/.cronos-verify"
cd "$PROJECT_ROOT"
mkdir -p "$OUT_DIR"
CONTRACTS=(
"contracts/tokens/WETH.sol:WETH"
"contracts/tokens/WETH10.sol:WETH10"
"contracts/ccip/CCIPWETH9Bridge.sol:CCIPWETH9Bridge"
"contracts/ccip/CCIPWETH10Bridge.sol:CCIPWETH10Bridge"
)
ADDRESSES=(
"0x99B3511A2d315A497C8112C1fdd8D508d4B1E506"
"0x3304b747E565a97ec8AC220b0B6A1f6ffDB837e6"
"0x3Cc23d086fCcbAe1e5f3FE2bA4A263E1D27d8Cab"
"0x105F8A15b819948a89153505762444Ee9f324684"
)
echo "Exporting flattened source for Cronos manual verification..."
echo ""
for i in "${!CONTRACTS[@]}"; do
entry="${CONTRACTS[$i]}"
addr="${ADDRESSES[$i]}"
path="${entry%%:*}"
name="${entry##*:}"
base=$(basename "$path" .sol)
out="$OUT_DIR/${base}_flattened.sol"
forge flatten "$path" > "$out" 2>/dev/null
echo "$name -> $out"
done
# Export Standard JSON Input (required — includes viaIR:true)
echo "Exporting Standard JSON Input (includes viaIR — required for bytecode match)..."
forge verify-contract "${ADDRESSES[0]}" "${CONTRACTS[0]}" --chain cronos --show-standard-json-input 2>/dev/null | jq -c . > "$OUT_DIR/WETH_standard_input.json"
forge verify-contract "${ADDRESSES[1]}" "${CONTRACTS[1]}" --chain cronos --show-standard-json-input 2>/dev/null | jq -c . > "$OUT_DIR/WETH10_standard_input.json"
forge verify-contract "${ADDRESSES[2]}" "${CONTRACTS[2]}" --chain cronos --constructor-args "$(cast abi-encode 'constructor(address,address,address)' 0xE26B0A098D861d5C7d9434aD471c0572Ca6EAa67 0x99B3511A2d315A497C8112C1fdd8D508d4B1E506 0x8c80A01F461f297Df7F9DA3A4f740D7297C8Ac85)" --show-standard-json-input 2>/dev/null | jq -c . > "$OUT_DIR/CCIPWETH9Bridge_standard_input.json"
forge verify-contract "${ADDRESSES[3]}" "${CONTRACTS[3]}" --chain cronos --constructor-args "$(cast abi-encode 'constructor(address,address,address)' 0xE26B0A098D861d5C7d9434aD471c0572Ca6EAa67 0x3304b747E565a97ec8AC220b0B6A1f6ffDB837e6 0x8c80A01F461f297Df7F9DA3A4f740D7297C8Ac85)" --show-standard-json-input 2>/dev/null | jq -c . > "$OUT_DIR/CCIPWETH10Bridge_standard_input.json"
echo " ✓ Standard JSON files written to $OUT_DIR/*_standard_input.json"
echo ""
echo "IMPORTANT: Use Standard-Json-Input (not flattened source). Contracts were deployed with via_ir=true."
echo " Flattened source produces different bytecode → Unmatched."
echo ""
echo "Next: https://explorer.cronos.org/verifyContract"
echo " 1. Select 'Solidity (Standard-Json-Input)'"
echo " 2. Upload the *_standard_input.json file for each contract"
echo " 3. See docs/deployment/CRONOS_VERIFICATION_RUNBOOK.md"
echo ""
echo "Sources: $OUT_DIR/"