Skip to content

Commit 0018e69

Browse files
authored
chore: verification improvements for berachain (#114)
1 parent c594600 commit 0018e69

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

script/verification/verify-utils.sh

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ get_chain_config() {
3737
local chain_id="$1"
3838
local -a config
3939
case "$chain_id" in
40-
1) config=("$ETHERSCAN_API_KEY" "etherscan" "$MAINNET_RPC_URL" "https://etherscan.io/") ;; # ethereum
40+
1) config=("$ETHERSCAN_API_KEY" "etherscan" "$MAINNET_RPC_URL" "https://etherscan.io/") ;; # ethereum
4141
11155111) config=("$ETHERSCAN_API_KEY" "etherscan" "$SEPOLIA_RPC_URL" "https://sepolia.etherscan.io/") ;; # sepolia
4242
59144) config=("$LINEASCAN_API_KEY" "etherscan" "$LINEA_RPC_URL" "https://lineascan.build/") ;; # linea
4343
59141) config=("$LINEASCAN_API_KEY" "etherscan" "$LINEA_SEPOLIA_RPC_URL" "https://sepolia.lineascan.build/") ;; # linea-sepolia
@@ -49,10 +49,10 @@ get_chain_config() {
4949
421614) config=("$ARBISCAN_API_KEY" "etherscan" "$ARBITRUM_SEPOLIA_RPC_URL" "https://sepolia.arbiscan.io/") ;; # arbitrum-sepolia
5050
137) config=("$POLYGONSCAN_API_KEY" "etherscan" "$POLYGON_RPC_URL" "https://polygonscan.com/") ;; # polygon
5151
100) config=("$GNOSISSCAN_API_KEY" "etherscan" "$GNOSIS_RPC_URL" "https://gnosisscan.io/") ;; # gnosis
52-
10200) config=("$GNOSISSCAN_API_KEY" "blockscout" "$GNOSIS_CHIADO_RPC_URL" "https://gnosis-chiado.blockscout.com/api") ;; # gnosis-chiado
52+
10200) config=("$GNOSISSCAN_API_KEY" "blockscout" "$GNOSIS_CHIADO_RPC_URL" "https://gnosis-chiado.blockscout.com/api") ;; # gnosis-chiado
5353
56) config=("$BINANCESCAN_API_KEY" "etherscan" "$BINANCE_RPC_URL" "https://bscscan.com/") ;; # binance
5454
97) config=("$BINANCESCAN_API_KEY" "etherscan" "$BINANCE_TESTNET_RPC_URL" "https://testnet.bscscan.com/") ;; # binance-testnet
55-
80069) config=("$BERACHAIN_API_KEY" "etherscan" "$BERACHAIN_TESTNET_RPC_URL" "https://testnet.berascan.com/") ;; # berachain-testnet
55+
80069) config=("$BERACHAIN_API_KEY" "custom" "$BERACHAIN_TESTNET_RPC_URL" "https://api-testnet.berascan.com/api") ;; # berachain-testnet
5656
*)
5757
echo "Unknown chain ID: $chain_id" >&2
5858
return 1
@@ -99,19 +99,23 @@ verify_across_chains() {
9999
# Build the base forge verify command
100100
local cmd=(
101101
forge verify-contract
102-
--rpc-url "$rpc_url"
103-
--chain-id "$chain_id"
104102
--num-of-optimizations 200
105-
--verifier "$verifier"
106103
)
107104

108-
# Only add etherscan-api-key if verifier is etherscan
109-
if [[ "$verifier" == "etherscan" ]]; then
105+
# Only add if verifier is not custom, the custom verifier is simpler
106+
if [[ "$verifier" != "custom" ]]; then
107+
cmd+=( --rpc-url "$rpc_url" )
108+
cmd+=( --chain-id "$chain_id" )
109+
cmd+=( --verifier "$verifier" )
110+
fi
111+
112+
# Only add etherscan-api-key if verifier is etherscan or custom
113+
if [[ "$verifier" == "etherscan" ]] || [[ "$verifier" == "custom" ]]; then
110114
cmd+=( --etherscan-api-key "$api_key" )
111115
fi
112116

113-
# Only add verifier-url if verifier is blockscout
114-
if [[ "$verifier" == "blockscout" ]]; then
117+
# Only add verifier-url if verifier is blockscout or custom
118+
if [[ "$verifier" == "blockscout" ]] || [[ "$verifier" == "custom" ]]; then
115119
cmd+=( --verifier-url "$verifier_url" )
116120
fi
117121

0 commit comments

Comments
 (0)