forked from morpho-org/morpho-optimizers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
117 lines (83 loc) · 3.14 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
-include .env.local
.EXPORT_ALL_VARIABLES:
MAKEFLAGS += --no-print-directory
PROTOCOL ?= compound
NETWORK ?= eth-mainnet
FOUNDRY_SRC ?= src/${PROTOCOL}/
FOUNDRY_PROFILE ?= ${PROTOCOL}
FOUNDRY_PRIVATE_KEY ?= ${DEPLOYER_PRIVATE_KEY}
FOUNDRY_ETH_RPC_URL ?= https://${NETWORK}.g.alchemy.com/v2/${ALCHEMY_KEY}
ifeq (${FOUNDRY_PROFILE}, production)
FOUNDRY_TEST = test/prod/${PROTOCOL}/
else
FOUNDRY_TEST ?= test/${PROTOCOL}/
endif
install:
yarn
foundryup
git submodule update --init --recursive
chmod +x ./scripts/**/*.sh
chmod +x ./export_env.sh
deploy:
@echo Deploying Morpho-${PROTOCOL}-${NETWORK}
./scripts/${PROTOCOL}/deploy.sh
initialize:
@echo Initializing Morpho-${PROTOCOL}-${NETWORK}
./scripts/${PROTOCOL}/initialize.sh
create-market:
@echo Creating market on Morpho-${PROTOCOL}-${NETWORK}
./scripts/${PROTOCOL}/create-market.sh
anvil:
@echo Starting fork of ${NETWORK}
@anvil --fork-url ${FOUNDRY_ETH_RPC_URL} --fork-block-number "${FOUNDRY_FORK_BLOCK_NUMBER}"
script-%:
@echo Running script $* of Morpho-${PROTOCOL} on ${NETWORK} with script mode: ${SMODE}
@forge script scripts/${PROTOCOL}/$*.s.sol:$* --broadcast -vvvv
contracts:
FOUNDRY_TEST=/dev/null forge build --sizes --force
ci:
forge test -vvv
ci-upgrade:
@FOUNDRY_MATCH_CONTRACT=TestUpgrade FOUNDRY_FUZZ_RUNS=64 FOUNDRY_PROFILE=production make ci
test:
@echo Running Morpho-${PROTOCOL}-${NETWORK} tests under \"${FOUNDRY_TEST}\"\
with profile \"${FOUNDRY_PROFILE}\", seed \"${FOUNDRY_FUZZ_SEED}\",\
match contract patterns \"\(${FOUNDRY_MATCH_CONTRACT}\)!${FOUNDRY_NO_MATCH_CONTRACT}\",\
match test patterns \"\(${FOUNDRY_MATCH_TEST}\)!${FOUNDRY_NO_MATCH_TEST}\"
forge test -vvv | tee trace.ansi
test-prod:
@FOUNDRY_NO_MATCH_CONTRACT=TestUpgrade FOUNDRY_PROFILE=production make test
test-upgrade:
@FOUNDRY_MATCH_CONTRACT=TestUpgrade FOUNDRY_PROFILE=production make test
test-common:
@FOUNDRY_TEST=test/common/ make test
test-upgrade-%:
@FOUNDRY_MATCH_TEST=$* make test-upgrade
test-prod-%:
@FOUNDRY_MATCH_TEST=$* make test-prod
test-%:
@FOUNDRY_MATCH_TEST=$* make test
contract-% c-%:
@FOUNDRY_MATCH_CONTRACT=$* make test
coverage:
@echo Create lcov coverage report for Morpho-${PROTOCOL}-${NETWORK} tests
forge coverage --report lcov
lcov --remove lcov.info -o lcov.info "test/*"
lcov-html:
@echo Transforming the lcov coverage report into html
genhtml lcov.info -o coverage
gas-report:
@echo Create gas report from Morpho-${PROTOCOL}-${NETWORK} tests under \"${FOUNDRY_TEST}\"\
with profile \"${FOUNDRY_PROFILE}\", seed \"${FOUNDRY_FUZZ_SEED}\",
forge test --gas-report | tee trace.ansi
storage-layout-generate:
@./scripts/storage-layout.sh generate snapshots/.storage-layout-${PROTOCOL} Morpho RewardsManager Lens
storage-layout-check:
@./scripts/storage-layout.sh check snapshots/.storage-layout-${PROTOCOL} Morpho RewardsManager Lens
storage-layout-generate-no-rewards:
@./scripts/storage-layout.sh generate snapshots/.storage-layout-${PROTOCOL} Morpho Lens
storage-layout-check-no-rewards:
@./scripts/storage-layout.sh check snapshots/.storage-layout-${PROTOCOL} Morpho Lens
config:
@forge config
.PHONY: test config test-common foundry coverage contracts