Skip to content

Commit 8ff2948

Browse files
authored
fix: contracts verification (#62)
1 parent a976769 commit 8ff2948

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

docker/scripts/verify.sh

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,19 +98,29 @@ get_source_code_name() {
9898
fi
9999
}
100100

101+
function is_predeploy_contract() {
102+
local contract_name="$1"
103+
104+
if [[ "$contract_name" == "L2MessageQueue" || "$contract_name" == "L1GasPriceOracle" || "$contract_name" == "Whitelist" || "$contract_name" == "WrappedEther" || "$contract_name" == "L2TxFeeVault" ]]; then
105+
return 0 # True
106+
else
107+
return 1 # False
108+
fi
109+
}
110+
101111
# read the file line by line
102112
while IFS= read -r line; do
103113
extract_contract_info "$line"
104114

105115
# get contracts deployment layer
106116
if [[ "$contract_name" =~ ^L1 ]]; then
107117
layer="L1"
108-
elif [[ "$contract_name" =~ ^L2 ]]; then
109-
layer="L2"
110118
# specially handle contract_name L1_GAS_PRICE_ORACLE_ADDR
111119
if [[ "$contract_name" == "L1_GAS_PRICE_ORACLE_ADDR" ]]; then
112-
layer="L1"
120+
layer="L2"
113121
fi
122+
elif [[ "$contract_name" =~ ^L2 ]]; then
123+
layer="L2"
114124
else
115125
echo "wrong contract name, not starts with L1 or L2, contract_name: $contract_name"
116126
continue
@@ -120,7 +130,7 @@ while IFS= read -r line; do
120130

121131
# skip if source_code_name or contract_addr is empty
122132
if [[ -z $source_code_name || -z $contract_addr ]]; then
123-
echo "empty source_code_name: $source_code_name or contract_addr: $contract_addr"
133+
echo "empty source_code_name $source_code_name or contract_addr $contract_addr"
124134
continue
125135
fi
126136

@@ -145,6 +155,9 @@ while IFS= read -r line; do
145155
elif [[ "$VERIFIER_TYPE_L2" == "sourcify" ]]; then
146156
EXTRA_PARAMS="--api-key $EXPLORER_API_KEY_L2 --verifier-url $EXPLORER_URI_L2 --verifier $VERIFIER_TYPE_L2"
147157
fi
148-
forge verify-contract $contract_addr $source_code_name --rpc-url $RPC_URI_L2 --chain-id $CHAIN_ID_L2 --watch --guess-constructor-args --skip-is-verified-check $EXTRA_PARAMS
158+
if ! is_predeploy_contract "$source_code_name"; then
159+
string="$EXTRA_PARAMS\" --guess-constructor-args\""
160+
fi
161+
forge verify-contract $contract_addr $source_code_name --rpc-url $RPC_URI_L2 --chain-id $CHAIN_ID_L2 --watch --skip-is-verified-check $EXTRA_PARAMS
149162
fi
150163
done < ./volume/config-contracts.toml

0 commit comments

Comments
 (0)