2
2
# (-include to ignore error if it does not exist)
3
3
-include .env
4
4
5
-
6
5
# only export these env vars if ENVIRONMENT = local
7
6
ifeq ($(ENVIRONMENT ) , local)
8
7
export ETHEREUM_RPC_URL = $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/ETHEREUM_RPC_URL/credential)
@@ -15,6 +14,7 @@ ifeq ($(ENVIRONMENT), local)
15
14
export FANTOM_RPC_URL := $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/FANTOM_RPC_URL/credential)
16
15
export LINEA_RPC_URL := $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/LINEA_RPC_URL/credential)
17
16
export BLAST_RPC_URL := $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/BLAST_RPC_URL/credential)
17
+ export BARTIO_RPC_URL := $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/BARTIO_RPC_URL/credential)
18
18
export ETHEREUM_RPC_URL_QN := $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/ETHEREUM_RPC_URL/credential)
19
19
export BSC_RPC_URL_QN := $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/BSC_RPC_URL/credential)
20
20
export AVALANCHE_RPC_URL_QN := $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/AVALANCHE_RPC_URL/credential)
@@ -23,27 +23,158 @@ ifeq ($(ENVIRONMENT), local)
23
23
export OPTIMISM_RPC_URL_QN := $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/OPTIMISM_RPC_URL/credential)
24
24
export BASE_RPC_URL_QN := $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/BASE_RPC_URL/credential)
25
25
export FANTOM_RPC_URL_QN := $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/FANTOM_RPC_URL/credential)
26
+ export SEPOLIA_RPC_URL_QN := $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/SEPOLIA_RPC_URL/credential)
27
+ export BSC_TESTNET_RPC_URL_QN := $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/BSC_TESTNET_RPC_URL/credential)
26
28
export LINEA_RPC_URL_QN := $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/LINEA_RPC_URL/credential)
27
29
export BLAST_RPC_URL_QN := $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/BLAST_RPC_URL/credential)
30
+ export BARTIO_RPC_URL_QN := $(shell op read op://5ylebqljbh3x6zomdxi3qd7tsa/BARTIO_RPC_URL/credential)
31
+ endif
32
+
33
+ # Check for required dependencies
34
+ CHECK_FORGE := $(shell command -v forge 2> /dev/null)
35
+ CHECK_SOLC := $(shell command -v solc 2> /dev/null)
36
+ CHECK_ABIGEN := $(shell command -v abigen 2> /dev/null)
37
+ CHECK_ITYFUZZ := $(shell ityfuzz -v forge 2> /dev/null)
38
+
39
+
40
+ check-forge :
41
+ ifndef CHECK_FORGE
42
+ $(error "Forge is not installed. Please install Forge and retry.")
43
+ endif
44
+
45
+ check-solc :
46
+ ifndef CHECK_SOLC
47
+ $(error "Solc is not installed. Please install solc and retry.")
48
+ endif
49
+
50
+ check-abigen :
51
+ ifndef CHECK_ABIGEN
52
+ $(error "Abigen is not installed. Please install Abigen and retry.")
28
53
endif
29
54
30
- # deps
31
- install :; forge install
32
- update :; forge update
33
-
34
- # Build & test
35
- build :; FOUNDRY_PROFILE=production forge build
36
- build-unoptimized :; FOUNDRY_PROFILE=localdev forge build
37
- build-sizes :; FOUNDRY_PROFILE=production forge build --sizes
38
- test-vvv :; forge test --match-test test_DstSwapIndex0DirectToCSRIndex1 --evm-version cancun -vvv
39
- ftest :; forge test --evm-version cancun
40
- test-ci :; forge test --no-match-path "test/invariant/** /* .sol" --evm-version cancun
41
- coverage :; FOUNDRY_PROFILE=coverage forge coverage --no-match-path "test/invariant/** /* .sol" --no-match-contract SmokeTest --evm-version cancun --report lcov
42
- coverage-t :; FOUNDRY_PROFILE=coverage forge coverage --match-contract 5115 --evm-version cancun --report lcov
43
- smoke-test :; forge test --match-contract SmokeTest -vvv
44
- invariant :; forge test --match-path "test/invariant/** /* .sol" --evm-version cancun -vvv
45
- invariant-rewards :; forge test --match-test invariant_tokenBalances --evm-version cancun -vvv
46
- clean :; forge clean
47
- snapshot :; forge snapshot
48
- fmt :; forge fmt && forge fmt test/
49
- ityfuzz :; ityfuzz evm -m -- forge test
55
+ check-ityfuzz :
56
+ ifndef CHECK_ITYFUZZ
57
+ $(error "ityfuzz is not installed. Please install ityfuzz and retry.")
58
+ endif
59
+
60
+ # Targets that require the checks
61
+ generate : check-forge check-solc check-abigen
62
+ install : check-forge
63
+ update : check-forge
64
+ build : check-forge
65
+ build-unoptimized : check-forge
66
+ build-sizes : check-forge
67
+ test-vvv : check-forge
68
+ ftest : check-forge
69
+ test-ci : check-forge
70
+ coverage : check-forge
71
+ coverage-t : check-forge
72
+ smoke-test : check-forge
73
+ invariant : check-forge
74
+ invariant-rewards : check-forge
75
+ clean : check-forge
76
+ snapshot : check-forge
77
+ fmt : check-forge
78
+ ityfuzz : check-ityfuzz
79
+
80
+ .PHONY : generate
81
+ generate : build # # Generates go bindings for smart contracts
82
+ ./script/utils/retrieve-abis.sh
83
+
84
+ # General
85
+ abigen --abi out/SuperformRouter.sol/SuperformRouter.abi --pkg contracts --type SFRouter --out contracts/SuperformRouter.go
86
+ abigen --abi out/SuperformFactory.sol/SuperformFactory.abi --pkg contracts --type SFFactory --out contracts/SuperformFactory.go
87
+ abigen --abi out/SuperPositions.sol/SuperPositions.abi --pkg contracts --type SuperPositions --out contracts/SuperPositions.go
88
+ abigen --abi out/VaultClaimer.sol/VaultClaimer.abi --pkg contracts --type VaultClaimer --out contracts/VaultClaimer.go
89
+ abigen --abi out/CoreStateRegistry.sol/CoreStateRegistry.abi --pkg contracts --type CoreStateRegistry --out contracts/CoreStateRegistry.go
90
+
91
+ # Payments
92
+ abigen --abi out/PaymentHelper.sol/PaymentHelper.abi --pkg contracts --type PaymentHelper --out contracts/PaymentHelper.go
93
+ abigen --abi out/PayMaster.sol/PayMaster.abi --pkg contracts --type PayMaster --out contracts/PayMaster.go
94
+
95
+ # Forms
96
+ abigen --abi out/ERC4626Form.sol/ERC4626Form.abi --pkg contracts --type ERC4626Form --out contracts/ERC4626Form.go
97
+
98
+ # Superform router plus
99
+ abigen --abi out/SuperformRouterPlus.sol/SuperformRouterPlus.abi --pkg contracts --type SuperformRouterPlus --out contracts/SuperformRouterPlus.go
100
+ abigen --abi out/SuperformRouterPlusAsync.sol/SuperformRouterPlusAsync.abi --pkg contracts --type SuperformRouterPlusAsync --out contracts/SuperformRouterPlusAsync.go
101
+
102
+ .PHONY : install
103
+ install : # # Installs the project
104
+ forge install
105
+
106
+ .PHONY : update
107
+ update : # # Updates the project
108
+ forge update
109
+
110
+ .PHONY : build
111
+ build : # # Builds the project
112
+ FOUNDRY_PROFILE=production forge build
113
+
114
+ .PHONY : build-unoptimized
115
+ build-unoptimized : # # Builds the project unoptimized
116
+ FOUNDRY_PROFILE=localdev forge build
117
+
118
+ .PHONY : build-sizes
119
+ build-sizes : # # Builds the project and shows sizes
120
+ FOUNDRY_PROFILE=production forge build --sizes
121
+
122
+ .PHONY : test-vvv
123
+ test-vvv : # # Runs tests with verbose output
124
+ forge test --match-test test_superRegistryAddresses --evm-version cancun -vv
125
+
126
+ .PHONY : ftest
127
+ ftest : # # Runs tests with cancun evm version
128
+ forge test --evm-version cancun
129
+
130
+ .PHONY : test-ci
131
+ test-ci : # # Runs tests in CI mode
132
+ forge test --no-match-path " test/invariant/**/*.sol" --evm-version cancun
133
+
134
+ .PHONY : coverage
135
+ coverage : # # Runs coverage
136
+ FOUNDRY_PROFILE=coverage forge coverage --no-match-path " test/invariant/**/*.sol" --evm-version cancun --report lcov
137
+
138
+ .PHONY : coverage-t
139
+ coverage-t : # # Runs coverage for a specific contract
140
+ FOUNDRY_PROFILE=coverage forge coverage --match-contract 7540 --evm-version cancun --report lcov
141
+
142
+ .PHONY : smoke-test
143
+ smoke-test : # # Runs smoke tests
144
+ forge test --match-contract SmokeTest -vvv
145
+
146
+ .PHONY : invariant
147
+ invariant : # # Runs invariant tests
148
+ forge test --match-path " test/invariant/**/*.sol" --evm-version cancun -vvv
149
+
150
+ .PHONY : invariant-rewards
151
+ invariant-rewards : # # Runs invariant tests for rewards
152
+ forge test --match-test invariant_tokenBalances --evm-version cancun -vvv
153
+
154
+ .PHONY : clean
155
+ clean : # # Cleans the project
156
+ forge clean
157
+
158
+ .PHONY : snapshot
159
+ snapshot : # # Creates a snapshot
160
+ forge snapshot
161
+
162
+ .PHONY : fmt
163
+ fmt : # # Formats the project
164
+ forge fmt && forge fmt test/
165
+
166
+ .PHONY : ityfuzz
167
+ ityfuzz : # # Runs ityfuzz
168
+ ityfuzz evm -m -- forge test
169
+
170
+ # # Help display.
171
+ # # Pulls comments from beside commands and prints a nicely formatted
172
+ # # display with the commands and their usage information.
173
+ .DEFAULT_GOAL := help
174
+
175
+ .PHONY : help
176
+ help : # # Prints this help
177
+ @grep -h -E ' ^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST ) \
178
+ | sort \
179
+ | awk ' BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
180
+
0 commit comments