anvil_fork 973 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. # This script forks a chain using anvil with the mnemonic that is used in the
  4. # testing environment.
  5. # It's a wrapper around anvil using Docker.
  6. # In an ideal world, we could just use anvil directly, but there are regular
  7. # upstream breaking changes in the nightly builds, and binaries of older
  8. # versions are deleted frequently from their GitHub. The Docker releases are
  9. # available for longer, so we just use those here.
  10. if [ -z "$1" ]; then
  11. echo "Usage: $0 <chain name>" >&2
  12. exit 1
  13. fi
  14. CHAIN_NAME="$1"
  15. # This is a known-to-be-working build.
  16. DOCKER_IMAGE="ghcr.io/foundry-rs/foundry:nightly-0d4468765c264d00ac961275fe176ce003d3e4ca@sha256:88fe2ea1005b9a3a7f8068645fef4cfb0fa7c16a5dd3b35582c70a1e36d16c25"
  17. docker run --rm -i -p 8545:8545 $DOCKER_IMAGE "anvil --host 0.0.0.0 --base-fee 0 --fork-url $(worm rpc mainnet $CHAIN_NAME) --mnemonic 'myth like bonus scare over problem client lizard pioneer submit female collect'"