@@ -25,7 +25,34 @@ timeout 300 bash -c 'until docker ps | grep graph-node | grep -q healthy; do sle
2525echo " Deploying contract services..."
2626docker compose up -d graph-contracts
2727# Wait for contracts to be deployed
28- sleep 20
28+ timeout 300 bash -c ' until docker ps -a | grep graph-contracts | grep -q "Exited (0)"; do sleep 5; done'
29+
30+ # Verify the contracts have code, usually when starting from scratch
31+ # there could be timing issues between contract deployment
32+ # and when transaction gets approved and contract address gets available
33+ # in the network.
34+ # So bellow is a kind of double check
35+ # Extract a few key contract addresses from the contracts.json file
36+ graph_token_address=$( jq -r ' ."1337".GraphToken.address' contracts.json)
37+ controller_address=$( jq -r ' ."1337".Controller.address' contracts.json)
38+
39+ echo " Checking GraphToken contract at $graph_token_address "
40+ code=$( docker exec chain cast code $graph_token_address --rpc-url http://localhost:8545)
41+ if [ -z " $code " ] || [ " $code " == " 0x" ]; then
42+ echo " ERROR: GraphToken contract has no code!"
43+ exit 1
44+ fi
45+ echo " GraphToken contract verified."
46+
47+ echo " Checking Controller contract at $controller_address "
48+ code=$( docker exec chain cast code $controller_address --rpc-url http://localhost:8545)
49+ if [ -z " $code " ] || [ " $code " == " 0x" ]; then
50+ echo " ERROR: Controller contract has no code!"
51+ exit 1
52+ fi
53+ echo " Controller contract verified."
54+ echo " Contract deployment successful."
55+
2956docker compose up -d tap-contracts
3057
3158echo " Starting indexer services..."
@@ -44,6 +71,7 @@ timeout 300 bash -c 'until docker ps | grep indexer-agent | grep -q healthy; do
4471
4572echo " Starting TAP services..."
4673docker compose up -d tap-aggregator
74+ # sleep 10
4775# tap-scrow-manager requires subgraph-deploy
4876# docker compose up -d tap-escrow-manager
4977sleep 10
0 commit comments