-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·77 lines (65 loc) · 1.77 KB
/
Copy pathdeploy.sh
File metadata and controls
executable file
·77 lines (65 loc) · 1.77 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
72
73
74
75
76
77
#!/bin/bash
set -e
echo "🚀 DeCo MVP Deployment Script"
echo "=============================="
echo ""
# Check if soroban CLI is installed
if ! command -v soroban &> /dev/null; then
echo "❌ Soroban CLI not found. Please install it first:"
echo " cargo install --locked soroban-cli"
exit 1
fi
# Build contract
echo "📦 Building contract..."
cd contract
soroban contract build
cd ..
# Check if admin identity exists
if ! soroban keys show admin &> /dev/null; then
echo "🔑 Generating admin identity..."
soroban keys generate admin --network testnet
fi
ADMIN_ADDRESS=$(soroban keys address admin)
echo "👤 Admin address: $ADMIN_ADDRESS"
echo ""
# Deploy contract
echo "🌐 Deploying contract to Testnet..."
CONTRACT_ID=$(soroban contract deploy \
--wasm contract/target/wasm32-unknown-unknown/release/deco_mvp.wasm \
--source admin \
--network testnet)
echo "✅ Contract deployed!"
echo "📝 Contract ID: $CONTRACT_ID"
echo ""
# Initialize contract
echo "⚙️ Initializing contract..."
soroban contract invoke \
--id $CONTRACT_ID \
--source admin \
--network testnet \
-- \
init \
--admin $ADMIN_ADDRESS \
--fee 100000000
echo "✅ Contract initialized!"
echo ""
# Update frontend config
echo "🔧 Updating frontend configuration..."
CONFIG_FILE="frontend/src/config.ts"
if [ -f "$CONFIG_FILE" ]; then
sed -i.bak "s/YOUR_DEPLOYED_CONTRACT_ID_HERE/$CONTRACT_ID/" "$CONFIG_FILE"
rm "${CONFIG_FILE}.bak"
echo "✅ Frontend config updated!"
else
echo "⚠️ Frontend config file not found. Please update manually."
fi
echo ""
echo "🎉 Deployment complete!"
echo ""
echo "Next steps:"
echo "1. cd frontend"
echo "2. npm install"
echo "3. npm run dev"
echo ""
echo "Contract ID: $CONTRACT_ID"
echo "Admin Address: $ADMIN_ADDRESS"