-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathdeploy_gamification_rewards.sh
More file actions
65 lines (50 loc) · 1.78 KB
/
deploy_gamification_rewards.sh
File metadata and controls
65 lines (50 loc) · 1.78 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
#!/bin/bash
# Gamification Rewards Contract Deployment Script
# This script builds and deploys the gamification rewards contract to Stellar testnet
set -e
echo "🔨 Building Gamification Rewards Contract..."
# Navigate to contract directory
cd "$(dirname "$0")/contracts/gamification_rewards" || exit 1
# Build the contract
cargo build --target wasm32-unknown-unknown --release
echo "✅ Build complete!"
# Get the WASM file path
WASM_FILE="../../target/wasm32-unknown-unknown/release/gamification_rewards.wasm"
if [ ! -f "$WASM_FILE" ]; then
echo "❌ Error: WASM file not found at $WASM_FILE"
exit 1
fi
echo "📦 WASM file ready: $WASM_FILE"
# Check if soroban CLI is installed
if ! command -v soroban &> /dev/null; then
echo "❌ Error: soroban CLI not found. Please install it first."
echo " Installation: https://soroban.stellar.org/docs/getting-started/setup"
exit 1
fi
echo "🚀 Deploying to Testnet..."
# Deploy to testnet
CONTRACT_ID=$(soroban contract deploy \
--wasm "$WASM_FILE" \
--source deployer \
--network testnet)
echo "✅ Deployment successful!"
echo "📍 Contract ID: $CONTRACT_ID"
# Save contract ID to file
echo "$CONTRACT_ID" > ../../gamification_rewards_contract_id.txt
echo "💾 Contract ID saved to gamification_rewards_contract_id.txt"
echo ""
echo "🎮 Next Steps:"
echo "1. Initialize the contract:"
echo " soroban contract invoke \\"
echo " --id $CONTRACT_ID \\"
echo " -- initialize \\"
echo " --admin <YOUR_ADMIN_ADDRESS>"
echo ""
echo "2. Set milestone thresholds (optional):"
echo " soroban contract invoke \\"
echo " --id $CONTRACT_ID \\"
echo " -- set_milestone_threshold \\"
echo " --admin <ADMIN_ADDRESS> \\"
echo " --level 1 --threshold 10"
echo ""
echo "3. Start recording player actions!"