-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (46 loc) · 1.52 KB
/
Copy pathMakefile
File metadata and controls
56 lines (46 loc) · 1.52 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
-include .env
.PHONY: all test clean deploy upgrade help build anvil local sepolia
# Network and account configuration
# Usage: make deploy local (uses anviltest account)
# make deploy sepolia (uses shaoguoji account, with verify)
IS_SEPOLIA := $(filter sepolia,$(MAKECMDGOALS))
NETWORK := $(if $(IS_SEPOLIA),sepolia,local)
ACCOUNT := $(if $(IS_SEPOLIA),shaoguoji,anviltest)
VERIFY_FLAG := $(if $(IS_SEPOLIA),--verify,)
# Dummy targets to allow 'make deploy local' without error
local:; @:
sepolia:; @:
help:
@echo "Usage:"
@echo " make deploy [local|sepolia] - Deploy a contract"
@echo " make test - Run all tests"
@echo " make anvil - Start local anvil chain"
@echo ""
@echo "Networks:"
@echo " local - Anvil (http://127.0.0.1:8545), account: anviltest"
@echo " sepolia - Sepolia testnet, account: shaoguoji (auto verify)"
all: build test
# Build contracts
build:
forge clean && forge build
# Run tests
test:
forge test -vvv
# Clean build artifacts
clean:
forge clean
# Start local anvil chain
anvil:
anvil -m 'test test test test test test test test test test test junk' --steps-tracing --block-time 1
# Deploy AutoBank
deploy:
@echo "================================================"
@echo "Deploying contract to $(NETWORK)"
@echo "Account: $(ACCOUNT)"
@echo "Verify: $(if $(IS_SEPOLIA),Yes,No)"
@echo "================================================"
forge script script/Deploy.s.sol \
--rpc-url $(NETWORK) \
--account $(ACCOUNT) \
--broadcast \
$(VERIFY_FLAG)