-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
168 lines (135 loc) · 4.75 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
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# include .env file and export its env vars
# (-include to ignore error if it does not exist)
-include .env
.DEFAULT_GOAL := help
.PHONY: help
help: ## display this help message
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-10s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
# inspiration from Patrick Collins: https://github.com/smartcontractkit/foundry-starter-kit/blob/main/Makefile
# wip (don't use "all" yet)
all: clean remove install update build
clean: ## clean the repo
forge clean
update: ## update rust, foundry and submodules
rustup update && foundryup && forge update
formatsol: ## run prettier on src, test and scripts
yarn run prettier
lintsol: ## run prettier and solhint
yarn run lint
devnet: ## run development node
anvil -f ${ALCHEMY_ETH_MAINNET_RPC_URL} \
--fork-block-number 15078000 \
-vvvv
prep-build:
@echo "preparing build"
node ./script/prep-build.js
build: ## forge build
forge build --names --sizes && node ./script/write-index.js && yarn tsc
b: build
bscript: ## build forge scripts
forge build --root . --contracts script/
.PHONY: test
test: ## forge test local, alias t
forge test
t: test
tt: ## forge test local -vv
forge test -vv
ttt: ## forge test local -vvv
forge test -vvv
tttt: ## forge test local -vvvv
forge test -vvvv
gas: ## gas snapshot
forge snapshot --check
gasforksnap: ## gas snapshot mainnet fork
forge snapshot --snap .gas-snapshot \
-f ${ALCHEMY_ETH_MAINNET_RPC_URL} \
--fork-block-number 15078000
gasforkcheck: ## gas check mainnet fork
forge snapshot --check \
-f ${ALCHEMY_ETH_MAINNET_RPC_URL} \
--fork-block-number 15078000 \
--via-ir
gasforkdiff: ## gas snapshot diff mainnet fork
forge snapshot --diff \
-f ${ALCHEMY_ETH_MAINNET_RPC_URL} \
--fork-block-number 15078000 \
--via-ir
cov: ## coverage report -vvv
forge coverage -vvv
coverage: ## coverage report (lcov), filtered for CI
forge coverage -vvv --report lcov --via-ir && node ./cli-tools/filter-lcov.js
lcov: ## coverage report (lcov)
forge coverage --report lcov --via-ir
lcov-fork: ## coverage report (lcov) for mainnet fork
forge coverage --report lcov \
-f ${ALCHEMY_ETH_MAINNET_RPC_URL} \
--fork-block-number 15078000 \
--via-ir
anvil-fork: ## fork goerli locally with anvil
anvil -f ${ALCHEMY_ETH_GOERLI_RPC_URL}
deploy-local: ## deploy contracts to local node with sender 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
forge script DeployProxy \
-f http:\\127.0.0.1:8545 \
--sender 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 \
--private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \
--broadcast \
-vvvv
# Deployment defaults to upgrading
facetsToCutIn="[]"
newDiamond=false
initNewDiamond=false
facetAction=1
senderAddress=0x90C36636E885BEE8096E4d12a7372866ab782091
deploy-goerli: ## deploy contracts to goerli with sender 0x90C36636E885BEE8096E4d12a7372866ab782091
@forge script SmartDeploy \
-s "smartDeploy(bool, bool, uint8, string[] memory)" ${newDiamond} ${initNewDiamond} ${facetAction} ${facetsToCutIn} \
-f ${ALCHEMY_ETH_GOERLI_RPC_URL} \
--chain-id 5 \
--etherscan-api-key ${ETHERSCAN_API_KEY} \
--sender ${senderAddress} \
--mnemonic-paths ./mnemonic.txt \
--mnemonic-indexes 0 \
-vv \
--ffi \
--broadcast \
--verify --delay 30 --retries 10
deploy-sim: ## simulate smart deploy to goerli
forge script SmartDeploy \
-s "smartDeploy(bool, bool, uint8, string[] memory)" ${newDiamond} ${initNewDiamond} ${facetAction} ${facetsToCutIn} \
-f ${ALCHEMY_ETH_GOERLI_RPC_URL} \
--chain-id 5 \
--etherscan-api-key ${ETHERSCAN_API_KEY} \
--sender ${senderAddress} \
--mnemonic-paths ./mnemonic.txt \
--mnemonic-indexes 0 \
-vvvv \
--ffi
deploy-polygon-zk: ## deploy contracts to polygon zkEVM testnet with sender 0x90C36636E885BEE8096E4d12a7372866ab782091
forge script DeployProxy \
-f https://rpc.public.zkevm-test.net \
--chain-id 1422 \
--sender ${senderAddress} \
--mnemonic-paths ./mnemonic.txt \
--mnemonic-indexes 0 \
-vvvv \
--ffi \
--legacy
update-twap: ## Update params related to TWAP oracle
forge script UpdateParams \
-f ${ALCHEMY_ETH_GOERLI_RPC_URL} \
--chain-id 5 \
--etherscan-api-key ${ETHERSCAN_API_KEY} \
--sender ${senderAddress} \
--mnemonic-paths ./mnemonic.txt \
--mnemonic-indexes 0 \
-vvvv \
--ffi \
--broadcast
release: build
yarn standard-version && git push --follow-tags
build-zksync: ## build zksync contracts
rm -dr artifacts-zk ; rm -dr cache_hardhat-zk ; yarn hardhat compile
deploy-zksync: ## deploy zksync contracts to zksync testnet with sender 0x90C36636E885BEE8096E4d12a7372866ab782091
yarn hardhat deploy-zksync --script deploy.ts
verify-hardhat: ## verify contracts (including on zksync explorer)
yarn hardhat verify