forked from KCEE0901/trustchain-escrow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·71 lines (63 loc) · 2.03 KB
/
Copy pathdeploy.sh
File metadata and controls
executable file
·71 lines (63 loc) · 2.03 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
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
#!/usr/bin/env bash
# deploy.sh
#
# Builds the Soroban escrow contract, deploys it to Stellar testnet,
# and prints the contract address.
#
# Prerequisites:
# - soroban CLI installed (>= 21.0.0)
# - Stellar keypair configured (run: soroban keys generate my-key --network testnet)
# - Account funded (run: soroban keys fund my-key --network testnet)
#
# Usage:
# bash scripts/deploy.sh
#
# TODO (contributor — medium, Issue #43):
# - Add --network flag to deploy to mainnet
# - Save contract address to backend/.env automatically
# - Add contract initialization call after deployment
# - Add --upgrade flag for upgrading an existing deployment
set -euo pipefail
NETWORK="${STELLAR_NETWORK:-testnet}"
KEY="${STELLAR_KEY:-my-key}"
CONTRACT_DIR="contracts/escrow_contract"
WASM_PATH="target/wasm32-unknown-unknown/release/stellar_trust_escrow_contract.wasm"
echo ""
echo "🚀 StellarTrustEscrow — Contract Deployment"
echo "==========================================="
echo "Network: $NETWORK"
echo "Key: $KEY"
echo ""
# Step 1: Build the contract
echo "📦 Building WASM contract…"
cd "$CONTRACT_DIR"
cargo build --release --target wasm32-unknown-unknown
cd - > /dev/null
echo " ✅ Build complete"
echo ""
# Step 2: Deploy
echo "🌐 Deploying to $NETWORK…"
CONTRACT_ADDRESS=$(soroban contract deploy \
--wasm "$WASM_PATH" \
--source "$KEY" \
--network "$NETWORK")
echo " ✅ Deployed!"
echo " Contract address: $CONTRACT_ADDRESS"
echo ""
# Step 3: Initialize (TODO — contributor)
# echo "⚙️ Initializing contract…"
# soroban contract invoke \
# --id "$CONTRACT_ADDRESS" \
# --source "$KEY" \
# --network "$NETWORK" \
# -- initialize \
# --admin "$(soroban keys address $KEY)"
# echo " ✅ Initialized"
echo "==========================================="
echo "✅ Deployment complete!"
echo ""
echo "Add this to your .env files:"
echo " CONTRACT_ADDRESS=$CONTRACT_ADDRESS"
echo " NEXT_PUBLIC_CONTRACT_ADDRESS=$CONTRACT_ADDRESS"
echo ""
echo "TODO: Update backend/.env and frontend/.env.local with the above values"