-
Notifications
You must be signed in to change notification settings - Fork 46
/
deploy_local.sh
29 lines (23 loc) · 1.02 KB
/
deploy_local.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
#!/usr/bin/env bash
# Read the RPC URL
echo Enter your mainnet RPC URL to fork a local Hardhat node from \(script uses silent mode\;\ i.e. not printed to the console\):
echo Example: "https://eth-mainnet.alchemyapi.io/v2/XXXXXXXXXX"
read -s rpc
## Fork the mainnet
echo Please wait 1 minute for Hardhat to fork the mainnet and run locally...
echo If this command fails, try running "yarn" to install Hardhat dependencies...
make -s mainnet-fork ETH_MAINNET_RPC_URL=$rpc &
# Wait for Hardhat to fork the mainnet
sleep 60
# Read the contract name
echo Which contract do you want to deploy \(e.g. Greeter\)?
read contract
# Read the constructor arguments
echo Enter the constructor arguments separated by spaces \(e.g. hello 0xacc4de8d4ca96c3f0c91b58f1d6c0d80cf8cc146 1\):
read -ra args
if [ -z "$args" ]
then
forge create -i ./contracts/src/${contract}.sol:${contract} --rpc-url "http://localhost:8545"
else
forge create -i ./contracts/src/${contract}.sol:${contract} --rpc-url "http://localhost:8545" --constructor-args ${args}
fi