-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathMakefile
206 lines (170 loc) · 9.37 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
# include .env file and export its env vars
# (-include to ignore error if it does not exist)
-include .env
all: clean install update solc build
# Install proper solc version.
solc:; nix-env -f https://github.com/dapphub/dapptools/archive/master.tar.gz -iA solc-static-versions.solc_0_8_12
# Clean the repo
clean :; forge clean
# Remove modules
remove :; rm -rf .gitmodules && rm -rf .git/modules/* && rm -rf lib && touch .gitmodules && git add . && git commit -m "modules"
# Install the Modules
install :; forge install
# Update Dependencies
update :; forge update
# Builds
build :; forge clean && forge build
# Lints
lint :; prettier --write src/**/*.sol && prettier --write src/**/*.sol
# Generate Gas Snapshots
snapshot :; forge clean && forge snapshot --optimize --optimizer-runs 1000000
# Rename all instances of femplate with the new repo name
rename :; chmod +x ./scripts/* && ./scripts/rename.sh
### --------------------------------------------------------------------
### DEPLOYMENTS
### --------------------------------------------------------------------
# Simple Bridge
deploy-simple-bridge :; @forge script script/simple-bridge/SimpleBridge.s.sol:DeploySimpleBridge \
--sig "run(address)" "${ORIGIN_CONNEXT}" \
--rpc-url ${ORIGIN_RPC_URL} \
--private-key ${PRIVATE_KEY} \
--broadcast \
--verify -vvvv
deploy-simple-bridge-anvil :; @forge script script/simple-bridge/SimpleBridge.s.sol:DeploySimpleBridge \
--sig "run(address)" "${ORIGIN_CONNEXT}" \
--rpc-url ${LOCALHOST} \
--private-key ${ANVIL_PRIVATE_KEY} \
--broadcast
# Greeter
deploy-source-greeter :; @forge script script/greeter/SourceGreeter.s.sol:DeploySourceGreeter \
--sig "run(address,address)" "${ORIGIN_CONNEXT}" "${ORIGIN_TOKEN}" \
--rpc-url ${ORIGIN_RPC_URL} \
--private-key ${PRIVATE_KEY} \
--broadcast \
--verify -vvvv
deploy-source-greeter-anvil :; @forge script script/greeter/SourceGreeter.s.sol:DeploySourceGreeter \
--sig "run(address,address)" "${ORIGIN_CONNEXT}" "${ORIGIN_TOKEN}" \
--rpc-url ${LOCALHOST} \
--private-key ${ANVIL_PRIVATE_KEY} \
--broadcast
deploy-destination-greeter :; @forge script script/greeter/DestinationGreeter.s.sol:DeployDestinationGreeter \
--sig "run(address)" "${DESTINATION_TOKEN}" \
--rpc-url ${DESTINATION_RPC_URL} \
--private-key ${PRIVATE_KEY} \
--broadcast \
--verify -vvvv
deploy-destination-greeter-anvil :; @forge script script/greeter/DestinationGreeter.s.sol:DeployDestinationGreeter \
--sig "run(address)" "${DESTINATION_TOKEN}" \
--rpc-url ${LOCALHOST} \
--private-key ${ANVIL_PRIVATE_KEY} \
--broadcast
# Greeter Authenticated
deploy-source-greeter-auth :; @forge script script/greeter-authenticated/SourceGreeterAuthenticated.s.sol:DeploySourceGreeterAuthenticated \
--sig "run(address)" "${ORIGIN_CONNEXT}" \
--rpc-url ${ORIGIN_RPC_URL} \
--private-key ${PRIVATE_KEY} \
--broadcast \
--verify -vvvv
deploy-source-greeter-auth-anvil :; @forge script script/greeter-authenticated/SourceGreeterAuthenticated.s.sol:DeploySourceGreeterAuthenticated \
--sig "run(address)" "${ORIGIN_CONNEXT}" \
--rpc-url ${LOCALHOST} \
--private-key ${ANVIL_PRIVATE_KEY} \
--broadcast
deploy-destination-greeter-auth :; @forge script script/greeter-authenticated/DestinationGreeterAuthenticated.s.sol:DeployDestinationGreeterAuthenticated \
--sig "run(uint32,address,address)" "${ORIGIN_DOMAIN}" "${SOURCE_GREETER_AUTHENTICATED}" "${DESTINATION_CONNEXT}" \
--rpc-url ${DESTINATION_RPC_URL} \
--private-key ${PRIVATE_KEY} \
--broadcast \
--verify -vvvv
deploy-destination-greeter-auth-anvil :; @forge script script/greeter-authenticated/DestinationGreeterAuthenticated.s.sol:DeployDestinationGreeterAuthenticated \
--sig "run(uint32,address,address)" "${ORIGIN_DOMAIN}" "${SOURCE_GREETER_AUTHENTICATED}" "${DESTINATION_CONNEXT}" \
--rpc-url ${LOCALHOST} \
--private-key ${ANVIL_PRIVATE_KEY} \
--broadcast
# Ping Pong
deploy-ping :; @forge script script/ping-pong/Ping.s.sol:DeployPing \
--sig "run(address)" "${ORIGIN_CONNEXT}" \
--rpc-url ${ORIGIN_RPC_URL} \
--private-key ${PRIVATE_KEY} \
--broadcast -vvvv
deploy-ping-anvil :; @forge script script/ping-pong/Ping.s.sol:DeployPing \
--sig "run(address)" "${ORIGIN_CONNEXT}" \
--rpc-url ${LOCALHOST} \
--private-key ${ANVIL_PRIVATE_KEY} \
--broadcast
deploy-pong :; @forge script script/ping-pong/Pong.s.sol:DeployPong \
--sig "run(address)" "${DESTINATION_CONNEXT}" \
--rpc-url ${DESTINATION_RPC_URL} \
--private-key ${PRIVATE_KEY} \
--broadcast -vvvv
deploy-pong-anvil :; @forge script script/ping-pong/Pong.s.sol:DeployPong \
--sig "run(address)" "${DESTINATION_CONNEXT}" \
--rpc-url ${LOCALHOST} \
--private-key ${ANVIL_PRIVATE_KEY} \
--broadcast
### --------------------------------------------------------------------
### SCRIPTS
### --------------------------------------------------------------------
# SimpleBridge.transfer()
transfer :; @forge script script/simple-bridge/Transfer.s.sol:Transfer \
--sig "run(address,address,uint256,address,uint32,uint256,uint256)" "${SIMPLE_BRIDGE}" "${ORIGIN_TOKEN}" "${AMOUNT}" "${RECIPIENT}" "${DESTINATION_DOMAIN}" "${MAX_SLIPPAGE}" "${RELAYER_FEE}" \
--rpc-url ${ORIGIN_RPC_URL} \
--private-key ${PRIVATE_KEY} \
--broadcast
transfer-eth :; @forge script script/simple-bridge/TransferEth.s.sol:TransferEth \
--sig "run(address,address,address,uint256,address,uint32,uint256,uint256)" "${SIMPLE_BRIDGE}" "${DESTINATION_UNWRAPPER}" "${ORIGIN_WETH}" "${AMOUNT}" "${RECIPIENT}" "${DESTINATION_DOMAIN}" "${MAX_SLIPPAGE}" "${RELAYER_FEE}" \
--rpc-url ${ORIGIN_RPC_URL} \
--private-key ${PRIVATE_KEY} \
--broadcast
# SourceGreeter.xUpdateGreeting()
update-greeting :; @forge script script/greeter/UpdateGreeting.s.sol:UpdateGreeting \
--sig "run(address,address,uint256,address,uint32,string,uint256)" "${SOURCE_GREETER}" "${ORIGIN_TOKEN}" "${AMOUNT}" "${DESTINATION_GREETER}" "${DESTINATION_DOMAIN}" "${NEW_GREETING}" "${RELAYER_FEE}" \
--rpc-url ${ORIGIN_RPC_URL} \
--private-key ${PRIVATE_KEY} \
--broadcast
# SourceGreeterAuthenticated.xUpdateGreeting()
update-greeting-auth :; @forge script script/greeter-authenticated/UpdateGreetingAuthenticated.s.sol:UpdateGreetingAuthenticated \
--sig "run(address,address,uint32,string,uint256)" "${SOURCE_GREETER_AUTHENTICATED}" "${DESTINATION_GREETER_AUTHENTICATED}" "${DESTINATION_DOMAIN}" "${NEW_GREETING_AUTHENTICATED}" "${RELAYER_FEE}" \
--rpc-url ${ORIGIN_RPC_URL} \
--private-key ${PRIVATE_KEY} \
--broadcast
# Ping.startpingPong()
start-ping-pong :; @forge script script/ping-pong/StartPingPong.s.sol:StartPingPong \
--sig "run(address,address,uint32,uint256)" "${PING}" "${PONG}" "${DESTINATION_DOMAIN}" "${RELAYER_FEE}" \
--rpc-url ${ORIGIN_RPC_URL} \
--private-key ${PRIVATE_KEY} \
--broadcast
### --------------------------------------------------------------------
### CASTS
### --------------------------------------------------------------------
# Read greeting variable of DestinationGreeter
read-greeting :; @cast call "${DESTINATION_GREETER}" "greeting()(string)" --rpc-url ${DESTINATION_RPC_URL}
# Read greeting variable of DestinationGreeterAuthenticated
read-greeting-auth :; @cast call "${DESTINATION_GREETER_AUTHENTICATED}" "greeting()(string)" --rpc-url ${DESTINATION_RPC_URL}
# Read pings variable of Ping
read-pings :; @cast call "${PING}" "pings()(uint)" --rpc-url ${ORIGIN_RPC_URL}
# Read pongs variable of Pong
read-pongs :; @cast call "${PONG}" "pongs()(uint)" --rpc-url ${DESTINATION_RPC_URL}
### --------------------------------------------------------------------
### TESTS
### --------------------------------------------------------------------
test-unit-all :; forge clean && forge test --match-contract "TestUnit"
test-forked-all :; forge clean && forge test --match-contract "TestForked" --fork-url ${GOERLI_RPC_URL}
## Simple Bridge
test-unit-simple-bridge :; forge clean && forge test --match-contract "SimpleBridgeTestUnit" -vvvv
test-forked-simple-bridge :; forge clean && forge test --match-contract "SimpleBridgeTestForked" --fork-url ${GOERLI_RPC_URL} -vvvv
## Greeter
test-unit-source-greeter:; forge clean && forge test --match-contract "SourceGreeterTestUnit" -vvvv
test-forked-source-greeter :; forge clean && forge test --match-contract "SourceGreeterTestForked" --fork-url ${GOERLI_RPC_URL} -vvvv
test-unit-destination-greeter:; forge clean && forge test --match-contract "DestinationGreeterTestUnit" -vvvv
# [TODO] test-forked-destination-greeter:; forge clean && forge test --match-contract "DestinationGreeterTestForked" --fork-url ${GOERLI_RPC_URL} -vvvv
## Greeter Authenticated
test-unit-source-greeter-auth:; forge clean && forge test --match-contract "SourceGreeterAuthenticatedTestUnit" -vvvv
test-forked-source-greeter-auth:; forge clean && forge test --match-contract "SourceGreeterAuthenticatedTestForked" --fork-url ${GOERLI_RPC_URL} -vvvv
test-unit-destination-greeter-auth:; forge clean && forge test --match-contract "DestinationGreeterAuthenticatedTestUnit" -vvvv
# [TODO] test-forked-destination-greeter-auth:; forge clean && forge test --match-contract "DestinationGreeterAuthenticatedTestForked" --fork-url ${GOERLI_RPC_URL} -vvvv
## Ping Pong
test-unit-ping :; forge clean && forge test --match-contract "PingTestUnit" -vvvv
# [TODO] test-forked-ping :; forge clean && forge test --match-contract "PingTestForked" --fork-url ${GOERLI_RPC_URL} -vvvv
test-unit-pong :; forge clean && forge test --match-contract "PongTestUnit" -vvvv
# [TODO] test-forked-ping :; forge clean && forge test --match-contract "PongTestForked" --fork-url ${GOERLI_RPC_URL} -vvvv