-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
83 lines (62 loc) · 2.3 KB
/
Makefile
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
-include .env
VENV_DIR = venv
REQUIREMENTS_FILE = requirements.txt
# Target to create a virtual environment
create_venv:
@echo "Creating virtual environment..."
python3 -m venv $(VENV_DIR)
# Target to install dependencies
install_deps: create_venv $(REQUIREMENTS_FILE)
@echo "Activating virtual environment and installing dependencies..."
$(VENV_DIR)/bin/python -m pip install --upgrade pip
$(VENV_DIR)/bin/pip install -r $(REQUIREMENTS_FILE)
# Target to clean up the virtual environment and requirements file
clean-venv:
@echo "Cleaning up venv"
rm -rf $(VENV_DIR)
# Clean the repo
clean:; forge clean && \
rm -rf docs && \
rm -rf coverage && \
rm -rf cache out && \
rm -rf artifacts && \
rm -rf broadcast && \
rm -rf node_modules && \
rm -rf $(VENV_DIR)
# Remove modules
remove:; rm -rf .gitmodules && rm -rf .git/modules/* && rm -rf lib && touch .gitmodules && git add . && git commit -m "modules"
# Set up dependencies and build the project
setup:; make build && \
make install && \
make format
# Install dependencies
install:; ./install.sh && make install_deps
# Update Dependencies
update:; forge update
# Build the project
build:; forge build
# Run tests
test:; forge test -vvv --gas-report
# Create a snapshot
snapshot:; forge snapshot
# Format the code
format:; forge fmt
# Run Anvil
anvil:; anvil -m 'test test test test test test test test test test test junk' --steps-tracing --block-time 1
# Run Slither
slither:; $(VENV_DIR)/bin/slither . --config-file slither.config.json --checklist
# Scope command
scope:; tree ./src/ | sed 's/└/#/g; s/──/--/g; s/├/#/g; s/│ /|/g; s/│/|/g'
# Create scope file
scopefile:; @tree ./src/ | sed 's/└/#/g' | awk -F '── ' '!/\.sol$$/ { path[int((length($$0) - length($$2))/2)] = $$2; next } { p = "src"; for(i=2; i<=int((length($$0) - length($$2))/2); i++) if (path[i] != "") p = p "/" path[i]; print p "/" $$2; }' > scope.txt
# Linting commands
lint:; pnpm lint:sol
lint-sol:; forge fmt --check && pnpm solhint {script,src,test}/**/*.sol
# Test coverage
test-coverage:; forge coverage
test-coverage-report:; forge coverage --report lcov && genhtml lcov.info --branch-coverage --output-dir coverage
# Docs
build-docs:; forge doc
docs:; forge doc --serve --port 4000
# Deploy Anvil
deploy-anvil:; forge script Deploy -vvv --rpc-url "http://127.0.0.1:8545"