Skip to content

Commit c055a78

Browse files
committed
Format the script
Signed-off-by: Faisal Usmani <[email protected]>
1 parent bc43acf commit c055a78

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

scripts/veryfyBytecode.sh

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
#!/bin/bash
22

3+
# This script verifies the bytecode of a contract onchain matches the bytecode in the artifact
4+
# It takes the following arguments:
5+
# 1. The transaction hash of the contract deployment
6+
# 2. The RPC URL to use
7+
# 3. The name of the contract
8+
9+
# Note that this script doesn't take into account any link libraries that are used in the contract
10+
311
args=("$@")
412

513
if [ ${#args[@]} -ne 3 ]; then
@@ -12,27 +20,18 @@ RPC=${args[1]}
1220
CONTRACT_NAME=${args[2]}
1321

1422
ONCHAIN=$(cast tx $TX --rpc-url $RPC --json | jq -r '.input' | sed 's/^0x//')
15-
echo "$ONCHAIN" > onchain_creation.hex
1623

1724
ART=out/$CONTRACT_NAME.sol/$CONTRACT_NAME.json
1825

1926
CREATION=$(jq -r '.bytecode.object' "$ART" | sed 's/^0x//')
2027

21-
TAIL=${ONCHAIN:${#CREATION}}
2228
CODE_ONCHAIN=${ONCHAIN:0:${#CREATION}}
2329

24-
25-
2630
cast keccak $CODE_ONCHAIN
2731
cast keccak $CREATION
2832

29-
if [[ $CODE_ONCHAIN == $CREATION ]]; then
30-
echo "✅ Code match";
31-
else
32-
echo "❌ Code mismatch";
33+
if [[ $CODE_ONCHAIN == $CREATION ]]; then
34+
echo "✅ Code match"
35+
else
36+
echo "❌ Code mismatch"
3337
fi
34-
35-
36-
37-
38-

0 commit comments

Comments
 (0)