Houndry Toolkit
This is a hardhat project that simplifies running anvil forked networks.
Installation
- Be sure to have installed foundry.
- Install this project
pnpm i @decent.xyz/houndry-toolkit
- Import the scripts into your
hardhat.config.ts
file.
import "@decent.xyz/houndry-toolkit";
Then you can run npx hardhat --help
in your project and you get to see the tasks
imported by this project.
npx hardhat --help
Hardhat version 2.19.1
Usage: hardhat [GLOBAL OPTIONS] [SCOPE] <TASK> [TASK OPTIONS]
...
AVAILABLE TASKS:
...
list-forks lists all running forks
start-fork starts a fork of a chain
start-forks starts forks of multiple chains
start-glue starts the glue service
stop-all-forks stops all running forks
stop-fork
stop-glue starts the glue service
Tasks
start-fork --chain <chain> --port <port>
Starts a fork-net, pretty self-explanatory.
The chains are defined in the .env
file. Refer to .env.example`
file for reference. Refer to getNewFork to see how
the forks are started. It retrieves the rpc from getRpc.
This generates a glueConfig.json
for the glue service
to use. It also generates a runningForks.json
file to keep track of the
running forks.
pnpm task start-fork --chain ethereum --port 6969
> @decent.xyz/houndry-toolkit@1.0.23 task /Users/arshankhanifar/trying_shit/houndry-toolkit
> hardhat "start-fork" "--chain" "ethereum" "--port" "6969"
running command: anvil -p 6969 -f https://mainnet.infura.io/v3/b51ad11ef8684195bf1b0e1cce635d67
started new fork at :{
"chain": "ethereum",
"pid": 90176,
"port": 6969
}
start-forks --chains <chain1,chain2>
Starts forks of comma-separated chains, starts the ports from 8545 and goes up from there.
start-glue
Starts the glue service. The glueConfig.json
will have already been
generated through running start-fork
and start-forks
.
stop-glue
Stops the glue service.
list-forks
Shows all the currently running forks:
pnpm task list-forks
> @decent.xyz/houndry-toolkit@1.0.23 task /Users/arshankhanifar/trying_shit/houndry-toolkit
> hardhat "list-forks"
chain: ethereum - port: 6969 - pid: 90176
chain: arbitrum - port: 6970 - pid: 93002
stop-all-forks
Stops all running forks.
Forknet Logs
There's a .forks/
directory created, where you can see the logs generated by
each forked network.
You can also watch the logs by running tail -f
. For instance, if you have
a fork of ethereum running, run:
tail -f ./.forks/ethereum.log
And that shows u the live logs.