2
2
set -e
3
3
4
4
# ==============================================================================
5
- # SETUP LOCAL GRAPH NETWORK FOR TESTING
5
+ # SETUP LOCAL GRAPH NETWORK FOR TESTING (HORIZON VERSION)
6
6
# ==============================================================================
7
- # This script sets up a local Graph network for testing.
7
+ # This script sets up a local Graph network for testing with horizon upgrade .
8
8
#
9
9
# NOTES:
10
10
# - If you encounter container conflicts, run: docker compose down
@@ -34,13 +34,8 @@ container_running() {
34
34
return $?
35
35
}
36
36
37
- # Function to fund the escrow smart contract
38
- # 1. first read .env variables from local-network/.env
39
- # 2. then read contract addresses from local-network/contracts.json
40
- # 3. finally, use the cast command to approve and deposit GRT to the escrow
41
- # this should be done just after deploying the gateway
42
- # otherwise it does not move forward in its setup process
43
- # causing false error during deployment of our local testnet
37
+ # Function to fund the escrow smart contract for horizon
38
+ # Uses L2GraphToken and TAPEscrow from the horizon structure
44
39
fund_escrow () {
45
40
echo " Funding escrow for sender..."
46
41
@@ -51,11 +46,14 @@ fund_escrow() {
51
46
return 1
52
47
fi
53
48
54
- GRAPH_TOKEN=$( jq -r ' ."1337".GraphToken.address' local-network/contracts.json)
55
- TAP_ESCROW=$( jq -r ' ."1337".TAPEscrow.address' local-network/contracts.json)
49
+ # Use L2GraphToken from horizon.json for horizon upgrade
50
+ GRAPH_TOKEN=$( jq -r ' ."1337".L2GraphToken.address' local-network/horizon.json)
51
+ TAP_ESCROW=$( jq -r ' ."1337".TAPEscrow.address' local-network/tap-contracts.json)
56
52
57
- if [ -z " $GRAPH_TOKEN " ] || [ -z " $TAP_ESCROW " ]; then
58
- echo " Error: Could not read contract addresses from contracts.json"
53
+ if [ -z " $GRAPH_TOKEN " ] || [ -z " $TAP_ESCROW " ] || [ " $GRAPH_TOKEN " == " null" ] || [ " $TAP_ESCROW " == " null" ]; then
54
+ echo " Error: Could not read contract addresses from horizon.json or tap-contracts.json"
55
+ echo " GRAPH_TOKEN: $GRAPH_TOKEN "
56
+ echo " TAP_ESCROW: $TAP_ESCROW "
59
57
return 1
60
58
fi
61
59
@@ -64,7 +62,7 @@ fund_escrow() {
64
62
SENDER_KEY=" $ACCOUNT0_SECRET "
65
63
AMOUNT=" 10000000000000000000"
66
64
67
- echo " Using GraphToken at: $GRAPH_TOKEN "
65
+ echo " Using L2GraphToken at: $GRAPH_TOKEN "
68
66
echo " Using TapEscrow at: $TAP_ESCROW "
69
67
echo " Using sender address: $SENDER_ADDRESS "
70
68
116
114
if [ ! -d " local-network" ]; then
117
115
git clone https://github.com/semiotic-ai/local-network.git
118
116
cd local-network
119
- # Checkout to a branch with no dipper
117
+ # Checkout to the horizon branch
120
118
git checkout suchapalaver/test/horizon
121
119
cd ..
122
120
fi
@@ -135,17 +133,17 @@ docker compose up -d graph-contracts
135
133
# Wait for contracts to be deployed
136
134
timeout 300 bash -c ' until docker ps -a | grep graph-contracts | grep -q "Exited (0)"; do sleep 5; done'
137
135
138
- # Verify the contracts have code
139
- graph_token_address =$( jq -r ' ."1337".GraphToken .address' contracts .json)
140
- controller_address=$( jq -r ' ."1337".Controller.address' contracts .json)
136
+ # Verify the contracts have code using horizon structure
137
+ l2_graph_token_address =$( jq -r ' ."1337".L2GraphToken .address' horizon .json)
138
+ controller_address=$( jq -r ' ."1337".Controller.address' horizon .json)
141
139
142
- echo " Checking GraphToken contract at $graph_token_address "
143
- code=$( docker exec chain cast code $graph_token_address --rpc-url http://localhost:8545)
140
+ echo " Checking L2GraphToken contract at $l2_graph_token_address "
141
+ code=$( docker exec chain cast code $l2_graph_token_address --rpc-url http://localhost:8545)
144
142
if [ -z " $code " ] || [ " $code " == " 0x" ]; then
145
- echo " ERROR: GraphToken contract has no code!"
143
+ echo " ERROR: L2GraphToken contract has no code!"
146
144
exit 1
147
145
fi
148
- echo " GraphToken contract verified."
146
+ echo " L2GraphToken contract verified."
149
147
150
148
echo " Checking Controller contract at $controller_address "
151
149
code=$( docker exec chain cast code $controller_address --rpc-url http://localhost:8545)
@@ -237,10 +235,12 @@ source local-network/.env
237
235
docker build -t local-gateway:latest ./local-network/gateway
238
236
239
237
echo " Running gateway container..."
238
+ # Updated to use the horizon file structure
240
239
docker run -d --name gateway \
241
240
--network local-network_default \
242
241
-p 7700:7700 \
243
- -v " $( pwd) /local-network/contracts.json" :/opt/contracts.json:ro \
242
+ -v " $( pwd) /local-network/tap-contracts.json" :/opt/tap-contracts.json:ro \
243
+ -v " $( pwd) /local-network/subgraph-service.json" :/opt/subgraph-service.json:ro \
244
244
-e RUST_LOG=info,graph_gateway=trace \
245
245
-e ACCOUNT0_SECRET=" $ACCOUNT0_SECRET " \
246
246
-e ACCOUNT0_ADDRESS=" $ACCOUNT0_ADDRESS " \
@@ -275,7 +275,7 @@ END_CONTAINERS_SIZE=$(docker system df --format '{{.ContainersSize}}' 2>/dev/nul
275
275
END_VOLUMES_SIZE=$( docker system df --format ' {{.VolumesSize}}' 2> /dev/null || echo " N/A" )
276
276
277
277
echo " All services are now running!"
278
- echo " You can enjoy your new local network setup for testing."
278
+ echo " You can enjoy your new local network setup for testing with horizon upgrade ."
279
279
280
280
echo " ============ FINAL DISK USAGE ============"
281
281
echo " Docker directory usage: $END_SPACE "
0 commit comments