github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/cosmos-sdk/x/gov/client/utils/utils.go (about) 1 package utils 2 3 import "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/x/gov/types" 4 5 // NormalizeVoteOption - normalize user specified vote option 6 func NormalizeVoteOption(option string) string { 7 switch option { 8 case "Yes", "yes": 9 return types.OptionYes.String() 10 11 case "Abstain", "abstain": 12 return types.OptionAbstain.String() 13 14 case "No", "no": 15 return types.OptionNo.String() 16 17 case "NoWithVeto", "no_with_veto": 18 return types.OptionNoWithVeto.String() 19 20 default: 21 return "" 22 } 23 } 24 25 // NormalizeProposalType - normalize user specified proposal type 26 func NormalizeProposalType(proposalType string) string { 27 switch proposalType { 28 case "Text", "text": 29 return types.ProposalTypeText 30 31 default: 32 return "" 33 } 34 } 35 36 // NormalizeProposalStatus - normalize user specified proposal status 37 func NormalizeProposalStatus(status string) string { 38 switch status { 39 case "DepositPeriod", "deposit_period": 40 return "DepositPeriod" 41 case "VotingPeriod", "voting_period": 42 return "VotingPeriod" 43 case "Passed", "passed": 44 return "Passed" 45 case "Rejected", "rejected": 46 return "Rejected" 47 } 48 return "" 49 }