chore: .gitignore and README updates

Made-with: Cursor
This commit is contained in:
defiQUG
2026-04-21 22:00:55 -07:00
parent 843cdbf71c
commit 768168de5e
37 changed files with 505 additions and 118 deletions

View File

@@ -1,7 +1,18 @@
#!/usr/bin/env bash
# Verify all four Cronos contracts via Etherscan-style API.
# Uses explorer-api.cronos.org (module/action, solidity-standard-json-input).
# Run from smom-dbis-138/
# Cronos (chain 25): confirm deployments and prepare manual verification.
#
# Cronos Explorer moved off legacy Etherscan-compatible POST endpoints on the
# public /mainnet/api route (404 on contract verification). Etherscan multichain
# v2 does not list Cronos chain id 25. Foundry forge verify-contract therefore
# cannot submit verification to Cronos reliably from CI.
#
# This script: (1) checks bytecode on RPC, (2) optionally exports Standard-JSON
# inputs for the web UI, (3) prints links to the manual runbook.
#
# Run from smom-dbis-138/: ./scripts/deployment/verify-cronos-contracts.sh
#
# Optional: CRONOS_EXPORT_SOURCES=1 — run export-cronos-verification-sources.sh
# Optional: CRONOS_REQUIRE_BYTECODE=1 — exit 1 if any listed address has no code (default: 1)
set -euo pipefail
@@ -25,66 +36,56 @@ elif [[ -n "${REPO_ROOT:-}" && -f "$REPO_ROOT/.env" ]]; then
set +a
fi
RPC="${CRONOS_RPC_URL:-https://evm.cronos.org}"
REQUIRE_CODE="${CRONOS_REQUIRE_BYTECODE:-1}"
if [ -z "${CRONOSCAN_API_KEY:-}" ]; then
echo "ERROR: CRONOSCAN_API_KEY not set. Set in .env (from explorer.cronos.org/register)."
exit 1
fi
export CRONOSCAN_API_KEY
echo "Cronos verification (Etherscan-style API)"
echo " API: https://explorer-api.cronos.org/mainnet/api"
echo " Chain: cronos (from foundry.toml)"
echo "Cronos verification (Chain 25)"
echo " RPC: $RPC"
echo " Explorer: https://explorer.cronos.org"
echo " Manual UI: https://explorer.cronos.org/verifyContract"
echo ""
echo "Note: Automated forge/etherscan verification is not supported against the current"
echo " Cronos Explorer API (see docs/04-configuration/CRONOS_EXPLORER_OPERATIONS.md)."
echo ""
verify() {
local addr="$1"
local contract="$2"
local extra_args="${3:-}"
echo "Verifying $contract at $addr..."
# shellcheck disable=SC2086
if forge verify-contract \
"$addr" "$contract" \
--chain cronos \
--etherscan-api-key "$CRONOSCAN_API_KEY" \
--skip-is-verified-check \
$extra_args \
--watch 2>&1; then
echo "$contract verified"
else
echo "$contract verification failed"
return 1
fi
}
CONTRACTS=(
"0x99B3511A2d315A497C8112C1fdd8D508d4B1E506:WETH9"
"0x3304b747E565a97ec8AC220b0B6A1f6ffDB837e6:WETH10"
"0x3Cc23d086fCcbAe1e5f3FE2bA4A263E1D27d8Cab:CCIPWETH9Bridge"
"0x105F8A15b819948a89153505762444Ee9f324684:CCIPWETH10Bridge"
)
FAIL=0
# WETH9 - no constructor args
verify "0x99B3511A2d315A497C8112C1fdd8D508d4B1E506" "contracts/tokens/WETH.sol:WETH" || FAIL=$((FAIL+1))
# WETH10 - no constructor args
verify "0x3304b747E565a97ec8AC220b0B6A1f6ffDB837e6" "contracts/tokens/WETH10.sol:WETH10" || FAIL=$((FAIL+1))
# CCIPWETH9Bridge - constructor(router, weth9, linkToken)
verify "0x3Cc23d086fCcbAe1e5f3FE2bA4A263E1D27d8Cab" "contracts/ccip/CCIPWETH9Bridge.sol:CCIPWETH9Bridge" \
"--constructor-args $(cast abi-encode 'constructor(address,address,address)' 0xE26B0A098D861d5C7d9434aD471c0572Ca6EAa67 0x99B3511A2d315A497C8112C1fdd8D508d4B1E506 0x8c80A01F461f297Df7F9DA3A4f740D7297C8Ac85)" || FAIL=$((FAIL+1))
# CCIPWETH10Bridge - constructor(router, weth10, linkToken)
verify "0x105F8A15b819948a89153505762444Ee9f324684" "contracts/ccip/CCIPWETH10Bridge.sol:CCIPWETH10Bridge" \
"--constructor-args $(cast abi-encode 'constructor(address,address,address)' 0xE26B0A098D861d5C7d9434aD471c0572Ca6EAa67 0x3304b747E565a97ec8AC220b0B6A1f6ffDB837e6 0x8c80A01F461f297Df7F9DA3A4f740D7297C8Ac85)" || FAIL=$((FAIL+1))
echo "On-chain bytecode:"
for entry in "${CONTRACTS[@]}"; do
addr="${entry%%:*}"
name="${entry##*:}"
code=$(cast code "$addr" --rpc-url "$RPC" 2>/dev/null || echo "0x")
if [[ "${#code}" -gt 10 ]]; then
echo "$name $addr"
else
echo "$name $addr — no bytecode"
FAIL=$((FAIL + 1))
fi
done
echo ""
if [ "$FAIL" -eq 0 ]; then
echo "All four Cronos contracts verified."
exit 0
else
echo "$FAIL contract(s) failed."
echo ""
echo "Manual verification (recommended):"
echo " 1. ./scripts/deployment/export-cronos-verification-sources.sh"
echo " 2. Open https://explorer.cronos.org/verifyContract"
echo " 3. Follow docs/deployment/CRONOS_VERIFICATION_RUNBOOK.md"
if [[ "${CRONOS_EXPORT_SOURCES:-0}" == "1" ]] && [[ -x "$SCRIPT_DIR/export-cronos-verification-sources.sh" ]]; then
echo "Regenerating Standard-JSON inputs (.cronos-verify/)..."
bash "$SCRIPT_DIR/export-cronos-verification-sources.sh" || true
echo ""
fi
echo "Next steps (manual verification required):"
echo " 1. docs/deployment/CRONOS_VERIFICATION_RUNBOOK.md"
echo " 2. Or: ./scripts/deployment/export-cronos-verification-sources.sh"
echo " then upload each *_standard_input.json at https://explorer.cronos.org/verifyContract"
echo ""
if [[ "$REQUIRE_CODE" == "1" ]] && [[ "$FAIL" -gt 0 ]]; then
echo "ERROR: $FAIL contract(s) missing bytecode on $RPC" >&2
exit 1
fi
echo "verify-cronos-contracts.sh finished (deployment OK; verification is manual on Cronos)."
exit 0