Skip to content

Commit 622fa97

Browse files
committed
fix(integration-tests): update fund_escrow.sh for correct file paths and formatting
- Fix contract file paths to use ../contrib/local-network/ directory - Update error message to reflect correct execution directory - Remove set -e to allow graceful error handling - Clean up formatting and spacing consistency
1 parent ee921cb commit 622fa97

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

integration-tests/fund_escrow.sh

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/bin/bash
2-
set -e
32

43
# ==============================================================================
54
# FUND ESCROW FOR BOTH V1 AND V2 (HORIZON)
@@ -29,20 +28,20 @@ get_contract_address() {
2928
if [ -f ".env" ]; then
3029
source .env
3130
else
32-
echo "Error: .env file not found. Please run from local-network directory."
31+
echo "Error: .env file not found. Please run from integration-tests directory."
3332
exit 1
3433
fi
3534

36-
# Get contract addresses
37-
GRAPH_TOKEN=$(get_contract_address "horizon.json" "L2GraphToken")
38-
TAP_ESCROW_V1=$(get_contract_address "tap-contracts.json" "TAPEscrow")
39-
PAYMENTS_ESCROW_V2=$(get_contract_address "horizon.json" "PaymentsEscrow")
40-
GRAPH_TALLY_COLLECTOR_V2=$(get_contract_address "horizon.json" "GraphTallyCollector")
35+
# Get contract addresses - Updated paths to local-network directory
36+
GRAPH_TOKEN=$(get_contract_address "../contrib/local-network/horizon.json" "L2GraphToken")
37+
TAP_ESCROW_V1=$(get_contract_address "../contrib/local-network/tap-contracts.json" "TAPEscrow")
38+
PAYMENTS_ESCROW_V2=$(get_contract_address "../contrib/local-network/horizon.json" "PaymentsEscrow")
39+
GRAPH_TALLY_COLLECTOR_V2=$(get_contract_address "../contrib/local-network/horizon.json" "GraphTallyCollector")
4140

4241
# Use environment variables from .env
4342
SENDER_ADDRESS="$ACCOUNT0_ADDRESS"
4443
SENDER_KEY="$ACCOUNT0_SECRET"
45-
AMOUNT="10000000000000000000" # 10 GRT per escrow
44+
AMOUNT="10000000000000000000" # 10 GRT per escrow
4645

4746
echo "============ FUNDING BOTH V1 AND V2 ESCROWS ============"
4847
echo "L2GraphToken address: $GRAPH_TOKEN"
@@ -128,8 +127,8 @@ echo "========== FUNDING V2 ESCROW =========="
128127
# For V2, we need to specify payer, collector, and receiver
129128
# Payer is the test account, but receiver must be the indexer address
130129
PAYER=$SENDER_ADDRESS
131-
COLLECTOR=$SENDER_ADDRESS
132-
RECEIVER="0xf4EF6650E48d099a4972ea5B414daB86e1998Bd3" # This must be the indexer address
130+
COLLECTOR=$SENDER_ADDRESS
131+
RECEIVER="0xf4EF6650E48d099a4972ea5B414daB86e1998Bd3" # This must be the indexer address
133132

134133
# Check current V2 escrow balance before funding
135134
echo "Checking current V2 escrow balance..."
@@ -152,21 +151,21 @@ docker exec chain cast send \
152151
# For V2, we also need to authorize the signer
153152
echo "Authorizing signer for V2..."
154153
# Create authorization proof: payer authorizes signer (same address in test)
155-
PROOF_DEADLINE=$(($(date +%s) + 3600)) # 1 hour from now
154+
PROOF_DEADLINE=$(($(date +%s) + 3600)) # 1 hour from now
156155
echo "Creating authorization proof with deadline: $PROOF_DEADLINE"
157156

158-
# Create the message to sign according to _verifyAuthorizationProof
157+
# Create the message to sign according to _verifyAuthorizationProof
159158
# abi.encodePacked(chainId, contractAddress, "authorizeSignerProof", deadline, authorizer)
160-
CHAIN_ID_HEX=$(printf "%064x" 1337) # uint256: 32 bytes
161-
CONTRACT_HEX=${GRAPH_TALLY_COLLECTOR_V2:2} # address: 20 bytes (remove 0x)
162-
DOMAIN_HEX=$(echo -n "authorizeSignerProof" | xxd -p) # string: no length prefix
163-
DEADLINE_HEX=$(printf "%064x" $PROOF_DEADLINE) # uint256: 32 bytes
164-
AUTHORIZER_HEX=${SENDER_ADDRESS:2} # address: 20 bytes (remove 0x)
159+
CHAIN_ID_HEX=$(printf "%064x" 1337) # uint256: 32 bytes
160+
CONTRACT_HEX=${GRAPH_TALLY_COLLECTOR_V2:2} # address: 20 bytes (remove 0x)
161+
DOMAIN_HEX=$(echo -n "authorizeSignerProof" | xxd -p) # string: no length prefix
162+
DEADLINE_HEX=$(printf "%064x" $PROOF_DEADLINE) # uint256: 32 bytes
163+
AUTHORIZER_HEX=${SENDER_ADDRESS:2} # address: 20 bytes (remove 0x)
165164

166165
MESSAGE_DATA="${CHAIN_ID_HEX}${CONTRACT_HEX}${DOMAIN_HEX}${DEADLINE_HEX}${AUTHORIZER_HEX}"
167166
MESSAGE_HASH=$(docker exec chain cast keccak "0x$MESSAGE_DATA")
168167

169-
# Sign the message with the signer's private key
168+
# Sign the message with the signer's private key
170169
PROOF=$(docker exec chain cast wallet sign --private-key $SENDER_KEY "$MESSAGE_HASH")
171170

172171
echo "Calling authorizeSigner with proof..."
@@ -203,11 +202,12 @@ ESCROW_BALANCE_V2="(check via subgraph)"
203202
# Since we can't easily check balance via contract call, we'll verify via transaction success
204203
echo "✅ V2 escrow deposit transaction completed!"
205204
echo " Payer: $PAYER"
206-
echo " Collector: $COLLECTOR"
205+
echo " Collector: $COLLECTOR"
207206
echo " Receiver: $RECEIVER"
208207
echo " Amount: $AMOUNT"
209208
echo ""
210209
echo "Note: V2 escrow balance can be verified via the TAP V2 subgraph"
211210

212211
echo ""
213-
echo "✅ Successfully funded both V1 and V2 escrows!"
212+
echo "✅ Successfully funded both V1 and V2 escrows!"
213+

0 commit comments

Comments
 (0)