-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-n3-message-bridge-contracts.expect
More file actions
42 lines (34 loc) · 1.4 KB
/
deploy-n3-message-bridge-contracts.expect
File metadata and controls
42 lines (34 loc) · 1.4 KB
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
#!/usr/bin/expect
# Set timeout to never expire
set timeout -1
# Spawn the command that outputs the contract hashes
spawn sh gradlew -q -PmainClass=network.bane.scripts.deploy.DeployAll run
# Wait for the management contract hash to appear and capture it
expect -re {BridgeManagement contract hash: ([0-9a-f]+)} {
set managementHash $expect_out(1,string)
}
# Wait for the bridge contract hash to appear and capture it
expect -re {Bridge contract hash: ([0-9a-f]+)} {
set bridgeHash $expect_out(1,string)
}
# Wait for the message bridge contract hash to appear and capture it
expect -re {MessageBridge contract hash: ([0-9a-f]+)} {
set messageBridgeHash $expect_out(1,string)
}
# Wait for the execution manager contract hash to appear and capture it
expect -re {ExecutionManager contract hash: ([0-9a-f]+)} {
set executionManagerHash $expect_out(1,string)
}
# Create the directory if it doesn't exist
file mkdir "/tools/addresses"
# Write all contract hashes to a single JSON file
set fileId [open "/tools/addresses/n3-addresses.json" "w"]
set json "{\n"
append json " \"management\": \"$managementHash\",\n"
append json " \"bridge\": \"$bridgeHash\",\n"
append json " \"messageBridge\": \"$messageBridgeHash\",\n"
append json " \"executionManager\": \"$executionManagerHash\"\n"
append json "}"
fconfigure $fileId -encoding utf-8 -translation lf
puts -nonewline $fileId $json
close $fileId