forked from pcaversaccio/hardhat-project-template-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
verify.sh
38 lines (29 loc) · 1.11 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
#!/usr/bin/env bash
echo Which compiler version did you use to build?
read version
echo Selected compiler version: $version
echo Which contract do you want to verify \(e.g. Greeter\)?
read contract
echo Selected contract name: $contract
echo What is the deployed address?
read deployed
echo Selected contract address: $deployed
echo What is the chain ID of the deployed address?
read id
echo Selected chain ID: $id
echo Enter the constructor abi \(e.g. constructor\(string\)\):
read abi
echo Selected constructor abi: $abi
echo Enter the constructor arguments separated by spaces \(e.g. 1 2 3\):
read -ra args
echo Selected constructor arguments: $args
encoded=`cast abi-encode $abi $args`
echo ABI-encoded constructor arguments: ${encoded:2}
echo Enter your Etherscan API key:
read -s etherscan
if [ -z "$args" ]
then
forge verify-contract --chain-id $id --compiler-version $version $deployed ./contracts/src/${contract}.sol:${contract} $etherscan
else
forge verify-contract --constructor-args ${encoded:2} --chain-id $id --compiler-version $version $deployed ./contracts/src/${contract}.sol:${contract} $etherscan
fi