Skip to content

Commit a915f09

Browse files
authored
support CREATE2 (#1354)
Signed-off-by: Ihor Farion <ihor@umaproject.org>
1 parent c02b587 commit a915f09

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

scripts/verifyBytecode.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ if [[ "$1" == "--broadcast" ]]; then
5454
fi
5555
[[ -f "$RUN_JSON" ]] || { echo "run json not found: $RUN_JSON"; exit 1; }
5656

57-
TX_ENTRY=$(jq -c --arg name "$CONTRACT_NAME" '[.transactions[] | select(.transactionType=="CREATE" and .contractName==$name)][-1]' "$RUN_JSON")
58-
[[ "$TX_ENTRY" != "null" ]] || { echo "no CREATE tx found for $CONTRACT_NAME in $RUN_JSON"; exit 1; }
57+
TX_ENTRY=$(jq -c --arg name "$CONTRACT_NAME" '[.transactions[] | select(.transactionType==("CREATE","CREATE2") and .contractName==$name)][-1]' "$RUN_JSON")
58+
[[ "$TX_ENTRY" != "null" ]] || { echo "no CREATE/CREATE2 tx found for $CONTRACT_NAME in $RUN_JSON"; exit 1; }
5959
TX=$(jq -r '.hash' <<< "$TX_ENTRY")
6060
else
6161
TX="$1"
@@ -71,7 +71,7 @@ else
7171
fi
7272
[[ -f "$RUN_JSON" ]] || { echo "run json not found: $RUN_JSON"; exit 1; }
7373

74-
TX_ENTRY=$(jq -c --arg tx "$TX" --arg name "$CONTRACT_NAME" '[.transactions[]? | select((((.hash // "") | tostring | ascii_downcase) == ($tx | ascii_downcase)) and .transactionType=="CREATE" and .contractName==$name)][0]' "$RUN_JSON")
74+
TX_ENTRY=$(jq -c --arg tx "$TX" --arg name "$CONTRACT_NAME" '[.transactions[]? | select((((.hash // "") | tostring | ascii_downcase) == ($tx | ascii_downcase)) and .transactionType==("CREATE","CREATE2") and .contractName==$name)][0]' "$RUN_JSON")
7575
[[ "$TX_ENTRY" != "null" ]] || {
7676
echo "tx $TX for CREATE $CONTRACT_NAME not found in $RUN_JSON"
7777
echo "Hint: run-latest.json may have an incorrect/stale CREATE tx hash. You can try to FIX MANUALLY."
@@ -82,6 +82,12 @@ fi
8282

8383
ONCHAIN=$(cast tx "$TX" --rpc-url "$RPC" --json | jq -r '.input' | sed 's/^0x//')
8484

85+
TX_TYPE=$(jq -r '.transactionType' <<< "$TX_ENTRY")
86+
if [[ "$TX_TYPE" == "CREATE2" ]]; then
87+
# CREATE2 deployer tx input = salt (32 bytes) || initCode
88+
ONCHAIN="${ONCHAIN:64}"
89+
fi
90+
8591
ART=out/$CONTRACT_NAME.sol/$CONTRACT_NAME.json
8692
[[ -f "$ART" ]] || { echo "artifact not found: $ART"; exit 1; }
8793

0 commit comments

Comments
 (0)