-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
126 lines (104 loc) · 3.16 KB
/
Makefile
File metadata and controls
126 lines (104 loc) · 3.16 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
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# include .env file and export its env vars
# (-include to ignore error if it does not exist)
# include .env
.PHONY: all build test deploy clean format lint anvil
DEFAULT_ANVIL_KEY := 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
DEPLOY_URL := http://localhost:8545
# Default target
all: build test
# Build the project
build:
forge build
# Run tests
test:
forge test -vvv
# Run tests with coverage
coverage:
forge coverage
forge coverage --report
# Start anvil local node
anvil:
@echo "Starting anvil local node..."
@if lsof -Pi :8545 -sTCP:LISTEN -t >/dev/null ; then \
echo "Anvil is already running" ; \
else \
anvil --chain-id 1337 > /dev/null 2>&1 & \
echo "Anvil started with chain ID 1337" ; \
sleep 2 ; \
fi
# Deploy to local network
deploy-local: build
@echo "Checking if Anvil is running..."
@if ! lsof -Pi :8545 -sTCP:LISTEN -t >/dev/null ; then \
echo "Starting Anvil..." ; \
anvil --chain-id 1337 --code-size-limit 999999 > /dev/null 2>&1 & \
echo "Waiting for Anvil to start..." ; \
sleep 2 ; \
fi
@echo "Deploying to local network..."
forge script scripts/UniswapV3Deployer.s.sol:UniswapV3Deployer --rpc-url ${DEPLOY_URL} --broadcast --private-key ${DEFAULT_ANVIL_KEY} --skip-simulation --force -vvvv
# Stop anvil local node
stop-anvil:
@echo "Stopping anvil local node..."
@if lsof -Pi :8545 -sTCP:LISTEN -t >/dev/null ; then \
kill $$(lsof -Pi :8545 -sTCP:LISTEN -t) ; \
echo "Anvil stopped" ; \
else \
echo "No Anvil instance running" ; \
fi
# Deploy to testnet
deploy-testnet: build
forge script scripts/UniswapV3Deployer.s.sol:UniswapV3Deployer --rpc-url testnet --broadcast
# Deploy to mainnet
deploy-mainnet: build
forge script scripts/UniswapV3Deployer.s.sol:UniswapV3Deployer --rpc-url mainnet --broadcast
# Clean build artifacts
clean:
forge clean
# Format code
format:
forge fmt
# Run linter
lint:
forge fmt --check
forge build --force
# Install dependencies
install:
forge install
# Update dependencies
update:
forge update
# Generate documentation
doc:
forge doc
# Run gas report
gas-report:
forge test --gas-report
# Run slither analysis
slither:
slither .
# Run mythril analysis
mythril:
myth analyze src/*.sol
# Run all security checks
security: slither mythril
# Help command
help:
@echo "Available commands:"
@echo " make build - Build the project"
@echo " make test - Run tests"
@echo " make coverage - Run tests with coverage"
@echo " make anvil - Start anvil local node"
@echo " make stop-anvil - Stop anvil local node"
@echo " make deploy-local - Deploy to local network (starts anvil if not running)"
@echo " make deploy-testnet - Deploy to testnet"
@echo " make deploy-mainnet - Deploy to mainnet"
@echo " make clean - Clean build artifacts"
@echo " make format - Format code"
@echo " make lint - Run linter"
@echo " make install - Install dependencies"
@echo " make update - Update dependencies"
@echo " make doc - Generate documentation"
@echo " make gas-report - Run gas report"
@echo " make security - Run security checks"
@echo " make help - Show this help message"