forked from compound-finance/comet
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.sh
More file actions
executable file
·140 lines (119 loc) · 3.76 KB
/
index.sh
File metadata and controls
executable file
·140 lines (119 loc) · 3.76 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/bin/bash
# Queue Proposal Script Wrapper
# This script provides a simple interface to queue a proposal using the TypeScript script
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Function to print colored output
print_info() {
echo -e "${BLUE}ℹ️ $1${NC}"
}
print_success() {
echo -e "${GREEN}✅ $1${NC}"
}
print_warning() {
echo -e "${YELLOW}⚠️ $1${NC}"
}
print_error() {
echo -e "${RED}❌ $1${NC}"
}
# Function to show help
show_help() {
echo -e "${BLUE}🎯 Queue Proposal Script Wrapper${NC}"
echo ""
echo "Usage: ./scripts/governor/queue-proposal/index.sh [options]"
echo ""
echo "Options:"
echo " -n, --network <network> Network to use (required)"
echo " -p, --proposal-id <id> Proposal ID to queue (required)"
echo " -h, --help Show this help message"
echo ""
echo "Examples:"
echo " # Queue proposal 1 on local network"
echo " ./scripts/governor/queue-proposal/index.sh -n local -p 1"
echo ""
echo " # Queue proposal 5 on polygon network"
echo " ./scripts/governor/queue-proposal/index.sh -n polygon -p 5"
echo ""
echo " # Queue proposal 10 on mainnet"
echo " ./scripts/governor/queue-proposal/index.sh -n mainnet -p 10"
echo ""
echo ""
echo "Available networks: local, hardhat, mainnet, polygon, arbitrum, optimism, base, etc."
echo ""
echo "Features:"
echo " - Uses the governor:queue command to queue approved proposals"
echo " - Provides clear feedback on queueing status"
echo " - Shows next steps after successful queueing"
echo " - Includes comprehensive error handling and troubleshooting tips"
echo ""
echo "Note: This script only queues the proposal. The proposal must have enough approvals"
echo "and be in the correct state to be queued. After queueing, you'll need to wait for"
echo "the timelock delay period before executing the proposal."
}
# Function to check if required tools are installed
check_requirements() {
print_info "Checking requirements..."
# Check if yarn is installed
if ! command -v yarn &> /dev/null; then
print_error "yarn is not installed. Please install yarn first."
exit 1
fi
# Check if ts-node is available
if ! yarn ts-node --version &> /dev/null; then
print_error "ts-node is not available. Please run 'yarn install' first."
exit 1
fi
print_success "Requirements check passed"
}
# Parse command line arguments
NETWORK=""
PROPOSAL_ID=""
while [[ $# -gt 0 ]]; do
case $1 in
-n|--network)
NETWORK="$2"
shift 2
;;
-p|--proposal-id)
PROPOSAL_ID="$2"
shift 2
;;
-h|--help)
show_help
exit 0
;;
*)
print_error "Unknown option: $1"
show_help
exit 1
;;
esac
done
# Main execution
main() {
# Validate required arguments
if [[ -z "$NETWORK" || -z "$PROPOSAL_ID" ]]; then
print_error "Both network and proposal-id are required"
show_help
exit 1
fi
print_info "Starting proposal queueing process..."
print_info "Network: $NETWORK"
print_info "Proposal ID: $PROPOSAL_ID"
print_info "This will queue the proposal for execution after timelock delay"
# Check requirements
check_requirements
# Run the queueing script
print_info "Executing queue proposal script..."
yarn ts-node scripts/governor/queue-proposal/index.ts \
--network "$NETWORK" \
--proposal-id "$PROPOSAL_ID"
print_success "Queue proposal script completed"
}
# Run main function
main "$@"