-
Notifications
You must be signed in to change notification settings - Fork 82
/
Makefile
50 lines (40 loc) · 1.36 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
# include .env file and export its env vars
# (-include to ignore error if it does not exist)
-include .env
install: update npm solc
# deps
update:; forge update
# npm deps for linting etc.
npm:; yarn install
# install solc version
# example to install other versions: `make solc 0_8_2`
SOLC_VERSION := 0_8_13
solc:; nix-env -f https://github.com/dapphub/dapptools/archive/master.tar.gz -iA solc-static-versions.solc_${SOLC_VERSION}
# Build & test
build :; forge build --optimize
test :; forge test --optimize
fuzz :; forge test -v --optimize
clean :; forge clean
lint :; yarn run lint
estimate :; ./scripts/estimate-gas.sh ${contract}
size :; ./scripts/contract-size.sh ${contract}
snapshot :; forge snapshot --optimize
test-deploy :; ./scripts/test-deploy.sh
# Deployment helpers
deploy :; @./scripts/deploy.sh
# mainnet
deploy-mainnet: export ETH_RPC_URL = $(call network,mainnet)
deploy-mainnet: check-api-key deploy
# rinkeby
deploy-rinkeby: export ETH_RPC_URL = $(call network,rinkeby)
deploy-rinkeby: check-api-key deploy
check-api-key:
ifndef ALCHEMY_API_KEY
$(error ALCHEMY_API_KEY is undefined)
endif
# Returns the URL to deploy to a hosted node.
# Requires the ALCHEMY_API_KEY env var to be set.
# The first argument determines the network (mainnet / rinkeby / ropsten / kovan / goerli)
define network
https://eth-$1.alchemyapi.io/v2/${ALCHEMY_API_KEY}
endef