-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
57 lines (48 loc) · 1.44 KB
/
setup.sh
File metadata and controls
57 lines (48 loc) · 1.44 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
#!/bin/bash
set -e
echo "🤝 Handshake Escrow - Setup Script"
echo "=================================="
# Ensure git repo exists (forge install uses submodules)
if [ ! -d .git ]; then
echo "📁 Initializing git repo (required for forge install)..."
git init >/dev/null
fi
# Check if foundry is installed
if ! command -v forge &> /dev/null; then
echo "❌ Foundry not found. Installing..."
curl -L https://foundry.paradigm.xyz | bash
foundryup
else
echo "✅ Foundry found"
fi
# Install dependencies
echo ""
echo "📦 Installing dependencies..."
set +e
forge install foundry-rs/forge-std --no-commit
STD1=$?
forge install OpenZeppelin/openzeppelin-contracts --no-commit
STD2=$?
set -e
if [ $STD1 -ne 0 ] || [ $STD2 -ne 0 ]; then
echo "ℹ️ Your Foundry version may not support --no-commit. Retrying without it..."
forge install foundry-rs/forge-std
forge install OpenZeppelin/openzeppelin-contracts
fi
# Build contracts
echo ""
echo "🔨 Building contracts..."
forge build
# Run tests
echo ""
echo "🧪 Running tests..."
forge test
echo ""
echo "=================================="
echo "✅ Setup complete!"
echo ""
echo "Next steps:"
echo "1. (Recommended) Import a deployer key into Foundry keystore with: cast wallet import <name>"
echo "2. Run 'forge test' to verify everything works"
echo "3. Deploy with 'forge script script/Deploy.s.sol --broadcast --account <name>'"
echo "=================================="