Skip to content

Commit ff8a81e

Browse files
ae2079cursoragent
andcommitted
fix: ignore .env.local and align arbitrum/polygon rpc env vars
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent e16e6e5 commit ff8a81e

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ MAINNET_RPC=
22
SEPOLIA_RPC=
33

44
BASE_RPC=
5+
# Must match foundry.toml [rpc_endpoints] (not ARBITRUM)
56
ARBITRUM_RPC=
67
GNOSIS_RPC=
78
CELO_RPC=
89
OPTIMISM_RPC=
10+
# Must match foundry.toml (not POLYGON_RPC_URL)
911
POLYGON_RPC=
1012

1113
# Deployer key for forge script (hex private key)

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ out-via-ir
1010

1111
# Config files
1212
.env
13+
.env.local
1314

1415
# Avoid ignoring gitkeep
1516
!/**/.gitkeep

scripts/deploy-implementation.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ set -e
33

44
# Deploy DonationHandler implementation via CreateX CREATE2 (same address on each chain when init code matches).
55
# Usage: ./scripts/deploy-implementation.sh <chain>
6-
# Requires .env: PRIVATE_KEY, <CHAIN>_RPC (e.g. BASE_RPC), ETHERSCAN_API_KEY for --verify
6+
# Requires .env: PRIVATE_KEY, <CHAIN>_RPC (e.g. BASE_RPC), ETHERSCAN_API_KEY for --verify.
7+
# Arbitrum/Polygon: ARBITRUM_RPC / POLYGON_RPC (foundry.toml); ARBITRUM / POLYGON_RPC_URL are accepted as fallbacks.
78
#
89
# Build uses FOUNDRY_PROFILE=deterministic — see foundry.toml (must match manual forge script runs).
910
# Chain names match foundry.toml [rpc_endpoints] keys (mainnet, base, sepolia, ...).
@@ -17,16 +18,21 @@ CHAIN="${1:?Usage: deploy-implementation.sh <chain> (e.g. base, mainnet, sepolia
1718
cd "$(dirname "$0")/.."
1819
source .env
1920

21+
# foundry.toml and this script expect ARBITRUM_RPC / POLYGON_RPC; support common alternate names.
22+
export ARBITRUM_RPC="${ARBITRUM_RPC:-${ARBITRUM:-}}"
23+
export POLYGON_RPC="${POLYGON_RPC:-${POLYGON_RPC_URL:-}}"
24+
2025
RPC_SUFFIX=$(echo "$CHAIN" | tr '[:lower:]' '[:upper:]' | tr '-' '_')
2126
RPC_VAR="${RPC_SUFFIX}_RPC"
27+
RPC_URL="${!RPC_VAR}"
2228

23-
if [[ -z "${!RPC_VAR}" ]]; then
24-
echo "Error: $RPC_VAR is not set in .env"
29+
if [[ -z "$RPC_URL" ]]; then
30+
echo "Error: $RPC_VAR is not set in .env (for polygon, POLYGON_RPC or POLYGON_RPC_URL; for arbitrum, ARBITRUM_RPC or ARBITRUM)"
2531
exit 1
2632
fi
2733

2834
CREATEX_ADDRESS="0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed"
29-
CREATEX_CODE=$(cast code "$CREATEX_ADDRESS" --rpc-url "${!RPC_VAR}" 2>/dev/null || true)
35+
CREATEX_CODE=$(cast code "$CREATEX_ADDRESS" --rpc-url "$RPC_URL" 2>/dev/null || true)
3036
if [[ -z "$CREATEX_CODE" || "$CREATEX_CODE" == "0x" ]]; then
3137
echo "Error: CreateX not deployed at $CREATEX_ADDRESS on this RPC (cast code returned empty)."
3238
exit 1
@@ -41,7 +47,7 @@ fi
4147
export FOUNDRY_PROFILE=deterministic
4248

4349
forge script script/DeployDonationHandlerImplementation.s.sol:DeployDonationHandlerImplementation \
44-
--rpc-url "${!RPC_VAR}" \
50+
--rpc-url "$RPC_URL" \
4551
--broadcast \
4652
--verify \
4753
--chain "$CHAIN" \

0 commit comments

Comments
 (0)