-
Notifications
You must be signed in to change notification settings - Fork 3
/
verify.sh
executable file
·75 lines (68 loc) · 2.35 KB
/
verify.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Default network value
network="2021"
networkName="ronin-testnet"
endpoint=https://sourcify.roninchain.com/server
# Function to print usage and exit
usage() {
echo "Usage: $0 -c <network>"
echo " -c: Specify the network (ronin-testnet or ronin-mainnet)"
exit 1
}
# Parse command-line options
while getopts "c:" opt; do
case $opt in
c)
case "$OPTARG" in
ronin-testnet)
child_folder="ronin-testnet"
network="2021"
networkName="ronin-testnet"
;;
ronin-mainnet)
child_folder="ronin-mainnet"
network="2020"
networkName="ronin-mainnet"
;;
*)
echo "Unknown network specified: $OPTARG"
usage
;;
esac
;;
*)
usage
;;
esac
done
yarn hardhat sourcify --endpoint ${endpoint} --network ${networkName}
# ToDo(TuDo): make foundry verification perfectly match using sourcify
# # Shift the processed options out of the argument list
# shift $((OPTIND - 1))
# # Define the deployments folder by concatenating it with the child folder
# folder="deployments/$child_folder"
# # Check if the specified folder exists
# if [ ! -d "$folder" ]; then
# echo "Error: The specified folder does not exist for the selected network."
# exit 1
# fi
# # Loop through JSON files in the selected folder
# for file in "$folder"/*.json; do
# # Check if the file exists and is a regular file
# if [ -f "$file" ]; then
# # Exclude the .chainId file
# if [ "$(basename "$file")" != ".chainId" ]; then
# # Extract contractName and address from the JSON file
# contractName=$(jq -r '.contractName' "$file")
# address=$(jq -r '.address' "$file")
# absolutePath=$(jq -r '.ast.absolutePath' "$file")
# # Check if contractName and address are not empty
# if [ -n "$contractName" ] && [ -n "$address" ]; then
# echo "$absolutePath"
# # Call the forge command for verification with the specified network
# forge verify-contract --verifier sourcify --verifier-url ${endpoint} -c "$network" "$address" "$absolutePath:$contractName"
# else
# echo "Error: Missing contractName or address in $file"
# fi
# fi
# fi
# done