#!/usr/bin/env bash # Local dev environment: anvil + multicall3 + demo deployment. # Usage: ./script/setup-local.sh set -euo pipefail cd "$(dirname "$0")/.." RPC=http://localhost:8545 # anvil default account #0 PK=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 MULTICALL3=0xcA11bde05977b3631167028862bE2a173976CA11 if ! cast chain-id --rpc-url $RPC >/dev/null 2>&1; then echo "anvil is not running, start it with: anvil --port 8545" exit 1 fi # wagmi batches reads through multicall3, which vanilla anvil lacks if [ "$(cast code $MULTICALL3 --rpc-url $RPC)" = "0x" ]; then echo "etching multicall3..." BYTECODE=$(cast code $MULTICALL3 --rpc-url https://1rpc.io/eth) cast rpc anvil_setCode $MULTICALL3 "$BYTECODE" --rpc-url $RPC >/dev/null fi echo "deploying demo environment..." PRIVATE_KEY=$PK forge script script/Deploy.s.sol --rpc-url $RPC --broadcast | grep -E "(hUSD|HoodquidityVaults|campaign)" echo "done. Update apps/web/src/lib/contracts.ts if addresses changed."