Skip to content

Commit 5e1d4a9

Browse files
authored
add network flag to contract deployment script (#709)
1 parent af6b7b4 commit 5e1d4a9

File tree

4 files changed

+260
-334
lines changed

4 files changed

+260
-334
lines changed

e2e/utils/contractdeploy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func DeployContract(endpoint string) error {
1818
os.Setenv("PRIVATE_KEY", "0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6")
1919
os.Setenv("URL", endpoint)
2020

21-
cmd := exec.Command("bash", "-c", "./deploy.sh")
21+
cmd := exec.Command("bash", "-c", "./deploy.sh --network dev")
2222
cmd.Dir = smartcontractsPath
2323

2424
stdout, err := cmd.StdoutPipe()

smartcontracts/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export PROJECT_ADDRESS=0xf07336E1c77319B4e740b666eb0C2B19D11fc14F
77
export PROJECT_REGISTRATION_FEE=1.0
88
export PROVER_REGISTRATION_FEE=1.0
99
export MIN_STAKE=1.0
10-
./deploy.sh
10+
./deploy.sh --network mainnet|testnet|dev
1111
```
1212

1313
### Deployment

smartcontracts/deploy.sh

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,28 @@ if [[ -z "${PRIVATE_KEY}" ]]; then
2424
exit 1
2525
fi
2626

27+
# Default network
28+
NETWORK="mainnet"
29+
30+
# Parse command line arguments
31+
while [[ $# -gt 0 ]]; do
32+
key="$1"
33+
case $key in
34+
--network)
35+
NETWORK="$2"
36+
shift # past argument
37+
shift # past value
38+
;;
39+
*)
40+
echo "Missing --network option: $1"
41+
exit 1
42+
;;
43+
esac
44+
done
45+
2746
# Run the Hardhat deployment script
2847
echo "Running Hardhat deployment..."
29-
yarn hardhat run scripts/deploy.ts --network dev
48+
yarn hardhat run scripts/deploy.ts --network $NETWORK
3049

3150
# Check if the previous command was successful
3251
if [ $? -eq 0 ]; then

0 commit comments

Comments
 (0)