generated from bgd-labs/bgd-forge-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
287 lines (212 loc) · 9.81 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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# To avoid make printing out commands and potentially exposing private keys, prepend an "@" to the command.
# include .env file and export its env vars
# (-include to ignore error if it does not exist)
-include .env
# deps
update:; forge update
# Build & test
build :; forge build --sizes --via-ir
test :; forge test -vvv
# ---------------------------------------------- BASE SCRIPT CONFIGURATION ---------------------------------------------
BASE_LEDGER = --legacy --ledger --mnemonic-indexes $(MNEMONIC_INDEX) --sender $(LEDGER_SENDER)
BASE_KEY = --private-key ${PRIVATE_KEY}
custom_ethereum := --with-gas-price 20000000000 # 53 gwei
#custom_polygon := --with-gas-price 190000000000 # 560 gwei
#custom_avalanche := --with-gas-price 27000000000 # 27 gwei
#custom_metis-testnet := --legacy --verifier-url https://goerli.explorer.metisdevops.link/api/
#custom_metis := --verifier-url https://api.routescan.io/v2/network/mainnet/evm/1088/etherscan
#custom_scroll-testnet := --legacy --with-gas-price 1000000000 # 1 gwei
custom_zksync := --zksync
custom_linea-testnet := --legacy --with-gas-price 27000000000 --force # 1 gwei
custom_linea := --with-gas-price 1000000000 --force # 1 gwei
custom_ethereum-testnet := --legacy --with-gas-price 27000000000 --force # 1 gwei
# params:
# 1 - path/file_name
# 2 - network name
# 3 - script to call if not the same as network name (optional)
# to define custom params per network add vars custom_network-name
# to use ledger, set LEDGER=true to env
# default to testnet deployment, to run production, set PROD=true to env
define deploy_single_fn
forge script \
scripts/$(1).s.sol:$(if $(3),$(if $(PROD),$(3),$(3)_testnet),$(shell UP=$(if $(PROD),$(2),$(2)_testnet); echo $${UP} | perl -nE 'say ucfirst')) \
--rpc-url $(if $(PROD),$(2),$(2)-testnet) --broadcast --verify -vvvv \
$(if $(LEDGER),$(BASE_LEDGER),$(BASE_KEY)) \
$(custom_$(if $(PROD),$(2),$(2)-testnet))
endef
# catapulta
#define deploy_single_fn
#npx catapulta@latest script \
# scripts/$(1).s.sol:$(if $(3),$(3),$(shell UP=$(if $(PROD),$(2),$(2)_testnet); echo $${UP} | perl -nE 'say ucfirst')) \
# --network $(2) --slow --skip-git \
# $(if $(LEDGER),$(BASE_LEDGER),$(BASE_KEY)) \
# $(custom_$(if $(PROD),$(2),$(2)-testnet))
#
#endef
define deploy_fn
$(foreach network,$(2),$(call deploy_single_fn,$(1),$(network),$(3)))
endef
# ----------------------------------------------------------------------------------------------------------------------
# ----------------------------------------- PRODUCTION DEPLOYMENT SCRIPTS ---------------------------------------------------------
# deploy emergency registry
deploy-emergency-registry:
$(call deploy_fn,Deploy_EmergencyRegistry,ethereum)
# Deploy Proxy Factories on all networks
deploy-proxy-factory:
$(call deploy_fn,InitialDeployments,ethereum avalanche polygon optimism arbitrum metis base binance gnosis zkevm)
# Deploy Cross Chain Infra on all networks
deploy-cross-chain-infra:
$(call deploy_fn,ccc/Deploy_CCC,ethereum avalanche polygon optimism arbitrum metis base binance gnosis zkevm)
## Deploy CCIP bridge adapters on all networks
deploy-ccip-bridge-adapters:
$(call deploy_fn,adapters/DeployCCIP,ethereum avalanche binance polygon binance gnosis)
## Deploy LayerZero bridge adapters on all networks
deploy-lz-bridge-adapters:
$(call deploy_fn,adapters/DeployLZ,ethereum avalanche binance polygon binance gnosis)
## Deploy HyperLane bridge adapters on all networks
deploy-hl-bridge-adapters:
$(call deploy_fn,adapters/DeployHL,ethereum avalanche binance polygon binance gnosis)
## Deploy SameChain adapters on ethereum
deploy-same-chain-adapters:
$(call deploy_fn,adapters/DeploySameChainAdapter,ethereum)
deploy-optimism-adapters:
$(call deploy_fn,adapters/DeployOpAdapter,ethereum optimism)
deploy-arbitrum-adapters:
$(call deploy_fn,adapters/DeployArbAdapter,ethereum arbitrum)
deploy-metis-adapters:
$(call deploy_fn,adapters/DeployMetisAdapter,ethereum metis)
deploy-polygon-adapters:
$(call deploy_fn,adapters/DeployPolygon,ethereum polygon)
deploy-base-adapters:
$(call deploy_fn,adapters/DeployCBaseAdapter,ethereum base)
deploy-gnosis-adapters:
$(call deploy_fn,adapters/DeployGnosisChain,ethereum gnosis)
deploy-scroll-adapters:
$(call deploy_fn,adapters/DeployScrollAdapter,ethereum scroll)
deploy-zkevm-adapters:
$(call deploy_fn,adapters/DeployZkEVMAdapter,ethereum zkevm)
deploy-wormhole-adapters:
$(call deploy_fn,adapters/DeployWormholeAdapter,ethereum celo)
deploy-zksync-adapters:
$(call deploy_fn,adapters/DeployZkSyncAdapter,ethereum)
deploy-linea-adapters:
$(call deploy_fn,adapters/DeployLineaAdapter,ethereum linea)
## Set sender bridge dapters. Only eth pol avax are needed as other networks will only receive
set-ccf-sender-adapters:
$(call deploy_fn,ccc/Set_CCF_Sender_Adapters,ethereum)
# Set the bridge adapters allowed to receive messages
set-ccr-receiver-adapters:
$(call deploy_fn,ccc/Set_CCR_Receivers_Adapters,ethereum polygon avalanche binance arbitrum optimism base metis gnosis zkevm)
# Sets the required confirmations
set-ccr-confirmations:
$(call deploy_fn,CCC/Set_CCR_Confirmations,ethereum polygon avalanche optimism arbitrum metis base binance gnosis zkevm)
# Generate Addresses Json
write-json-addresses :; forge script scripts/WriteAddresses.s.sol:WriteDeployedAddresses -vvvv
## Deploy and configure all contracts
deploy-full:
make deploy-proxy-factory
make deploy-cross-chain-infra
make deploy-ccip-bridge-adapters
make deploy-lz-bridge-adapters
make deploy-hl-bridge-adapters
make deploy-same-chain-adapters
make deploy-optimism-adapters
make deploy-arbitrum-adapters
make deploy-metis-adapters
make deploy-polygon-adapters
make set-ccf-approved-senders
make set-ccf-sender-adapters
make set-ccr-receiver-adapters
make set-ccr-confirmations
make fund-crosschain
make write-json-addresses
# ----------------------------------------------------------------------------------------------------------------------
# ----------------------------------------- TESTNET DEPLOYMENT SCRIPTS ---------------------------------------------------------
# Deploy Proxy Factories on all networks
deploy-proxy-factory-test:
$(call deploy_fn,InitialDeployments,linea)
# Deploy Cross Chain Infra on all networks
deploy-cross-chain-infra-test:
$(call deploy_fn,ccc/DeployCCC,linea)
## Deploy CCIP bridge adapters on all networks
deploy-ccip-bridge-adapters-test:
$(call deploy_fn,adapters/DeployCCIP,ethereum)
## Deploy LayerZero bridge adapters on all networks
deploy-lz-bridge-adapters-test:
$(call deploy_fn,adapters/DeployLZ,ethereum)
## Deploy HyperLane bridge adapters on all networks
deploy-hl-bridge-adapters-test:
$(call deploy_fn,adapters/DeployHL,ethereum)
## Deploy SameChain adapters on ethereum
deploy-same-chain-adapters-test:
$(call deploy_fn,adapters/DeploySameChainAdapter,ethereum)
deploy-scroll-adapters-test:
$(call deploy_fn,adapters/DeployScrollAdapter,ethereum)
deploy-wormhole-adapters-test:
$(call deploy_fn,adapters/DeployWormholeAdapter,ethereum)
deploy-polygon-adapters-test:
$(call deploy_fn,adapters/DeployPolygon,ethereum)
deploy-gnosis-adapters-test:
$(call deploy_fn,adapters/DeployGnosisChain,ethereum)
deploy-arbitrum-adapters-test:
$(call deploy_fn,adapters/DeployArbAdapter,ethereum)
deploy-optimism-adapters-test:
$(call deploy_fn,adapters/DeployOpAdapter,ethereum)
deploy-metis-adapters-test:
$(call deploy_fn,adapters/DeployMetisAdapter,ethereum)
deploy-base-adapters-test:
$(call deploy_fn,adapters/DeployCBaseAdapter,ethereum)
deploy-linea-adapters-test:
$(call deploy_fn,adapters/DeployLineaAdapter,ethereum)
## Set sender bridge dapters. Only eth pol avax are needed as other networks will only receive
set-ccf-sender-adapters-test:
$(call deploy_fn,ccc/Set_CCF_Sender_Adapters,ethereum)
# Set the bridge adapters allowed to receive messages
set-ccr-receiver-adapters-test:
$(call deploy_fn,ccc/Set_CCR_Receivers_Adapters,linea)
# Sets the required confirmations
set-ccr-confirmations-test:
$(call deploy_fn,ccc/Set_CCR_Confirmations,linea)
## Deploy and configure all contracts
deploy-full-test:
#make deploy-proxy-factory-test
make deploy-cross-chain-infra-test
make deploy-ccip-bridge-adapters-test
make deploy-lz-bridge-adapters-test
make deploy-hl-bridge-adapters-test
make deploy-same-chain-adapters-test
make set-ccf-sender-adapters-test
make set-ccr-receiver-adapters-test
make set-ccr-confirmations-test
make fund-crosschain-test
make write-json-addresses
# ----------------------------------------------------------------------------------------------------------------------
# ----------------------------------------- HELPER SCRIPTS ---------------------------------------------------------
remove-bridge-adapters:
$(call deploy_fn,helpers/RemoveBridgeAdapters,ethereum)
send-direct-message:
$(call deploy_fn,helpers/Send_Direct_CCMessage,ethereum)
deploy_mock_destination:
$(call deploy_fn,helpers/Deploy_Mock_destination,linea)
set-approved-ccf-senders:
$(call deploy_fn,helpers/Set_Approved_Senders,ethereum)
send-message:
@$(call deploy_fn,helpers/Testnet_ForwardMessage,ethereum,Testnet_ForwardMessage)
deploy_mock_ccc:
$(call deploy_fn,helpers/mocks/Deploy_Mock_CCC,zkevm)
send-message-via-adapter:
$(call deploy_fn,helpers/Send_Message_Via_Adapter,ethereum)
deploy_ccc_granular_guardian:
$(call deploy_fn,access_control/network_scripts/GranularGuardianNetworkDeploys,linea)
deploy-ccc-revision-and-update:
$(call deploy_fn,CCC/UpdateCCC,ethereum)
deploy-ccc-update-payload:
$(call deploy_fn,helpers/UpdateCCCImpl_Payload,celo)
deploy-ccc-shuffle-payload:
$(call deploy_fn,payloads/ccc/shuffle/Network_Deployments,metis)
deploy-zksync-path-payload:
$(call deploy_fn,payloads/adapters/zksync/Network_Deployments,ethereum)
deploy-linea-path-payload:
$(call deploy_fn,payloads/adapters/ethereum/Network_Deployments,ethereum)
update-owners-and-guardians:
$(call deploy_fn,helpers/Update_Ownership,zksync)