forked from chirag-bgh/console-V2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_script_local.sh
More file actions
executable file
·36 lines (28 loc) · 890 Bytes
/
run_script_local.sh
File metadata and controls
executable file
·36 lines (28 loc) · 890 Bytes
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
#!/usr/bin/env bash
# Read the RPC URL
source .env
## Fork Mainnet
echo Please wait a few seconds for anvil to fork mainnet and run locally...
anvil --fork-url $RPC_URL &
# Wait for anvil to fork
sleep 5
# Read script
echo Which script do you want to run?
read script
# Read script arguments
echo Enter script arguments, or press enter if none:
read -ra args
# Run the script
echo Running Script: $script...
# We specify the anvil url as http://localhost:8545
# We need to specify the sender for our local anvil node
forge script $script \
--fork-url http://localhost:8545 \
--broadcast \
-vvvv \
--sender 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 \
--private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \
$args
# Once finished, we want to kill our anvil instance running in the background
trap "exit" INT TERM
trap "kill 0" EXIT