github.com/Finschia/finschia-sdk@v0.49.1/x/fbridge/types/fbridge.go (about) 1 package types 2 3 import ( 4 "errors" 5 ) 6 7 var QueryParamToRole = map[string]Role{ 8 "unspecified": 0, 9 "guardian": 1, 10 "operator": 2, 11 "judge": 3, 12 } 13 14 func IsValidRole(role Role) error { 15 switch role { 16 case RoleGuardian, RoleOperator, RoleJudge: 17 return nil 18 } 19 20 return errors.New("unsupported role") 21 } 22 23 func IsValidVoteOption(option VoteOption) error { 24 switch option { 25 case OptionYes, OptionNo: 26 return nil 27 } 28 29 return errors.New("unsupported vote option") 30 } 31 32 func IsValidBridgeStatus(status BridgeStatus) error { 33 switch status { 34 case StatusActive, StatusInactive: 35 return nil 36 } 37 38 return errors.New("unsupported bridge status") 39 }