-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.go
52 lines (42 loc) · 1.15 KB
/
utils.go
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
package utils
import "github.com/evoblockchain/evochain/x/gov/types"
// NormalizeVoteOption - normalize user specified vote option
func NormalizeVoteOption(option string) string {
switch option {
case "Yes", "yes":
return types.OptionYes.String()
case "Abstain", "abstain":
return types.OptionAbstain.String()
case "No", "no":
return types.OptionNo.String()
case "NoWithVeto", "no_with_veto":
return types.OptionNoWithVeto.String()
default:
return ""
}
}
//NormalizeProposalType - normalize user specified proposal type
func NormalizeProposalType(proposalType string) string {
switch proposalType {
case "Text", "text":
return types.ProposalTypeText
case "SoftwareUpgrade", "software_upgrade":
return types.ProposalTypeSoftwareUpgrade
default:
return ""
}
}
//NormalizeProposalStatus - normalize user specified proposal status
func NormalizeProposalStatus(status string) string {
switch status {
case "DepositPeriod", "deposit_period":
return "DepositPeriod"
case "VotingPeriod", "voting_period":
return "VotingPeriod"
case "Passed", "passed":
return "Passed"
case "Rejected", "rejected":
return "Rejected"
}
return ""
}