diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 0881c34e8..0f226221a 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -236,15 +236,6 @@ func NewAppKeeper( authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - // register the staking hooks - // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks - appKeepers.StakingKeeper.SetHooks( - stakingtypes.NewMultiStakingHooks( - appKeepers.DistrKeeper.Hooks(), - appKeepers.SlashingKeeper.Hooks(), - ), - ) - // UpgradeKeeper must be created before IBCKeeper appKeepers.UpgradeKeeper = upgradekeeper.NewKeeper( skipUpgradeHeights, @@ -302,6 +293,16 @@ func NewAppKeeper( // If evidence needs to be handled for the app, set routes in router here and seal appKeepers.EvidenceKeeper = *evidenceKeeper + // register the staking hooks + // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks + appKeepers.StakingKeeper.SetHooks( + stakingtypes.NewMultiStakingHooks( + appKeepers.DistrKeeper.Hooks(), + appKeepers.SlashingKeeper.Hooks(), + appKeepers.GovKeeper.StakingHooks(), + ), + ) + // ICA Host keeper appKeepers.ICAHostKeeper = icahostkeeper.NewKeeper( appCodec, diff --git a/go.mod b/go.mod index f1792697d..5e6f8d293 100644 --- a/go.mod +++ b/go.mod @@ -37,6 +37,7 @@ require ( google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 google.golang.org/grpc v1.62.1 google.golang.org/protobuf v1.33.0 + gopkg.in/yaml.v2 v2.4.0 gotest.tools/v3 v3.5.1 sigs.k8s.io/yaml v1.4.0 ) @@ -206,7 +207,6 @@ require ( google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect gopkg.in/ini.v1 v1.67.0 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.6 // indirect pgregory.net/rapid v1.1.0 // indirect diff --git a/proto/atomone/gov/v1/genesis.proto b/proto/atomone/gov/v1/genesis.proto index ebaddf79c..5ea5efdcf 100644 --- a/proto/atomone/gov/v1/genesis.proto +++ b/proto/atomone/gov/v1/genesis.proto @@ -34,4 +34,8 @@ message GenesisState { // // Since: cosmos-sdk 0.48 string constitution = 9; + // governors defines all the governors present at genesis. + repeated Governor governors = 10; + // governance_delegations defines all the governance delegations present at genesis. + repeated GovernanceDelegation governance_delegations = 11; } diff --git a/proto/atomone/gov/v1/gov.proto b/proto/atomone/gov/v1/gov.proto index e40d259c8..e7d2d8677 100644 --- a/proto/atomone/gov/v1/gov.proto +++ b/proto/atomone/gov/v1/gov.proto @@ -272,4 +272,94 @@ message Params { // Number of times a proposal should be checked for quorum after the quorum timeout // has elapsed. Used to compute the amount of time in between quorum checks. uint64 quorum_check_count = 22; + + // defines the maximum number of governors that can be active at any given time. + uint64 max_governors = 23; + // defines the duration of time that need to elapse between governor status changes. + google.protobuf.Duration governor_status_change_period = 24 [(gogoproto.stdduration) = true]; + // defines the minimum amound of bonded tokens, aka the "self-delegation" (because active governors + // must have the governance VP from the base account automatically delegated to them), that a governor + // must have to be considered active. + string min_governor_self_delegation = 25 [(cosmos_proto.scalar) = "cosmos.Int" ]; +} + + +// Governor defines a governor, together with the total amount of delegated +// validator's bond shares for a set amount of validators. When a delegator +// delegates a percentage of its x/gov power to a governor, the resulting +// shares from each delegators delegations in x/staking are added to the +// governor's total shares. +message Governor { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // governor_address defines the address of the governor; bech32-encoded. + string governor_address = 1; + // status is the status of the governor (active/inactive). + GovernorStatus status = 2; + // description defines the description terms for the governor. + GovernorDescription description = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + // voting_power defines the (estimated) voting power of the governor. + string voting_power = 4 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + + // last_status_change_time is the time when the governor's status was last changed. + google.protobuf.Timestamp last_status_change_time = 5 [(gogoproto.stdtime) = true]; +} + +// GovernorStatus is the status of a governor. +enum GovernorStatus { + option (gogoproto.goproto_enum_prefix) = false; + + // UNSPECIFIED defines an invalid governor status. + GOVERNOR_STATUS_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "Unspecified"]; + // ACTIVE defines a governor that is active. + GOVERNOR_STATUS_ACTIVE = 1 [(gogoproto.enumvalue_customname) = "Active"]; + // INACTIVE defines a governor that is inactive. + GOVERNOR_STATUS_INACTIVE = 2 [(gogoproto.enumvalue_customname) = "Inactive"]; +} + +// Description defines a governor description. +message GovernorDescription { + option (gogoproto.equal) = true; + + // moniker defines a human-readable name for the governor. + string moniker = 1; + // identity defines an optional identity signature (ex. UPort or Keybase). + string identity = 2; + // website defines an optional website link. + string website = 3; + // security_contact defines an optional email for security contact. + string security_contact = 4; + // details define other optional details. + string details = 5; +} + +// GovernorValShares holds the number of virtual shares from the +// specific validator that a governor can use to vote on proposals. +message GovernorValShares { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string governor_address = 1; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; + // shares define the delegation shares available from this validator. + string shares = 3 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; +} + +// GovernanceDelegation defines a delegation of governance voting power from a +// delegator to a governor. +message GovernanceDelegation { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string governor_address = 2; } diff --git a/proto/atomone/gov/v1/query.proto b/proto/atomone/gov/v1/query.proto index e8e595cdf..cc0c481e1 100644 --- a/proto/atomone/gov/v1/query.proto +++ b/proto/atomone/gov/v1/query.proto @@ -61,6 +61,31 @@ service Query { option (google.api.http).get = "/atomone/gov/v1/proposals/{proposal_id}/tally"; } + + // Governor queries governor information based on governor address. + rpc Governor(QueryGovernorRequest) returns (QueryGovernorResponse) { + option (google.api.http).get = "/atomone/gov/v1/governor/{governor_address}"; + } + + // Governors queries all governors. + rpc Governors(QueryGovernorsRequest) returns (QueryGovernorsResponse) { + option (google.api.http).get = "/atomone/gov/v1/governors"; + } + + // GovernanceDelegations queries all delegations of a governor. + rpc GovernanceDelegations(QueryGovernanceDelegationsRequest) returns (QueryGovernanceDelegationsResponse) { + option (google.api.http).get = "/atomone/gov/v1/governors/{governor_address}/delegations"; + } + + // GovernanceDelegation queries a delegation + rpc GovernanceDelegation(QueryGovernanceDelegationRequest) returns (QueryGovernanceDelegationResponse) { + option (google.api.http).get = "/atomone/gov/v1/delegations/{delegator_address}"; + } + + // GovernorValShares queries all governor virtual validator shares resulting from all governance delegations. + rpc GovernorValShares(QueryGovernorValSharesRequest) returns (QueryGovernorValSharesResponse) { + option (google.api.http).get = "/atomone/gov/v1/vshares/{governor_address}"; + } } // QueryConstitutionRequest is the request type for the Query/Constitution RPC method @@ -209,3 +234,78 @@ message QueryTallyResultResponse { // tally defines the requested tally. TallyResult tally = 1; } + +// QueryGovernorRequest is the request type for the Query/Governor RPC method. +message QueryGovernorRequest { + // gvernor_address defines the address of the governor. + string governor_address = 1 [(cosmos_proto.scalar) = "atomone.GovernorAddressString"]; +} + +// QueryGovernorResponse is the response type for the Query/Governor RPC method. +message QueryGovernorResponse { + // governor defines the requested governor. + Governor governor = 1; +} + +// QueryGovernorsRequest is the request type for the Query/Governors RPC method. +message QueryGovernorsRequest { + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryGovernorsResponse is the response type for the Query/Governors RPC method. +message QueryGovernorsResponse { + // governors defines the requested governors. + repeated Governor governors = 1; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryGovernanceDelegationsRequest is the request type for the Query/GovernanceDelegations RPC method. +message QueryGovernanceDelegationsRequest { + // governor_address defines the address of the governor. + string governor_address = 1 [(cosmos_proto.scalar) = "atomone.GovernorAddressString"]; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryGovernanceDelegationsResponse is the response type for the Query/GovernanceDelegations RPC method. +message QueryGovernanceDelegationsResponse { + // delegations defines the requested delegations. + repeated GovernanceDelegation delegations = 1; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryGovernanceDelegationRequest is the request type for the Query/GovernanceDelegation RPC method. +message QueryGovernanceDelegationRequest { + // delegator_address defines the address of the delegator. + string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// QueryGovernanceDelegationResponse is the response type for the Query/GovernanceDelegation RPC method. +message QueryGovernanceDelegationResponse { + // governor_address defines the address of the governor. + string governor_address = 1; +} + +// QueryGovernorValSharesRequest is the request type for the Query/GovernorValShares RPC method. +message QueryGovernorValSharesRequest { + // governor_address defines the address of the governor. + string governor_address = 1 [(cosmos_proto.scalar) = "atomone.GovernorAddressString"]; + + // pagination defines the pagination in the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryGovernorValSharesResponse is the response type for the Query/GovernorValShares RPC method. +message QueryGovernorValSharesResponse { + // val_shares defines the requested validator shares. + repeated GovernorValShares val_shares = 1; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} diff --git a/proto/atomone/gov/v1/tx.proto b/proto/atomone/gov/v1/tx.proto index f05db7f93..6e1b87862 100644 --- a/proto/atomone/gov/v1/tx.proto +++ b/proto/atomone/gov/v1/tx.proto @@ -48,6 +48,23 @@ service Msg { // new constitution amendment. The authority is defined in the keeper. rpc ProposeConstitutionAmendment(MsgProposeConstitutionAmendment) returns (MsgProposeConstitutionAmendmentResponse); + + // CreateGovernor defines a method to create a new governor. + rpc CreateGovernor(MsgCreateGovernor) returns (MsgCreateGovernorResponse); + + // EditGovernor defines a method to edit an existing governor. + // It also sets its status. + rpc EditGovernor(MsgEditGovernor) returns (MsgEditGovernorResponse); + + // UpdateGovernorStatus defines a method to update the status of a governor. + rpc UpdateGovernorStatus(MsgUpdateGovernorStatus) returns (MsgUpdateGovernorStatusResponse); + + // DelegateGovernor defines a method to delegate a non-zero percentange of + // governance voting power from a delegator to a governor. + rpc DelegateGovernor(MsgDelegateGovernor) returns (MsgDelegateGovernorResponse); + + // UndelegateGovernor defines a method to undelegate governance voting power + rpc UndelegateGovernor(MsgUndelegateGovernor) returns (MsgUndelegateGovernorResponse); } // MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary @@ -220,4 +237,82 @@ message MsgProposeConstitutionAmendment { // MsgProposeConstitutionAmendmentResponse defines the response structure for executing a // MsgProposeConstitutionAmendment message. -message MsgProposeConstitutionAmendmentResponse {} \ No newline at end of file +message MsgProposeConstitutionAmendmentResponse {} + +// MsgCreateGovernor defines a SDK message for creating a new governor. +message MsgCreateGovernor { + option (cosmos.msg.v1.signer) = "address"; + option (amino.name) = "atomone/MsgCreateGovernor"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // address is the base account address that is creating the governor. + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + GovernorDescription description = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// MsgCreateGovernorrResponse defines the Msg/CreateGovernor response type. +message MsgCreateGovernorResponse {} + +// MsgEditGovernor defines a SDK message for editing an existing governor. +message MsgEditGovernor { + option (cosmos.msg.v1.signer) = "address"; + option (amino.name) = "cosmos-sdk/MsgEditGovernor"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // address is the base account address that is editing the corresponding governor. + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + GovernorDescription description = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// MsgEditGovernorResponse defines the Msg/EditGovernor response type. +message MsgEditGovernorResponse {} + +// MsgUpdateGovernorStatus defines a SDK message for updating the status of a governor. +message MsgUpdateGovernorStatus { + option (cosmos.msg.v1.signer) = "address"; + option (amino.name) = "cosmos-sdk/MsgUpdateGovernorStatus"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // address is the base account address that is editing the corresponding governor. + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + GovernorStatus status = 2; +} + +// MsgUpdateGovernorStatusResponse defines the Msg/UpdateGovernorStatus response type. +message MsgUpdateGovernorStatusResponse {} + +// MsgDelegateGovernor defines a SDK message for performing a delegation of governance voting power +// from a delegator to a governor. +message MsgDelegateGovernor { + option (cosmos.msg.v1.signer) = "delegator_address"; + option (amino.name) = "atomone/MsgDelegateGovernor"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string governor_address = 2; +} + +// MsgDelegateGovernorResponse defines the Msg/Delegate response type. +message MsgDelegateGovernorResponse {} + +// MsgUndelegateGovernor defines a SDK message for undelegating governance voting power +message MsgUndelegateGovernor { + option (cosmos.msg.v1.signer) = "delegator_address"; + option (amino.name) = "cosmos-sdk/MsgUndelegateGovernor"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// MsgUndelegateGovernorResponse defines the Msg/UndelegateGovernor response type. +message MsgUndelegateGovernorResponse {} diff --git a/tests/e2e/genesis.go b/tests/e2e/genesis.go index ac7a401cf..ebb145a9a 100644 --- a/tests/e2e/genesis.go +++ b/tests/e2e/genesis.go @@ -173,9 +173,12 @@ func modifyGenesis(path, moniker, amountStr string, addrAll []sdk.AccAddress, de lawThreshold, _ := sdk.NewDecFromStr("0.000000000000000001") amendmentsQuorum, _ := sdk.NewDecFromStr("0.000000000000000001") amendmentsThreshold, _ := sdk.NewDecFromStr("0.000000000000000001") + minGovernorSelfDelegation, _ := sdk.NewIntFromString("10000000") maxDepositPeriod := 10 * time.Minute votingPeriod := 15 * time.Second + maxGovernors := uint64(100) + governorStatusChangePeriod := 30 * time.Second govGenState := govv1.NewGenesisState(1, govv1.NewParams( @@ -186,6 +189,7 @@ func modifyGenesis(path, moniker, amountStr string, addrAll []sdk.AccAddress, de sdk.ZeroDec().String(), false, false, govv1.DefaultMinDepositRatio.String(), govv1.DefaultQuorumTimeout, govv1.DefaultMaxVotingPeriodExtension, govv1.DefaultQuorumCheckCount, + maxGovernors, governorStatusChangePeriod, minGovernorSelfDelegation.String(), ), ) govGenState.Constitution = "This is a test constitution" diff --git a/x/gov/client/cli/query.go b/x/gov/client/cli/query.go index 95e3de6ec..b36111a79 100644 --- a/x/gov/client/cli/query.go +++ b/x/gov/client/cli/query.go @@ -40,6 +40,11 @@ func GetQueryCmd() *cobra.Command { GetCmdQueryDeposits(), GetCmdQueryTally(), GetCmdConstitution(), + GetCmdQueryGovernor(), + GetCmdQueryGovernors(), + GetCmdQueryGovernanceDelegation(), + GetCmdQueryGovernanceDelegations(), + GetCmdQueryGovernorValShares(), ) return govQueryCmd @@ -676,3 +681,222 @@ func GetCmdConstitution() *cobra.Command { }, } } + +// GetCmdQueryGovernor implements the query governor command. +func GetCmdQueryGovernor() *cobra.Command { + cmd := &cobra.Command{ + Use: "governor [address]", + Args: cobra.ExactArgs(1), + Short: "Query details of a single governor", + Long: strings.TrimSpace( + fmt.Sprintf(`Query details for a governor by its address. + +Example: +$ %s query gov governor cosmosgov1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk +`, + version.AppName, + ), + ), + RunE: func(cmd *cobra.Command, args []string) error { + addr, err := types.GovernorAddressFromBech32(args[0]) + if err != nil { + return err + } + + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := v1.NewQueryClient(clientCtx) + + res, err := queryClient.Governor( + cmd.Context(), + &v1.QueryGovernorRequest{GovernorAddress: addr.String()}, + ) + if err != nil { + return err + } + + return clientCtx.PrintProto(res.Governor) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +// GetCmdQueryGovernors implements the query governors command. +func GetCmdQueryGovernors() *cobra.Command { + cmd := &cobra.Command{ + Use: "governors", + Short: "Query all governors", + Long: strings.TrimSpace( + fmt.Sprintf(`Query all governors. + +Example: +$ %s query gov governors +`, + version.AppName, + ), + ), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := v1.NewQueryClient(clientCtx) + + res, err := queryClient.Governors( + cmd.Context(), + &v1.QueryGovernorsRequest{}, + ) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +// GetCmdQueryGovernanceDelegation implements the query governance delegation command. +func GetCmdQueryGovernanceDelegation() *cobra.Command { + cmd := &cobra.Command{ + Use: "delegation [address]", + Args: cobra.ExactArgs(1), + Short: "Query governance delegation for a delegator", + Long: strings.TrimSpace( + fmt.Sprintf(`Query details for a governance delegation by a delegator. + +Example: +$ %s query gov delegation cosmos1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk +`, + version.AppName, + ), + ), + RunE: func(cmd *cobra.Command, args []string) error { + addr, err := sdk.AccAddressFromBech32(args[0]) + if err != nil { + return err + } + + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := v1.NewQueryClient(clientCtx) + + res, err := queryClient.GovernanceDelegation( + cmd.Context(), + &v1.QueryGovernanceDelegationRequest{DelegatorAddress: addr.String()}, + ) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +// GetCmdQueryGovernanceDelegations implements the query governance delegations command. +func GetCmdQueryGovernanceDelegations() *cobra.Command { + cmd := &cobra.Command{ + Use: "delegations [governor_address]", + Short: "Query all governance delegations for a governor", + Long: strings.TrimSpace( + fmt.Sprintf(`Query all governance delegations for a governor. + +Example: +$ %s query gov delegations cosmosgov1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk +`, + version.AppName, + ), + ), + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + addr, err := types.GovernorAddressFromBech32(args[0]) + if err != nil { + return err + } + + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := v1.NewQueryClient(clientCtx) + + res, err := queryClient.GovernanceDelegations( + cmd.Context(), + &v1.QueryGovernanceDelegationsRequest{GovernorAddress: addr.String()}, + ) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +// GetCmdQueryGovernorValShares implements the query governor validator shares command. +func GetCmdQueryGovernorValShares() *cobra.Command { + cmd := &cobra.Command{ + Use: "vshares [governor_address]", + Args: cobra.ExactArgs(1), + Short: "Query governor virtual validators shares", + Long: strings.TrimSpace( + fmt.Sprintf(`Query details for a governor virtual validators shares by its address. + +Example: +$ %s query gov vshares cosmosgov1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk +`, + version.AppName, + ), + ), + RunE: func(cmd *cobra.Command, args []string) error { + addr, err := types.GovernorAddressFromBech32(args[0]) + if err != nil { + return err + } + + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := v1.NewQueryClient(clientCtx) + + res, err := queryClient.GovernorValShares( + cmd.Context(), + &v1.QueryGovernorValSharesRequest{GovernorAddress: addr.String()}, + ) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index f1362de35..059ebb0e6 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -74,6 +74,11 @@ func NewTxCmd(legacyPropCmds []*cobra.Command) *cobra.Command { NewCmdSubmitProposal(), NewCmdDraftProposal(), NewCmdGenerateConstitutionAmendment(), + CreateGovernorCmd(), + EditGovernorCmd(), + UpdateGovernorStatusCmd(), + DelegateGovernorCmd(), + UndelegateGovernorCmd(), // Deprecated cmdSubmitLegacyProp, @@ -470,3 +475,159 @@ $ %s tx gov generate-constitution-amendment path/to/updated/constitution.md return cmd } + +// CreateGovernorCmd creates a new Governor +func CreateGovernorCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "create-governor [address] [moniker] [identity] [website] [security-contact] [details]", + Short: "Create a new Governor", + Args: cobra.ExactArgs(6), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + address, err := sdk.AccAddressFromBech32(args[0]) + if err != nil { + return err + } + + description := v1.GovernorDescription{ + Moniker: args[1], + Identity: args[2], + Website: args[3], + SecurityContact: args[4], + Details: args[5], + } + + msg := v1.NewMsgCreateGovernor(address, description) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +// EditGovernorCmd edits a Governor +func EditGovernorCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "edit-governor [address] [moniker] [identity] [website] [security-contact] [details]", + Short: "Edit a Governor.", + Args: cobra.ExactArgs(6), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + address, err := sdk.AccAddressFromBech32(args[0]) + if err != nil { + return err + } + + description := v1.GovernorDescription{ + Moniker: args[1], + Identity: args[2], + Website: args[3], + SecurityContact: args[4], + Details: args[5], + } + + msg := v1.NewMsgEditGovernor(address, description) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +// UpdateGovernorStatusCmd updates the status of a Governor +func UpdateGovernorStatusCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-governor-status [address] [status]", + Short: "Update the status of a Governor", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + address, err := sdk.AccAddressFromBech32(args[0]) + if err != nil { + return err + } + + status, err := v1.GovernorStatusFromString(args[1]) + if err != nil { + return err + } + + msg := v1.NewMsgUpdateGovernorStatus(address, status) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +// DelegateGovernorCmd delegates or redelegates to a Governor +func DelegateGovernorCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "delegate-governor [delegator-address] [governor-address]", + Short: "Delegate governance power to a Governor. Triggers a redelegation if a governance delegation already exists", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + delegatorAddress, err := sdk.AccAddressFromBech32(args[0]) + if err != nil { + return err + } + + governorAddress, err := types.GovernorAddressFromBech32(args[1]) + if err != nil { + return err + } + + msg := v1.NewMsgDelegateGovernor(delegatorAddress, governorAddress) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +// UndelegateGovernorCmd undelegates from a Governor +func UndelegateGovernorCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "undelegate-governor [delegator-address]", + Short: "Undelegate tokens from a Governor", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + delegatorAddress, err := sdk.AccAddressFromBech32(args[0]) + if err != nil { + return err + } + + msg := v1.NewMsgUndelegateGovernor(delegatorAddress) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} diff --git a/x/gov/genesis.go b/x/gov/genesis.go index a1f221e0c..7ca8329ed 100644 --- a/x/gov/genesis.go +++ b/x/gov/genesis.go @@ -77,6 +77,44 @@ func InitGenesis(ctx sdk.Context, ak types.AccountKeeper, bk types.BankKeeper, k if !balance.IsEqual(totalDeposits) { panic(fmt.Sprintf("expected module account was %s but we got %s", balance.String(), totalDeposits.String())) } + + // set governors + for _, governor := range data.Governors { + // check that base account exists + accAddr := sdk.AccAddress(governor.GetAddress()) + acc := ak.GetAccount(ctx, accAddr) + if acc == nil { + panic(fmt.Sprintf("account %s does not exist", accAddr.String())) + } + + k.SetGovernor(ctx, *governor) + if governor.IsActive() { + k.DelegateToGovernor(ctx, accAddr, governor.GetAddress()) + } + } + // set governance delegations + for _, delegation := range data.GovernanceDelegations { + delAddr := sdk.MustAccAddressFromBech32(delegation.DelegatorAddress) + govAddr := types.MustGovernorAddressFromBech32(delegation.GovernorAddress) + // check delegator exists + acc := ak.GetAccount(ctx, delAddr) + if acc == nil { + panic(fmt.Sprintf("account %s does not exist", delAddr.String())) + } + // check governor exists + _, found := k.GetGovernor(ctx, govAddr) + if !found { + panic(fmt.Sprintf("governor %s does not exist", govAddr.String())) + } + + // if account is active governor and delegation is not to self, error + delGovAddr := types.GovernorAddress(delAddr) + if _, found = k.GetGovernor(ctx, delGovAddr); found && !delGovAddr.Equals(govAddr) { + panic(fmt.Sprintf("account %s is an active governor and cannot delegate", delAddr.String())) + } + + k.DelegateToGovernor(ctx, delAddr, govAddr) + } } // ExportGenesis - output genesis parameters @@ -85,6 +123,7 @@ func ExportGenesis(ctx sdk.Context, k *keeper.Keeper) *v1.GenesisState { proposals := k.GetProposals(ctx) params := k.GetParams(ctx) constitution := k.GetConstitution(ctx) + governors := k.GetAllGovernors(ctx) var proposalsDeposits v1.Deposits var proposalsVotes v1.Votes @@ -96,12 +135,19 @@ func ExportGenesis(ctx sdk.Context, k *keeper.Keeper) *v1.GenesisState { proposalsVotes = append(proposalsVotes, votes...) } + var governanceDelegations []*v1.GovernanceDelegation + for _, g := range governors { + delegations := k.GetAllGovernanceDelegationsByGovernor(ctx, g.GetAddress()) + governanceDelegations = append(governanceDelegations, delegations...) + } return &v1.GenesisState{ - StartingProposalId: startingProposalID, - Deposits: proposalsDeposits, - Votes: proposalsVotes, - Proposals: proposals, - Params: ¶ms, - Constitution: constitution, + StartingProposalId: startingProposalID, + Deposits: proposalsDeposits, + Votes: proposalsVotes, + Proposals: proposals, + Params: ¶ms, + Constitution: constitution, + Governors: governors, + GovernanceDelegations: governanceDelegations, } } diff --git a/x/gov/keeper/delegation.go b/x/gov/keeper/delegation.go new file mode 100644 index 000000000..77c779f0a --- /dev/null +++ b/x/gov/keeper/delegation.go @@ -0,0 +1,256 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + "github.com/atomone-hub/atomone/x/gov/types" + v1 "github.com/atomone-hub/atomone/x/gov/types/v1" +) + +// SetGovernanceDelegation sets a governance delegation in the store +func (k Keeper) SetGovernanceDelegation(ctx sdk.Context, delegation v1.GovernanceDelegation) { + store := ctx.KVStore(k.storeKey) + b := k.cdc.MustMarshal(&delegation) + delAddr := sdk.MustAccAddressFromBech32(delegation.DelegatorAddress) + store.Set(types.GovernanceDelegationKey(delAddr), b) + + // Set the reverse mapping from governor to delegation + // mainly for querying all delegations for a governor + // TODO: see if we can avoid duplicate storage + govAddr := types.MustGovernorAddressFromBech32(delegation.GovernorAddress) + store.Set(types.GovernanceDelegationsByGovernorKey(govAddr, delAddr), b) +} + +// GetGovernanceDelegation gets a governance delegation from the store +func (k Keeper) GetGovernanceDelegation(ctx sdk.Context, delegatorAddr sdk.AccAddress) (v1.GovernanceDelegation, bool) { + store := ctx.KVStore(k.storeKey) + b := store.Get(types.GovernanceDelegationKey(delegatorAddr)) + if b == nil { + return v1.GovernanceDelegation{}, false + } + var delegation v1.GovernanceDelegation + k.cdc.MustUnmarshal(b, &delegation) + return delegation, true +} + +// RemoveGovernanceDelegation removes a governance delegation from the store +func (k Keeper) RemoveGovernanceDelegation(ctx sdk.Context, delegatorAddr sdk.AccAddress) { + // need to remove from both the delegator and governor mapping + store := ctx.KVStore(k.storeKey) + delegation, found := k.GetGovernanceDelegation(ctx, delegatorAddr) + if !found { + return + } + delAddr := sdk.MustAccAddressFromBech32(delegation.DelegatorAddress) + store.Delete(types.GovernanceDelegationKey(delAddr)) + + govAddr := types.MustGovernorAddressFromBech32(delegation.GovernorAddress) + store.Delete(types.GovernanceDelegationsByGovernorKey(govAddr, delAddr)) +} + +// SetGovernorValShares sets a governor validator shares in the store +func (k Keeper) SetGovernorValShares(ctx sdk.Context, share v1.GovernorValShares) { + store := ctx.KVStore(k.storeKey) + b := k.cdc.MustMarshal(&share) + govAddr := types.MustGovernorAddressFromBech32(share.GovernorAddress) + valAddr, err := sdk.ValAddressFromBech32(share.ValidatorAddress) + if err != nil { + panic(err) + } + store.Set(types.ValidatorSharesByGovernorKey(govAddr, valAddr), b) + + // set the reverse mapping from validator to governor + // TODO: see if we can avoid duplicate storage + store.Set(types.ValidatorSharesByValidatorKey(valAddr, govAddr), b) +} + +// GetGovernorValShares gets a governor validator shares from the store +func (k Keeper) GetGovernorValShares(ctx sdk.Context, governorAddr types.GovernorAddress, validatorAddr sdk.ValAddress) (v1.GovernorValShares, bool) { + store := ctx.KVStore(k.storeKey) + b := store.Get(types.ValidatorSharesByGovernorKey(governorAddr, validatorAddr)) + if b == nil { + return v1.GovernorValShares{}, false + } + var share v1.GovernorValShares + k.cdc.MustUnmarshal(b, &share) + return share, true +} + +// IterateGovernorValShares iterates over all governor validator shares +func (k Keeper) IterateGovernorValShares(ctx sdk.Context, governorAddr types.GovernorAddress, cb func(index int64, share v1.GovernorValShares) (stop bool)) { + store := ctx.KVStore(k.storeKey) + iterator := sdk.KVStorePrefixIterator(store, types.ValidatorSharesByGovernorKey(governorAddr, []byte{})) + defer iterator.Close() + + for i := int64(0); iterator.Valid(); iterator.Next() { + var share v1.GovernorValShares + k.cdc.MustUnmarshal(iterator.Value(), &share) + if cb(i, share) { + break + } + i++ + } +} + +// IterateGovernorDelegations iterates over all governor delegations +func (k Keeper) IterateGovernorDelegations(ctx sdk.Context, governorAddr types.GovernorAddress, cb func(index int64, delegation v1.GovernanceDelegation) (stop bool)) { + store := ctx.KVStore(k.storeKey) + iterator := sdk.KVStorePrefixIterator(store, types.GovernanceDelegationsByGovernorKey(governorAddr, []byte{})) + defer iterator.Close() + + for i := int64(0); iterator.Valid(); iterator.Next() { + var delegation v1.GovernanceDelegation + k.cdc.MustUnmarshal(iterator.Value(), &delegation) + if cb(i, delegation) { + break + } + i++ + } +} + +// GetGovernorValSharesByValidator gets all governor validator shares for a specific validator +func (k Keeper) GetGovernorValSharesByValidator(ctx sdk.Context, validatorAddr sdk.ValAddress) []v1.GovernorValShares { + store := ctx.KVStore(k.storeKey) + iterator := sdk.KVStorePrefixIterator(store, types.ValidatorSharesByValidatorKey(validatorAddr, []byte{})) + defer iterator.Close() + + var shares []v1.GovernorValShares + for ; iterator.Valid(); iterator.Next() { + var share v1.GovernorValShares + k.cdc.MustUnmarshal(iterator.Value(), &share) + shares = append(shares, share) + } + return shares +} + +// IterateGovernorValSharesByValidator iterates over all governor validator shares for a specific validator +func (k Keeper) IterateGovernorValSharesByValidator(ctx sdk.Context, validatorAddr sdk.ValAddress, cb func(index int64, share v1.GovernorValShares) (stop bool)) { + store := ctx.KVStore(k.storeKey) + iterator := sdk.KVStorePrefixIterator(store, types.ValidatorSharesByValidatorKey(validatorAddr, []byte{})) + defer iterator.Close() + + for i := int64(0); iterator.Valid(); iterator.Next() { + var share v1.GovernorValShares + k.cdc.MustUnmarshal(iterator.Value(), &share) + if cb(i, share) { + break + } + i++ + } +} + +// RemoveGovernorValShares removes a governor validator shares from the store +func (k Keeper) RemoveGovernorValShares(ctx sdk.Context, governorAddr types.GovernorAddress, validatorAddr sdk.ValAddress) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.ValidatorSharesByGovernorKey(governorAddr, validatorAddr)) + store.Delete(types.ValidatorSharesByValidatorKey(validatorAddr, governorAddr)) +} + +// GetAllGovernanceDelegationsByGovernor gets all governance delegations for a specific governor +func (k Keeper) GetAllGovernanceDelegationsByGovernor(ctx sdk.Context, governorAddr types.GovernorAddress) (delegations []*v1.GovernanceDelegation) { + store := ctx.KVStore(k.storeKey) + iterator := sdk.KVStorePrefixIterator(store, types.GovernanceDelegationsByGovernorKey(governorAddr, []byte{})) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var delegation v1.GovernanceDelegation + k.cdc.MustUnmarshal(iterator.Value(), &delegation) + delegations = append(delegations, &delegation) + } + return delegations +} + +// GetAllGovernorValShares gets all governor validators shares +func (k Keeper) GetAllGovernorValShares(ctx sdk.Context, governorAddr types.GovernorAddress) []v1.GovernorValShares { + store := ctx.KVStore(k.storeKey) + iterator := sdk.KVStorePrefixIterator(store, types.ValidatorSharesByGovernorKey(governorAddr, []byte{})) + defer iterator.Close() + + var shares []v1.GovernorValShares + for ; iterator.Valid(); iterator.Next() { + var share v1.GovernorValShares + k.cdc.MustUnmarshal(iterator.Value(), &share) + shares = append(shares, share) + } + return shares +} + +// IncreaseGovernorShares increases the governor validator shares in the store +func (k Keeper) IncreaseGovernorShares(ctx sdk.Context, governorAddr types.GovernorAddress, validatorAddr sdk.ValAddress, shares sdk.Dec) { + valShares, found := k.GetGovernorValShares(ctx, governorAddr, validatorAddr) + if !found { + valShares = v1.NewGovernorValShares(governorAddr, validatorAddr, shares) + } else { + valShares.Shares = valShares.Shares.Add(shares) + } + k.SetGovernorValShares(ctx, valShares) + governor, _ := k.GetGovernor(ctx, governorAddr) + validator, _ := k.sk.GetValidator(ctx, validatorAddr) + vp := shares.MulInt(validator.GetBondedTokens()).Quo(validator.GetDelegatorShares()) + governor.VotingPower = governor.GetVotingPower().Add(vp) + k.UpdateGovernorByPowerIndex(ctx, governor) +} + +// DecreaseGovernorShares decreases the governor validator shares in the store +func (k Keeper) DecreaseGovernorShares(ctx sdk.Context, governorAddr types.GovernorAddress, validatorAddr sdk.ValAddress, shares sdk.Dec) { + share, found := k.GetGovernorValShares(ctx, governorAddr, validatorAddr) + if !found { + panic("cannot decrease shares for a non-existent governor delegation") + } + share.Shares = share.Shares.Sub(shares) + if share.Shares.IsNegative() { + panic("negative shares") + } + if share.Shares.IsZero() { + k.RemoveGovernorValShares(ctx, governorAddr, validatorAddr) + } else { + k.SetGovernorValShares(ctx, share) + } + governor, _ := k.GetGovernor(ctx, governorAddr) + validator, _ := k.sk.GetValidator(ctx, validatorAddr) + vp := shares.MulInt(validator.GetBondedTokens()).Quo(validator.GetDelegatorShares()) + governorVP := governor.GetVotingPower().Sub(vp) + if governorVP.IsNegative() { + panic("negative governor voting power") + } + governor.VotingPower = governorVP + k.UpdateGovernorByPowerIndex(ctx, governor) +} + +// UndelegateFromGovernor decreases all governor validator shares in the store +// and then removes the governor delegation for the given delegator +func (k Keeper) UndelegateFromGovernor(ctx sdk.Context, delegatorAddr sdk.AccAddress) { + delegation, found := k.GetGovernanceDelegation(ctx, delegatorAddr) + if !found { + return + } + govAddr := types.MustGovernorAddressFromBech32(delegation.GovernorAddress) + // iterate all delegations of delegator and decrease shares + k.sk.IterateDelegations(ctx, delegatorAddr, func(_ int64, delegation stakingtypes.DelegationI) (stop bool) { + k.DecreaseGovernorShares(ctx, govAddr, delegation.GetValidatorAddr(), delegation.GetShares()) + return false + }) + // remove the governor delegation + k.RemoveGovernanceDelegation(ctx, delegatorAddr) +} + +// DelegateGovernor creates a governor delegation for the given delegator +// and increases all governor validator shares in the store +func (k Keeper) DelegateToGovernor(ctx sdk.Context, delegatorAddr sdk.AccAddress, governorAddr types.GovernorAddress) { + delegation := v1.NewGovernanceDelegation(delegatorAddr, governorAddr) + k.SetGovernanceDelegation(ctx, delegation) + // iterate all delegations of delegator and increase shares + k.sk.IterateDelegations(ctx, delegatorAddr, func(_ int64, delegation stakingtypes.DelegationI) (stop bool) { + k.IncreaseGovernorShares(ctx, governorAddr, delegation.GetValidatorAddr(), delegation.GetShares()) + return false + }) +} + +// RedelegateGovernor re-delegates all governor validator shares from one governor to another +func (k Keeper) RedelegateToGovernor(ctx sdk.Context, delegatorAddr sdk.AccAddress, dstGovernorAddr types.GovernorAddress) { + // undelegate from the source governor + k.UndelegateFromGovernor(ctx, delegatorAddr) + // delegate to the destination governor + k.DelegateToGovernor(ctx, delegatorAddr, dstGovernorAddr) +} diff --git a/x/gov/keeper/governor.go b/x/gov/keeper/governor.go new file mode 100644 index 000000000..5b6461816 --- /dev/null +++ b/x/gov/keeper/governor.go @@ -0,0 +1,156 @@ +package keeper + +import ( + "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + "github.com/atomone-hub/atomone/x/gov/types" + v1 "github.com/atomone-hub/atomone/x/gov/types/v1" +) + +// GetGovernor returns the governor with the provided address +func (k Keeper) GetGovernor(ctx sdk.Context, addr types.GovernorAddress) (v1.Governor, bool) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.GovernorKey(addr)) + if bz == nil { + return v1.Governor{}, false + } + + return v1.MustUnmarshalGovernor(k.cdc, bz), true +} + +// SetGovernor sets the governor in the store +func (k Keeper) SetGovernor(ctx sdk.Context, governor v1.Governor) { + store := ctx.KVStore(k.storeKey) + bz := v1.MustMarshalGovernor(k.cdc, &governor) + store.Set(types.GovernorKey(governor.GetAddress()), bz) +} + +// GetAllGovernors returns all governors +func (k Keeper) GetAllGovernors(ctx sdk.Context) (governors v1.Governors) { + store := ctx.KVStore(k.storeKey) + + iterator := sdk.KVStorePrefixIterator(store, types.GovernorKeyPrefix) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + governor := v1.MustUnmarshalGovernor(k.cdc, iterator.Value()) + governors = append(governors, &governor) + } + + return governors +} + +// GetAllActiveGovernors returns all active governors +func (k Keeper) GetAllActiveGovernors(ctx sdk.Context) (governors v1.Governors) { + store := ctx.KVStore(k.storeKey) + + iterator := sdk.KVStorePrefixIterator(store, types.GovernorKeyPrefix) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + governor := v1.MustUnmarshalGovernor(k.cdc, iterator.Value()) + if governor.IsActive() { + governors = append(governors, &governor) + } + } + + return governors +} + +// IterateGovernors iterates over all governors and performs a callback function +func (k Keeper) IterateGovernors(ctx sdk.Context, cb func(index int64, governor v1.GovernorI) (stop bool)) { + store := ctx.KVStore(k.storeKey) + + iterator := sdk.KVStorePrefixIterator(store, types.GovernorKeyPrefix) + defer iterator.Close() + + for i := int64(0); iterator.Valid(); iterator.Next() { + governor := v1.MustUnmarshalGovernor(k.cdc, iterator.Value()) + if cb(i, governor) { + break + } + i++ + } +} + +// governor by power index +func (k Keeper) SetGovernorByPowerIndex(ctx sdk.Context, governor v1.Governor) { + store := ctx.KVStore(k.storeKey) + store.Set(types.GovernorsByPowerKey(governor.GetAddress(), governor.GetVotingPower()), governor.GetAddress()) +} + +// governor by power index +func (k Keeper) DeleteGovernorByPowerIndex(ctx sdk.Context, governor v1.Governor) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.GovernorsByPowerKey(governor.GetAddress(), governor.GetVotingPower())) +} + +// UpdateGovernorByPowerIndex updates the governor in the governor by power index +func (k Keeper) UpdateGovernorByPowerIndex(ctx sdk.Context, governor v1.Governor) { + oldGovernor, _ := k.GetGovernor(ctx, governor.GetAddress()) + k.DeleteGovernorByPowerIndex(ctx, oldGovernor) + k.SetGovernorByPowerIndex(ctx, governor) + k.SetGovernor(ctx, governor) +} + +// IterateMaxGovernorsByGovernancePower iterates over the top params.MaxGovernors governors by governance power +// inactive governors or governors that don't meet the minimum self-delegation requirement are not included +func (k Keeper) IterateMaxGovernorsByGovernancePower(ctx sdk.Context, cb func(index int64, governor v1.GovernorI) (stop bool)) { + store := ctx.KVStore(k.storeKey) + maxGovernors := k.GetParams(ctx).MaxGovernors + var totGovernors uint64 = 0 + + iterator := sdk.KVStoreReversePrefixIterator(store, types.GovernorsByPowerKeyPrefix) + defer iterator.Close() + + for ; iterator.Valid() && totGovernors <= maxGovernors; iterator.Next() { + // the value stored is the governor address + governorAddr := types.GovernorAddress(iterator.Value()) + governor, _ := k.GetGovernor(ctx, governorAddr) + if governor.IsActive() && k.ValidateGovernorMinSelfDelegation(ctx, governor) { + if cb(int64(totGovernors), governor) { + break + } + totGovernors++ + } + } +} + +func (k Keeper) getGovernorBondedTokens(ctx sdk.Context, govAddr types.GovernorAddress) (bondedTokens math.Int) { + bondedTokens = sdk.ZeroInt() + addr := sdk.AccAddress(govAddr) + k.sk.IterateDelegations(ctx, addr, func(_ int64, delegation stakingtypes.DelegationI) (stop bool) { + validatorAddr := delegation.GetValidatorAddr() + validator, _ := k.sk.GetValidator(ctx, validatorAddr) + shares := delegation.GetShares() + bt := shares.MulInt(validator.GetBondedTokens()).Quo(validator.GetDelegatorShares()).TruncateInt() + bondedTokens = bondedTokens.Add(bt) + + return false + }) + + return bondedTokens +} + +func (k Keeper) ValidateGovernorMinSelfDelegation(ctx sdk.Context, governor v1.Governor) bool { + minGovernorSelfDelegation, _ := math.NewIntFromString(k.GetParams(ctx).MinGovernorSelfDelegation) + bondedTokens := k.getGovernorBondedTokens(ctx, governor.GetAddress()) + delAddr := sdk.AccAddress(governor.GetAddress()) + + // ensure that the governor is active and that has a valid governance self-delegation + if !governor.IsActive() { + return false + } + if del, found := k.GetGovernanceDelegation(ctx, delAddr); !found || !governor.GetAddress().Equals(types.MustGovernorAddressFromBech32(del.GovernorAddress)) { + panic("active governor without governance self-delegation") + } + + if bondedTokens.LT(minGovernorSelfDelegation) { + return false + } + + return true +} diff --git a/x/gov/keeper/grpc_query.go b/x/gov/keeper/grpc_query.go index 6290d681a..01e4c0991 100644 --- a/x/gov/keeper/grpc_query.go +++ b/x/gov/keeper/grpc_query.go @@ -290,6 +290,155 @@ func (q Keeper) TallyResult(c context.Context, req *v1.QueryTallyResultRequest) return &v1.QueryTallyResultResponse{Tally: &tallyResult}, nil } +// Governor queries governor information based on governor address. +func (q Keeper) Governor(c context.Context, req *v1.QueryGovernorRequest) (*v1.QueryGovernorResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if req.GovernorAddress == "" { + return nil, status.Error(codes.InvalidArgument, "empty governor address") + } + + governorAddr, err := types.GovernorAddressFromBech32(req.GovernorAddress) + if err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + ctx := sdk.UnwrapSDKContext(c) + + governor, found := q.GetGovernor(ctx, governorAddr) + if !found { + return nil, status.Errorf(codes.NotFound, "governor %s doesn't exist", req.GovernorAddress) + } + + return &v1.QueryGovernorResponse{Governor: &governor}, nil +} + +// Governors queries all governors. +func (q Keeper) Governors(c context.Context, req *v1.QueryGovernorsRequest) (*v1.QueryGovernorsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + + store := ctx.KVStore(q.storeKey) + governorStore := prefix.NewStore(store, types.GovernorKeyPrefix) + + var governors v1.Governors + pageRes, err := query.Paginate(governorStore, req.Pagination, func(key []byte, value []byte) error { + var governor v1.Governor + if err := q.cdc.Unmarshal(value, &governor); err != nil { + return err + } + + governors = append(governors, &governor) + return nil + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &v1.QueryGovernorsResponse{Governors: governors, Pagination: pageRes}, nil +} + +// GovernanceDelegations queries all delegations of a governor. +func (q Keeper) GovernanceDelegations(c context.Context, req *v1.QueryGovernanceDelegationsRequest) (*v1.QueryGovernanceDelegationsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if req.GovernorAddress == "" { + return nil, status.Error(codes.InvalidArgument, "empty governor address") + } + + governorAddr, err := types.GovernorAddressFromBech32(req.GovernorAddress) + if err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + ctx := sdk.UnwrapSDKContext(c) + + store := ctx.KVStore(q.storeKey) + delegationStore := prefix.NewStore(store, types.GovernanceDelegationsByGovernorKey(governorAddr, []byte{})) + + var delegations []*v1.GovernanceDelegation + pageRes, err := query.Paginate(delegationStore, req.Pagination, func(key []byte, value []byte) error { + var delegation v1.GovernanceDelegation + if err := q.cdc.Unmarshal(value, &delegation); err != nil { + return err + } + + delegations = append(delegations, &delegation) + return nil + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &v1.QueryGovernanceDelegationsResponse{Delegations: delegations, Pagination: pageRes}, nil +} + +// GovernanceDelegation queries a delegation +func (q Keeper) GovernanceDelegation(c context.Context, req *v1.QueryGovernanceDelegationRequest) (*v1.QueryGovernanceDelegationResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if req.DelegatorAddress == "" { + return nil, status.Error(codes.InvalidArgument, "empty delegator address") + } + + delegatorAddr, err := sdk.AccAddressFromBech32(req.DelegatorAddress) + if err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + ctx := sdk.UnwrapSDKContext(c) + + delegation, found := q.GetGovernanceDelegation(ctx, delegatorAddr) + if !found { + return nil, status.Errorf(codes.NotFound, "governance delegation for %s does not exist", req.DelegatorAddress) + } + + return &v1.QueryGovernanceDelegationResponse{GovernorAddress: delegation.GovernorAddress}, nil +} + +// GovernorValShares queries all validator shares of a governor. +func (q Keeper) GovernorValShares(c context.Context, req *v1.QueryGovernorValSharesRequest) (*v1.QueryGovernorValSharesResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if req.GovernorAddress == "" { + return nil, status.Error(codes.InvalidArgument, "empty governor address") + } + + governorAddr, err := types.GovernorAddressFromBech32(req.GovernorAddress) + if err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + ctx := sdk.UnwrapSDKContext(c) + + store := ctx.KVStore(q.storeKey) + valShareStore := prefix.NewStore(store, types.ValidatorSharesByGovernorKey(governorAddr, []byte{})) + + var valShares []*v1.GovernorValShares + pageRes, err := query.Paginate(valShareStore, req.Pagination, func(key []byte, value []byte) error { + var valShare v1.GovernorValShares + if err := q.cdc.Unmarshal(value, &valShare); err != nil { + return err + } + + valShares = append(valShares, &valShare) + + return nil + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &v1.QueryGovernorValSharesResponse{ValShares: valShares, Pagination: pageRes}, nil +} + var _ v1beta1.QueryServer = legacyQueryServer{} type legacyQueryServer struct { diff --git a/x/gov/keeper/hooks.go b/x/gov/keeper/hooks.go new file mode 100644 index 000000000..c35f5f150 --- /dev/null +++ b/x/gov/keeper/hooks.go @@ -0,0 +1,120 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + "github.com/atomone-hub/atomone/x/gov/types" + v1 "github.com/atomone-hub/atomone/x/gov/types/v1" +) + +// Hooks wrapper struct for gov keeper +type Hooks struct { + k Keeper +} + +var _ stakingtypes.StakingHooks = Hooks{} + +// Return the slashing hooks +func (k Keeper) StakingHooks() Hooks { + return Hooks{k} +} + +// BeforeDelegationSharesModified is called when a delegation's shares are modified +// We trigger a governor shares decrease here subtracting all delegation shares. +// The right amount of shares will be possibly added back in AfterDelegationModified +func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { + // does the delegator have a governance delegation? + govDelegation, found := h.k.GetGovernanceDelegation(ctx, delAddr) + if !found { + return nil + } + govAddr := types.MustGovernorAddressFromBech32(govDelegation.GovernorAddress) + + // Fetch the delegation + delegation, _ := h.k.sk.GetDelegation(ctx, delAddr, valAddr) + + // update the Governor's Validator shares + h.k.DecreaseGovernorShares(ctx, govAddr, valAddr, delegation.Shares) + + return nil +} + +// AfterDelegationModified is called when a delegation is created or modified +// We trigger a governor shares increase here adding all delegation shares. +// It is balanced by the full-amount decrease in BeforeDelegationSharesModified +func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { + // does the delegator have a governance delegation? + govDelegation, found := h.k.GetGovernanceDelegation(ctx, delAddr) + if !found { + return nil + } + + // Fetch the delegation + delegation, found := h.k.sk.GetDelegation(ctx, delAddr, valAddr) + if !found { + return nil + } + + governor, _ := h.k.GetGovernor(ctx, types.MustGovernorAddressFromBech32(govDelegation.GovernorAddress)) + + // Calculate the new shares and update the Governor's shares + shares := delegation.Shares + + h.k.IncreaseGovernorShares(ctx, governor.GetAddress(), valAddr, shares) + + return nil +} + +// BeforeValidatorSlashed is called when a validator is slashed +func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) error { + // iterate through all GovernorValShares and reduce the governor VP by the appropriate amount + h.k.IterateGovernorValSharesByValidator(ctx, valAddr, func(index int64, shares v1.GovernorValShares) bool { + govAddr := types.MustGovernorAddressFromBech32(shares.GovernorAddress) + governor, _ := h.k.GetGovernor(ctx, govAddr) + validator, _ := h.k.sk.GetValidator(ctx, valAddr) + tokensBurned := shares.Shares.MulInt(validator.GetBondedTokens()).Quo(validator.GetDelegatorShares()).Mul(fraction) + governorVP := governor.GetVotingPower().Sub(tokensBurned) + if governorVP.IsNegative() { + panic("negative governor voting power") + } + governor.VotingPower = governorVP + h.k.UpdateGovernorByPowerIndex(ctx, governor) + return false + }) + + return nil +} + +// BeforeDelegationRemoved is called when a delegation is removed +func (h Hooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { + return nil +} + +func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) error { + return nil +} + +func (h Hooks) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress) error { + return nil +} + +func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { + return nil +} + +func (h Hooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { + return nil +} + +func (h Hooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { + return nil +} + +func (h Hooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { + return nil +} + +func (h Hooks) AfterUnbondingInitiated(ctx sdk.Context, unbondingID uint64) error { + return nil +} diff --git a/x/gov/keeper/invariants.go b/x/gov/keeper/invariants.go index fcb1b4f8b..f4e644cd9 100644 --- a/x/gov/keeper/invariants.go +++ b/x/gov/keeper/invariants.go @@ -6,6 +6,7 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/atomone-hub/atomone/x/gov/types" v1 "github.com/atomone-hub/atomone/x/gov/types/v1" @@ -14,6 +15,8 @@ import ( // RegisterInvariants registers all governance invariants func RegisterInvariants(ir sdk.InvariantRegistry, keeper *Keeper, bk types.BankKeeper) { ir.RegisterRoute(types.ModuleName, "module-account", ModuleAccountInvariant(keeper, bk)) + ir.RegisterRoute(types.ModuleName, "governors-voting-power", GovernorsVotingPowerInvariant(keeper, keeper.sk)) + ir.RegisterRoute(types.ModuleName, "governors-delegations", GovernorsDelegationsInvariant(keeper, keeper.sk)) } // AllInvariants runs all invariants of the governance module @@ -47,3 +50,127 @@ func ModuleAccountInvariant(keeper *Keeper, bk types.BankKeeper) sdk.Invariant { balances, expectedDeposits)), broken } } + +// GovernorsVotingPowerInvariant checks that the voting power of all governors +// is actually equal to the voting power resulting from the delegated validator shares +func GovernorsVotingPowerInvariant(keeper *Keeper, sk types.StakingKeeper) sdk.Invariant { + return func(ctx sdk.Context) (string, bool) { + var ( + expectedVotingPower sdk.Dec + actualVotingPower sdk.Dec + broken bool + brokenGovernorAddr string + fail bool + invariantStr string + ) + + keeper.IterateGovernors(ctx, func(index int64, governor v1.GovernorI) bool { + expectedVotingPower = governor.GetVotingPower() + actualVotingPower = sdk.ZeroDec() + fail = false + keeper.IterateGovernorValShares(ctx, governor.GetAddress(), func(index int64, shares v1.GovernorValShares) bool { + validatorAddr, err := sdk.ValAddressFromBech32(shares.ValidatorAddress) + if err != nil { + invariantStr = sdk.FormatInvariant(types.ModuleName, fmt.Sprintf("governor %s voting power", governor.GetAddress().String()), + fmt.Sprintf("failed to parse validator address %s: %v", shares.ValidatorAddress, err)) + fail = true + return true + } + validator, found := sk.GetValidator(ctx, validatorAddr) + if !found { + invariantStr = sdk.FormatInvariant(types.ModuleName, fmt.Sprintf("governor %s voting power", governor.GetAddress().String()), + fmt.Sprintf("validator %s not found", validatorAddr.String())) + fail = true + return true + } + vp := shares.Shares.MulInt(validator.GetBondedTokens()).Quo(validator.GetDelegatorShares()) + actualVotingPower = actualVotingPower.Add(vp) + return false + }) + broken = !expectedVotingPower.Equal(actualVotingPower) + if fail { + broken = true + } + if broken { + brokenGovernorAddr = governor.GetAddress().String() + } + return broken // break on first broken invariant + }) + if !fail { + invariantStr = sdk.FormatInvariant(types.ModuleName, fmt.Sprintf("governor %s voting power", brokenGovernorAddr), + fmt.Sprintf("\texpected voting power: %s\n\tactual voting power: %s\n", expectedVotingPower, actualVotingPower)) + } + return invariantStr, broken + } +} + +// GovernorsDelegationsInvariant checks that the validator shares resulting from all +// governor delegations actually correspond to the stored governor validator shares +func GovernorsDelegationsInvariant(keeper *Keeper, sk types.StakingKeeper) sdk.Invariant { + return func(ctx sdk.Context) (string, bool) { + var ( + broken = false + invariantStr string + ) + + keeper.IterateGovernors(ctx, func(index int64, governor v1.GovernorI) bool { + // check that if governor is active, it has a valid governance self-delegation + if governor.IsActive() { + if del, ok := keeper.GetGovernanceDelegation(ctx, sdk.AccAddress(governor.GetAddress())); !ok || !governor.GetAddress().Equals(types.MustGovernorAddressFromBech32(del.GovernorAddress)) { + invariantStr = sdk.FormatInvariant(types.ModuleName, fmt.Sprintf("governor %s delegations", governor.GetAddress().String()), + "active governor without governance self-delegation") + broken = true + return true + } + } + + valShares := make(map[string]sdk.Dec) + valSharesKeys := make([]string, 0) + keeper.IterateGovernorDelegations(ctx, governor.GetAddress(), func(index int64, delegation v1.GovernanceDelegation) bool { + delAddr := sdk.MustAccAddressFromBech32(delegation.DelegatorAddress) + keeper.sk.IterateDelegations(ctx, delAddr, func(_ int64, delegation stakingtypes.DelegationI) (stop bool) { + validatorAddr := delegation.GetValidatorAddr() + shares := delegation.GetShares() + if _, ok := valShares[validatorAddr.String()]; !ok { + valShares[validatorAddr.String()] = sdk.ZeroDec() + valSharesKeys = append(valSharesKeys, validatorAddr.String()) + } + valShares[validatorAddr.String()] = valShares[validatorAddr.String()].Add(shares) + return false + }) + return false + }) + + for _, valAddrStr := range valSharesKeys { + shares := valShares[valAddrStr] + validatorAddr, _ := sdk.ValAddressFromBech32(valAddrStr) + vs, ok := keeper.GetGovernorValShares(ctx, governor.GetAddress(), validatorAddr) + if !ok { + invariantStr = sdk.FormatInvariant(types.ModuleName, fmt.Sprintf("governor %s delegations", governor.GetAddress().String()), + fmt.Sprintf("validator %s shares not found", valAddrStr)) + broken = true + return true + } + if !vs.Shares.Equal(shares) { + invariantStr = sdk.FormatInvariant(types.ModuleName, fmt.Sprintf("governor %s delegations", governor.GetAddress().String()), + fmt.Sprintf("stored shares %s for validator %s do not match actual shares %s", vs.Shares, valAddrStr, shares)) + broken = true + return true + } + } + + keeper.IterateGovernorValShares(ctx, governor.GetAddress(), func(index int64, shares v1.GovernorValShares) bool { + if _, ok := valShares[shares.ValidatorAddress]; !ok && shares.Shares.GT(sdk.ZeroDec()) { + invariantStr = sdk.FormatInvariant(types.ModuleName, fmt.Sprintf("governor %s delegations", governor.GetAddress().String()), + fmt.Sprintf("non-zero (%s) shares stored for validator %s where there should be none", shares.Shares, shares.ValidatorAddress)) + broken = true + return true + } + return false + }) + + return broken + }) + return invariantStr, broken + } +} diff --git a/x/gov/keeper/msg_server.go b/x/gov/keeper/msg_server.go index 6ef0bc5dd..3e192f501 100644 --- a/x/gov/keeper/msg_server.go +++ b/x/gov/keeper/msg_server.go @@ -5,6 +5,7 @@ import ( "fmt" "cosmossdk.io/errors" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors1 "github.com/cosmos/cosmos-sdk/types/errors" @@ -215,6 +216,146 @@ func (k msgServer) ProposeConstitutionAmendment(goCtx context.Context, msg *v1.M return &v1.MsgProposeConstitutionAmendmentResponse{}, nil } +func (k msgServer) CreateGovernor(goCtx context.Context, msg *v1.MsgCreateGovernor) (*v1.MsgCreateGovernorResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // Ensure the governor does not already exist + addr := sdk.MustAccAddressFromBech32(msg.Address) + govAddr := govtypes.GovernorAddress(addr.Bytes()) + if _, found := k.GetGovernor(ctx, govAddr); found { + return nil, govtypes.ErrGovernorExists + } + + // Ensure the governor has a valid description + if _, err := msg.Description.EnsureLength(); err != nil { + return nil, err + } + + minSelfDelegation, _ := math.NewIntFromString(k.GetParams(ctx).MinGovernorSelfDelegation) + bondedTokens := k.getGovernorBondedTokens(ctx, govAddr) + if bondedTokens.LT(minSelfDelegation) { + return nil, govtypes.ErrInsufficientGovernorDelegation.Wrapf("minimum self-delegation required: %s, total bonded tokens: %s", minSelfDelegation, bondedTokens) + } + + governor, err := v1.NewGovernor(govAddr.String(), msg.Description, ctx.BlockTime()) + if err != nil { + return nil, err + } + + k.SetGovernor(ctx, governor) + + // a base account automatically creates a governance delegation to itself + k.DelegateToGovernor(ctx, addr, govAddr) + + return &v1.MsgCreateGovernorResponse{}, nil +} + +func (k msgServer) EditGovernor(goCtx context.Context, msg *v1.MsgEditGovernor) (*v1.MsgEditGovernorResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // Ensure the governor exists + addr := sdk.MustAccAddressFromBech32(msg.Address) + govAddr := govtypes.GovernorAddress(addr.Bytes()) + governor, found := k.GetGovernor(ctx, govAddr) + if !found { + return nil, govtypes.ErrUnknownGovernor + } + + // Ensure the governor has a valid description + if _, err := msg.Description.EnsureLength(); err != nil { + return nil, err + } + + // Update the governor + governor.Description = msg.Description + k.SetGovernor(ctx, governor) + + return &v1.MsgEditGovernorResponse{}, nil +} + +func (k msgServer) UpdateGovernorStatus(goCtx context.Context, msg *v1.MsgUpdateGovernorStatus) (*v1.MsgUpdateGovernorStatusResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // Ensure the governor exists + addr := sdk.MustAccAddressFromBech32(msg.Address) + govAddr := govtypes.GovernorAddress(addr.Bytes()) + governor, found := k.GetGovernor(ctx, govAddr) + if !found { + return nil, govtypes.ErrUnknownGovernor + } + + if !msg.Status.IsValid() { + return nil, govtypes.ErrInvalidGovernorStatus + } + + // Ensure the governor is not already in the desired status + if governor.Status == msg.Status { + return nil, govtypes.ErrGovernorStatusEqual + } + + // Ensure the governor has been in the current status for the required period + governorStatusChangePeriod := *k.GetParams(ctx).GovernorStatusChangePeriod + changeTime := ctx.BlockTime() + if governor.LastStatusChangeTime.Add(governorStatusChangePeriod).After(changeTime) { + return nil, govtypes.ErrGovernorStatusChangePeriod.Wrapf("last status change time: %s, need to wait until: %s", governor.LastStatusChangeTime, governor.LastStatusChangeTime.Add(governorStatusChangePeriod)) + } + + // Update the governor status + governor.Status = msg.Status + governor.LastStatusChangeTime = &changeTime + k.SetGovernor(ctx, governor) + // if status changes to active, create governance self-delegation + // in case it didn't exist + if governor.IsActive() { + k.RedelegateToGovernor(ctx, addr, govAddr) + } + return &v1.MsgUpdateGovernorStatusResponse{}, nil +} + +func (k msgServer) DelegateGovernor(goCtx context.Context, msg *v1.MsgDelegateGovernor) (*v1.MsgDelegateGovernorResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + delAddr := sdk.MustAccAddressFromBech32(msg.DelegatorAddress) + govAddr := govtypes.MustGovernorAddressFromBech32(msg.GovernorAddress) + + // Ensure the delegator is not already an active governor, as they cannot delegate + if g, found := k.GetGovernor(ctx, govtypes.GovernorAddress(delAddr.Bytes())); found && g.IsActive() { + return nil, govtypes.ErrDelegatorIsGovernor + } + + // Ensure the delegation is not already present + gd, found := k.GetGovernanceDelegation(ctx, delAddr) + if found && govAddr.Equals(govtypes.MustGovernorAddressFromBech32(gd.GovernorAddress)) { + return nil, govtypes.ErrGovernanceDelegationExists + } + // redelegate if a delegation to another governor already exists + if found { + k.RedelegateToGovernor(ctx, delAddr, govAddr) + } else { + // Create the delegation + k.DelegateToGovernor(ctx, delAddr, govAddr) + } + + return &v1.MsgDelegateGovernorResponse{}, nil +} + +func (k msgServer) UndelegateGovernor(goCtx context.Context, msg *v1.MsgUndelegateGovernor) (*v1.MsgUndelegateGovernorResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + delAddr := sdk.MustAccAddressFromBech32(msg.DelegatorAddress) + + // Ensure the delegation exists + _, found := k.GetGovernanceDelegation(ctx, delAddr) + if !found { + return nil, govtypes.ErrUnknownGovernanceDelegation + } + + // Remove the delegation + k.UndelegateFromGovernor(ctx, delAddr) + + return &v1.MsgUndelegateGovernorResponse{}, nil +} + type legacyMsgServer struct { govAcct string server v1.MsgServer diff --git a/x/gov/keeper/tally.go b/x/gov/keeper/tally.go index 7b65fbafb..8ae90bb1a 100644 --- a/x/gov/keeper/tally.go +++ b/x/gov/keeper/tally.go @@ -8,15 +8,16 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/atomone-hub/atomone/x/gov/types" v1 "github.com/atomone-hub/atomone/x/gov/types/v1" ) // Tally iterates over the votes and updates the tally of a proposal based on the voting power of the // voters func (keeper Keeper) Tally(ctx sdk.Context, proposal v1.Proposal) (passes bool, burnDeposits bool, tallyResults v1.TallyResult) { - // fetch all the bonded validators currValidators := keeper.getBondedValidatorsByAddress(ctx) - totalVotingPower, results := keeper.tallyVotes(ctx, proposal, currValidators, true) + currGovernors := keeper.getGovernorsByAddress(ctx) + totalVotingPower, results := keeper.tallyVotes(ctx, proposal, currValidators, currGovernors, true) params := keeper.GetParams(ctx) tallyResults = v1.NewTallyResultFromMap(results) @@ -59,18 +60,16 @@ func (keeper Keeper) HasReachedQuorum(ctx sdk.Context, proposal v1.Proposal) (qu return false, nil } - /* DISABLED on AtomOne - no possible increase of computation speed by - iterating over validators since vote inheritance is disabled. - Keeping as comment because this should be adapted with governors loop - - // we check first if voting power of validators alone is enough to pass quorum - // and if so, we return true skipping the iteration over all votes - // can speed up computation in case quorum is already reached by validator votes alone + quorum, _, err := keeper.getQuorumAndThreshold(ctx, proposal) + currGovernors := keeper.getGovernorsByAddress(ctx) + // we check first if voting power of governors alone is enough to pass quorum + // and if so, we return true skipping the iteration over all votes. + // Can speed up computation in case quorum is already reached by governor votes alone approxTotalVotingPower := math.LegacyZeroDec() - for _, val := range currValidators { - _, ok := keeper.GetVote(ctx, proposal.Id, sdk.AccAddress(val.GetOperator())) + for _, gov := range currGovernors { + _, ok := keeper.GetVote(ctx, proposal.Id, sdk.AccAddress(gov.Address)) if ok { - approxTotalVotingPower = approxTotalVotingPower.Add(math.LegacyNewDecFromInt(val.GetBondedTokens())) + approxTotalVotingPower = approxTotalVotingPower.Add(gov.VotingPower) } } // check and return whether or not the proposal has reached quorum @@ -78,15 +77,12 @@ func (keeper Keeper) HasReachedQuorum(ctx sdk.Context, proposal v1.Proposal) (qu if approxPercentVoting.GTE(quorum) { return true, nil } - */ - // voting power of validators does not reach quorum, let's tally all votes currValidators := keeper.getBondedValidatorsByAddress(ctx) - totalVotingPower, _ := keeper.tallyVotes(ctx, proposal, currValidators, false) + totalVotingPower, _ := keeper.tallyVotes(ctx, proposal, currValidators, currGovernors, false) // check and return whether or not the proposal has reached quorum percentVoting := totalVotingPower.Quo(math.LegacyNewDecFromInt(totalBonded)) - quorum, _, err := keeper.getQuorumAndThreshold(ctx, proposal) if err != nil { return false, err } @@ -104,13 +100,31 @@ func (keeper Keeper) getBondedValidatorsByAddress(ctx sdk.Context) map[string]st return vals } +// getGovernorsByAddress fetches all the active param.MaxGovernors top governors by voting power +// and puts them in map using their operator address as the key. +func (keeper Keeper) getGovernorsByAddress(ctx sdk.Context) map[string]v1.GovernorGovInfo { + govs := make(map[string]v1.GovernorGovInfo) + keeper.IterateMaxGovernorsByGovernancePower(ctx, func(index int64, governor v1.GovernorI) (stop bool) { + govs[governor.GetAddress().String()] = v1.NewGovernorGovInfo( + governor.GetAddress(), + keeper.GetAllGovernorValShares(ctx, governor.GetAddress()), + v1.WeightedVoteOptions{}, + governor.GetVotingPower(), + ) + return false + }) + return govs +} + // tallyVotes returns the total voting power and tally results of the votes // on a proposal. If `isFinal` is true, results will be stored in `results` // map and votes will be deleted. Otherwise, only the total voting power // will be returned and `results` will be nil. func (keeper Keeper) tallyVotes( ctx sdk.Context, proposal v1.Proposal, - currValidators map[string]stakingtypes.ValidatorI, isFinal bool, + currValidators map[string]stakingtypes.ValidatorI, + currGovernors map[string]v1.GovernorGovInfo, + isFinal bool, ) (totalVotingPower math.LegacyDec, results map[v1.VoteOption]math.LegacyDec) { totalVotingPower = math.LegacyZeroDec() if isFinal { @@ -121,23 +135,48 @@ func (keeper Keeper) tallyVotes( } keeper.IterateVotes(ctx, proposal.Id, func(vote v1.Vote) bool { + var governor v1.GovernorGovInfo + voter := sdk.MustAccAddressFromBech32(vote.Voter) - // iterate over all delegations from voter, deduct from any delegated-to validators + + // if voter is a governor record it in the map + govAddrStr := types.GovernorAddress(voter.Bytes()).String() + if gov, ok := currGovernors[govAddrStr]; ok { + gov.Vote = vote.Options + currGovernors[govAddrStr] = gov + } + + gd, hasGovernor := keeper.GetGovernanceDelegation(ctx, voter) + if hasGovernor { + if gi, ok := currGovernors[gd.GovernorAddress]; ok { + governor = gi + } else { + hasGovernor = false + } + } + + // iterate over all delegations from voter keeper.sk.IterateDelegations(ctx, voter, func(index int64, delegation stakingtypes.DelegationI) (stop bool) { valAddrStr := delegation.GetValidatorAddr().String() + votingPower := math.LegacyZeroDec() if val, ok := currValidators[valAddrStr]; ok { // delegation shares * bonded / total shares - votingPower := delegation.GetShares().MulInt(val.GetBondedTokens()).Quo(val.GetDelegatorShares()) + votingPower = votingPower.Add(delegation.GetShares().MulInt(val.GetBondedTokens()).Quo(val.GetDelegatorShares())) - if isFinal { - for _, option := range vote.Options { - weight, _ := math.LegacyNewDecFromStr(option.Weight) - subPower := votingPower.Mul(weight) - results[option.Option] = results[option.Option].Add(subPower) - } + // remove the delegation shares from the governor + if hasGovernor { + governor.ValSharesDeductions[valAddrStr] = governor.ValSharesDeductions[valAddrStr].Add(delegation.GetShares()) + } + } + + totalVotingPower = totalVotingPower.Add(votingPower) + if isFinal { + for _, option := range vote.Options { + weight, _ := math.LegacyNewDecFromStr(option.Weight) + subPower := votingPower.Mul(weight) + results[option.Option] = results[option.Option].Add(subPower) } - totalVotingPower = totalVotingPower.Add(votingPower) } return false @@ -168,6 +207,52 @@ func (keeper Keeper) tallyVotes( } */ + // iterate over the governors again to tally their voting power + for _, gov := range currGovernors { + if len(gov.Vote) == 0 { + continue + } + + // Calculate the voting power of governors that have voted. + // Iterate over all validators the governor has delegation shares assigned to. + // As governor are simply voters that need to have 100% of their bonded tokens + // delegated to them and their shares were deducted when iterating over votes + // we don't need to handle special cases. + votingPower := math.LegacyZeroDec() + for valAddrStr, shares := range gov.ValShares { + if val, ok := currValidators[valAddrStr]; ok { + sharesAfterDeductions := shares.Sub(gov.ValSharesDeductions[valAddrStr]) + votingPower = votingPower.Add(sharesAfterDeductions.MulInt(val.GetBondedTokens()).Quo(val.GetDelegatorShares())) + } + } + if isFinal { + for _, option := range gov.Vote { + weight, _ := sdk.NewDecFromStr(option.Weight) + subPower := votingPower.Mul(weight) + results[option.Option] = results[option.Option].Add(subPower) + } + } + totalVotingPower = totalVotingPower.Add(votingPower) + + /* + // Alternative to the for loop above. It assumes a VotingPowerDeductions + // field in the GovernorGovInfo struct that is updated when iterating over votes + // instead of updating the ValSharesDeductions map. + // This also assumes that gov.VotingPower is always accurate, which needs to be fully verified. + // However, in such a case, this would be the more efficient way to calculate the voting power. + + votingPower := gov.VotingPower.Sub(gov.VotingPowerDeductions)) + if isFinal { + for _, option := range gov.Vote { + weight, _ := sdk.NewDecFromStr(option.Weight) + subPower := votingPower.Mul(weight) + results[option.Option] = results[option.Option].Add(subPower) + } + } + totalVotingPower = totalVotingPower.Add(votingPower) + */ + + } return totalVotingPower, results } diff --git a/x/gov/simulation/genesis.go b/x/gov/simulation/genesis.go index 2dc910b70..10aa98c39 100644 --- a/x/gov/simulation/genesis.go +++ b/x/gov/simulation/genesis.go @@ -30,6 +30,8 @@ const ( TallyParamsConstitutionAmendmentThreshold = "tally_params_constitution_amendment_threshold" TallyParamsLawQuorum = "tally_params_law_quorum" TallyParamsLawThreshold = "tally_params_law_threshold" + GovernorStatusChangePeriod = "governor_status_change_period" + MinGovernorSelfDelegation = "min_governor_self_delegation" // NOTE: backport from v50 MinDepositRatio = "min_deposit_ratio" @@ -101,6 +103,11 @@ func GenQuorumCheckCount(r *rand.Rand) uint64 { return uint64(simulation.RandIntBetween(r, 0, 30)) } +// GenMinGovernorSelfDelegation returns a randomized MinGovernorSelfDelegation +func GenMinGovernorSelfDelegation(r *rand.Rand) math.Int { + return math.NewInt(int64(simulation.RandIntBetween(r, 1000, 10000000))) +} + // RandomizedGenState generates a random GenesisState for gov func RandomizedGenState(simState *module.SimulationState) { startingProposalID := uint64(simState.Rand.Intn(100)) @@ -179,9 +186,23 @@ func RandomizedGenState(simState *module.SimulationState) { var quorumCheckCount uint64 simState.AppParams.GetOrGenerate(simState.Cdc, QuorumCheckCount, &quorumCheckCount, simState.Rand, func(r *rand.Rand) { quorumCheckCount = GenQuorumCheckCount(r) }) + maxGovernors := uint64(simState.Rand.Intn(100)) + + var governorStatusChangePeriod time.Duration + simState.AppParams.GetOrGenerate( + simState.Cdc, GovernorStatusChangePeriod, &governorStatusChangePeriod, simState.Rand, + func(r *rand.Rand) { governorStatusChangePeriod = GenDepositParamsDepositPeriod(r) }, + ) + + var minGovernorSelfDelegation math.Int + simState.AppParams.GetOrGenerate( + simState.Cdc, MinGovernorSelfDelegation, &minGovernorSelfDelegation, simState.Rand, + func(r *rand.Rand) { minGovernorSelfDelegation = GenMinGovernorSelfDelegation(r) }, + ) + govGenesis := v1.NewGenesisState( startingProposalID, - v1.NewParams(minDeposit, depositPeriod, votingPeriod, quorum.String(), threshold.String(), amendmentsQuorum.String(), amendmentsThreshold.String(), lawQuorum.String(), lawThreshold.String(), minInitialDepositRatio.String(), simState.Rand.Intn(2) == 0, simState.Rand.Intn(2) == 0, minDepositRatio.String(), quorumTimout, maxVotingPeriodExtension, quorumCheckCount), + v1.NewParams(minDeposit, depositPeriod, votingPeriod, quorum.String(), threshold.String(), amendmentsQuorum.String(), amendmentsThreshold.String(), lawQuorum.String(), lawThreshold.String(), minInitialDepositRatio.String(), simState.Rand.Intn(2) == 0, simState.Rand.Intn(2) == 0, minDepositRatio.String(), quorumTimout, maxVotingPeriodExtension, quorumCheckCount, maxGovernors, governorStatusChangePeriod, minGovernorSelfDelegation.String()), ) bz, err := json.MarshalIndent(&govGenesis, "", " ") diff --git a/x/gov/testutil/expected_keepers_mocks.go b/x/gov/testutil/expected_keepers_mocks.go index 3492e16a4..97885d2c7 100644 --- a/x/gov/testutil/expected_keepers_mocks.go +++ b/x/gov/testutil/expected_keepers_mocks.go @@ -984,6 +984,36 @@ func (mr *MockStakingKeeperMockRecorder) BondDenom(ctx interface{}) *gomock.Call return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BondDenom", reflect.TypeOf((*MockStakingKeeper)(nil).BondDenom), ctx) } +// GetDelegation mocks base method. +func (m *MockStakingKeeper) GetDelegation(ctx types.Context, delAddr types.AccAddress, valAddr types.ValAddress) (types2.Delegation, bool) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDelegation", ctx, delAddr, valAddr) + ret0, _ := ret[0].(types2.Delegation) + ret1, _ := ret[1].(bool) + return ret0, ret1 +} + +// GetDelegation indicates an expected call of GetDelegation. +func (mr *MockStakingKeeperMockRecorder) GetDelegation(ctx, delAddr, valAddr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDelegation", reflect.TypeOf((*MockStakingKeeper)(nil).GetDelegation), ctx, delAddr, valAddr) +} + +// GetValidator mocks base method. +func (m *MockStakingKeeper) GetValidator(ctx types.Context, addr types.ValAddress) (types2.Validator, bool) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetValidator", ctx, addr) + ret0, _ := ret[0].(types2.Validator) + ret1, _ := ret[1].(bool) + return ret0, ret1 +} + +// GetValidator indicates an expected call of GetValidator. +func (mr *MockStakingKeeperMockRecorder) GetValidator(ctx, addr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValidator", reflect.TypeOf((*MockStakingKeeper)(nil).GetValidator), ctx, addr) +} + // IterateBondedValidatorsByPower mocks base method. func (m *MockStakingKeeper) IterateBondedValidatorsByPower(arg0 types.Context, arg1 func(int64, types2.ValidatorI) bool) { m.ctrl.T.Helper() diff --git a/x/gov/types/address.go b/x/gov/types/address.go new file mode 100644 index 000000000..eec4d6704 --- /dev/null +++ b/x/gov/types/address.go @@ -0,0 +1,179 @@ +package types + +import ( + "bytes" + "encoding/hex" + "encoding/json" + "errors" + "fmt" + "strings" + + "gopkg.in/yaml.v2" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Address = GovernorAddress{} + +const ( + // Prefix for governor addresses + // Full prefix is defined as `bech32AccountPrefix + PrefixGovernor` + PrefixGovernor = "gov" +) + +type GovernorAddress []byte + +// GovernorAddressFromHex creates a GovernorAddress from a hex string. +func GovernorAddressFromHex(address string) (addr GovernorAddress, err error) { + bz, err := addressBytesFromHexString(address) + return GovernorAddress(bz), err +} + +// GovernorAddressFromBech32 creates a GovernorAddress from a Bech32 string. +func GovernorAddressFromBech32(address string) (addr GovernorAddress, err error) { + if len(strings.TrimSpace(address)) == 0 { + return GovernorAddress{}, errors.New("empty address string is not allowed") + } + + bech32PrefixGovAddr := sdk.GetConfig().GetBech32AccountAddrPrefix() + PrefixGovernor + + bz, err := sdk.GetFromBech32(address, bech32PrefixGovAddr) + if err != nil { + return nil, err + } + + err = sdk.VerifyAddressFormat(bz) + if err != nil { + return nil, err + } + + return GovernorAddress(bz), nil +} + +// MustGovernorAddressFromBech32 creates a GovernorAddress from a Bech32 string. +// If the address is invalid, it panics. +func MustGovernorAddressFromBech32(address string) GovernorAddress { + addr, err := GovernorAddressFromBech32(address) + if err != nil { + panic(err) + } + + return addr +} + +// Returns boolean for whether two GovernorAddresses are Equal +func (ga GovernorAddress) Equals(ga2 sdk.Address) bool { + if ga.Empty() && ga2.Empty() { + return true + } + + return bytes.Equal(ga.Bytes(), ga2.Bytes()) +} + +// Returns boolean for whether a GovernorAddress is empty +func (ga GovernorAddress) Empty() bool { + return len(ga) == 0 +} + +// Marshal returns the raw address bytes. It is needed for protobuf +// compatibility. +func (ga GovernorAddress) Marshal() ([]byte, error) { + return ga, nil +} + +// Unmarshal sets the address to the given data. It is needed for protobuf +// compatibility. +func (ga *GovernorAddress) Unmarshal(data []byte) error { + *ga = data + return nil +} + +// MarshalJSON marshals to JSON using Bech32. +func (ga GovernorAddress) MarshalJSON() ([]byte, error) { + return json.Marshal(ga.String()) +} + +// MarshalYAML marshals to YAML using Bech32. +func (ga GovernorAddress) MarshalYAML() (interface{}, error) { + return ga.String(), nil +} + +// UnmarshalJSON unmarshals from JSON assuming Bech32 encoding. +func (ga *GovernorAddress) UnmarshalJSON(data []byte) error { + var s string + err := json.Unmarshal(data, &s) + if err != nil { + return err + } + if s == "" { + *ga = GovernorAddress{} + return nil + } + + ga2, err := GovernorAddressFromBech32(s) + if err != nil { + return err + } + + *ga = ga2 + return nil +} + +// UnmarshalYAML unmarshals from YAML assuming Bech32 encoding. +func (ga *GovernorAddress) UnmarshalYAML(data []byte) error { + var s string + err := yaml.Unmarshal(data, &s) + if err != nil { + return err + } + if s == "" { + *ga = GovernorAddress{} + return nil + } + + ga2, err := GovernorAddressFromBech32(s) + if err != nil { + return err + } + + *ga = ga2 + return nil +} + +// Bytes returns the raw address bytes. +func (ga GovernorAddress) Bytes() []byte { + return ga +} + +// String implements the Stringer interface. +func (ga GovernorAddress) String() string { + if ga.Empty() { + return "" + } + + bech32Addr, err := sdk.Bech32ifyAddressBytes(sdk.GetConfig().GetBech32AccountAddrPrefix()+PrefixGovernor, ga.Bytes()) + if err != nil { + panic(err) + } + return bech32Addr +} + +// Format implements the fmt.Formatter interface. +func (ga GovernorAddress) Format(s fmt.State, verb rune) { + switch verb { + case 's': + s.Write([]byte(ga.String())) + case 'p': + s.Write([]byte(fmt.Sprintf("%p", ga))) + default: + s.Write([]byte(fmt.Sprintf("%X", []byte(ga)))) + } +} + +func addressBytesFromHexString(address string) ([]byte, error) { + if len(address) == 0 { + return nil, sdk.ErrEmptyHexAddress + } + + return hex.DecodeString(address) +} diff --git a/x/gov/types/errors.go b/x/gov/types/errors.go index c00889dc6..2891a47e7 100644 --- a/x/gov/types/errors.go +++ b/x/gov/types/errors.go @@ -10,17 +10,27 @@ var ( ErrInactiveProposal = sdkerrors.Register(ModuleName, 30, "inactive proposal") //nolint:staticcheck ErrAlreadyActiveProposal = sdkerrors.Register(ModuleName, 40, "proposal already active") //nolint:staticcheck // Errors 5 & 6 are legacy errors related to v1beta1.Proposal. - ErrInvalidProposalContent = sdkerrors.Register(ModuleName, 50, "invalid proposal content") //nolint:staticcheck - ErrInvalidProposalType = sdkerrors.Register(ModuleName, 60, "invalid proposal type") //nolint:staticcheck - ErrInvalidVote = sdkerrors.Register(ModuleName, 70, "invalid vote option") //nolint:staticcheck - ErrInvalidGenesis = sdkerrors.Register(ModuleName, 80, "invalid genesis state") //nolint:staticcheck - ErrNoProposalHandlerExists = sdkerrors.Register(ModuleName, 90, "no handler exists for proposal type") //nolint:staticcheck - ErrUnroutableProposalMsg = sdkerrors.Register(ModuleName, 100, "proposal message not recognized by router") //nolint:staticcheck - ErrNoProposalMsgs = sdkerrors.Register(ModuleName, 110, "no messages proposed") //nolint:staticcheck - ErrInvalidProposalMsg = sdkerrors.Register(ModuleName, 120, "invalid proposal message") //nolint:staticcheck - ErrInvalidSigner = sdkerrors.Register(ModuleName, 130, "expected gov account as only signer for proposal message") //nolint:staticcheck - ErrInvalidSignalMsg = sdkerrors.Register(ModuleName, 140, "signal message is invalid") //nolint:staticcheck - ErrMetadataTooLong = sdkerrors.Register(ModuleName, 150, "metadata too long") //nolint:staticcheck - ErrMinDepositTooSmall = sdkerrors.Register(ModuleName, 160, "minimum deposit is too small") //nolint:staticcheck - ErrInvalidConstitutionAmendment = sdkerrors.Register(ModuleName, 170, "invalid constitution amendment") //nolint:staticcheck + ErrInvalidProposalContent = sdkerrors.Register(ModuleName, 50, "invalid proposal content") //nolint:staticcheck + ErrInvalidProposalType = sdkerrors.Register(ModuleName, 60, "invalid proposal type") //nolint:staticcheck + ErrInvalidVote = sdkerrors.Register(ModuleName, 70, "invalid vote option") //nolint:staticcheck + ErrInvalidGenesis = sdkerrors.Register(ModuleName, 80, "invalid genesis state") //nolint:staticcheck + ErrNoProposalHandlerExists = sdkerrors.Register(ModuleName, 90, "no handler exists for proposal type") //nolint:staticcheck + ErrUnroutableProposalMsg = sdkerrors.Register(ModuleName, 100, "proposal message not recognized by router") //nolint:staticcheck + ErrNoProposalMsgs = sdkerrors.Register(ModuleName, 110, "no messages proposed") //nolint:staticcheck + ErrInvalidProposalMsg = sdkerrors.Register(ModuleName, 120, "invalid proposal message") //nolint:staticcheck + ErrInvalidSigner = sdkerrors.Register(ModuleName, 130, "expected gov account as only signer for proposal message") //nolint:staticcheck + ErrInvalidSignalMsg = sdkerrors.Register(ModuleName, 140, "signal message is invalid") //nolint:staticcheck + ErrMetadataTooLong = sdkerrors.Register(ModuleName, 150, "metadata too long") //nolint:staticcheck + ErrMinDepositTooSmall = sdkerrors.Register(ModuleName, 160, "minimum deposit is too small") //nolint:staticcheck + ErrInvalidConstitutionAmendment = sdkerrors.Register(ModuleName, 170, "invalid constitution amendment") //nolint:staticcheck + ErrGovernorExists = sdkerrors.Register(ModuleName, 300, "governor already exists") //nolint:staticcheck + ErrUnknownGovernor = sdkerrors.Register(ModuleName, 310, "unknown governor") //nolint:staticcheck + ErrInvalidGovernorStatus = sdkerrors.Register(ModuleName, 320, "invalid governor status") //nolint:staticcheck + ErrGovernanceDelegationExists = sdkerrors.Register(ModuleName, 330, "governance delegation already exists") //nolint:staticcheck + ErrUnknownGovernanceDelegation = sdkerrors.Register(ModuleName, 340, "unknown governance delegation") //nolint:staticcheck + ErrInvalidGovernanceDescription = sdkerrors.Register(ModuleName, 350, "invalid governance description") //nolint:staticcheck + ErrDelegatorIsGovernor = sdkerrors.Register(ModuleName, 360, "cannot delegate, delegator is an active governor") //nolint:staticcheck + ErrGovernorStatusEqual = sdkerrors.Register(ModuleName, 370, "cannot change governor status to the same status") //nolint:staticcheck + ErrGovernorStatusChangePeriod = sdkerrors.Register(ModuleName, 380, "governor status change period not elapsed") //nolint:staticcheck + ErrInsufficientGovernorDelegation = sdkerrors.Register(ModuleName, 390, "insufficient governor self-delegation") //nolint:staticcheck ) diff --git a/x/gov/types/expected_keepers.go b/x/gov/types/expected_keepers.go index b486e5daf..bb78d19f4 100644 --- a/x/gov/types/expected_keepers.go +++ b/x/gov/types/expected_keepers.go @@ -16,6 +16,9 @@ type ParamSubspace interface { // StakingKeeper expected staking keeper (Validator and Delegator sets) (noalias) type StakingKeeper interface { + GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool) + GetDelegation(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (delegation stakingtypes.Delegation, found bool) + // iterate through bonded validators by operator address, execute func for each validator IterateBondedValidatorsByPower( sdk.Context, func(index int64, validator stakingtypes.ValidatorI) (stop bool), diff --git a/x/gov/types/keys.go b/x/gov/types/keys.go index 8d12a08bd..51db49f09 100644 --- a/x/gov/types/keys.go +++ b/x/gov/types/keys.go @@ -55,6 +55,14 @@ var ( // KeyConstitution is the key string used to store the chain's constitution KeyConstitution = []byte{0x40} + + // GovernorKeyPrefix is the prefix for governor key + GovernorKeyPrefix = []byte{0x50} + GovernorsByPowerKeyPrefix = []byte{0x51} + GovernanceDelegationKeyPrefix = []byte{0x52} + ValidatorSharesByGovernorKeyPrefix = []byte{0x53} + GovernanceDelegationsByGovernorKeyPrefix = []byte{0x54} + ValidatorSharesByValidatorKeyPrefix = []byte{0x55} ) var lenTime = len(sdk.FormatTimeBytes(time.Now())) @@ -131,6 +139,41 @@ func VoteKey(proposalID uint64, voterAddr sdk.AccAddress) []byte { return append(VotesKey(proposalID), address.MustLengthPrefix(voterAddr.Bytes())...) } +// GovernorKey gets the first part of the governor key based on the governor address +func GovernorKey(governorAddr GovernorAddress) []byte { + return append(GovernorKeyPrefix, address.MustLengthPrefix(governorAddr.Bytes())...) +} + +// GovernorsByPowerKey gets the first part of the governors by power key based on the power and governor address +func GovernorsByPowerKey(governorAddr GovernorAddress, power sdk.Dec) []byte { + powerBytes := make([]byte, 8) + binary.BigEndian.PutUint64(powerBytes, uint64(power.TruncateInt64())) + return append(GovernorsByPowerKeyPrefix, append(powerBytes, address.MustLengthPrefix(governorAddr.Bytes())...)...) +} + +// GovernanceDelegationKey gets the first part of the governance delegation key based on the delegator address +func GovernanceDelegationKey(delegatorAddr sdk.AccAddress) []byte { + return append(GovernanceDelegationKeyPrefix, address.MustLengthPrefix(delegatorAddr.Bytes())...) +} + +// GovernanceDelegationsByGovernorKey gets the first part of the key for governance delegations indexed by governor +// based on the delegator address and delegator address +func GovernanceDelegationsByGovernorKey(governorAddr GovernorAddress, delegatorAddr sdk.AccAddress) []byte { + return append(GovernanceDelegationsByGovernorKeyPrefix, append(address.MustLengthPrefix(governorAddr.Bytes()), address.MustLengthPrefix(delegatorAddr.Bytes())...)...) +} + +// ValidatorSharesByGovernorKey gets the first part of the validator shares key based +// on the governor address and validator address +func ValidatorSharesByGovernorKey(governorAddr GovernorAddress, validatorAddr sdk.ValAddress) []byte { + return append(ValidatorSharesByGovernorKeyPrefix, append(address.MustLengthPrefix(governorAddr.Bytes()), address.MustLengthPrefix(validatorAddr.Bytes())...)...) +} + +// ValidatorSharesByValidatorKey gets the first part of the key for validator shares indexed by validator based on +// on the validator address and governor address +func ValidatorSharesByValidatorKey(validatorAddr sdk.ValAddress, governorAddr GovernorAddress) []byte { + return append(ValidatorSharesByValidatorKeyPrefix, append(address.MustLengthPrefix(validatorAddr.Bytes()), address.MustLengthPrefix(governorAddr.Bytes())...)...) +} + // Split keys function; used for iterators // SplitProposalKey split the proposal key and returns the proposal id diff --git a/x/gov/types/v1/codec.go b/x/gov/types/v1/codec.go index 281cf5b31..b49b8fbb0 100644 --- a/x/gov/types/v1/codec.go +++ b/x/gov/types/v1/codec.go @@ -32,6 +32,10 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "atomone/x/gov/v1/MsgUpdateParams") legacy.RegisterAminoMsg(cdc, &MsgProposeConstitutionAmendment{}, "atomone/x/gov/v1/MsgProposeAmendment") legacy.RegisterAminoMsg(cdc, &MsgProposeLaw{}, "atomone/x/gov/v1/MsgProposeLaw") + legacy.RegisterAminoMsg(cdc, &MsgCreateGovernor{}, "atomone/v1/MsgCreateGovernor") + legacy.RegisterAminoMsg(cdc, &MsgEditGovernor{}, "atomone/v1/MsgEditGovernor") + legacy.RegisterAminoMsg(cdc, &MsgDelegateGovernor{}, "atomone/v1/MsgDelegateGovernor") + legacy.RegisterAminoMsg(cdc, &MsgUndelegateGovernor{}, "atomone/v1/MsgUndelegateGovernor") } // RegisterInterfaces registers the interfaces types with the Interface Registry. @@ -45,6 +49,10 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { &MsgUpdateParams{}, &MsgProposeConstitutionAmendment{}, &MsgProposeLaw{}, + &MsgCreateGovernor{}, + &MsgEditGovernor{}, + &MsgDelegateGovernor{}, + &MsgUndelegateGovernor{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/gov/types/v1/delegation.go b/x/gov/types/v1/delegation.go new file mode 100644 index 000000000..acefc2d9b --- /dev/null +++ b/x/gov/types/v1/delegation.go @@ -0,0 +1,30 @@ +package v1 + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/atomone-hub/atomone/x/gov/types" +) + +// NewGovernanceDelegation creates a new GovernanceDelegation instance +func NewGovernanceDelegation(delegatorAddr sdk.AccAddress, governorAddr types.GovernorAddress) GovernanceDelegation { + return GovernanceDelegation{ + DelegatorAddress: delegatorAddr.String(), + GovernorAddress: governorAddr.String(), + } +} + +// NewGovernorValShares creates a new GovernorValShares instance +func NewGovernorValShares(governorAddr types.GovernorAddress, validatorAddress sdk.ValAddress, shares sdk.Dec) GovernorValShares { + if shares.IsNegative() { + panic(fmt.Sprintf("invalid governor val shares: %s", shares)) + } + + return GovernorValShares{ + GovernorAddress: governorAddr.String(), + ValidatorAddress: validatorAddress.String(), + Shares: shares, + } +} diff --git a/x/gov/types/v1/exported.go b/x/gov/types/v1/exported.go new file mode 100644 index 000000000..343d12350 --- /dev/null +++ b/x/gov/types/v1/exported.go @@ -0,0 +1,17 @@ +package v1 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/atomone-hub/atomone/x/gov/types" +) + +type GovernorI interface { + GetMoniker() string // moniker of the governor + GetStatus() GovernorStatus // status of the governor + IsActive() bool // check if has a active status + IsInactive() bool // check if has status inactive + GetAddress() types.GovernorAddress // governor address to receive/return governors delegations + GetDescription() GovernorDescription // description of the governor + GetVotingPower() sdk.Dec // voting power of the governor +} diff --git a/x/gov/types/v1/genesis.go b/x/gov/types/v1/genesis.go index 0065eb9ea..17d25f149 100644 --- a/x/gov/types/v1/genesis.go +++ b/x/gov/types/v1/genesis.go @@ -6,7 +6,10 @@ import ( "golang.org/x/sync/errgroup" - "github.com/cosmos/cosmos-sdk/codec/types" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/atomone-hub/atomone/x/gov/types" ) // NewGenesisState creates a new genesis state for the governance module @@ -97,6 +100,43 @@ func ValidateGenesis(data *GenesisState) error { return nil }) + // weed out duplicate governors + errGroup.Go(func() error { + governorIds := make(map[string]struct{}) + for _, g := range data.Governors { + if _, err := types.GovernorAddressFromBech32(g.GovernorAddress); err != nil { + return fmt.Errorf("invalid governor address: %v", g) + } + if _, ok := governorIds[g.GovernorAddress]; ok { + return fmt.Errorf("duplicate governor: %v", g) + } + + governorIds[g.GovernorAddress] = struct{}{} + } + + return nil + }) + + // weed out duplicate governance delegations + errGroup.Go(func() error { + delegatorIds := make(map[string]struct{}) + for _, d := range data.GovernanceDelegations { + if _, err := sdk.AccAddressFromBech32(d.DelegatorAddress); err != nil { + return fmt.Errorf("invalid delegator address: %v", d) + } + if _, err := types.GovernorAddressFromBech32(d.GovernorAddress); err != nil { + return fmt.Errorf("invalid governor address: %v", d) + } + if _, ok := delegatorIds[d.DelegatorAddress]; ok { + return fmt.Errorf("duplicate governance delegation: %v", d) + } + + delegatorIds[d.DelegatorAddress] = struct{}{} + } + + return nil + }) + // verify params errGroup.Go(func() error { return data.Params.ValidateBasic() @@ -105,10 +145,10 @@ func ValidateGenesis(data *GenesisState) error { return errGroup.Wait() } -var _ types.UnpackInterfacesMessage = GenesisState{} +var _ codectypes.UnpackInterfacesMessage = GenesisState{} // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (data GenesisState) UnpackInterfaces(unpacker types.AnyUnpacker) error { +func (data GenesisState) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { for _, p := range data.Proposals { err := p.UnpackInterfaces(unpacker) if err != nil { diff --git a/x/gov/types/v1/genesis.pb.go b/x/gov/types/v1/genesis.pb.go index 3e6dc87b2..04f93be70 100644 --- a/x/gov/types/v1/genesis.pb.go +++ b/x/gov/types/v1/genesis.pb.go @@ -49,6 +49,10 @@ type GenesisState struct { // // Since: cosmos-sdk 0.48 Constitution string `protobuf:"bytes,9,opt,name=constitution,proto3" json:"constitution,omitempty"` + // governors defines all the governors present at genesis. + Governors []*Governor `protobuf:"bytes,10,rep,name=governors,proto3" json:"governors,omitempty"` + // governance_delegations defines all the governance delegations present at genesis. + GovernanceDelegations []*GovernanceDelegation `protobuf:"bytes,11,rep,name=governance_delegations,json=governanceDelegations,proto3" json:"governance_delegations,omitempty"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -150,6 +154,20 @@ func (m *GenesisState) GetConstitution() string { return "" } +func (m *GenesisState) GetGovernors() []*Governor { + if m != nil { + return m.Governors + } + return nil +} + +func (m *GenesisState) GetGovernanceDelegations() []*GovernanceDelegation { + if m != nil { + return m.GovernanceDelegations + } + return nil +} + func init() { proto.RegisterType((*GenesisState)(nil), "atomone.gov.v1.GenesisState") } @@ -157,31 +175,34 @@ func init() { func init() { proto.RegisterFile("atomone/gov/v1/genesis.proto", fileDescriptor_7737a96fb154b10d) } var fileDescriptor_7737a96fb154b10d = []byte{ - // 380 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xcf, 0xaa, 0xda, 0x40, - 0x14, 0xc6, 0x1d, 0xff, 0x55, 0xc7, 0xe8, 0x62, 0x90, 0x76, 0x68, 0x6d, 0x08, 0xae, 0x42, 0xc1, - 0xa4, 0x2a, 0xf4, 0x01, 0xa4, 0xc5, 0x76, 0x27, 0x69, 0xe9, 0xa2, 0x1b, 0x89, 0x66, 0x88, 0x01, - 0xcd, 0x09, 0x99, 0xe3, 0x50, 0xb7, 0x7d, 0x82, 0x3e, 0x56, 0x97, 0x2e, 0xbb, 0x2c, 0xfa, 0x22, - 0xc5, 0x49, 0x72, 0xd5, 0xdc, 0x7b, 0x77, 0xc3, 0xf9, 0x7e, 0xdf, 0x77, 0x3e, 0x0e, 0x43, 0x07, - 0x3e, 0xc2, 0x0e, 0x62, 0xe1, 0x86, 0xa0, 0x5c, 0x35, 0x76, 0x43, 0x11, 0x0b, 0x19, 0x49, 0x27, - 0x49, 0x01, 0x81, 0xf5, 0x72, 0xd5, 0x09, 0x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xbf, 0x7c, - 0x74, 0x09, 0xad, 0x7a, 0x39, 0xc5, 0x86, 0xd4, 0x58, 0x43, 0x2c, 0x31, 0xc2, 0x3d, 0x46, 0x10, - 0xf3, 0xb6, 0x45, 0xec, 0xb6, 0x77, 0x37, 0x9b, 0xcd, 0xff, 0x9c, 0x4c, 0x72, 0x3c, 0x99, 0xe4, - 0xdf, 0xc9, 0x24, 0xbf, 0xcf, 0x66, 0xe5, 0x78, 0x36, 0x2b, 0x7f, 0xcf, 0x66, 0xe5, 0xc7, 0x28, - 0x8c, 0x70, 0xb3, 0x5f, 0x39, 0x6b, 0xd8, 0xb9, 0xf9, 0x9e, 0xd1, 0x66, 0xbf, 0x2a, 0xde, 0xee, - 0x4f, 0xfd, 0xa3, 0xf0, 0x90, 0x08, 0xe9, 0xaa, 0xf1, 0xaa, 0xa9, 0x3f, 0xd5, 0xf4, 0x7f, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x19, 0xfd, 0x88, 0xa5, 0x9e, 0x02, 0x00, 0x00, + // 432 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xc1, 0x6e, 0xd3, 0x40, + 0x10, 0x86, 0xb3, 0x6d, 0x13, 0x9a, 0x4d, 0xda, 0xc3, 0xaa, 0x94, 0x15, 0x14, 0x2b, 0xaa, 0x38, + 0x44, 0x48, 0xb5, 0x49, 0x2b, 0xf1, 0x00, 0x51, 0x51, 0xe0, 0x56, 0x2d, 0x88, 0x03, 0x1c, 0xa2, + 0x4d, 0xbc, 0xda, 0x5a, 0x72, 0x3c, 0x96, 0x77, 0xb2, 0xa2, 0x6f, 0xc1, 0x8d, 0x57, 0xe2, 0xd8, + 0x23, 0x47, 0x94, 0xbc, 0x08, 0xf2, 0xda, 0xae, 0x53, 0xe3, 0xde, 0xec, 0x99, 0x6f, 0xbe, 0x19, + 0xfd, 0x5a, 0x7a, 0x26, 0x11, 0x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xc7, 0x77, 0x95, 0xe5, 0x99, + 0xb3, 0xbc, 0x6a, 0x5a, 0xbe, 0xe4, 0xcc, 0x8e, 0x64, 0x80, 0x75, 0x81, 0xf9, 0xb4, 0x57, 0x4e, + 0x1f, 0xba, 0xe9, 0xd3, 0xff, 0x92, 0x70, 0x5d, 0x51, 0x52, 0xec, 0x9c, 0x0e, 0x97, 0x90, 0x18, + 0x8c, 0x70, 0x8d, 0x11, 0x24, 0xbc, 0x3f, 0x22, 0xe3, 0xbe, 0x78, 0x54, 0xcb, 0x03, 0xd6, 0x60, + 0x55, 0x96, 0x40, 0x66, 0x38, 0x6d, 0x0f, 0x78, 0x56, 0x02, 0xa2, 0x46, 0xd9, 0x77, 0x7a, 0x5a, + 0xfc, 0xc8, 0x64, 0xa9, 0xe6, 0xa1, 0x8a, 0x95, 0x96, 0xb9, 0xd0, 0xf0, 0x81, 0x93, 0xbc, 0x69, + 0x97, 0xe4, 0xf4, 0xf5, 0x03, 0x2c, 0x9e, 0xeb, 0x96, 0xaa, 0x99, 0xce, 0x7e, 0x6f, 0x3c, 0x72, + 0xbf, 0xf1, 0xc8, 0xdf, 0x8d, 0x47, 0x7e, 0x6e, 0xbd, 0xce, 0xfd, 0xd6, 0xeb, 0xfc, 0xd9, 0x7a, + 0x9d, 0x6f, 0x17, 0x3a, 0xc2, 0xdb, 0xf5, 0xc2, 0x5f, 0xc2, 0x2a, 0x28, 0x17, 0x5c, 0xdc, 0xae, + 0x17, 0xd5, 0x77, 0xf0, 0xc3, 0x3d, 0x73, 0xbc, 0x4b, 0x95, 0x09, 0xec, 0x64, 0xd1, 0x73, 0x2f, + 0xfd, 0xea, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x10, 0x1f, 0x03, 0x97, 0x33, 0x03, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -204,6 +225,34 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.GovernanceDelegations) > 0 { + for iNdEx := len(m.GovernanceDelegations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.GovernanceDelegations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + } + } + if len(m.Governors) > 0 { + for iNdEx := len(m.Governors) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Governors[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + } + } if len(m.Constitution) > 0 { i -= len(m.Constitution) copy(dAtA[i:], m.Constitution) @@ -367,6 +416,18 @@ func (m *GenesisState) Size() (n int) { if l > 0 { n += 1 + l + sovGenesis(uint64(l)) } + if len(m.Governors) > 0 { + for _, e := range m.Governors { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.GovernanceDelegations) > 0 { + for _, e := range m.GovernanceDelegations { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } return n } @@ -702,6 +763,74 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } m.Constitution = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Governors", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Governors = append(m.Governors, &Governor{}) + if err := m.Governors[len(m.Governors)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GovernanceDelegations", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GovernanceDelegations = append(m.GovernanceDelegations, &GovernanceDelegation{}) + if err := m.GovernanceDelegations[len(m.GovernanceDelegations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/gov/types/v1/gov.pb.go b/x/gov/types/v1/gov.pb.go index 4c2182c6b..a73f51931 100644 --- a/x/gov/types/v1/gov.pb.go +++ b/x/gov/types/v1/gov.pb.go @@ -4,6 +4,7 @@ package v1 import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" types1 "github.com/cosmos/cosmos-sdk/codec/types" @@ -117,6 +118,38 @@ func (ProposalStatus) EnumDescriptor() ([]byte, []int) { return fileDescriptor_ecf0f9950ff6986c, []int{1} } +// GovernorStatus is the status of a governor. +type GovernorStatus int32 + +const ( + // UNSPECIFIED defines an invalid governor status. + Unspecified GovernorStatus = 0 + // ACTIVE defines a governor that is active. + Active GovernorStatus = 1 + // INACTIVE defines a governor that is inactive. + Inactive GovernorStatus = 2 +) + +var GovernorStatus_name = map[int32]string{ + 0: "GOVERNOR_STATUS_UNSPECIFIED", + 1: "GOVERNOR_STATUS_ACTIVE", + 2: "GOVERNOR_STATUS_INACTIVE", +} + +var GovernorStatus_value = map[string]int32{ + "GOVERNOR_STATUS_UNSPECIFIED": 0, + "GOVERNOR_STATUS_ACTIVE": 1, + "GOVERNOR_STATUS_INACTIVE": 2, +} + +func (x GovernorStatus) String() string { + return proto.EnumName(GovernorStatus_name, int32(x)) +} + +func (GovernorStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_ecf0f9950ff6986c, []int{2} +} + // WeightedVoteOption defines a unit of vote for vote split. type WeightedVoteOption struct { // option defines the valid vote options, it must not contain duplicate vote @@ -846,6 +879,14 @@ type Params struct { // Number of times a proposal should be checked for quorum after the quorum timeout // has elapsed. Used to compute the amount of time in between quorum checks. QuorumCheckCount uint64 `protobuf:"varint,22,opt,name=quorum_check_count,json=quorumCheckCount,proto3" json:"quorum_check_count,omitempty"` + // defines the maximum number of governors that can be active at any given time. + MaxGovernors uint64 `protobuf:"varint,23,opt,name=max_governors,json=maxGovernors,proto3" json:"max_governors,omitempty"` + // defines the duration of time that need to elapse between governor status changes. + GovernorStatusChangePeriod *time.Duration `protobuf:"bytes,24,opt,name=governor_status_change_period,json=governorStatusChangePeriod,proto3,stdduration" json:"governor_status_change_period,omitempty"` + // defines the minimum amound of bonded tokens, aka the "self-delegation" (because active governors + // must have the governance VP from the base account automatically delegated to them), that a governor + // must have to be considered active. + MinGovernorSelfDelegation string `protobuf:"bytes,25,opt,name=min_governor_self_delegation,json=minGovernorSelfDelegation,proto3" json:"min_governor_self_delegation,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -993,9 +1034,246 @@ func (m *Params) GetQuorumCheckCount() uint64 { return 0 } +func (m *Params) GetMaxGovernors() uint64 { + if m != nil { + return m.MaxGovernors + } + return 0 +} + +func (m *Params) GetGovernorStatusChangePeriod() *time.Duration { + if m != nil { + return m.GovernorStatusChangePeriod + } + return nil +} + +func (m *Params) GetMinGovernorSelfDelegation() string { + if m != nil { + return m.MinGovernorSelfDelegation + } + return "" +} + +// Governor defines a governor, together with the total amount of delegated +// validator's bond shares for a set amount of validators. When a delegator +// delegates a percentage of its x/gov power to a governor, the resulting +// shares from each delegators delegations in x/staking are added to the +// governor's total shares. +type Governor struct { + // governor_address defines the address of the governor; bech32-encoded. + GovernorAddress string `protobuf:"bytes,1,opt,name=governor_address,json=governorAddress,proto3" json:"governor_address,omitempty"` + // status is the status of the governor (active/inactive). + Status GovernorStatus `protobuf:"varint,2,opt,name=status,proto3,enum=atomone.gov.v1.GovernorStatus" json:"status,omitempty"` + // description defines the description terms for the governor. + Description GovernorDescription `protobuf:"bytes,3,opt,name=description,proto3" json:"description"` + // voting_power defines the (estimated) voting power of the governor. + VotingPower cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=voting_power,json=votingPower,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"voting_power"` + // last_status_change_time is the time when the governor's status was last changed. + LastStatusChangeTime *time.Time `protobuf:"bytes,5,opt,name=last_status_change_time,json=lastStatusChangeTime,proto3,stdtime" json:"last_status_change_time,omitempty"` +} + +func (m *Governor) Reset() { *m = Governor{} } +func (m *Governor) String() string { return proto.CompactTextString(m) } +func (*Governor) ProtoMessage() {} +func (*Governor) Descriptor() ([]byte, []int) { + return fileDescriptor_ecf0f9950ff6986c, []int{10} +} +func (m *Governor) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Governor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Governor.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Governor) XXX_Merge(src proto.Message) { + xxx_messageInfo_Governor.Merge(m, src) +} +func (m *Governor) XXX_Size() int { + return m.Size() +} +func (m *Governor) XXX_DiscardUnknown() { + xxx_messageInfo_Governor.DiscardUnknown(m) +} + +var xxx_messageInfo_Governor proto.InternalMessageInfo + +// Description defines a governor description. +type GovernorDescription struct { + // moniker defines a human-readable name for the governor. + Moniker string `protobuf:"bytes,1,opt,name=moniker,proto3" json:"moniker,omitempty"` + // identity defines an optional identity signature (ex. UPort or Keybase). + Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` + // website defines an optional website link. + Website string `protobuf:"bytes,3,opt,name=website,proto3" json:"website,omitempty"` + // security_contact defines an optional email for security contact. + SecurityContact string `protobuf:"bytes,4,opt,name=security_contact,json=securityContact,proto3" json:"security_contact,omitempty"` + // details define other optional details. + Details string `protobuf:"bytes,5,opt,name=details,proto3" json:"details,omitempty"` +} + +func (m *GovernorDescription) Reset() { *m = GovernorDescription{} } +func (m *GovernorDescription) String() string { return proto.CompactTextString(m) } +func (*GovernorDescription) ProtoMessage() {} +func (*GovernorDescription) Descriptor() ([]byte, []int) { + return fileDescriptor_ecf0f9950ff6986c, []int{11} +} +func (m *GovernorDescription) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GovernorDescription) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GovernorDescription.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GovernorDescription) XXX_Merge(src proto.Message) { + xxx_messageInfo_GovernorDescription.Merge(m, src) +} +func (m *GovernorDescription) XXX_Size() int { + return m.Size() +} +func (m *GovernorDescription) XXX_DiscardUnknown() { + xxx_messageInfo_GovernorDescription.DiscardUnknown(m) +} + +var xxx_messageInfo_GovernorDescription proto.InternalMessageInfo + +func (m *GovernorDescription) GetMoniker() string { + if m != nil { + return m.Moniker + } + return "" +} + +func (m *GovernorDescription) GetIdentity() string { + if m != nil { + return m.Identity + } + return "" +} + +func (m *GovernorDescription) GetWebsite() string { + if m != nil { + return m.Website + } + return "" +} + +func (m *GovernorDescription) GetSecurityContact() string { + if m != nil { + return m.SecurityContact + } + return "" +} + +func (m *GovernorDescription) GetDetails() string { + if m != nil { + return m.Details + } + return "" +} + +// GovernorValShares holds the number of virtual shares from the +// specific validator that a governor can use to vote on proposals. +type GovernorValShares struct { + GovernorAddress string `protobuf:"bytes,1,opt,name=governor_address,json=governorAddress,proto3" json:"governor_address,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + // shares define the delegation shares available from this validator. + Shares cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=shares,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"shares"` +} + +func (m *GovernorValShares) Reset() { *m = GovernorValShares{} } +func (m *GovernorValShares) String() string { return proto.CompactTextString(m) } +func (*GovernorValShares) ProtoMessage() {} +func (*GovernorValShares) Descriptor() ([]byte, []int) { + return fileDescriptor_ecf0f9950ff6986c, []int{12} +} +func (m *GovernorValShares) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GovernorValShares) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GovernorValShares.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GovernorValShares) XXX_Merge(src proto.Message) { + xxx_messageInfo_GovernorValShares.Merge(m, src) +} +func (m *GovernorValShares) XXX_Size() int { + return m.Size() +} +func (m *GovernorValShares) XXX_DiscardUnknown() { + xxx_messageInfo_GovernorValShares.DiscardUnknown(m) +} + +var xxx_messageInfo_GovernorValShares proto.InternalMessageInfo + +// GovernanceDelegation defines a delegation of governance voting power from a +// delegator to a governor. +type GovernanceDelegation struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + GovernorAddress string `protobuf:"bytes,2,opt,name=governor_address,json=governorAddress,proto3" json:"governor_address,omitempty"` +} + +func (m *GovernanceDelegation) Reset() { *m = GovernanceDelegation{} } +func (m *GovernanceDelegation) String() string { return proto.CompactTextString(m) } +func (*GovernanceDelegation) ProtoMessage() {} +func (*GovernanceDelegation) Descriptor() ([]byte, []int) { + return fileDescriptor_ecf0f9950ff6986c, []int{13} +} +func (m *GovernanceDelegation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GovernanceDelegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GovernanceDelegation.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GovernanceDelegation) XXX_Merge(src proto.Message) { + xxx_messageInfo_GovernanceDelegation.Merge(m, src) +} +func (m *GovernanceDelegation) XXX_Size() int { + return m.Size() +} +func (m *GovernanceDelegation) XXX_DiscardUnknown() { + xxx_messageInfo_GovernanceDelegation.DiscardUnknown(m) +} + +var xxx_messageInfo_GovernanceDelegation proto.InternalMessageInfo + func init() { proto.RegisterEnum("atomone.gov.v1.VoteOption", VoteOption_name, VoteOption_value) proto.RegisterEnum("atomone.gov.v1.ProposalStatus", ProposalStatus_name, ProposalStatus_value) + proto.RegisterEnum("atomone.gov.v1.GovernorStatus", GovernorStatus_name, GovernorStatus_value) proto.RegisterType((*WeightedVoteOption)(nil), "atomone.gov.v1.WeightedVoteOption") proto.RegisterType((*Deposit)(nil), "atomone.gov.v1.Deposit") proto.RegisterType((*Proposal)(nil), "atomone.gov.v1.Proposal") @@ -1006,105 +1284,176 @@ func init() { proto.RegisterType((*VotingParams)(nil), "atomone.gov.v1.VotingParams") proto.RegisterType((*TallyParams)(nil), "atomone.gov.v1.TallyParams") proto.RegisterType((*Params)(nil), "atomone.gov.v1.Params") + proto.RegisterType((*Governor)(nil), "atomone.gov.v1.Governor") + proto.RegisterType((*GovernorDescription)(nil), "atomone.gov.v1.GovernorDescription") + proto.RegisterType((*GovernorValShares)(nil), "atomone.gov.v1.GovernorValShares") + proto.RegisterType((*GovernanceDelegation)(nil), "atomone.gov.v1.GovernanceDelegation") } func init() { proto.RegisterFile("atomone/gov/v1/gov.proto", fileDescriptor_ecf0f9950ff6986c) } var fileDescriptor_ecf0f9950ff6986c = []byte{ - // 1447 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xbf, 0x6f, 0xdb, 0x46, - 0x14, 0x36, 0xf5, 0xcb, 0xf2, 0xb3, 0x2d, 0xd3, 0x67, 0x27, 0xa1, 0xed, 0x58, 0x76, 0x85, 0x22, - 0x70, 0xd3, 0x58, 0xaa, 0x9d, 0x22, 0x43, 0x91, 0x45, 0xb6, 0x98, 0x54, 0x41, 0x6a, 0x29, 0x94, - 0xe2, 0x36, 0x1d, 0x4a, 0x9c, 0xc4, 0x8b, 0x4c, 0x44, 0xe4, 0x29, 0xe4, 0xd1, 0xb6, 0xfe, 0x8b, - 0x4c, 0x45, 0xd1, 0xa9, 0x63, 0xc7, 0x0e, 0x01, 0xfa, 0x07, 0x14, 0x05, 0x32, 0x15, 0x41, 0xa6, - 0x76, 0x49, 0x8b, 0x64, 0x28, 0x90, 0xbd, 0x7b, 0x71, 0xc7, 0xa3, 0x7e, 0x59, 0x81, 0x9c, 0xa0, - 0x5d, 0x6c, 0xf2, 0xde, 0xf7, 0xbd, 0xf7, 0xee, 0xbd, 0xef, 0xdd, 0x89, 0xa0, 0x61, 0x46, 0x1d, - 0xea, 0x92, 0x42, 0x8b, 0x1e, 0x17, 0x8e, 0x77, 0xf8, 0xbf, 0x7c, 0xc7, 0xa3, 0x8c, 0xa2, 0x8c, - 0xb4, 0xe4, 0xf9, 0xd2, 0xf1, 0xce, 0x6a, 0xb6, 0x49, 0x7d, 0x87, 0xfa, 0x85, 0x06, 0xf6, 0x49, - 0xe1, 0x78, 0xa7, 0x41, 0x18, 0xde, 0x29, 0x34, 0xa9, 0xed, 0x86, 0xf8, 0xd5, 0xe5, 0x16, 0x6d, - 0x51, 0xf1, 0x58, 0xe0, 0x4f, 0x72, 0x75, 0xa3, 0x45, 0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x9a, 0x36, 0x0f, 0x00, 0x00, + // 1937 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcf, 0x6f, 0x1b, 0xc7, + 0x15, 0xd6, 0x52, 0x14, 0x45, 0x3d, 0x4a, 0x14, 0x35, 0x96, 0xed, 0x15, 0x65, 0x91, 0x0a, 0x53, + 0x04, 0x8a, 0x6a, 0x91, 0x91, 0x5d, 0xe4, 0x60, 0xe4, 0x42, 0x89, 0xb4, 0x4a, 0xc3, 0x15, 0x99, + 0x25, 0xad, 0x34, 0x3d, 0x74, 0x31, 0xe4, 0x8e, 0xa8, 0x85, 0xb9, 0x3b, 0xcc, 0xee, 0x90, 0x12, + 0xff, 0x83, 0xc0, 0xa7, 0xa0, 0xa7, 0xa2, 0xa8, 0x01, 0x03, 0xbd, 0xf4, 0x98, 0x83, 0x81, 0xfe, + 0x01, 0x45, 0x81, 0x9c, 0x8a, 0xc0, 0xa7, 0xb6, 0x07, 0xb7, 0xb0, 0x0f, 0x0d, 0x72, 0xea, 0xa5, + 0x40, 0x8f, 0xc5, 0xfc, 0x58, 0x72, 0x49, 0x51, 0x95, 0x64, 0x34, 0x17, 0x69, 0xe7, 0xcd, 0xf7, + 0x7d, 0xf3, 0x66, 0xde, 0x7b, 0xf3, 0x83, 0xa0, 0x63, 0x46, 0x1d, 0xea, 0x92, 0x42, 0x9b, 0xf6, + 0x0b, 0xfd, 0x5d, 0xfe, 0x2f, 0xdf, 0xf5, 0x28, 0xa3, 0x28, 0xa9, 0x7a, 0xf2, 0xdc, 0xd4, 0xdf, + 0x4d, 0x67, 0x5a, 0xd4, 0x77, 0xa8, 0x5f, 0x68, 0x62, 0x9f, 0x14, 0xfa, 0xbb, 0x4d, 0xc2, 0xf0, + 0x6e, 0xa1, 0x45, 0x6d, 0x57, 0xe2, 0xd3, 0xab, 0x6d, 0xda, 0xa6, 0xe2, 0xb3, 0xc0,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0x37, 0x67, 0xb7, 0x12, 0xf7, 0xd6, 0xf2, 0x8a, 0xc1, 0xe3, 0x94, 0x57, 0x71, 0xca, + 0xef, 0x53, 0xdb, 0xdd, 0x5b, 0xf8, 0xe6, 0x75, 0x76, 0xe6, 0xf7, 0xff, 0xfc, 0x7a, 0x5b, 0x33, + 0x14, 0x27, 0xf7, 0xc7, 0x39, 0x88, 0xd7, 0x94, 0x13, 0x28, 0x09, 0x91, 0xa1, 0x6b, 0x11, 0xdb, + 0x42, 0x1f, 0x41, 0xdc, 0x21, 0xbe, 0x8f, 0xdb, 0xc4, 0xd7, 0x23, 0x42, 0x7c, 0x35, 0x2f, 0x43, + 0x92, 0x0f, 0x42, 0x92, 0x2f, 0xba, 0x03, 0x63, 0x88, 0x42, 0x1f, 0x43, 0xcc, 0x67, 0x98, 0xf5, + 0x7c, 0x7d, 0x56, 0xac, 0x66, 0x66, 0x72, 0x35, 0x83, 0xb1, 0xea, 0x02, 0x65, 0x28, 0x34, 0xaa, + 0x00, 0x3a, 0xb6, 0x5d, 0xdc, 0x31, 0x19, 0xee, 0x74, 0x06, 0xa6, 0x47, 0xfc, 0x5e, 0x87, 0xe9, + 0xd1, 0x4d, 0x6d, 0x2b, 0x71, 0x6f, 0x7d, 0x52, 0xa3, 0xc1, 0x31, 0x86, 0x80, 0x18, 0x29, 0x41, + 0x0b, 0x59, 0x50, 0x11, 0x12, 0x7e, 0xaf, 0xe9, 0xd8, 0xcc, 0xe4, 0x99, 0xa6, 0xcf, 0x09, 0x8d, + 0xf4, 0x39, 0xbf, 0x1b, 0x41, 0x1a, 0xee, 0x45, 0xbf, 0xfa, 0x7b, 0x56, 0x33, 0x40, 0x92, 0xb8, + 0x19, 0x3d, 0x82, 0x94, 0x5a, 0x5f, 0x93, 0xb8, 0x96, 0xd4, 0x89, 0x5d, 0x51, 0x27, 0xa9, 0x98, + 0x65, 0xd7, 0x12, 0x5a, 0x15, 0x58, 0x62, 0x94, 0xe1, 0x8e, 0xa9, 0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 0xb7, 0x8f, + 0xaa, 0x8d, 0xb2, 0x59, 0xad, 0x35, 0x2a, 0xd5, 0x43, 0xf3, 0xc9, 0x61, 0xbd, 0x56, 0xde, 0xaf, + 0x3c, 0xac, 0x94, 0x4b, 0xa9, 0x19, 0x74, 0x03, 0x96, 0xc3, 0x9d, 0x9f, 0x97, 0xeb, 0x29, 0x0d, + 0xdd, 0x86, 0x1b, 0x61, 0x63, 0x71, 0xaf, 0xde, 0x28, 0x56, 0x0e, 0x53, 0x11, 0x84, 0x20, 0x19, + 0xee, 0x38, 0xac, 0xa6, 0x66, 0xb7, 0xff, 0xac, 0x41, 0x72, 0xfc, 0xb7, 0x02, 0x94, 0x85, 0xf5, + 0x9a, 0x51, 0xad, 0x55, 0xeb, 0xc5, 0xc7, 0x66, 0xbd, 0x51, 0x6c, 0x3c, 0xa9, 0x4f, 0x8c, 0x9a, + 0x83, 0xcc, 0x24, 0xa0, 0x54, 0xae, 0x55, 0xeb, 0x95, 0x86, 0x59, 0x2b, 0x1b, 0x95, 0x6a, 0x29, + 0xa5, 0xa1, 0xf7, 0x60, 0x63, 0x12, 0x73, 0x54, 0x6d, 0x54, 0x0e, 0x0f, 0x02, 0x48, 0x04, 0xa5, + 0xe1, 0xd6, 0x24, 0xa4, 0x56, 0xac, 0xd7, 0xcb, 0xa5, 0xd4, 0x2c, 0xba, 0x03, 0xfa, 0x64, 0x9f, + 0x51, 0x7e, 0x54, 0xde, 0x6f, 0x94, 0x4b, 0xa9, 0xe8, 0x34, 0xe6, 0xc3, 0x62, 0xe5, 0x71, 0xb9, + 0x94, 0x9a, 0xdb, 0xfe, 0xad, 0x06, 0xc9, 0xf1, 0x1d, 0x09, 0x7d, 0x04, 0xeb, 0x07, 0xd5, 0xa3, + 0xb2, 0x71, 0x58, 0x35, 0xa6, 0x4e, 0x28, 0xbd, 0xfc, 0xec, 0xf9, 0x66, 0xe2, 0x89, 0xeb, 0x77, + 0x49, 0xcb, 0x3e, 0xb6, 0x09, 0xbf, 0x37, 0xdd, 0x9a, 0x64, 0x14, 0xf7, 0x1b, 0x95, 0xa3, 0x72, + 0x4a, 0x4b, 0xc3, 0xb3, 0xe7, 0x9b, 0xb1, 0x62, 0x8b, 0xd9, 0x7d, 0x82, 0xb6, 0x41, 0x9f, 0xc4, + 0x55, 0x0e, 0x15, 0x32, 0x92, 0x5e, 0x7c, 0xf6, 0x7c, 0x33, 0x5e, 0x71, 0xb1, 0xc0, 0xa6, 0xa3, + 0x5f, 0xfe, 0x2e, 0x33, 0xb3, 0x77, 0xf0, 0xcd, 0x9b, 0x8c, 0xf6, 0xed, 0x9b, 0x8c, 0xf6, 0x8f, + 0x37, 0x19, 0xed, 0xab, 0xb7, 0x99, 0x99, 0x6f, 0xdf, 0x66, 0x66, 0xfe, 0xf2, 0x36, 0x33, 0xf3, + 0x8b, 0x9d, 0xb6, 0xcd, 0x4e, 0x7a, 0xcd, 0x7c, 0x8b, 0x3a, 0x05, 0xb5, 0x49, 0xee, 0x9c, 0xf4, + 0x9a, 0xc1, 0x77, 0xe1, 0x4c, 0xfc, 0x72, 0xc8, 0x06, 0x5d, 0xe2, 0x17, 0xfa, 0xbb, 0xcd, 0x98, + 0xd8, 0x8d, 0xee, 0xff, 0x37, 0x00, 0x00, 0xff, 0xff, 0x23, 0x13, 0x27, 0x7c, 0x58, 0x14, 0x00, + 0x00, +} + +func (this *GovernorDescription) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*GovernorDescription) + if !ok { + that2, ok := that.(GovernorDescription) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Moniker != that1.Moniker { + return false + } + if this.Identity != that1.Identity { + return false + } + if this.Website != that1.Website { + return false + } + if this.SecurityContact != that1.SecurityContact { + return false + } + if this.Details != that1.Details { + return false + } + return true } - func (m *WeightedVoteOption) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1638,15 +1987,17 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.QuorumCheckCount != 0 { - i = encodeVarintGov(dAtA, i, uint64(m.QuorumCheckCount)) + if len(m.MinGovernorSelfDelegation) > 0 { + i -= len(m.MinGovernorSelfDelegation) + copy(dAtA[i:], m.MinGovernorSelfDelegation) + i = encodeVarintGov(dAtA, i, uint64(len(m.MinGovernorSelfDelegation))) i-- dAtA[i] = 0x1 i-- - dAtA[i] = 0xb0 + dAtA[i] = 0xca } - if m.MaxVotingPeriodExtension != nil { - n9, err9 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxVotingPeriodExtension, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxVotingPeriodExtension):]) + if m.GovernorStatusChangePeriod != nil { + n9, err9 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.GovernorStatusChangePeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.GovernorStatusChangePeriod):]) if err9 != nil { return 0, err9 } @@ -1655,10 +2006,24 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1 i-- - dAtA[i] = 0xaa + dAtA[i] = 0xc2 } - if m.QuorumTimeout != nil { - n10, err10 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.QuorumTimeout, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.QuorumTimeout):]) + if m.MaxGovernors != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.MaxGovernors)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xb8 + } + if m.QuorumCheckCount != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.QuorumCheckCount)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xb0 + } + if m.MaxVotingPeriodExtension != nil { + n10, err10 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxVotingPeriodExtension, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxVotingPeriodExtension):]) if err10 != nil { return 0, err10 } @@ -1667,6 +2032,18 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1 i-- + dAtA[i] = 0xaa + } + if m.QuorumTimeout != nil { + n11, err11 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.QuorumTimeout, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.QuorumTimeout):]) + if err11 != nil { + return 0, err11 + } + i -= n11 + i = encodeVarintGov(dAtA, i, uint64(n11)) + i-- + dAtA[i] = 0x1 + i-- dAtA[i] = 0xa2 } if len(m.LawThreshold) > 0 { @@ -1754,22 +2131,22 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x22 } if m.VotingPeriod != nil { - n11, err11 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.VotingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod):]) - if err11 != nil { - return 0, err11 + n12, err12 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.VotingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod):]) + if err12 != nil { + return 0, err12 } - i -= n11 - i = encodeVarintGov(dAtA, i, uint64(n11)) + i -= n12 + i = encodeVarintGov(dAtA, i, uint64(n12)) i-- dAtA[i] = 0x1a } if m.MaxDepositPeriod != nil { - n12, err12 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxDepositPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod):]) - if err12 != nil { - return 0, err12 + n13, err13 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxDepositPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod):]) + if err13 != nil { + return 0, err13 } - i -= n12 - i = encodeVarintGov(dAtA, i, uint64(n12)) + i -= n13 + i = encodeVarintGov(dAtA, i, uint64(n13)) i-- dAtA[i] = 0x12 } @@ -1790,60 +2167,267 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func encodeVarintGov(dAtA []byte, offset int, v uint64) int { - offset -= sovGov(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *Governor) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *WeightedVoteOption) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Option != 0 { - n += 1 + sovGov(uint64(m.Option)) - } - l = len(m.Weight) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - return n + +func (m *Governor) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Deposit) Size() (n int) { - if m == nil { - return 0 - } +func (m *Governor) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.ProposalId != 0 { - n += 1 + sovGov(uint64(m.ProposalId)) + if m.LastStatusChangeTime != nil { + n14, err14 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.LastStatusChangeTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.LastStatusChangeTime):]) + if err14 != nil { + return 0, err14 + } + i -= n14 + i = encodeVarintGov(dAtA, i, uint64(n14)) + i-- + dAtA[i] = 0x2a } - l = len(m.Depositor) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) + { + size := m.VotingPower.Size() + i -= size + if _, err := m.VotingPower.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGov(dAtA, i, uint64(size)) } - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovGov(uint64(l)) + i-- + dAtA[i] = 0x22 + { + size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) } - return n + i-- + dAtA[i] = 0x1a + if m.Status != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x10 + } + if len(m.GovernorAddress) > 0 { + i -= len(m.GovernorAddress) + copy(dAtA[i:], m.GovernorAddress) + i = encodeVarintGov(dAtA, i, uint64(len(m.GovernorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *Proposal) Size() (n int) { - if m == nil { - return 0 +func (m *GovernorDescription) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int + return dAtA[:n], nil +} + +func (m *GovernorDescription) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GovernorDescription) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Details) > 0 { + i -= len(m.Details) + copy(dAtA[i:], m.Details) + i = encodeVarintGov(dAtA, i, uint64(len(m.Details))) + i-- + dAtA[i] = 0x2a + } + if len(m.SecurityContact) > 0 { + i -= len(m.SecurityContact) + copy(dAtA[i:], m.SecurityContact) + i = encodeVarintGov(dAtA, i, uint64(len(m.SecurityContact))) + i-- + dAtA[i] = 0x22 + } + if len(m.Website) > 0 { + i -= len(m.Website) + copy(dAtA[i:], m.Website) + i = encodeVarintGov(dAtA, i, uint64(len(m.Website))) + i-- + dAtA[i] = 0x1a + } + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintGov(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0x12 + } + if len(m.Moniker) > 0 { + i -= len(m.Moniker) + copy(dAtA[i:], m.Moniker) + i = encodeVarintGov(dAtA, i, uint64(len(m.Moniker))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GovernorValShares) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GovernorValShares) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GovernorValShares) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Shares.Size() + i -= size + if _, err := m.Shares.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintGov(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.GovernorAddress) > 0 { + i -= len(m.GovernorAddress) + copy(dAtA[i:], m.GovernorAddress) + i = encodeVarintGov(dAtA, i, uint64(len(m.GovernorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GovernanceDelegation) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GovernanceDelegation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GovernanceDelegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.GovernorAddress) > 0 { + i -= len(m.GovernorAddress) + copy(dAtA[i:], m.GovernorAddress) + i = encodeVarintGov(dAtA, i, uint64(len(m.GovernorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintGov(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintGov(dAtA []byte, offset int, v uint64) int { + offset -= sovGov(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *WeightedVoteOption) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Option != 0 { + n += 1 + sovGov(uint64(m.Option)) + } + l = len(m.Weight) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + return n +} + +func (m *Deposit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovGov(uint64(m.ProposalId)) + } + l = len(m.Depositor) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + return n +} + +func (m *Proposal) Size() (n int) { + if m == nil { + return 0 + } + var l int _ = l if m.Id != 0 { n += 1 + sovGov(uint64(m.Id)) @@ -2102,6 +2686,106 @@ func (m *Params) Size() (n int) { if m.QuorumCheckCount != 0 { n += 2 + sovGov(uint64(m.QuorumCheckCount)) } + if m.MaxGovernors != 0 { + n += 2 + sovGov(uint64(m.MaxGovernors)) + } + if m.GovernorStatusChangePeriod != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.GovernorStatusChangePeriod) + n += 2 + l + sovGov(uint64(l)) + } + l = len(m.MinGovernorSelfDelegation) + if l > 0 { + n += 2 + l + sovGov(uint64(l)) + } + return n +} + +func (m *Governor) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.GovernorAddress) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + if m.Status != 0 { + n += 1 + sovGov(uint64(m.Status)) + } + l = m.Description.Size() + n += 1 + l + sovGov(uint64(l)) + l = m.VotingPower.Size() + n += 1 + l + sovGov(uint64(l)) + if m.LastStatusChangeTime != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.LastStatusChangeTime) + n += 1 + l + sovGov(uint64(l)) + } + return n +} + +func (m *GovernorDescription) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Moniker) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Identity) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Website) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.SecurityContact) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Details) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + return n +} + +func (m *GovernorValShares) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.GovernorAddress) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = m.Shares.Size() + n += 1 + l + sovGov(uint64(l)) + return n +} + +func (m *GovernanceDelegation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.GovernorAddress) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } return n } @@ -4218,6 +4902,769 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } + case 23: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxGovernors", wireType) + } + m.MaxGovernors = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxGovernors |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 24: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GovernorStatusChangePeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.GovernorStatusChangePeriod == nil { + m.GovernorStatusChangePeriod = new(time.Duration) + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.GovernorStatusChangePeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 25: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinGovernorSelfDelegation", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MinGovernorSelfDelegation = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Governor) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Governor: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Governor: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GovernorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GovernorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= GovernorStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VotingPower", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.VotingPower.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastStatusChangeTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LastStatusChangeTime == nil { + m.LastStatusChangeTime = new(time.Time) + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.LastStatusChangeTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GovernorDescription) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GovernorDescription: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GovernorDescription: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Moniker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Moniker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Website = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SecurityContact", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SecurityContact = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Details = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GovernorValShares) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GovernorValShares: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GovernorValShares: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GovernorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GovernorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Shares", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Shares.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GovernanceDelegation) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GovernanceDelegation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GovernanceDelegation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GovernorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GovernorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGov(dAtA[iNdEx:]) diff --git a/x/gov/types/v1/governor.go b/x/gov/types/v1/governor.go new file mode 100644 index 000000000..00724b7be --- /dev/null +++ b/x/gov/types/v1/governor.go @@ -0,0 +1,224 @@ +package v1 + +import ( + "bytes" + "sort" + "strings" + time "time" + + "cosmossdk.io/errors" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + "github.com/atomone-hub/atomone/x/gov/types" +) + +var ( + GovernorStatusUnspecified = GovernorStatus_name[int32(Unspecified)] + GovernorStatusActive = GovernorStatus_name[int32(Active)] + GovernorStatusInactive = GovernorStatus_name[int32(Inactive)] +) + +var _ GovernorI = Governor{} + +// NewGovernor constructs a new Governor +func NewGovernor(address string, description GovernorDescription, creationTime time.Time) (Governor, error) { + return Governor{ + GovernorAddress: address, + Description: description, + Status: Active, + VotingPower: sdk.ZeroDec(), + LastStatusChangeTime: &creationTime, + }, nil +} + +// Governors is a collection of Governor +type Governors []*Governor + +func (g Governors) String() (out string) { + for _, gov := range g { + out += gov.String() + "\n" + } + + return strings.TrimSpace(out) +} + +// Sort Governors sorts governor array in ascending governor address order +func (g Governors) Sort() { + sort.Sort(g) +} + +// Implements sort interface +func (g Governors) Len() int { + return len(g) +} + +// Implements sort interface +func (g Governors) Less(i, j int) bool { + return bytes.Compare(g[i].GetAddress().Bytes(), g[j].GetAddress().Bytes()) == -1 +} + +// Implements sort interface +func (g Governors) Swap(i, j int) { + g[i], g[j] = g[j], g[i] +} + +// GovernorsByVotingPower implements sort.Interface for []Governor based on +// the VotingPower and Address fields. +// The governors are sorted first by their voting power (descending). Secondary index - Address (ascending). +// Copied from tendermint/types/validator_set.go +type GovernorsByVotingPower []Governor + +func (govz GovernorsByVotingPower) Len() int { return len(govz) } + +func (govz GovernorsByVotingPower) Less(i, j int) bool { + if govz[i].GetVotingPower().Equal(govz[j].GetVotingPower()) { + addrI := govz[i].GetAddress() + addrJ := govz[j].GetAddress() + return bytes.Compare(addrI, addrJ) == -1 + } + return govz[i].GetVotingPower().GT(govz[j].GetVotingPower()) +} + +func (govz GovernorsByVotingPower) Swap(i, j int) { + govz[i], govz[j] = govz[j], govz[i] +} + +func MustMarshalGovernor(cdc codec.BinaryCodec, governor *Governor) []byte { + return cdc.MustMarshal(governor) +} + +func MustUnmarshalGovernor(cdc codec.BinaryCodec, value []byte) Governor { + governor, err := UnmarshalGovernor(cdc, value) + if err != nil { + panic(err) + } + + return governor +} + +// unmarshal a redelegation from a store value +func UnmarshalGovernor(cdc codec.BinaryCodec, value []byte) (g Governor, err error) { + err = cdc.Unmarshal(value, &g) + return g, err +} + +// IsActive checks if the governor status equals Active +func (g Governor) IsActive() bool { + return g.GetStatus() == Active +} + +// IsInactive checks if the governor status equals Inactive +func (g Governor) IsInactive() bool { + return g.GetStatus() == Inactive +} + +func NewGovernorDescription(moniker, identity, website, securityContact, details string) GovernorDescription { + return GovernorDescription{ + Moniker: moniker, + Identity: identity, + Website: website, + SecurityContact: securityContact, + Details: details, + } +} + +// UpdateDescription updates the fields of a given description. An error is +// returned if the resulting description contains an invalid length. +func (d GovernorDescription) UpdateDescription(d2 GovernorDescription) (GovernorDescription, error) { + if d2.Moniker == stakingtypes.DoNotModifyDesc { + d2.Moniker = d.Moniker + } + + if d2.Identity == stakingtypes.DoNotModifyDesc { + d2.Identity = d.Identity + } + + if d2.Website == stakingtypes.DoNotModifyDesc { + d2.Website = d.Website + } + + if d2.SecurityContact == stakingtypes.DoNotModifyDesc { + d2.SecurityContact = d.SecurityContact + } + + if d2.Details == stakingtypes.DoNotModifyDesc { + d2.Details = d.Details + } + + return NewGovernorDescription( + d2.Moniker, + d2.Identity, + d2.Website, + d2.SecurityContact, + d2.Details, + ).EnsureLength() +} + +// EnsureLength ensures the length of a vovernor's description. +func (d GovernorDescription) EnsureLength() (GovernorDescription, error) { + if len(d.Moniker) > stakingtypes.MaxMonikerLength { + return d, errors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid moniker length; got: %d, max: %d", len(d.Moniker), stakingtypes.MaxMonikerLength) + } + + if len(d.Identity) > stakingtypes.MaxIdentityLength { + return d, errors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid identity length; got: %d, max: %d", len(d.Identity), stakingtypes.MaxIdentityLength) + } + + if len(d.Website) > stakingtypes.MaxWebsiteLength { + return d, errors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid website length; got: %d, max: %d", len(d.Website), stakingtypes.MaxWebsiteLength) + } + + if len(d.SecurityContact) > stakingtypes.MaxSecurityContactLength { + return d, errors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid security contact length; got: %d, max: %d", len(d.SecurityContact), stakingtypes.MaxSecurityContactLength) + } + + if len(d.Details) > stakingtypes.MaxDetailsLength { + return d, errors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid details length; got: %d, max: %d", len(d.Details), stakingtypes.MaxDetailsLength) + } + + return d, nil +} + +func (s GovernorStatus) IsValid() bool { + return s == Active || s == Inactive +} + +// GovernorStatusFromString returns a GovernorStatus from a string. It returns an +// error if the string is invalid. +func GovernorStatusFromString(str string) (GovernorStatus, error) { + switch str { + case GovernorStatusActive: + return Active, nil + case GovernorStatusInactive: + return Inactive, nil + default: + return Unspecified, types.ErrInvalidGovernorStatus.Wrapf("unrecognized governor status %s", str) + } +} + +// MinEqual defines a more minimum set of equality conditions when comparing two +// governors. +func (g *Governor) MinEqual(other *Governor) bool { + return g.GovernorAddress == other.GovernorAddress && + g.Status == other.Status && + g.Description.Equal(other.Description) && + g.GetVotingPower().Equal(other.GetVotingPower()) +} + +// Equal checks if the receiver equals the parameter +func (g *Governor) Equal(v2 *Governor) bool { + return g.MinEqual(v2) +} + +func (g Governor) GetVotingPower() sdk.Dec { return g.VotingPower } +func (g Governor) GetMoniker() string { return g.Description.Moniker } +func (g Governor) GetStatus() GovernorStatus { return g.Status } +func (g Governor) GetDescription() GovernorDescription { return g.Description } +func (g Governor) GetLastStatusChangeTime() *time.Time { return g.LastStatusChangeTime } +func (g Governor) GetAddress() types.GovernorAddress { + return types.MustGovernorAddressFromBech32(g.GovernorAddress) +} diff --git a/x/gov/types/v1/msgs.go b/x/gov/types/v1/msgs.go index 6b0103719..c216325f0 100644 --- a/x/gov/types/v1/msgs.go +++ b/x/gov/types/v1/msgs.go @@ -392,3 +392,168 @@ func (msg MsgProposeLaw) GetSigners() []sdk.AccAddress { authority, _ := sdk.AccAddressFromBech32(msg.Authority) return []sdk.AccAddress{authority} } + +// NewMsgCreateGovernor creates a new MsgCreateGovernor instance +func NewMsgCreateGovernor(address sdk.AccAddress, description GovernorDescription) *MsgCreateGovernor { + return &MsgCreateGovernor{Address: address.String(), Description: description} +} + +// Route implements the sdk.Msg interface. +func (msg MsgCreateGovernor) Route() string { return types.RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgCreateGovernor) Type() string { return sdk.MsgTypeURL(&msg) } + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgCreateGovernor) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Address); err != nil { + return sdkerrors.ErrInvalidAddress.Wrap(err.Error()) + } + + if _, err := msg.Description.EnsureLength(); err != nil { + return types.ErrInvalidGovernanceDescription.Wrap(err.Error()) + } + return nil +} + +// GetSignBytes returns the message bytes to sign over. +func (msg MsgCreateGovernor) GetSignBytes() []byte { + bz := codec.ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// GetSigners returns the expected signers for a MsgCreateGovernor. +func (msg MsgCreateGovernor) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Address) + return []sdk.AccAddress{addr} +} + +// NewMsgEditGovernor creates a new MsgEditGovernor instance +func NewMsgEditGovernor(addr sdk.AccAddress, description GovernorDescription) *MsgEditGovernor { + return &MsgEditGovernor{Address: addr.String(), Description: description} +} + +// Route implements the sdk.Msg interface. +func (msg MsgEditGovernor) Route() string { return types.RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgEditGovernor) Type() string { return sdk.MsgTypeURL(&msg) } + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgEditGovernor) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Address); err != nil { + return sdkerrors.ErrInvalidAddress.Wrap(err.Error()) + } + return nil +} + +// GetSignBytes returns the message bytes to sign over. +func (msg MsgEditGovernor) GetSignBytes() []byte { + bz := codec.ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// GetSigners returns the expected signers for a MsgEditGovernor. +func (msg MsgEditGovernor) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Address) + return []sdk.AccAddress{addr} +} + +// NewMsgDelegateGovernor creates a new MsgDelegateGovernor instance +func NewMsgDelegateGovernor(delegator sdk.AccAddress, governor types.GovernorAddress) *MsgDelegateGovernor { + return &MsgDelegateGovernor{DelegatorAddress: delegator.String(), GovernorAddress: governor.String()} +} + +// Route implements the sdk.Msg interface. +func (msg MsgDelegateGovernor) Route() string { return types.RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgDelegateGovernor) Type() string { return sdk.MsgTypeURL(&msg) } + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgDelegateGovernor) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.DelegatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrap(err.Error()) + } + if _, err := types.GovernorAddressFromBech32(msg.GovernorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid governor address: %s", err) + } + return nil +} + +// GetSignBytes returns the message bytes to sign over. +func (msg MsgDelegateGovernor) GetSignBytes() []byte { + bz := codec.ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// GetSigners returns the expected signers for a MsgDelegateGovernor. +func (msg MsgDelegateGovernor) GetSigners() []sdk.AccAddress { + delegator, _ := sdk.AccAddressFromBech32(msg.DelegatorAddress) + return []sdk.AccAddress{delegator} +} + +// NewMsgUndelegateGovernor creates a new MsgUndelegateGovernor instance +func NewMsgUndelegateGovernor(delegator sdk.AccAddress) *MsgUndelegateGovernor { + return &MsgUndelegateGovernor{DelegatorAddress: delegator.String()} +} + +// Route implements the sdk.Msg interface. +func (msg MsgUndelegateGovernor) Route() string { return types.RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgUndelegateGovernor) Type() string { return sdk.MsgTypeURL(&msg) } + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgUndelegateGovernor) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.DelegatorAddress); err != nil { + return sdkerrors.ErrInvalidAddress.Wrap(err.Error()) + } + return nil +} + +// GetSignBytes returns the message bytes to sign over. +func (msg MsgUndelegateGovernor) GetSignBytes() []byte { + bz := codec.ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// GetSigners returns the expected signers for a MsgUndelegateGovernor. +func (msg MsgUndelegateGovernor) GetSigners() []sdk.AccAddress { + delegator, _ := sdk.AccAddressFromBech32(msg.DelegatorAddress) + return []sdk.AccAddress{delegator} +} + +// NewMsgUpdateGovernorStatus creates a new MsgUpdateGovernorStatus instance +func NewMsgUpdateGovernorStatus(address sdk.AccAddress, status GovernorStatus) *MsgUpdateGovernorStatus { + return &MsgUpdateGovernorStatus{Address: address.String(), Status: status} +} + +// Route implements the sdk.Msg interface. +func (msg MsgUpdateGovernorStatus) Route() string { return types.RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgUpdateGovernorStatus) Type() string { return sdk.MsgTypeURL(&msg) } + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgUpdateGovernorStatus) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Address); err != nil { + return sdkerrors.ErrInvalidAddress.Wrap(err.Error()) + } + if !msg.Status.IsValid() { + return types.ErrInvalidGovernorStatus.Wrap(msg.Status.String()) + } + return nil +} + +// GetSignBytes returns the message bytes to sign over. +func (msg MsgUpdateGovernorStatus) GetSignBytes() []byte { + bz := codec.ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// GetSigners returns the expected signers for a MsgUpdateGovernorStatus. +func (msg MsgUpdateGovernorStatus) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Address) + return []sdk.AccAddress{addr} +} diff --git a/x/gov/types/v1/params.go b/x/gov/types/v1/params.go index 62453463c..3350bbdba 100644 --- a/x/gov/types/v1/params.go +++ b/x/gov/types/v1/params.go @@ -11,9 +11,10 @@ import ( // Default period for deposits & voting and min voting period const ( - DefaultVotingPeriod time.Duration = time.Hour * 24 * 21 // 21 days - MinVotingPeriod time.Duration = time.Hour * 24 * 21 // 21 days - DefaultDepositPeriod time.Duration = time.Hour * 24 * 14 // 14 days + DefaultVotingPeriod time.Duration = time.Hour * 24 * 21 // 21 days + MinVotingPeriod time.Duration = time.Hour * 24 * 21 // 21 days + DefaultDepositPeriod time.Duration = time.Hour * 24 * 14 // 14 days + DefaultGovernorStatusChangePeriod time.Duration = time.Hour * 24 * 28 // 28 days ) // Default governance params @@ -31,9 +32,11 @@ var ( DefaultBurnVoteQuorom = false // set to false to replicate behavior of when this change was made (0.47) DefaultMinDepositRatio = sdk.NewDecWithPrec(1, 2) // NOTE: backport from v50 - DefaultQuorumTimeout time.Duration = DefaultVotingPeriod - (time.Hour * 24 * 1) // disabled by default (DefaultQuorumCheckCount must be set to a non-zero value to enable) - DefaultMaxVotingPeriodExtension time.Duration = DefaultVotingPeriod - DefaultQuorumTimeout // disabled by default (DefaultQuorumCheckCount must be set to a non-zero value to enable) - DefaultQuorumCheckCount uint64 = 0 // disabled by default (0 means no check) + DefaultQuorumTimeout time.Duration = DefaultVotingPeriod - (time.Hour * 24 * 1) // disabled by default (DefaultQuorumCheckCount must be set to a non-zero value to enable) + DefaultMaxVotingPeriodExtension time.Duration = DefaultVotingPeriod - DefaultQuorumTimeout // disabled by default (DefaultQuorumCheckCount must be set to a non-zero value to enable) + DefaultQuorumCheckCount uint64 = 0 // disabled by default (0 means no check) + DefaultMaxGovernors uint64 = 100 + DefaultMinGovernorSelfDelegation = sdk.NewInt(1000_000000) ) // Deprecated: NewDepositParams creates a new DepositParams object @@ -65,6 +68,7 @@ func NewParams( quorum, threshold, constitutionAmendmentQuorum, constitutionAmendmentThreshold, lawQuorum, lawThreshold, minInitialDepositRatio string, burnProposalDeposit, burnVoteQuorum bool, minDepositRatio string, quorumTimeout, maxVotingPeriodExtension time.Duration, quorumCheckCount uint64, + maxGovernors uint64, governorStatusChangePeriod time.Duration, minGovernorSelfDelegation string, ) Params { return Params{ MinDeposit: minDeposit, @@ -83,6 +87,9 @@ func NewParams( QuorumTimeout: &quorumTimeout, MaxVotingPeriodExtension: &maxVotingPeriodExtension, QuorumCheckCount: quorumCheckCount, + MaxGovernors: maxGovernors, + GovernorStatusChangePeriod: &governorStatusChangePeriod, + MinGovernorSelfDelegation: minGovernorSelfDelegation, } } @@ -105,6 +112,9 @@ func DefaultParams() Params { DefaultQuorumTimeout, DefaultMaxVotingPeriodExtension, DefaultQuorumCheckCount, + DefaultMaxGovernors, + DefaultGovernorStatusChangePeriod, + DefaultMinGovernorSelfDelegation.String(), ) } @@ -245,5 +255,21 @@ func (p Params) ValidateBasic() error { } } + if p.GovernorStatusChangePeriod == nil { + return fmt.Errorf("governor status change period must not be nil: %d", p.GovernorStatusChangePeriod) + } + + if p.GovernorStatusChangePeriod.Seconds() <= 0 { + return fmt.Errorf("governor status change period must be positive: %d", p.GovernorStatusChangePeriod) + } + + minGovernorSelfDelegation, ok := math.NewIntFromString(p.MinGovernorSelfDelegation) + if !ok { + return fmt.Errorf("invalid minimum governor self delegation: %s", p.MinGovernorSelfDelegation) + } + if minGovernorSelfDelegation.IsNegative() { + return fmt.Errorf("minimum governor self delegation must be positive: %s", minGovernorSelfDelegation) + } + return nil } diff --git a/x/gov/types/v1/query.pb.go b/x/gov/types/v1/query.pb.go index 83c14285a..ed5738da5 100644 --- a/x/gov/types/v1/query.pb.go +++ b/x/gov/types/v1/query.pb.go @@ -975,990 +975,1285 @@ func (m *QueryTallyResultResponse) GetTally() *TallyResult { return nil } -func init() { - proto.RegisterType((*QueryConstitutionRequest)(nil), "atomone.gov.v1.QueryConstitutionRequest") - proto.RegisterType((*QueryConstitutionResponse)(nil), "atomone.gov.v1.QueryConstitutionResponse") - proto.RegisterType((*QueryProposalRequest)(nil), "atomone.gov.v1.QueryProposalRequest") - proto.RegisterType((*QueryProposalResponse)(nil), "atomone.gov.v1.QueryProposalResponse") - proto.RegisterType((*QueryProposalsRequest)(nil), "atomone.gov.v1.QueryProposalsRequest") - proto.RegisterType((*QueryProposalsResponse)(nil), "atomone.gov.v1.QueryProposalsResponse") - proto.RegisterType((*QueryVoteRequest)(nil), "atomone.gov.v1.QueryVoteRequest") - proto.RegisterType((*QueryVoteResponse)(nil), "atomone.gov.v1.QueryVoteResponse") - proto.RegisterType((*QueryVotesRequest)(nil), "atomone.gov.v1.QueryVotesRequest") - proto.RegisterType((*QueryVotesResponse)(nil), "atomone.gov.v1.QueryVotesResponse") - proto.RegisterType((*QueryParamsRequest)(nil), "atomone.gov.v1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "atomone.gov.v1.QueryParamsResponse") - proto.RegisterType((*QueryDepositRequest)(nil), "atomone.gov.v1.QueryDepositRequest") - proto.RegisterType((*QueryDepositResponse)(nil), "atomone.gov.v1.QueryDepositResponse") - proto.RegisterType((*QueryDepositsRequest)(nil), "atomone.gov.v1.QueryDepositsRequest") - proto.RegisterType((*QueryDepositsResponse)(nil), "atomone.gov.v1.QueryDepositsResponse") - proto.RegisterType((*QueryTallyResultRequest)(nil), "atomone.gov.v1.QueryTallyResultRequest") - proto.RegisterType((*QueryTallyResultResponse)(nil), "atomone.gov.v1.QueryTallyResultResponse") +// QueryGovernorRequest is the request type for the Query/Governor RPC method. +type QueryGovernorRequest struct { + // gvernor_address defines the address of the governor. + GovernorAddress string `protobuf:"bytes,1,opt,name=governor_address,json=governorAddress,proto3" json:"governor_address,omitempty"` } -func init() { proto.RegisterFile("atomone/gov/v1/query.proto", fileDescriptor_2290d0188dd70223) } - -var fileDescriptor_2290d0188dd70223 = []byte{ - // 1030 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x5d, 0x6f, 0xdc, 0x44, - 0x14, 0x8d, 0x37, 0x1f, 0xcd, 0xde, 0xa4, 0x01, 0x2e, 0xa1, 0x75, 0xdc, 0xb0, 0xb4, 0x26, 0x24, - 0x69, 0x45, 0x6c, 0x36, 0x25, 0x2d, 0x42, 0x14, 0x44, 0x28, 0x0d, 0x7d, 0x40, 0x0a, 0x6e, 0xc5, - 0x03, 0x2f, 0x91, 0x93, 0xb5, 0x5c, 0x4b, 0x1b, 0x8f, 0xbb, 0x33, 0xbb, 0x22, 0x0a, 0xab, 0x4a, - 0x48, 0x48, 0x94, 0xa7, 0x22, 0x84, 0x10, 0xfd, 0x1d, 0xfc, 0x08, 0x1e, 0x2b, 0x78, 0xe1, 0x11, - 0x25, 0xfc, 0x0e, 0x84, 0x3c, 0x73, 0xed, 0xb5, 0x1d, 0xef, 0x57, 0x55, 0xf1, 0xb8, 0x33, 0xe7, - 0x9e, 0x73, 0xe6, 0xce, 0x9d, 0x7b, 0xbd, 0x60, 0xb8, 0x82, 0x1d, 0xb2, 0xd0, 0xb3, 0x7d, 0xd6, - 0xb1, 0x3b, 0x75, 0xfb, 0x61, 0xdb, 0x6b, 0x1d, 0x59, 0x51, 0x8b, 0x09, 0x86, 0x0b, 0xb4, 0x67, - 0xf9, 0xac, 0x63, 0x75, 0xea, 0xc6, 0xb5, 0x03, 0xc6, 0x0f, 0x19, 0xb7, 0xf7, 0x5d, 0xee, 0x29, - 0xa0, 0xdd, 0xa9, 0xef, 0x7b, 0xc2, 0xad, 0xdb, 0x91, 0xeb, 0x07, 0xa1, 0x2b, 0x02, 0x16, 0xaa, - 0x58, 0x63, 0xd9, 0x67, 0xcc, 0x6f, 0x7a, 0xb6, 0x1b, 0x05, 0xb6,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 0xe2, 0x43, 0xfc, 0x60, 0xd4, 0x74, 0x24, 0xad, 0xc9, 0x3e, 0x4e, 0x1b, 0x78, - 0x17, 0x7f, 0xd4, 0x60, 0x36, 0x69, 0x78, 0x38, 0x50, 0x98, 0x0f, 0x7e, 0x3c, 0xc5, 0xae, 0x69, - 0xbe, 0x27, 0xfd, 0x6d, 0xe2, 0x3b, 0xe3, 0xfa, 0xc3, 0x5f, 0x34, 0x98, 0xcb, 0x74, 0x1f, 0x5c, - 0x2b, 0x15, 0x3c, 0xdb, 0x0f, 0x8d, 0xf5, 0xe1, 0xc0, 0xe7, 0xad, 0x25, 0xd9, 0x00, 0xb7, 0x77, - 0x7e, 0x3f, 0xa9, 0x69, 0xcf, 0x4e, 0x6a, 0xda, 0xdf, 0x27, 0x35, 0xed, 0xc9, 0x69, 0x6d, 0xe2, - 0xd9, 0x69, 0x6d, 0xe2, 0xaf, 0xd3, 0xda, 0xc4, 0x57, 0x1b, 0x7e, 0x20, 0x1e, 0xb4, 0xf7, 0xad, - 0x03, 0x76, 0x98, 0x50, 0x6e, 0x3c, 0x68, 0xef, 0xa7, 0xf4, 0x5f, 0x4b, 0x81, 0xb8, 0x20, 0x78, - 0xfc, 0x3f, 0x6d, 0x46, 0xfe, 0x8b, 0xba, 0xfe, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x17, 0xab, - 0xa6, 0x19, 0xf2, 0x0d, 0x00, 0x00, +func (m *QueryGovernorRequest) Reset() { *m = QueryGovernorRequest{} } +func (m *QueryGovernorRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGovernorRequest) ProtoMessage() {} +func (*QueryGovernorRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2290d0188dd70223, []int{18} +} +func (m *QueryGovernorRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGovernorRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGovernorRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGovernorRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGovernorRequest.Merge(m, src) +} +func (m *QueryGovernorRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGovernorRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGovernorRequest.DiscardUnknown(m) } -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 +var xxx_messageInfo_QueryGovernorRequest proto.InternalMessageInfo -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QueryClient interface { - // Constitution queries the chain's constitution. - Constitution(ctx context.Context, in *QueryConstitutionRequest, opts ...grpc.CallOption) (*QueryConstitutionResponse, error) - // Proposal queries proposal details based on ProposalID. - Proposal(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryProposalResponse, error) - // Proposals queries all proposals based on given status. - Proposals(ctx context.Context, in *QueryProposalsRequest, opts ...grpc.CallOption) (*QueryProposalsResponse, error) - // Vote queries voted information based on proposalID, voterAddr. - Vote(ctx context.Context, in *QueryVoteRequest, opts ...grpc.CallOption) (*QueryVoteResponse, error) - // Votes queries votes of a given proposal. - Votes(ctx context.Context, in *QueryVotesRequest, opts ...grpc.CallOption) (*QueryVotesResponse, error) - // Params queries all parameters of the gov module. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // Deposit queries single deposit information based proposalID, depositAddr. - Deposit(ctx context.Context, in *QueryDepositRequest, opts ...grpc.CallOption) (*QueryDepositResponse, error) - // Deposits queries all deposits of a single proposal. - Deposits(ctx context.Context, in *QueryDepositsRequest, opts ...grpc.CallOption) (*QueryDepositsResponse, error) - // TallyResult queries the tally of a proposal vote. - TallyResult(ctx context.Context, in *QueryTallyResultRequest, opts ...grpc.CallOption) (*QueryTallyResultResponse, error) +func (m *QueryGovernorRequest) GetGovernorAddress() string { + if m != nil { + return m.GovernorAddress + } + return "" } -type queryClient struct { - cc grpc1.ClientConn +// QueryGovernorResponse is the response type for the Query/Governor RPC method. +type QueryGovernorResponse struct { + // governor defines the requested governor. + Governor *Governor `protobuf:"bytes,1,opt,name=governor,proto3" json:"governor,omitempty"` } -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} +func (m *QueryGovernorResponse) Reset() { *m = QueryGovernorResponse{} } +func (m *QueryGovernorResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGovernorResponse) ProtoMessage() {} +func (*QueryGovernorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2290d0188dd70223, []int{19} } - -func (c *queryClient) Constitution(ctx context.Context, in *QueryConstitutionRequest, opts ...grpc.CallOption) (*QueryConstitutionResponse, error) { - out := new(QueryConstitutionResponse) - err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Constitution", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +func (m *QueryGovernorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } - -func (c *queryClient) Proposal(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryProposalResponse, error) { - out := new(QueryProposalResponse) - err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Proposal", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryGovernorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGovernorResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return out, nil +} +func (m *QueryGovernorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGovernorResponse.Merge(m, src) +} +func (m *QueryGovernorResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGovernorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGovernorResponse.DiscardUnknown(m) } -func (c *queryClient) Proposals(ctx context.Context, in *QueryProposalsRequest, opts ...grpc.CallOption) (*QueryProposalsResponse, error) { - out := new(QueryProposalsResponse) - err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Proposals", in, out, opts...) - if err != nil { - return nil, err +var xxx_messageInfo_QueryGovernorResponse proto.InternalMessageInfo + +func (m *QueryGovernorResponse) GetGovernor() *Governor { + if m != nil { + return m.Governor } - return out, nil + return nil } -func (c *queryClient) Vote(ctx context.Context, in *QueryVoteRequest, opts ...grpc.CallOption) (*QueryVoteResponse, error) { - out := new(QueryVoteResponse) - err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Vote", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +// QueryGovernorsRequest is the request type for the Query/Governors RPC method. +type QueryGovernorsRequest struct { + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (c *queryClient) Votes(ctx context.Context, in *QueryVotesRequest, opts ...grpc.CallOption) (*QueryVotesResponse, error) { - out := new(QueryVotesResponse) - err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Votes", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryGovernorsRequest) Reset() { *m = QueryGovernorsRequest{} } +func (m *QueryGovernorsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGovernorsRequest) ProtoMessage() {} +func (*QueryGovernorsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2290d0188dd70223, []int{20} +} +func (m *QueryGovernorsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGovernorsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGovernorsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return out, nil +} +func (m *QueryGovernorsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGovernorsRequest.Merge(m, src) +} +func (m *QueryGovernorsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGovernorsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGovernorsRequest.DiscardUnknown(m) } -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Params", in, out, opts...) - if err != nil { - return nil, err +var xxx_messageInfo_QueryGovernorsRequest proto.InternalMessageInfo + +func (m *QueryGovernorsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination } - return out, nil + return nil } -func (c *queryClient) Deposit(ctx context.Context, in *QueryDepositRequest, opts ...grpc.CallOption) (*QueryDepositResponse, error) { - out := new(QueryDepositResponse) - err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Deposit", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +// QueryGovernorsResponse is the response type for the Query/Governors RPC method. +type QueryGovernorsResponse struct { + // governors defines the requested governors. + Governors []*Governor `protobuf:"bytes,1,rep,name=governors,proto3" json:"governors,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (c *queryClient) Deposits(ctx context.Context, in *QueryDepositsRequest, opts ...grpc.CallOption) (*QueryDepositsResponse, error) { - out := new(QueryDepositsResponse) - err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Deposits", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryGovernorsResponse) Reset() { *m = QueryGovernorsResponse{} } +func (m *QueryGovernorsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGovernorsResponse) ProtoMessage() {} +func (*QueryGovernorsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2290d0188dd70223, []int{21} +} +func (m *QueryGovernorsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGovernorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGovernorsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return out, nil +} +func (m *QueryGovernorsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGovernorsResponse.Merge(m, src) +} +func (m *QueryGovernorsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGovernorsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGovernorsResponse.DiscardUnknown(m) } -func (c *queryClient) TallyResult(ctx context.Context, in *QueryTallyResultRequest, opts ...grpc.CallOption) (*QueryTallyResultResponse, error) { - out := new(QueryTallyResultResponse) - err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/TallyResult", in, out, opts...) - if err != nil { - return nil, err +var xxx_messageInfo_QueryGovernorsResponse proto.InternalMessageInfo + +func (m *QueryGovernorsResponse) GetGovernors() []*Governor { + if m != nil { + return m.Governors } - return out, nil + return nil } -// QueryServer is the server API for Query service. -type QueryServer interface { - // Constitution queries the chain's constitution. - Constitution(context.Context, *QueryConstitutionRequest) (*QueryConstitutionResponse, error) - // Proposal queries proposal details based on ProposalID. - Proposal(context.Context, *QueryProposalRequest) (*QueryProposalResponse, error) - // Proposals queries all proposals based on given status. - Proposals(context.Context, *QueryProposalsRequest) (*QueryProposalsResponse, error) - // Vote queries voted information based on proposalID, voterAddr. - Vote(context.Context, *QueryVoteRequest) (*QueryVoteResponse, error) - // Votes queries votes of a given proposal. - Votes(context.Context, *QueryVotesRequest) (*QueryVotesResponse, error) - // Params queries all parameters of the gov module. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // Deposit queries single deposit information based proposalID, depositAddr. - Deposit(context.Context, *QueryDepositRequest) (*QueryDepositResponse, error) - // Deposits queries all deposits of a single proposal. - Deposits(context.Context, *QueryDepositsRequest) (*QueryDepositsResponse, error) - // TallyResult queries the tally of a proposal vote. - TallyResult(context.Context, *QueryTallyResultRequest) (*QueryTallyResultResponse, error) +func (m *QueryGovernorsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil } -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { +// QueryGovernanceDelegationsRequest is the request type for the Query/GovernanceDelegations RPC method. +type QueryGovernanceDelegationsRequest struct { + // governor_address defines the address of the governor. + GovernorAddress string `protobuf:"bytes,1,opt,name=governor_address,json=governorAddress,proto3" json:"governor_address,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (*UnimplementedQueryServer) Constitution(ctx context.Context, req *QueryConstitutionRequest) (*QueryConstitutionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Constitution not implemented") -} -func (*UnimplementedQueryServer) Proposal(ctx context.Context, req *QueryProposalRequest) (*QueryProposalResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Proposal not implemented") -} -func (*UnimplementedQueryServer) Proposals(ctx context.Context, req *QueryProposalsRequest) (*QueryProposalsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Proposals not implemented") -} -func (*UnimplementedQueryServer) Vote(ctx context.Context, req *QueryVoteRequest) (*QueryVoteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Vote not implemented") +func (m *QueryGovernanceDelegationsRequest) Reset() { *m = QueryGovernanceDelegationsRequest{} } +func (m *QueryGovernanceDelegationsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGovernanceDelegationsRequest) ProtoMessage() {} +func (*QueryGovernanceDelegationsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2290d0188dd70223, []int{22} } -func (*UnimplementedQueryServer) Votes(ctx context.Context, req *QueryVotesRequest) (*QueryVotesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Votes not implemented") +func (m *QueryGovernanceDelegationsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +func (m *QueryGovernanceDelegationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGovernanceDelegationsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } -func (*UnimplementedQueryServer) Deposit(ctx context.Context, req *QueryDepositRequest) (*QueryDepositResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Deposit not implemented") +func (m *QueryGovernanceDelegationsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGovernanceDelegationsRequest.Merge(m, src) } -func (*UnimplementedQueryServer) Deposits(ctx context.Context, req *QueryDepositsRequest) (*QueryDepositsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Deposits not implemented") +func (m *QueryGovernanceDelegationsRequest) XXX_Size() int { + return m.Size() } -func (*UnimplementedQueryServer) TallyResult(ctx context.Context, req *QueryTallyResultRequest) (*QueryTallyResultResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method TallyResult not implemented") +func (m *QueryGovernanceDelegationsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGovernanceDelegationsRequest.DiscardUnknown(m) } -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) +var xxx_messageInfo_QueryGovernanceDelegationsRequest proto.InternalMessageInfo + +func (m *QueryGovernanceDelegationsRequest) GetGovernorAddress() string { + if m != nil { + return m.GovernorAddress + } + return "" } -func _Query_Constitution_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryConstitutionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Constitution(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/atomone.gov.v1.Query/Constitution", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Constitution(ctx, req.(*QueryConstitutionRequest)) +func (m *QueryGovernanceDelegationsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination } - return interceptor(ctx, in, info, handler) + return nil } -func _Query_Proposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryProposalRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Proposal(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/atomone.gov.v1.Query/Proposal", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Proposal(ctx, req.(*QueryProposalRequest)) - } - return interceptor(ctx, in, info, handler) +// QueryGovernanceDelegationsResponse is the response type for the Query/GovernanceDelegations RPC method. +type QueryGovernanceDelegationsResponse struct { + // delegations defines the requested delegations. + Delegations []*GovernanceDelegation `protobuf:"bytes,1,rep,name=delegations,proto3" json:"delegations,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func _Query_Proposals_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryProposalsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Proposals(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/atomone.gov.v1.Query/Proposals", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Proposals(ctx, req.(*QueryProposalsRequest)) +func (m *QueryGovernanceDelegationsResponse) Reset() { *m = QueryGovernanceDelegationsResponse{} } +func (m *QueryGovernanceDelegationsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGovernanceDelegationsResponse) ProtoMessage() {} +func (*QueryGovernanceDelegationsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2290d0188dd70223, []int{23} +} +func (m *QueryGovernanceDelegationsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGovernanceDelegationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGovernanceDelegationsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return interceptor(ctx, in, info, handler) +} +func (m *QueryGovernanceDelegationsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGovernanceDelegationsResponse.Merge(m, src) +} +func (m *QueryGovernanceDelegationsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGovernanceDelegationsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGovernanceDelegationsResponse.DiscardUnknown(m) } -func _Query_Vote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryVoteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Vote(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/atomone.gov.v1.Query/Vote", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Vote(ctx, req.(*QueryVoteRequest)) +var xxx_messageInfo_QueryGovernanceDelegationsResponse proto.InternalMessageInfo + +func (m *QueryGovernanceDelegationsResponse) GetDelegations() []*GovernanceDelegation { + if m != nil { + return m.Delegations } - return interceptor(ctx, in, info, handler) + return nil } -func _Query_Votes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryVotesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Votes(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/atomone.gov.v1.Query/Votes", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Votes(ctx, req.(*QueryVotesRequest)) +func (m *QueryGovernanceDelegationsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination } - return interceptor(ctx, in, info, handler) + return nil } -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/atomone.gov.v1.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) +// QueryGovernanceDelegationRequest is the request type for the Query/GovernanceDelegation RPC method. +type QueryGovernanceDelegationRequest struct { + // delegator_address defines the address of the delegator. + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` } -func _Query_Deposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDepositRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Deposit(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/atomone.gov.v1.Query/Deposit", +func (m *QueryGovernanceDelegationRequest) Reset() { *m = QueryGovernanceDelegationRequest{} } +func (m *QueryGovernanceDelegationRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGovernanceDelegationRequest) ProtoMessage() {} +func (*QueryGovernanceDelegationRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2290d0188dd70223, []int{24} +} +func (m *QueryGovernanceDelegationRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGovernanceDelegationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGovernanceDelegationRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Deposit(ctx, req.(*QueryDepositRequest)) +} +func (m *QueryGovernanceDelegationRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGovernanceDelegationRequest.Merge(m, src) +} +func (m *QueryGovernanceDelegationRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGovernanceDelegationRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGovernanceDelegationRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGovernanceDelegationRequest proto.InternalMessageInfo + +func (m *QueryGovernanceDelegationRequest) GetDelegatorAddress() string { + if m != nil { + return m.DelegatorAddress } - return interceptor(ctx, in, info, handler) + return "" } -func _Query_Deposits_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDepositsRequest) - if err := dec(in); err != nil { - return nil, err +// QueryGovernanceDelegationResponse is the response type for the Query/GovernanceDelegation RPC method. +type QueryGovernanceDelegationResponse struct { + // governor_address defines the address of the governor. + GovernorAddress string `protobuf:"bytes,1,opt,name=governor_address,json=governorAddress,proto3" json:"governor_address,omitempty"` +} + +func (m *QueryGovernanceDelegationResponse) Reset() { *m = QueryGovernanceDelegationResponse{} } +func (m *QueryGovernanceDelegationResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGovernanceDelegationResponse) ProtoMessage() {} +func (*QueryGovernanceDelegationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2290d0188dd70223, []int{25} +} +func (m *QueryGovernanceDelegationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGovernanceDelegationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGovernanceDelegationResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - if interceptor == nil { - return srv.(QueryServer).Deposits(ctx, in) +} +func (m *QueryGovernanceDelegationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGovernanceDelegationResponse.Merge(m, src) +} +func (m *QueryGovernanceDelegationResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGovernanceDelegationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGovernanceDelegationResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGovernanceDelegationResponse proto.InternalMessageInfo + +func (m *QueryGovernanceDelegationResponse) GetGovernorAddress() string { + if m != nil { + return m.GovernorAddress } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/atomone.gov.v1.Query/Deposits", + return "" +} + +// QueryGovernorValSharesRequest is the request type for the Query/GovernorValShares RPC method. +type QueryGovernorValSharesRequest struct { + // governor_address defines the address of the governor. + GovernorAddress string `protobuf:"bytes,1,opt,name=governor_address,json=governorAddress,proto3" json:"governor_address,omitempty"` + // pagination defines the pagination in the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryGovernorValSharesRequest) Reset() { *m = QueryGovernorValSharesRequest{} } +func (m *QueryGovernorValSharesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGovernorValSharesRequest) ProtoMessage() {} +func (*QueryGovernorValSharesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2290d0188dd70223, []int{26} +} +func (m *QueryGovernorValSharesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGovernorValSharesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGovernorValSharesRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Deposits(ctx, req.(*QueryDepositsRequest)) +} +func (m *QueryGovernorValSharesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGovernorValSharesRequest.Merge(m, src) +} +func (m *QueryGovernorValSharesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGovernorValSharesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGovernorValSharesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGovernorValSharesRequest proto.InternalMessageInfo + +func (m *QueryGovernorValSharesRequest) GetGovernorAddress() string { + if m != nil { + return m.GovernorAddress } - return interceptor(ctx, in, info, handler) + return "" } -func _Query_TallyResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryTallyResultRequest) - if err := dec(in); err != nil { - return nil, err +func (m *QueryGovernorValSharesRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination } - if interceptor == nil { - return srv.(QueryServer).TallyResult(ctx, in) + return nil +} + +// QueryGovernorValSharesResponse is the response type for the Query/GovernorValShares RPC method. +type QueryGovernorValSharesResponse struct { + // val_shares defines the requested validator shares. + ValShares []*GovernorValShares `protobuf:"bytes,1,rep,name=val_shares,json=valShares,proto3" json:"val_shares,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryGovernorValSharesResponse) Reset() { *m = QueryGovernorValSharesResponse{} } +func (m *QueryGovernorValSharesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGovernorValSharesResponse) ProtoMessage() {} +func (*QueryGovernorValSharesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2290d0188dd70223, []int{27} +} +func (m *QueryGovernorValSharesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGovernorValSharesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGovernorValSharesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/atomone.gov.v1.Query/TallyResult", +} +func (m *QueryGovernorValSharesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGovernorValSharesResponse.Merge(m, src) +} +func (m *QueryGovernorValSharesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGovernorValSharesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGovernorValSharesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGovernorValSharesResponse proto.InternalMessageInfo + +func (m *QueryGovernorValSharesResponse) GetValShares() []*GovernorValShares { + if m != nil { + return m.ValShares } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).TallyResult(ctx, req.(*QueryTallyResultRequest)) + return nil +} + +func (m *QueryGovernorValSharesResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination } - return interceptor(ctx, in, info, handler) + return nil } -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "atomone.gov.v1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Constitution", - Handler: _Query_Constitution_Handler, - }, - { - MethodName: "Proposal", - Handler: _Query_Proposal_Handler, - }, - { - MethodName: "Proposals", - Handler: _Query_Proposals_Handler, - }, - { - MethodName: "Vote", - Handler: _Query_Vote_Handler, - }, - { - MethodName: "Votes", - Handler: _Query_Votes_Handler, - }, - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - { - MethodName: "Deposit", - Handler: _Query_Deposit_Handler, - }, - { - MethodName: "Deposits", - Handler: _Query_Deposits_Handler, - }, - { - MethodName: "TallyResult", - Handler: _Query_TallyResult_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "atomone/gov/v1/query.proto", +func init() { + proto.RegisterType((*QueryConstitutionRequest)(nil), "atomone.gov.v1.QueryConstitutionRequest") + proto.RegisterType((*QueryConstitutionResponse)(nil), "atomone.gov.v1.QueryConstitutionResponse") + proto.RegisterType((*QueryProposalRequest)(nil), "atomone.gov.v1.QueryProposalRequest") + proto.RegisterType((*QueryProposalResponse)(nil), "atomone.gov.v1.QueryProposalResponse") + proto.RegisterType((*QueryProposalsRequest)(nil), "atomone.gov.v1.QueryProposalsRequest") + proto.RegisterType((*QueryProposalsResponse)(nil), "atomone.gov.v1.QueryProposalsResponse") + proto.RegisterType((*QueryVoteRequest)(nil), "atomone.gov.v1.QueryVoteRequest") + proto.RegisterType((*QueryVoteResponse)(nil), "atomone.gov.v1.QueryVoteResponse") + proto.RegisterType((*QueryVotesRequest)(nil), "atomone.gov.v1.QueryVotesRequest") + proto.RegisterType((*QueryVotesResponse)(nil), "atomone.gov.v1.QueryVotesResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "atomone.gov.v1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "atomone.gov.v1.QueryParamsResponse") + proto.RegisterType((*QueryDepositRequest)(nil), "atomone.gov.v1.QueryDepositRequest") + proto.RegisterType((*QueryDepositResponse)(nil), "atomone.gov.v1.QueryDepositResponse") + proto.RegisterType((*QueryDepositsRequest)(nil), "atomone.gov.v1.QueryDepositsRequest") + proto.RegisterType((*QueryDepositsResponse)(nil), "atomone.gov.v1.QueryDepositsResponse") + proto.RegisterType((*QueryTallyResultRequest)(nil), "atomone.gov.v1.QueryTallyResultRequest") + proto.RegisterType((*QueryTallyResultResponse)(nil), "atomone.gov.v1.QueryTallyResultResponse") + proto.RegisterType((*QueryGovernorRequest)(nil), "atomone.gov.v1.QueryGovernorRequest") + proto.RegisterType((*QueryGovernorResponse)(nil), "atomone.gov.v1.QueryGovernorResponse") + proto.RegisterType((*QueryGovernorsRequest)(nil), "atomone.gov.v1.QueryGovernorsRequest") + proto.RegisterType((*QueryGovernorsResponse)(nil), "atomone.gov.v1.QueryGovernorsResponse") + proto.RegisterType((*QueryGovernanceDelegationsRequest)(nil), "atomone.gov.v1.QueryGovernanceDelegationsRequest") + proto.RegisterType((*QueryGovernanceDelegationsResponse)(nil), "atomone.gov.v1.QueryGovernanceDelegationsResponse") + proto.RegisterType((*QueryGovernanceDelegationRequest)(nil), "atomone.gov.v1.QueryGovernanceDelegationRequest") + proto.RegisterType((*QueryGovernanceDelegationResponse)(nil), "atomone.gov.v1.QueryGovernanceDelegationResponse") + proto.RegisterType((*QueryGovernorValSharesRequest)(nil), "atomone.gov.v1.QueryGovernorValSharesRequest") + proto.RegisterType((*QueryGovernorValSharesResponse)(nil), "atomone.gov.v1.QueryGovernorValSharesResponse") } -func (m *QueryConstitutionRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func init() { proto.RegisterFile("atomone/gov/v1/query.proto", fileDescriptor_2290d0188dd70223) } + +var fileDescriptor_2290d0188dd70223 = []byte{ + // 1399 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0xcf, 0x8f, 0x14, 0x45, + 0x14, 0xa6, 0x86, 0x5d, 0xd8, 0x7d, 0xbb, 0x2c, 0x4b, 0xb9, 0xc0, 0xd0, 0xc0, 0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4, 0x66, 0x5d, 0xe2, 0x41, 0x4c, 0x80, 0x54, 0xeb, + 0x89, 0x74, 0x41, 0x67, 0xc5, 0x1b, 0x87, 0xfc, 0xf3, 0x2b, 0x31, 0x52, 0x21, 0xbc, 0x12, 0x25, + 0x8f, 0xcc, 0x2b, 0x31, 0xa0, 0x1c, 0x42, 0xc7, 0xd7, 0x3c, 0xbf, 0x10, 0x58, 0x8c, 0x70, 0x33, + 0xec, 0x75, 0xf3, 0xba, 0xd9, 0x32, 0x2d, 0x61, 0x00, 0xff, 0x95, 0xf5, 0x1b, 0xdb, 0x86, 0x7c, + 0x46, 0x40, 0xcd, 0xe3, 0x8e, 0x1a, 0xdf, 0x84, 0x99, 0x46, 0x38, 0x8c, 0x2a, 0x2f, 0xa5, 0xab, + 0x1c, 0xcf, 0x51, 0x8b, 0x06, 0x8e, 0x4f, 0xf3, 0x26, 0x9c, 0xc8, 0xa4, 0x2d, 0x15, 0xbf, 0x01, + 0x07, 0xb0, 0x76, 0x9f, 0xe4, 0xd9, 0x07, 0xef, 0x7c, 0x10, 0x22, 0xb7, 0xca, 0x47, 0x39, 0xab, + 0x1b, 0x08, 0x74, 0x3a, 0x6b, 0x75, 0xfb, 0xb7, 0xde, 0x33, 0x02, 0xc7, 0x63, 0xad, 0x7c, 0xcf, + 0x68, 0xdd, 0xb9, 0x6f, 0x74, 0xcc, 0xff, 0x79, 0xab, 0xfc, 0x44, 0xa0, 0x94, 0xc5, 0x1b, 0x55, + 0xb8, 0x06, 0xe0, 0xf9, 0x66, 0x9d, 0x8f, 0x62, 0x97, 0x2c, 0x66, 0xed, 0xc5, 0x30, 0x7c, 0xda, + 0x93, 0x7f, 0x8e, 0xad, 0x41, 0xaa, 0x3f, 0xcf, 0xc3, 0x24, 0x67, 0x4b, 0x1f, 0x11, 0x98, 0x8d, + 0xbe, 0x92, 0xe8, 0x72, 0x92, 0x51, 0xd6, 0x23, 0x4b, 0x39, 0x3d, 0x04, 0x52, 0xd4, 0x56, 0x97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 0x74, 0x44, 0x8a, 0x36, 0x2c, 0x1c, + 0xd9, 0x56, 0x39, 0xdb, 0xb3, 0xf4, 0x4c, 0x92, 0xad, 0x27, 0xbc, 0x49, 0x8a, 0xd6, 0x2b, 0xab, + 0xbf, 0x6d, 0x97, 0xc8, 0xf3, 0xed, 0x12, 0xf9, 0x73, 0xbb, 0x44, 0x1e, 0xef, 0x94, 0x76, 0x3d, + 0xdf, 0x29, 0xed, 0xfa, 0x63, 0xa7, 0xb4, 0xeb, 0x93, 0xb2, 0xd5, 0x74, 0xef, 0x77, 0xd7, 0xb4, + 0x75, 0xb6, 0x21, 0xf3, 0x95, 0xef, 0x77, 0xd7, 0x82, 0xdc, 0x9f, 0xf2, 0xec, 0xfe, 0x09, 0xea, + 0xe8, 0x5e, 0x65, 0x6d, 0x0f, 0xff, 0xef, 0xed, 0xf9, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x4e, + 0xec, 0x5f, 0xb6, 0x6a, 0x16, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Constitution queries the chain's constitution. + Constitution(ctx context.Context, in *QueryConstitutionRequest, opts ...grpc.CallOption) (*QueryConstitutionResponse, error) + // Proposal queries proposal details based on ProposalID. + Proposal(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryProposalResponse, error) + // Proposals queries all proposals based on given status. + Proposals(ctx context.Context, in *QueryProposalsRequest, opts ...grpc.CallOption) (*QueryProposalsResponse, error) + // Vote queries voted information based on proposalID, voterAddr. + Vote(ctx context.Context, in *QueryVoteRequest, opts ...grpc.CallOption) (*QueryVoteResponse, error) + // Votes queries votes of a given proposal. + Votes(ctx context.Context, in *QueryVotesRequest, opts ...grpc.CallOption) (*QueryVotesResponse, error) + // Params queries all parameters of the gov module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // Deposit queries single deposit information based proposalID, depositAddr. + Deposit(ctx context.Context, in *QueryDepositRequest, opts ...grpc.CallOption) (*QueryDepositResponse, error) + // Deposits queries all deposits of a single proposal. + Deposits(ctx context.Context, in *QueryDepositsRequest, opts ...grpc.CallOption) (*QueryDepositsResponse, error) + // TallyResult queries the tally of a proposal vote. + TallyResult(ctx context.Context, in *QueryTallyResultRequest, opts ...grpc.CallOption) (*QueryTallyResultResponse, error) + // Governor queries governor information based on governor address. + Governor(ctx context.Context, in *QueryGovernorRequest, opts ...grpc.CallOption) (*QueryGovernorResponse, error) + // Governors queries all governors. + Governors(ctx context.Context, in *QueryGovernorsRequest, opts ...grpc.CallOption) (*QueryGovernorsResponse, error) + // GovernanceDelegations queries all delegations of a governor. + GovernanceDelegations(ctx context.Context, in *QueryGovernanceDelegationsRequest, opts ...grpc.CallOption) (*QueryGovernanceDelegationsResponse, error) + // GovernanceDelegation queries a delegation + GovernanceDelegation(ctx context.Context, in *QueryGovernanceDelegationRequest, opts ...grpc.CallOption) (*QueryGovernanceDelegationResponse, error) + // GovernorValShares queries all governor virtual validator shares resulting from all governance delegations. + GovernorValShares(ctx context.Context, in *QueryGovernorValSharesRequest, opts ...grpc.CallOption) (*QueryGovernorValSharesResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Constitution(ctx context.Context, in *QueryConstitutionRequest, opts ...grpc.CallOption) (*QueryConstitutionResponse, error) { + out := new(QueryConstitutionResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Constitution", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryConstitutionRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return out, nil } -func (m *QueryConstitutionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil +func (c *queryClient) Proposal(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryProposalResponse, error) { + out := new(QueryProposalResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Proposal", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryConstitutionResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) Proposals(ctx context.Context, in *QueryProposalsRequest, opts ...grpc.CallOption) (*QueryProposalsResponse, error) { + out := new(QueryProposalsResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Proposals", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryConstitutionResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) Vote(ctx context.Context, in *QueryVoteRequest, opts ...grpc.CallOption) (*QueryVoteResponse, error) { + out := new(QueryVoteResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Vote", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryConstitutionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Constitution) > 0 { - i -= len(m.Constitution) - copy(dAtA[i:], m.Constitution) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Constitution))) - i-- - dAtA[i] = 0xa +func (c *queryClient) Votes(ctx context.Context, in *QueryVotesRequest, opts ...grpc.CallOption) (*QueryVotesResponse, error) { + out := new(QueryVotesResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Votes", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryProposalRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Params", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryProposalRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) Deposit(ctx context.Context, in *QueryDepositRequest, opts ...grpc.CallOption) (*QueryDepositResponse, error) { + out := new(QueryDepositResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Deposit", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryProposalRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ProposalId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 +func (c *queryClient) Deposits(ctx context.Context, in *QueryDepositsRequest, opts ...grpc.CallOption) (*QueryDepositsResponse, error) { + out := new(QueryDepositsResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Deposits", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryProposalResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) TallyResult(ctx context.Context, in *QueryTallyResultRequest, opts ...grpc.CallOption) (*QueryTallyResultResponse, error) { + out := new(QueryTallyResultResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/TallyResult", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryProposalResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) Governor(ctx context.Context, in *QueryGovernorRequest, opts ...grpc.CallOption) (*QueryGovernorResponse, error) { + out := new(QueryGovernorResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Governor", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Proposal != nil { - { - size, err := m.Proposal.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa +func (c *queryClient) Governors(ctx context.Context, in *QueryGovernorsRequest, opts ...grpc.CallOption) (*QueryGovernorsResponse, error) { + out := new(QueryGovernorsResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/Governors", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryProposalsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) GovernanceDelegations(ctx context.Context, in *QueryGovernanceDelegationsRequest, opts ...grpc.CallOption) (*QueryGovernanceDelegationsResponse, error) { + out := new(QueryGovernanceDelegationsResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/GovernanceDelegations", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryProposalsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) GovernanceDelegation(ctx context.Context, in *QueryGovernanceDelegationRequest, opts ...grpc.CallOption) (*QueryGovernanceDelegationResponse, error) { + out := new(QueryGovernanceDelegationResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/GovernanceDelegation", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryProposalsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if len(m.Depositor) > 0 { - i -= len(m.Depositor) - copy(dAtA[i:], m.Depositor) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Depositor))) - i-- - dAtA[i] = 0x1a - } - if len(m.Voter) > 0 { - i -= len(m.Voter) - copy(dAtA[i:], m.Voter) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Voter))) - i-- - dAtA[i] = 0x12 - } - if m.ProposalStatus != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ProposalStatus)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryProposalsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) GovernorValShares(ctx context.Context, in *QueryGovernorValSharesRequest, opts ...grpc.CallOption) (*QueryGovernorValSharesResponse, error) { + out := new(QueryGovernorValSharesResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/GovernorValShares", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryProposalsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +// QueryServer is the server API for Query service. +type QueryServer interface { + // Constitution queries the chain's constitution. + Constitution(context.Context, *QueryConstitutionRequest) (*QueryConstitutionResponse, error) + // Proposal queries proposal details based on ProposalID. + Proposal(context.Context, *QueryProposalRequest) (*QueryProposalResponse, error) + // Proposals queries all proposals based on given status. + Proposals(context.Context, *QueryProposalsRequest) (*QueryProposalsResponse, error) + // Vote queries voted information based on proposalID, voterAddr. + Vote(context.Context, *QueryVoteRequest) (*QueryVoteResponse, error) + // Votes queries votes of a given proposal. + Votes(context.Context, *QueryVotesRequest) (*QueryVotesResponse, error) + // Params queries all parameters of the gov module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // Deposit queries single deposit information based proposalID, depositAddr. + Deposit(context.Context, *QueryDepositRequest) (*QueryDepositResponse, error) + // Deposits queries all deposits of a single proposal. + Deposits(context.Context, *QueryDepositsRequest) (*QueryDepositsResponse, error) + // TallyResult queries the tally of a proposal vote. + TallyResult(context.Context, *QueryTallyResultRequest) (*QueryTallyResultResponse, error) + // Governor queries governor information based on governor address. + Governor(context.Context, *QueryGovernorRequest) (*QueryGovernorResponse, error) + // Governors queries all governors. + Governors(context.Context, *QueryGovernorsRequest) (*QueryGovernorsResponse, error) + // GovernanceDelegations queries all delegations of a governor. + GovernanceDelegations(context.Context, *QueryGovernanceDelegationsRequest) (*QueryGovernanceDelegationsResponse, error) + // GovernanceDelegation queries a delegation + GovernanceDelegation(context.Context, *QueryGovernanceDelegationRequest) (*QueryGovernanceDelegationResponse, error) + // GovernorValShares queries all governor virtual validator shares resulting from all governance delegations. + GovernorValShares(context.Context, *QueryGovernorValSharesRequest) (*QueryGovernorValSharesResponse, error) } -func (m *QueryProposalsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.Proposals) > 0 { - for iNdEx := len(m.Proposals) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Proposals[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { } -func (m *QueryVoteRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil +func (*UnimplementedQueryServer) Constitution(ctx context.Context, req *QueryConstitutionRequest) (*QueryConstitutionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Constitution not implemented") +} +func (*UnimplementedQueryServer) Proposal(ctx context.Context, req *QueryProposalRequest) (*QueryProposalResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Proposal not implemented") +} +func (*UnimplementedQueryServer) Proposals(ctx context.Context, req *QueryProposalsRequest) (*QueryProposalsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Proposals not implemented") +} +func (*UnimplementedQueryServer) Vote(ctx context.Context, req *QueryVoteRequest) (*QueryVoteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Vote not implemented") +} +func (*UnimplementedQueryServer) Votes(ctx context.Context, req *QueryVotesRequest) (*QueryVotesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Votes not implemented") +} +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) Deposit(ctx context.Context, req *QueryDepositRequest) (*QueryDepositResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Deposit not implemented") +} +func (*UnimplementedQueryServer) Deposits(ctx context.Context, req *QueryDepositsRequest) (*QueryDepositsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Deposits not implemented") +} +func (*UnimplementedQueryServer) TallyResult(ctx context.Context, req *QueryTallyResultRequest) (*QueryTallyResultResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TallyResult not implemented") +} +func (*UnimplementedQueryServer) Governor(ctx context.Context, req *QueryGovernorRequest) (*QueryGovernorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Governor not implemented") +} +func (*UnimplementedQueryServer) Governors(ctx context.Context, req *QueryGovernorsRequest) (*QueryGovernorsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Governors not implemented") +} +func (*UnimplementedQueryServer) GovernanceDelegations(ctx context.Context, req *QueryGovernanceDelegationsRequest) (*QueryGovernanceDelegationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GovernanceDelegations not implemented") +} +func (*UnimplementedQueryServer) GovernanceDelegation(ctx context.Context, req *QueryGovernanceDelegationRequest) (*QueryGovernanceDelegationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GovernanceDelegation not implemented") +} +func (*UnimplementedQueryServer) GovernorValShares(ctx context.Context, req *QueryGovernorValSharesRequest) (*QueryGovernorValSharesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GovernorValShares not implemented") } -func (m *QueryVoteRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) } -func (m *QueryVoteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Voter) > 0 { - i -= len(m.Voter) - copy(dAtA[i:], m.Voter) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Voter))) - i-- - dAtA[i] = 0x12 +func _Query_Constitution_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryConstitutionRequest) + if err := dec(in); err != nil { + return nil, err } - if m.ProposalId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 + if interceptor == nil { + return srv.(QueryServer).Constitution(ctx, in) } - return len(dAtA) - i, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/Constitution", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Constitution(ctx, req.(*QueryConstitutionRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryVoteResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_Proposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryProposalRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryVoteResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + if interceptor == nil { + return srv.(QueryServer).Proposal(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/Proposal", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Proposal(ctx, req.(*QueryProposalRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Vote != nil { - { - size, err := m.Vote.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa +func _Query_Proposals_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryProposalsRequest) + if err := dec(in); err != nil { + return nil, err } - return len(dAtA) - i, nil + if interceptor == nil { + return srv.(QueryServer).Proposals(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/Proposals", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Proposals(ctx, req.(*QueryProposalsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryVotesRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_Vote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryVoteRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).Vote(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/Vote", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Vote(ctx, req.(*QueryVoteRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryVotesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryVotesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 +func _Query_Votes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryVotesRequest) + if err := dec(in); err != nil { + return nil, err } - if m.ProposalId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 + if interceptor == nil { + return srv.(QueryServer).Votes(ctx, in) } - return len(dAtA) - i, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/Votes", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Votes(ctx, req.(*QueryVotesRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryVotesResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryVotesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryVotesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) } - if len(m.Votes) > 0 { - for iNdEx := len(m.Votes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Votes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/Params", } - return len(dAtA) - i, nil + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_Deposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDepositRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ParamsType) > 0 { - i -= len(m.ParamsType) - copy(dAtA[i:], m.ParamsType) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ParamsType))) - i-- - dAtA[i] = 0xa + if interceptor == nil { + return srv.(QueryServer).Deposit(ctx, in) } - return len(dAtA) - i, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/Deposit", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Deposit(ctx, req.(*QueryDepositRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_Deposits_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDepositsRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).Deposits(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/Deposits", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Deposits(ctx, req.(*QueryDepositsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func _Query_TallyResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTallyResultRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TallyResult(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/TallyResult", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TallyResult(ctx, req.(*QueryTallyResultRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Params != nil { - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 +func _Query_Governor_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGovernorRequest) + if err := dec(in); err != nil { + return nil, err } - if m.TallyParams != nil { - { - size, err := m.TallyParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a + if interceptor == nil { + return srv.(QueryServer).Governor(ctx, in) } - if m.DepositParams != nil { - { - size, err := m.DepositParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/Governor", } - if m.VotingParams != nil { - { - size, err := m.VotingParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Governor(ctx, req.(*QueryGovernorRequest)) } - return len(dAtA) - i, nil + return interceptor(ctx, in, info, handler) } -func (m *QueryDepositRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_Governors_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGovernorsRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).Governors(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/Governors", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Governors(ctx, req.(*QueryGovernorsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryDepositRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func _Query_GovernanceDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGovernanceDelegationsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GovernanceDelegations(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/GovernanceDelegations", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GovernanceDelegations(ctx, req.(*QueryGovernanceDelegationsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryDepositRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) +func _Query_GovernanceDelegation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGovernanceDelegationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GovernanceDelegation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/GovernanceDelegation", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GovernanceDelegation(ctx, req.(*QueryGovernanceDelegationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GovernorValShares_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGovernorValSharesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GovernorValShares(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/GovernorValShares", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GovernorValShares(ctx, req.(*QueryGovernorValSharesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "atomone.gov.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Constitution", + Handler: _Query_Constitution_Handler, + }, + { + MethodName: "Proposal", + Handler: _Query_Proposal_Handler, + }, + { + MethodName: "Proposals", + Handler: _Query_Proposals_Handler, + }, + { + MethodName: "Vote", + Handler: _Query_Vote_Handler, + }, + { + MethodName: "Votes", + Handler: _Query_Votes_Handler, + }, + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "Deposit", + Handler: _Query_Deposit_Handler, + }, + { + MethodName: "Deposits", + Handler: _Query_Deposits_Handler, + }, + { + MethodName: "TallyResult", + Handler: _Query_TallyResult_Handler, + }, + { + MethodName: "Governor", + Handler: _Query_Governor_Handler, + }, + { + MethodName: "Governors", + Handler: _Query_Governors_Handler, + }, + { + MethodName: "GovernanceDelegations", + Handler: _Query_GovernanceDelegations_Handler, + }, + { + MethodName: "GovernanceDelegation", + Handler: _Query_GovernanceDelegation_Handler, + }, + { + MethodName: "GovernorValShares", + Handler: _Query_GovernorValShares_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "atomone/gov/v1/query.proto", +} + +func (m *QueryConstitutionRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryConstitutionRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConstitutionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Depositor) > 0 { - i -= len(m.Depositor) - copy(dAtA[i:], m.Depositor) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Depositor))) + return len(dAtA) - i, nil +} + +func (m *QueryConstitutionResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryConstitutionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConstitutionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Constitution) > 0 { + i -= len(m.Constitution) + copy(dAtA[i:], m.Constitution) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Constitution))) i-- - dAtA[i] = 0x12 + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryProposalRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryProposalRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryProposalRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l if m.ProposalId != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) i-- @@ -1967,7 +2262,7 @@ func (m *QueryDepositRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryDepositResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryProposalResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1977,19 +2272,19 @@ func (m *QueryDepositResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryDepositResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryProposalResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Deposit != nil { + if m.Proposal != nil { { - size, err := m.Deposit.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Proposal.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2002,7 +2297,7 @@ func (m *QueryDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryDepositsRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryProposalsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2012,12 +2307,12 @@ func (m *QueryDepositsRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryDepositsRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryProposalsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryDepositsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryProposalsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2032,17 +2327,31 @@ func (m *QueryDepositsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- + dAtA[i] = 0x22 + } + if len(m.Depositor) > 0 { + i -= len(m.Depositor) + copy(dAtA[i:], m.Depositor) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Depositor))) + i-- + dAtA[i] = 0x1a + } + if len(m.Voter) > 0 { + i -= len(m.Voter) + copy(dAtA[i:], m.Voter) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Voter))) + i-- dAtA[i] = 0x12 } - if m.ProposalId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + if m.ProposalStatus != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalStatus)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } -func (m *QueryDepositsResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryProposalsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2052,12 +2361,12 @@ func (m *QueryDepositsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryDepositsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryProposalsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryDepositsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryProposalsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2074,10 +2383,10 @@ func (m *QueryDepositsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.Deposits) > 0 { - for iNdEx := len(m.Deposits) - 1; iNdEx >= 0; iNdEx-- { + if len(m.Proposals) > 0 { + for iNdEx := len(m.Proposals) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Deposits[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Proposals[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2091,7 +2400,7 @@ func (m *QueryDepositsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryTallyResultRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryVoteRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2101,16 +2410,23 @@ func (m *QueryTallyResultRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryTallyResultRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryVoteRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryTallyResultRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryVoteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if len(m.Voter) > 0 { + i -= len(m.Voter) + copy(dAtA[i:], m.Voter) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Voter))) + i-- + dAtA[i] = 0x12 + } if m.ProposalId != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) i-- @@ -2119,7 +2435,7 @@ func (m *QueryTallyResultRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *QueryTallyResultResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryVoteResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2129,19 +2445,19 @@ func (m *QueryTallyResultResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryTallyResultResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryVoteResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryTallyResultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Tally != nil { + if m.Vote != nil { { - size, err := m.Tally.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Vote.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2154,305 +2470,2132 @@ func (m *QueryTallyResultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *QueryVotesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *QueryConstitutionRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n + +func (m *QueryVotesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryConstitutionResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Constitution) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryProposalRequest) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryVotesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } if m.ProposalId != 0 { - n += 1 + sovQuery(uint64(m.ProposalId)) + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 } - return n + return len(dAtA) - i, nil } -func (m *QueryProposalResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Proposal != nil { - l = m.Proposal.Size() - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryVotesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return n + return dAtA[:n], nil } -func (m *QueryProposalsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalStatus != 0 { - n += 1 + sovQuery(uint64(m.ProposalStatus)) - } - l = len(m.Voter) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Depositor) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n +func (m *QueryVotesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryProposalsResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryVotesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.Proposals) > 0 { - for _, e := range m.Proposals { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.Votes) > 0 { + for iNdEx := len(m.Votes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Votes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } - return n + return len(dAtA) - i, nil } -func (m *QueryVoteRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovQuery(uint64(m.ProposalId)) - } - l = len(m.Voter) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return n + return dAtA[:n], nil } -func (m *QueryVoteResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Vote != nil { - l = m.Vote.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryVotesRequest) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.ProposalId != 0 { - n += 1 + sovQuery(uint64(m.ProposalId)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.ParamsType) > 0 { + i -= len(m.ParamsType) + copy(dAtA[i:], m.ParamsType) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ParamsType))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryVotesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Votes) > 0 { - for _, e := range m.Votes { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return n + return dAtA[:n], nil } -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ParamsType) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.VotingParams != nil { - l = m.VotingParams.Size() - n += 1 + l + sovQuery(uint64(l)) - } - if m.DepositParams != nil { - l = m.DepositParams.Size() - n += 1 + l + sovQuery(uint64(l)) + if m.Params != nil { + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 } if m.TallyParams != nil { - l = m.TallyParams.Size() - n += 1 + l + sovQuery(uint64(l)) + { + size, err := m.TallyParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a } - if m.Params != nil { - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) + if m.DepositParams != nil { + { + size, err := m.DepositParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - return n + if m.VotingParams != nil { + { + size, err := m.VotingParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *QueryDepositRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryDepositRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryDepositRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDepositRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.ProposalId != 0 { - n += 1 + sovQuery(uint64(m.ProposalId)) + if len(m.Depositor) > 0 { + i -= len(m.Depositor) + copy(dAtA[i:], m.Depositor) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Depositor))) + i-- + dAtA[i] = 0x12 } - l = len(m.Depositor) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if m.ProposalId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 } - return n + return len(dAtA) - i, nil } -func (m *QueryDepositResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryDepositResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryDepositResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l if m.Deposit != nil { - l = m.Deposit.Size() - n += 1 + l + sovQuery(uint64(l)) + { + size, err := m.Deposit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDepositsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryDepositsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDepositsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryDepositsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryDepositsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDepositsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Deposits) > 0 { + for iNdEx := len(m.Deposits) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Deposits[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryTallyResultRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTallyResultRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTallyResultRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ProposalId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryTallyResultResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTallyResultResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTallyResultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Tally != nil { + { + size, err := m.Tally.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGovernorRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGovernorRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGovernorRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.GovernorAddress) > 0 { + i -= len(m.GovernorAddress) + copy(dAtA[i:], m.GovernorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.GovernorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGovernorResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGovernorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGovernorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Governor != nil { + { + size, err := m.Governor.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGovernorsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGovernorsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGovernorsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGovernorsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGovernorsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGovernorsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Governors) > 0 { + for iNdEx := len(m.Governors) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Governors[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryGovernanceDelegationsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGovernanceDelegationsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGovernanceDelegationsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.GovernorAddress) > 0 { + i -= len(m.GovernorAddress) + copy(dAtA[i:], m.GovernorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.GovernorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGovernanceDelegationsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGovernanceDelegationsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGovernanceDelegationsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Delegations) > 0 { + for iNdEx := len(m.Delegations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Delegations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryGovernanceDelegationRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGovernanceDelegationRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGovernanceDelegationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGovernanceDelegationResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGovernanceDelegationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGovernanceDelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.GovernorAddress) > 0 { + i -= len(m.GovernorAddress) + copy(dAtA[i:], m.GovernorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.GovernorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGovernorValSharesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGovernorValSharesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGovernorValSharesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.GovernorAddress) > 0 { + i -= len(m.GovernorAddress) + copy(dAtA[i:], m.GovernorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.GovernorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGovernorValSharesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGovernorValSharesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGovernorValSharesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.ValShares) > 0 { + for iNdEx := len(m.ValShares) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ValShares[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryConstitutionRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryConstitutionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Constitution) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryProposalRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + return n +} + +func (m *QueryProposalResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Proposal != nil { + l = m.Proposal.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryProposalsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalStatus != 0 { + n += 1 + sovQuery(uint64(m.ProposalStatus)) + } + l = len(m.Voter) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Depositor) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryProposalsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Proposals) > 0 { + for _, e := range m.Proposals { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryVoteRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + l = len(m.Voter) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryVoteResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Vote != nil { + l = m.Vote.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryVotesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryVotesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Votes) > 0 { + for _, e := range m.Votes { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ParamsType) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.VotingParams != nil { + l = m.VotingParams.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if m.DepositParams != nil { + l = m.DepositParams.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if m.TallyParams != nil { + l = m.TallyParams.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if m.Params != nil { + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDepositRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + l = len(m.Depositor) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDepositResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Deposit != nil { + l = m.Deposit.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDepositsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDepositsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Deposits) > 0 { + for _, e := range m.Deposits { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryTallyResultRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + return n +} + +func (m *QueryTallyResultResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Tally != nil { + l = m.Tally.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGovernorRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.GovernorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGovernorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Governor != nil { + l = m.Governor.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGovernorsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGovernorsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Governors) > 0 { + for _, e := range m.Governors { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGovernanceDelegationsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.GovernorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGovernanceDelegationsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Delegations) > 0 { + for _, e := range m.Delegations { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGovernanceDelegationRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGovernanceDelegationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.GovernorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGovernorValSharesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.GovernorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGovernorValSharesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.ValShares) > 0 { + for _, e := range m.ValShares { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryConstitutionRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryConstitutionRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConstitutionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryConstitutionResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryConstitutionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConstitutionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Constitution", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Constitution = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryProposalRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryProposalRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryProposalRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryProposalResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryProposalResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryProposalResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proposal", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Proposal == nil { + m.Proposal = &Proposal{} + } + if err := m.Proposal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryProposalsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryProposalsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryProposalsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalStatus", wireType) + } + m.ProposalStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalStatus |= ProposalStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Voter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Depositor = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryProposalsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryProposalsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryProposalsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proposals", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Proposals = append(m.Proposals, &Proposal{}) + if err := m.Proposals[len(m.Proposals)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryVoteRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryVoteRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVoteRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Voter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryVoteResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryVoteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Vote", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Vote == nil { + m.Vote = &Vote{} + } + if err := m.Vote.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } } - return n -} -func (m *QueryDepositsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovQuery(uint64(m.ProposalId)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) + if iNdEx > l { + return io.ErrUnexpectedEOF } - return n + return nil } - -func (m *QueryDepositsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Deposits) > 0 { - for _, e := range m.Deposits { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryVotesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryVotesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVotesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy } } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryTallyResultRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovQuery(uint64(m.ProposalId)) - } - return n -} -func (m *QueryTallyResultResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Tally != nil { - l = m.Tally.Size() - n += 1 + l + sovQuery(uint64(l)) + if iNdEx > l { + return io.ErrUnexpectedEOF } - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + return nil } -func (m *QueryConstitutionRequest) Unmarshal(dAtA []byte) error { +func (m *QueryVotesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2475,12 +4618,82 @@ func (m *QueryConstitutionRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryConstitutionRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryVotesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConstitutionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryVotesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Votes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Votes = append(m.Votes, &Vote{}) + if err := m.Votes[len(m.Votes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -2502,7 +4715,7 @@ func (m *QueryConstitutionRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryConstitutionResponse) Unmarshal(dAtA []byte) error { +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2525,15 +4738,15 @@ func (m *QueryConstitutionResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryConstitutionResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConstitutionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Constitution", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ParamsType", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2561,7 +4774,7 @@ func (m *QueryConstitutionResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Constitution = string(dAtA[iNdEx:postIndex]) + m.ParamsType = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2584,7 +4797,7 @@ func (m *QueryConstitutionResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryProposalRequest) Unmarshal(dAtA []byte) error { +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2607,17 +4820,17 @@ func (m *QueryProposalRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryProposalRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryProposalRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VotingParams", wireType) } - m.ProposalId = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -2627,11 +4840,136 @@ func (m *QueryProposalRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VotingParams == nil { + m.VotingParams = &VotingParams{} + } + if err := m.VotingParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DepositParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DepositParams == nil { + m.DepositParams = &DepositParams{} + } + if err := m.DepositParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TallyParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TallyParams == nil { + m.TallyParams = &TallyParams{} + } + if err := m.TallyParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Params == nil { + m.Params = &Params{} + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -2653,7 +4991,7 @@ func (m *QueryProposalRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryProposalResponse) Unmarshal(dAtA []byte) error { +func (m *QueryDepositRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2676,17 +5014,36 @@ func (m *QueryProposalResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryProposalResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDepositRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryProposalResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDepositRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proposal", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -2696,27 +5053,23 @@ func (m *QueryProposalResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Proposal == nil { - m.Proposal = &Proposal{} - } - if err := m.Proposal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Depositor = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2739,7 +5092,7 @@ func (m *QueryProposalResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryProposalsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryDepositResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2762,36 +5115,17 @@ func (m *QueryProposalsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryProposalsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDepositResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryProposalsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalStatus", wireType) - } - m.ProposalStatus = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalStatus |= ProposalStatus(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Deposit", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -2801,29 +5135,83 @@ func (m *QueryProposalsRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } - if postIndex > l { + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Deposit == nil { + m.Deposit = &Deposit{} + } + if err := m.Deposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDepositsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { return io.ErrUnexpectedEOF } - m.Voter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } - var stringLen uint64 + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryDepositsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDepositsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -2833,25 +5221,12 @@ func (m *QueryProposalsRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ProposalId |= uint64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Depositor = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } @@ -2908,7 +5283,7 @@ func (m *QueryProposalsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryProposalsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryDepositsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2931,15 +5306,15 @@ func (m *QueryProposalsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryProposalsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDepositsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryProposalsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDepositsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proposals", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Deposits", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2966,8 +5341,8 @@ func (m *QueryProposalsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Proposals = append(m.Proposals, &Proposal{}) - if err := m.Proposals[len(m.Proposals)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Deposits = append(m.Deposits, &Deposit{}) + if err := m.Deposits[len(m.Deposits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3028,7 +5403,7 @@ func (m *QueryProposalsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryVoteRequest) Unmarshal(dAtA []byte) error { +func (m *QueryTallyResultRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3051,10 +5426,10 @@ func (m *QueryVoteRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryVoteRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryTallyResultRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryVoteRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryTallyResultRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3076,38 +5451,6 @@ func (m *QueryVoteRequest) Unmarshal(dAtA []byte) error { break } } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Voter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3129,7 +5472,7 @@ func (m *QueryVoteRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryVoteResponse) Unmarshal(dAtA []byte) error { +func (m *QueryTallyResultResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3152,15 +5495,15 @@ func (m *QueryVoteResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryVoteResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryTallyResultResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryVoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryTallyResultResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Vote", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Tally", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3187,10 +5530,10 @@ func (m *QueryVoteResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Vote == nil { - m.Vote = &Vote{} + if m.Tally == nil { + m.Tally = &TallyResult{} } - if err := m.Vote.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Tally.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3215,7 +5558,7 @@ func (m *QueryVoteResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryVotesRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGovernorRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3238,36 +5581,17 @@ func (m *QueryVotesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryVotesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGovernorRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryVotesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGovernorRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field GovernorAddress", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3277,27 +5601,23 @@ func (m *QueryVotesRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.GovernorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3320,7 +5640,7 @@ func (m *QueryVotesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryVotesResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGovernorResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3343,49 +5663,15 @@ func (m *QueryVotesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryVotesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGovernorResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryVotesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGovernorResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Votes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Votes = append(m.Votes, &Vote{}) - if err := m.Votes[len(m.Votes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Governor", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3412,10 +5698,10 @@ func (m *QueryVotesResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} + if m.Governor == nil { + m.Governor = &Governor{} } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Governor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3440,7 +5726,7 @@ func (m *QueryVotesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGovernorsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3463,17 +5749,17 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGovernorsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGovernorsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ParamsType", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3483,23 +5769,27 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.ParamsType = string(dAtA[iNdEx:postIndex]) + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -3522,7 +5812,7 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGovernorsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3545,15 +5835,15 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGovernorsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGovernorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VotingParams", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Governors", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3580,16 +5870,14 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.VotingParams == nil { - m.VotingParams = &VotingParams{} - } - if err := m.VotingParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Governors = append(m.Governors, &Governor{}) + if err := m.Governors[len(m.Governors)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DepositParams", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3613,21 +5901,71 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { if postIndex < 0 { return ErrInvalidLengthQuery } - if postIndex > l { + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - if m.DepositParams == nil { - m.DepositParams = &DepositParams{} + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGovernanceDelegationsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery } - if err := m.DepositParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + if iNdEx >= l { + return io.ErrUnexpectedEOF } - iNdEx = postIndex - case 3: + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGovernanceDelegationsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGovernanceDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TallyParams", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field GovernorAddress", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3637,31 +5975,27 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.TallyParams == nil { - m.TallyParams = &TallyParams{} - } - if err := m.TallyParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.GovernorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3688,10 +6022,10 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Params == nil { - m.Params = &Params{} + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3716,7 +6050,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDepositRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGovernanceDelegationsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3739,17 +6073,17 @@ func (m *QueryDepositRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDepositRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGovernanceDelegationsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDepositRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGovernanceDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delegations", wireType) } - m.ProposalId = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3759,16 +6093,31 @@ func (m *QueryDepositRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Delegations = append(m.Delegations, &GovernanceDelegation{}) + if err := m.Delegations[len(m.Delegations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3778,23 +6127,27 @@ func (m *QueryDepositRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Depositor = string(dAtA[iNdEx:postIndex]) + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -3817,7 +6170,7 @@ func (m *QueryDepositRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDepositResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGovernanceDelegationRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3840,17 +6193,17 @@ func (m *QueryDepositResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDepositResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGovernanceDelegationRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGovernanceDelegationRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Deposit", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3860,27 +6213,23 @@ func (m *QueryDepositResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Deposit == nil { - m.Deposit = &Deposit{} - } - if err := m.Deposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3903,7 +6252,7 @@ func (m *QueryDepositResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDepositsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGovernanceDelegationResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3926,36 +6275,17 @@ func (m *QueryDepositsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDepositsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGovernanceDelegationResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDepositsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGovernanceDelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field GovernorAddress", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3965,27 +6295,23 @@ func (m *QueryDepositsRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.GovernorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -4008,7 +6334,7 @@ func (m *QueryDepositsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDepositsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGovernorValSharesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4031,17 +6357,17 @@ func (m *QueryDepositsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDepositsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGovernorValSharesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDepositsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGovernorValSharesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Deposits", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field GovernorAddress", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4051,25 +6377,23 @@ func (m *QueryDepositsResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Deposits = append(m.Deposits, &Deposit{}) - if err := m.Deposits[len(m.Deposits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.GovernorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -4101,7 +6425,7 @@ func (m *QueryDepositsResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Pagination == nil { - m.Pagination = &query.PageResponse{} + m.Pagination = &query.PageRequest{} } if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4128,7 +6452,7 @@ func (m *QueryDepositsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryTallyResultRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGovernorValSharesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4151,17 +6475,17 @@ func (m *QueryTallyResultRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryTallyResultRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGovernorValSharesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryTallyResultRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGovernorValSharesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValShares", wireType) } - m.ProposalId = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4171,64 +6495,29 @@ func (m *QueryTallyResultRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryTallyResultResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery } - if iNdEx >= l { + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + m.ValShares = append(m.ValShares, &GovernorValShares{}) + if err := m.ValShares[len(m.ValShares)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryTallyResultResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryTallyResultResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + iNdEx = postIndex + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tally", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4255,10 +6544,10 @@ func (m *QueryTallyResultResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Tally == nil { - m.Tally = &TallyResult{} + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} } - if err := m.Tally.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/gov/types/v1/query.pb.gw.go b/x/gov/types/v1/query.pb.gw.go index c0047cfbf..9ed7707f5 100644 --- a/x/gov/types/v1/query.pb.gw.go +++ b/x/gov/types/v1/query.pb.gw.go @@ -545,6 +545,294 @@ func local_request_Query_TallyResult_0(ctx context.Context, marshaler runtime.Ma } +func request_Query_Governor_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGovernorRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["governor_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "governor_address") + } + + protoReq.GovernorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "governor_address", err) + } + + msg, err := client.Governor(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Governor_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGovernorRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["governor_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "governor_address") + } + + protoReq.GovernorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "governor_address", err) + } + + msg, err := server.Governor(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_Governors_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Governors_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGovernorsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Governors_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Governors(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Governors_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGovernorsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Governors_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Governors(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_GovernanceDelegations_0 = &utilities.DoubleArray{Encoding: map[string]int{"governor_address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_GovernanceDelegations_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGovernanceDelegationsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["governor_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "governor_address") + } + + protoReq.GovernorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "governor_address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GovernanceDelegations_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GovernanceDelegations(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GovernanceDelegations_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGovernanceDelegationsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["governor_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "governor_address") + } + + protoReq.GovernorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "governor_address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GovernanceDelegations_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GovernanceDelegations(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_GovernanceDelegation_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGovernanceDelegationRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + msg, err := client.GovernanceDelegation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GovernanceDelegation_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGovernanceDelegationRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + msg, err := server.GovernanceDelegation(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_GovernorValShares_0 = &utilities.DoubleArray{Encoding: map[string]int{"governor_address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_GovernorValShares_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGovernorValSharesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["governor_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "governor_address") + } + + protoReq.GovernorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "governor_address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GovernorValShares_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GovernorValShares(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GovernorValShares_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGovernorValSharesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["governor_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "governor_address") + } + + protoReq.GovernorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "governor_address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GovernorValShares_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GovernorValShares(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -758,6 +1046,121 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_Governor_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Governor_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Governor_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Governors_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Governors_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Governors_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GovernanceDelegations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GovernanceDelegations_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GovernanceDelegations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GovernanceDelegation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GovernanceDelegation_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GovernanceDelegation_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GovernorValShares_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GovernorValShares_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GovernorValShares_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -979,6 +1382,106 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_Governor_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Governor_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Governor_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Governors_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Governors_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Governors_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GovernanceDelegations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_GovernanceDelegations_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GovernanceDelegations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GovernanceDelegation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_GovernanceDelegation_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GovernanceDelegation_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GovernorValShares_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_GovernorValShares_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GovernorValShares_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1000,6 +1503,16 @@ var ( pattern_Query_Deposits_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"atomone", "gov", "v1", "proposals", "proposal_id", "deposits"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_TallyResult_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"atomone", "gov", "v1", "proposals", "proposal_id", "tally"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Governor_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"atomone", "gov", "v1", "governor", "governor_address"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Governors_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"atomone", "gov", "v1", "governors"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_GovernanceDelegations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"atomone", "gov", "v1", "governors", "governor_address", "delegations"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_GovernanceDelegation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"atomone", "gov", "v1", "delegations", "delegator_address"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_GovernorValShares_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"atomone", "gov", "v1", "vshares", "governor_address"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -1020,4 +1533,14 @@ var ( forward_Query_Deposits_0 = runtime.ForwardResponseMessage forward_Query_TallyResult_0 = runtime.ForwardResponseMessage + + forward_Query_Governor_0 = runtime.ForwardResponseMessage + + forward_Query_Governors_0 = runtime.ForwardResponseMessage + + forward_Query_GovernanceDelegations_0 = runtime.ForwardResponseMessage + + forward_Query_GovernanceDelegation_0 = runtime.ForwardResponseMessage + + forward_Query_GovernorValShares_0 = runtime.ForwardResponseMessage ) diff --git a/x/gov/types/v1/tally.go b/x/gov/types/v1/tally.go index 05522e0c4..2d623eb2a 100644 --- a/x/gov/types/v1/tally.go +++ b/x/gov/types/v1/tally.go @@ -4,8 +4,37 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/atomone-hub/atomone/x/gov/types" ) +// GovernorGovInfo used for tallying +type GovernorGovInfo struct { + Address types.GovernorAddress // address of the governor + ValShares map[string]sdk.Dec // shares held for each validator + ValSharesDeductions map[string]sdk.Dec // deductions from validator's shares when a delegator votes independently + Vote WeightedVoteOptions // vote of the governor + VotingPower sdk.Dec // voting power of the governor +} + +// NewGovernorGovInfo creates a GovernorGovInfo instance +func NewGovernorGovInfo(address types.GovernorAddress, valShares []GovernorValShares, options WeightedVoteOptions, votingPower sdk.Dec) GovernorGovInfo { + valSharesMap := make(map[string]sdk.Dec) + valSharesDeductionsMap := make(map[string]sdk.Dec) + for _, valShare := range valShares { + valSharesMap[valShare.ValidatorAddress] = valShare.Shares + valSharesDeductionsMap[valShare.ValidatorAddress] = math.LegacyZeroDec() + } + + return GovernorGovInfo{ + Address: address, + ValShares: valSharesMap, + ValSharesDeductions: valSharesDeductionsMap, + Vote: options, + VotingPower: votingPower, + } +} + // NewTallyResult creates a new TallyResult instance func NewTallyResult(yes, abstain, no math.Int) TallyResult { return TallyResult{ diff --git a/x/gov/types/v1/tx.pb.go b/x/gov/types/v1/tx.pb.go index 7dd0c1abc..31cce5a7c 100644 --- a/x/gov/types/v1/tx.pb.go +++ b/x/gov/types/v1/tx.pb.go @@ -871,6 +871,389 @@ func (m *MsgProposeConstitutionAmendmentResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgProposeConstitutionAmendmentResponse proto.InternalMessageInfo +// MsgCreateGovernor defines a SDK message for creating a new governor. +type MsgCreateGovernor struct { + // address is the base account address that is creating the governor. + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Description GovernorDescription `protobuf:"bytes,2,opt,name=description,proto3" json:"description"` +} + +func (m *MsgCreateGovernor) Reset() { *m = MsgCreateGovernor{} } +func (m *MsgCreateGovernor) String() string { return proto.CompactTextString(m) } +func (*MsgCreateGovernor) ProtoMessage() {} +func (*MsgCreateGovernor) Descriptor() ([]byte, []int) { + return fileDescriptor_f6c84786701fca8d, []int{16} +} +func (m *MsgCreateGovernor) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateGovernor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateGovernor.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreateGovernor) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateGovernor.Merge(m, src) +} +func (m *MsgCreateGovernor) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateGovernor) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateGovernor.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateGovernor proto.InternalMessageInfo + +// MsgCreateGovernorrResponse defines the Msg/CreateGovernor response type. +type MsgCreateGovernorResponse struct { +} + +func (m *MsgCreateGovernorResponse) Reset() { *m = MsgCreateGovernorResponse{} } +func (m *MsgCreateGovernorResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateGovernorResponse) ProtoMessage() {} +func (*MsgCreateGovernorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f6c84786701fca8d, []int{17} +} +func (m *MsgCreateGovernorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateGovernorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateGovernorResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreateGovernorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateGovernorResponse.Merge(m, src) +} +func (m *MsgCreateGovernorResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateGovernorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateGovernorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateGovernorResponse proto.InternalMessageInfo + +// MsgEditGovernor defines a SDK message for editing an existing governor. +type MsgEditGovernor struct { + // address is the base account address that is editing the corresponding governor. + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Description GovernorDescription `protobuf:"bytes,2,opt,name=description,proto3" json:"description"` +} + +func (m *MsgEditGovernor) Reset() { *m = MsgEditGovernor{} } +func (m *MsgEditGovernor) String() string { return proto.CompactTextString(m) } +func (*MsgEditGovernor) ProtoMessage() {} +func (*MsgEditGovernor) Descriptor() ([]byte, []int) { + return fileDescriptor_f6c84786701fca8d, []int{18} +} +func (m *MsgEditGovernor) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEditGovernor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEditGovernor.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgEditGovernor) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEditGovernor.Merge(m, src) +} +func (m *MsgEditGovernor) XXX_Size() int { + return m.Size() +} +func (m *MsgEditGovernor) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEditGovernor.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgEditGovernor proto.InternalMessageInfo + +// MsgEditGovernorResponse defines the Msg/EditGovernor response type. +type MsgEditGovernorResponse struct { +} + +func (m *MsgEditGovernorResponse) Reset() { *m = MsgEditGovernorResponse{} } +func (m *MsgEditGovernorResponse) String() string { return proto.CompactTextString(m) } +func (*MsgEditGovernorResponse) ProtoMessage() {} +func (*MsgEditGovernorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f6c84786701fca8d, []int{19} +} +func (m *MsgEditGovernorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEditGovernorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEditGovernorResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgEditGovernorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEditGovernorResponse.Merge(m, src) +} +func (m *MsgEditGovernorResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgEditGovernorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEditGovernorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgEditGovernorResponse proto.InternalMessageInfo + +// MsgUpdateGovernorStatus defines a SDK message for updating the status of a governor. +type MsgUpdateGovernorStatus struct { + // address is the base account address that is editing the corresponding governor. + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Status GovernorStatus `protobuf:"varint,2,opt,name=status,proto3,enum=atomone.gov.v1.GovernorStatus" json:"status,omitempty"` +} + +func (m *MsgUpdateGovernorStatus) Reset() { *m = MsgUpdateGovernorStatus{} } +func (m *MsgUpdateGovernorStatus) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateGovernorStatus) ProtoMessage() {} +func (*MsgUpdateGovernorStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_f6c84786701fca8d, []int{20} +} +func (m *MsgUpdateGovernorStatus) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateGovernorStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateGovernorStatus.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateGovernorStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateGovernorStatus.Merge(m, src) +} +func (m *MsgUpdateGovernorStatus) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateGovernorStatus) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateGovernorStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateGovernorStatus proto.InternalMessageInfo + +// MsgUpdateGovernorStatusResponse defines the Msg/UpdateGovernorStatus response type. +type MsgUpdateGovernorStatusResponse struct { +} + +func (m *MsgUpdateGovernorStatusResponse) Reset() { *m = MsgUpdateGovernorStatusResponse{} } +func (m *MsgUpdateGovernorStatusResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateGovernorStatusResponse) ProtoMessage() {} +func (*MsgUpdateGovernorStatusResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f6c84786701fca8d, []int{21} +} +func (m *MsgUpdateGovernorStatusResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateGovernorStatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateGovernorStatusResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateGovernorStatusResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateGovernorStatusResponse.Merge(m, src) +} +func (m *MsgUpdateGovernorStatusResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateGovernorStatusResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateGovernorStatusResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateGovernorStatusResponse proto.InternalMessageInfo + +// MsgDelegateGovernor defines a SDK message for performing a delegation of governance voting power +// from a delegator to a governor. +type MsgDelegateGovernor struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + GovernorAddress string `protobuf:"bytes,2,opt,name=governor_address,json=governorAddress,proto3" json:"governor_address,omitempty"` +} + +func (m *MsgDelegateGovernor) Reset() { *m = MsgDelegateGovernor{} } +func (m *MsgDelegateGovernor) String() string { return proto.CompactTextString(m) } +func (*MsgDelegateGovernor) ProtoMessage() {} +func (*MsgDelegateGovernor) Descriptor() ([]byte, []int) { + return fileDescriptor_f6c84786701fca8d, []int{22} +} +func (m *MsgDelegateGovernor) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDelegateGovernor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDelegateGovernor.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgDelegateGovernor) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDelegateGovernor.Merge(m, src) +} +func (m *MsgDelegateGovernor) XXX_Size() int { + return m.Size() +} +func (m *MsgDelegateGovernor) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDelegateGovernor.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDelegateGovernor proto.InternalMessageInfo + +// MsgDelegateGovernorResponse defines the Msg/Delegate response type. +type MsgDelegateGovernorResponse struct { +} + +func (m *MsgDelegateGovernorResponse) Reset() { *m = MsgDelegateGovernorResponse{} } +func (m *MsgDelegateGovernorResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDelegateGovernorResponse) ProtoMessage() {} +func (*MsgDelegateGovernorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f6c84786701fca8d, []int{23} +} +func (m *MsgDelegateGovernorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDelegateGovernorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDelegateGovernorResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgDelegateGovernorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDelegateGovernorResponse.Merge(m, src) +} +func (m *MsgDelegateGovernorResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDelegateGovernorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDelegateGovernorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDelegateGovernorResponse proto.InternalMessageInfo + +// MsgUndelegateGovernor defines a SDK message for undelegating governance voting power +type MsgUndelegateGovernor struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` +} + +func (m *MsgUndelegateGovernor) Reset() { *m = MsgUndelegateGovernor{} } +func (m *MsgUndelegateGovernor) String() string { return proto.CompactTextString(m) } +func (*MsgUndelegateGovernor) ProtoMessage() {} +func (*MsgUndelegateGovernor) Descriptor() ([]byte, []int) { + return fileDescriptor_f6c84786701fca8d, []int{24} +} +func (m *MsgUndelegateGovernor) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUndelegateGovernor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUndelegateGovernor.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUndelegateGovernor) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUndelegateGovernor.Merge(m, src) +} +func (m *MsgUndelegateGovernor) XXX_Size() int { + return m.Size() +} +func (m *MsgUndelegateGovernor) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUndelegateGovernor.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUndelegateGovernor proto.InternalMessageInfo + +// MsgUndelegateGovernorResponse defines the Msg/UndelegateGovernor response type. +type MsgUndelegateGovernorResponse struct { +} + +func (m *MsgUndelegateGovernorResponse) Reset() { *m = MsgUndelegateGovernorResponse{} } +func (m *MsgUndelegateGovernorResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUndelegateGovernorResponse) ProtoMessage() {} +func (*MsgUndelegateGovernorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f6c84786701fca8d, []int{25} +} +func (m *MsgUndelegateGovernorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUndelegateGovernorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUndelegateGovernorResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUndelegateGovernorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUndelegateGovernorResponse.Merge(m, src) +} +func (m *MsgUndelegateGovernorResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUndelegateGovernorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUndelegateGovernorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUndelegateGovernorResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgSubmitProposal)(nil), "atomone.gov.v1.MsgSubmitProposal") proto.RegisterType((*MsgSubmitProposalResponse)(nil), "atomone.gov.v1.MsgSubmitProposalResponse") @@ -888,77 +1271,107 @@ func init() { proto.RegisterType((*MsgProposeLawResponse)(nil), "atomone.gov.v1.MsgProposeLawResponse") proto.RegisterType((*MsgProposeConstitutionAmendment)(nil), "atomone.gov.v1.MsgProposeConstitutionAmendment") proto.RegisterType((*MsgProposeConstitutionAmendmentResponse)(nil), "atomone.gov.v1.MsgProposeConstitutionAmendmentResponse") + proto.RegisterType((*MsgCreateGovernor)(nil), "atomone.gov.v1.MsgCreateGovernor") + proto.RegisterType((*MsgCreateGovernorResponse)(nil), "atomone.gov.v1.MsgCreateGovernorResponse") + proto.RegisterType((*MsgEditGovernor)(nil), "atomone.gov.v1.MsgEditGovernor") + proto.RegisterType((*MsgEditGovernorResponse)(nil), "atomone.gov.v1.MsgEditGovernorResponse") + proto.RegisterType((*MsgUpdateGovernorStatus)(nil), "atomone.gov.v1.MsgUpdateGovernorStatus") + proto.RegisterType((*MsgUpdateGovernorStatusResponse)(nil), "atomone.gov.v1.MsgUpdateGovernorStatusResponse") + proto.RegisterType((*MsgDelegateGovernor)(nil), "atomone.gov.v1.MsgDelegateGovernor") + proto.RegisterType((*MsgDelegateGovernorResponse)(nil), "atomone.gov.v1.MsgDelegateGovernorResponse") + proto.RegisterType((*MsgUndelegateGovernor)(nil), "atomone.gov.v1.MsgUndelegateGovernor") + proto.RegisterType((*MsgUndelegateGovernorResponse)(nil), "atomone.gov.v1.MsgUndelegateGovernorResponse") } func init() { proto.RegisterFile("atomone/gov/v1/tx.proto", fileDescriptor_f6c84786701fca8d) } var fileDescriptor_f6c84786701fca8d = []byte{ - // 1026 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4d, 0x6f, 0x1b, 0x45, - 0x18, 0xce, 0xe6, 0xb3, 0x79, 0x03, 0xa9, 0xb2, 0x72, 0xf1, 0x66, 0x09, 0x76, 0xba, 0x2a, 0x6a, - 0x12, 0x91, 0x5d, 0xec, 0x02, 0x15, 0x56, 0x0e, 0xc4, 0x01, 0xa1, 0x4a, 0xb5, 0x5a, 0xb9, 0xe2, - 0x43, 0x1c, 0x88, 0xc6, 0xf6, 0x30, 0x59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28, 0x19, 0x3f, 0x5f, 0x96, 0xe6, 0x5e, 0x5c, 0x96, - 0xe6, 0xfe, 0xb8, 0x2c, 0xcd, 0x7d, 0xb5, 0x4f, 0x7c, 0x7e, 0xd2, 0x6b, 0xb9, 0x6d, 0x1a, 0x78, - 0x6a, 0x8f, 0xfd, 0x93, 0x5e, 0xcb, 0x4b, 0x77, 0x1e, 0x1f, 0x44, 0x98, 0x89, 0xff, 0xe7, 0xcb, - 0xf1, 0x9f, 0xa8, 0x7b, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xf0, 0xec, 0xe9, 0xac, 0xe1, 0x0b, - 0x00, 0x00, + // 1358 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0xcf, 0x6f, 0x1b, 0xc5, + 0x17, 0xcf, 0x36, 0x4d, 0xd2, 0xbc, 0x7c, 0xbf, 0x69, 0xb3, 0xb8, 0xc4, 0xd9, 0xa4, 0x76, 0xba, + 0x2d, 0x6a, 0x52, 0xc8, 0x2e, 0x76, 0xa1, 0x15, 0xa6, 0x42, 0x34, 0x69, 0x55, 0x55, 0xaa, 0xd5, + 0xca, 0x55, 0x01, 0x71, 0x68, 0xb4, 0xf6, 0x0e, 0x9b, 0x85, 0xec, 0x8e, 0xb5, 0x33, 0x36, 0x0d, + 0x27, 0xc4, 0xa9, 0xe2, 0xc4, 0x9f, 0x50, 0x89, 0x0b, 0xc7, 0x1c, 0x7a, 0xe9, 0x95, 0x03, 0x54, + 0x08, 0xa4, 0x8a, 0x13, 0xa7, 0x0a, 0x35, 0x87, 0x22, 0xae, 0x9c, 0x91, 0xd0, 0xce, 0xec, 0x8c, + 0xf7, 0xc7, 0x38, 0x0e, 0x91, 0x40, 0x5c, 0xac, 0x9d, 0xf7, 0x3e, 0xef, 0xcd, 0xe7, 0xf3, 0xe6, + 0xcd, 0x0f, 0xc3, 0xbc, 0x43, 0x71, 0x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, 0x7e, 0x19, 0x26, 0x9d, 0x00, 0xf7, + 0x42, 0x9a, 0x14, 0xe7, 0x60, 0x67, 0x54, 0x12, 0xd3, 0x58, 0x61, 0x7b, 0x44, 0x66, 0x8b, 0xab, + 0x70, 0x32, 0x5b, 0x85, 0x44, 0x96, 0x59, 0x02, 0x7d, 0x30, 0x92, 0xda, 0x1f, 0xf3, 0xb6, 0xb8, + 0xdb, 0x75, 0x1d, 0x8a, 0x6e, 0x3b, 0x91, 0x13, 0x90, 0x58, 0xc9, 0x60, 0x57, 0x6a, 0xa3, 0x94, + 0x48, 0xa8, 0xfe, 0x16, 0x4c, 0x76, 0x59, 0x06, 0x26, 0x7f, 0xa6, 0xfe, 0x72, 0x7e, 0x99, 0x79, + 0xfe, 0x8c, 0x0c, 0x1e, 0xd0, 0xb8, 0x50, 0xdc, 0xea, 0xcb, 0x42, 0xc6, 0x7d, 0x71, 0x41, 0xe5, + 0x78, 0x26, 0x4b, 0x9a, 0x36, 0x49, 0x59, 0x9f, 0xc1, 0xff, 0x9b, 0xc4, 0xe3, 0x47, 0x1f, 0xba, + 0xe9, 0x7c, 0x7a, 0x58, 0x4d, 0x8d, 0x5a, 0x91, 0x58, 0x45, 0x45, 0x6c, 0x30, 0x95, 0x39, 0x0f, + 0x27, 0x33, 0x06, 0x49, 0x6a, 0x57, 0x83, 0xea, 0xc0, 0xb3, 0x81, 0x43, 0x42, 0x7d, 0xda, 0x8b, + 0xbb, 0xfc, 0x4a, 0x80, 0x42, 0x37, 0x88, 0x4f, 0xc4, 0xc3, 0xd6, 0x3e, 0x3e, 0x49, 0x45, 0x12, + 0x79, 0x92, 0x0a, 0x43, 0xe3, 0x52, 0x51, 0xc5, 0xd9, 0x7d, 0x54, 0x48, 0x3a, 0xe6, 0x2a, 0x9c, + 0x1b, 0xc1, 0x58, 0xaa, 0xfb, 0x49, 0x63, 0x97, 0xf7, 0x46, 0x84, 0x1c, 0x8a, 0xae, 0xe3, 0x3e, + 0x8a, 0x42, 0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x85, 0x28, 0x1b, + 0x5d, 0x7d, 0xa5, 0xc5, 0x0b, 0x93, 0xb9, 0xce, 0x54, 0x0b, 0x93, 0x06, 0x28, 0x17, 0x46, 0x75, + 0x85, 0xe8, 0x5d, 0x28, 0x29, 0xaf, 0x8f, 0xe1, 0x2b, 0x9b, 0x05, 0x1a, 0xf6, 0x01, 0x81, 0x72, + 0x46, 0x17, 0x4e, 0x14, 0x0e, 0xf2, 0x33, 0xca, 0xe6, 0xcc, 0x82, 0x8c, 0x57, 0x0f, 0x00, 0x92, + 0xb3, 0x7c, 0x0c, 0xba, 0xe2, 0x14, 0x55, 0x75, 0x56, 0x11, 0x66, 0xac, 0x1d, 0x08, 0x26, 0xe6, + 0x32, 0x26, 0x3e, 0x8f, 0xaf, 0xfa, 0xf5, 0xeb, 0x4f, 0x9e, 0x57, 0xb4, 0xa7, 0xcf, 0x2b, 0xda, + 0xaf, 0xcf, 0x2b, 0xda, 0x57, 0x7b, 0x95, 0xb1, 0xa7, 0x7b, 0x95, 0xb1, 0x5f, 0xf6, 0x2a, 0x63, + 0x1f, 0xae, 0x79, 0x3e, 0xdd, 0xea, 0xb5, 0xad, 0x0e, 0x0e, 0xec, 0x24, 0xf3, 0xda, 0x56, 0xaf, + 0x6d, 0x67, 0x9f, 0x79, 0x74, 0xa7, 0x8b, 0x88, 0xdd, 0xaf, 0xb5, 0x27, 0xd9, 0x3f, 0xf6, 0x0b, + 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0xf3, 0xf0, 0x7c, 0xb5, 0x4e, 0x12, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -996,6 +1409,18 @@ type MsgClient interface { // ProposeConstitutionAmendment defines a governance operation for proposing a // new constitution amendment. The authority is defined in the keeper. ProposeConstitutionAmendment(ctx context.Context, in *MsgProposeConstitutionAmendment, opts ...grpc.CallOption) (*MsgProposeConstitutionAmendmentResponse, error) + // CreateGovernor defines a method to create a new governor. + CreateGovernor(ctx context.Context, in *MsgCreateGovernor, opts ...grpc.CallOption) (*MsgCreateGovernorResponse, error) + // EditGovernor defines a method to edit an existing governor. + // It also sets its status. + EditGovernor(ctx context.Context, in *MsgEditGovernor, opts ...grpc.CallOption) (*MsgEditGovernorResponse, error) + // UpdateGovernorStatus defines a method to update the status of a governor. + UpdateGovernorStatus(ctx context.Context, in *MsgUpdateGovernorStatus, opts ...grpc.CallOption) (*MsgUpdateGovernorStatusResponse, error) + // DelegateGovernor defines a method to delegate a non-zero percentange of + // governance voting power from a delegator to a governor. + DelegateGovernor(ctx context.Context, in *MsgDelegateGovernor, opts ...grpc.CallOption) (*MsgDelegateGovernorResponse, error) + // UndelegateGovernor defines a method to undelegate governance voting power + UndelegateGovernor(ctx context.Context, in *MsgUndelegateGovernor, opts ...grpc.CallOption) (*MsgUndelegateGovernorResponse, error) } type msgClient struct { @@ -1078,6 +1503,51 @@ func (c *msgClient) ProposeConstitutionAmendment(ctx context.Context, in *MsgPro return out, nil } +func (c *msgClient) CreateGovernor(ctx context.Context, in *MsgCreateGovernor, opts ...grpc.CallOption) (*MsgCreateGovernorResponse, error) { + out := new(MsgCreateGovernorResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Msg/CreateGovernor", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) EditGovernor(ctx context.Context, in *MsgEditGovernor, opts ...grpc.CallOption) (*MsgEditGovernorResponse, error) { + out := new(MsgEditGovernorResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Msg/EditGovernor", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateGovernorStatus(ctx context.Context, in *MsgUpdateGovernorStatus, opts ...grpc.CallOption) (*MsgUpdateGovernorStatusResponse, error) { + out := new(MsgUpdateGovernorStatusResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Msg/UpdateGovernorStatus", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) DelegateGovernor(ctx context.Context, in *MsgDelegateGovernor, opts ...grpc.CallOption) (*MsgDelegateGovernorResponse, error) { + out := new(MsgDelegateGovernorResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Msg/DelegateGovernor", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UndelegateGovernor(ctx context.Context, in *MsgUndelegateGovernor, opts ...grpc.CallOption) (*MsgUndelegateGovernorResponse, error) { + out := new(MsgUndelegateGovernorResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Msg/UndelegateGovernor", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // SubmitProposal defines a method to create new proposal given the messages. @@ -1103,6 +1573,18 @@ type MsgServer interface { // ProposeConstitutionAmendment defines a governance operation for proposing a // new constitution amendment. The authority is defined in the keeper. ProposeConstitutionAmendment(context.Context, *MsgProposeConstitutionAmendment) (*MsgProposeConstitutionAmendmentResponse, error) + // CreateGovernor defines a method to create a new governor. + CreateGovernor(context.Context, *MsgCreateGovernor) (*MsgCreateGovernorResponse, error) + // EditGovernor defines a method to edit an existing governor. + // It also sets its status. + EditGovernor(context.Context, *MsgEditGovernor) (*MsgEditGovernorResponse, error) + // UpdateGovernorStatus defines a method to update the status of a governor. + UpdateGovernorStatus(context.Context, *MsgUpdateGovernorStatus) (*MsgUpdateGovernorStatusResponse, error) + // DelegateGovernor defines a method to delegate a non-zero percentange of + // governance voting power from a delegator to a governor. + DelegateGovernor(context.Context, *MsgDelegateGovernor) (*MsgDelegateGovernorResponse, error) + // UndelegateGovernor defines a method to undelegate governance voting power + UndelegateGovernor(context.Context, *MsgUndelegateGovernor) (*MsgUndelegateGovernorResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -1133,6 +1615,21 @@ func (*UnimplementedMsgServer) ProposeLaw(ctx context.Context, req *MsgProposeLa func (*UnimplementedMsgServer) ProposeConstitutionAmendment(ctx context.Context, req *MsgProposeConstitutionAmendment) (*MsgProposeConstitutionAmendmentResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ProposeConstitutionAmendment not implemented") } +func (*UnimplementedMsgServer) CreateGovernor(ctx context.Context, req *MsgCreateGovernor) (*MsgCreateGovernorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateGovernor not implemented") +} +func (*UnimplementedMsgServer) EditGovernor(ctx context.Context, req *MsgEditGovernor) (*MsgEditGovernorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EditGovernor not implemented") +} +func (*UnimplementedMsgServer) UpdateGovernorStatus(ctx context.Context, req *MsgUpdateGovernorStatus) (*MsgUpdateGovernorStatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateGovernorStatus not implemented") +} +func (*UnimplementedMsgServer) DelegateGovernor(ctx context.Context, req *MsgDelegateGovernor) (*MsgDelegateGovernorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DelegateGovernor not implemented") +} +func (*UnimplementedMsgServer) UndelegateGovernor(ctx context.Context, req *MsgUndelegateGovernor) (*MsgUndelegateGovernorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UndelegateGovernor not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -1282,17 +1779,107 @@ func _Msg_ProposeConstitutionAmendment_Handler(srv interface{}, ctx context.Cont return interceptor(ctx, in, info, handler) } -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "atomone.gov.v1.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "SubmitProposal", - Handler: _Msg_SubmitProposal_Handler, - }, - { - MethodName: "ExecLegacyContent", - Handler: _Msg_ExecLegacyContent_Handler, +func _Msg_CreateGovernor_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateGovernor) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateGovernor(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Msg/CreateGovernor", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateGovernor(ctx, req.(*MsgCreateGovernor)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_EditGovernor_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgEditGovernor) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).EditGovernor(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Msg/EditGovernor", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).EditGovernor(ctx, req.(*MsgEditGovernor)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateGovernorStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateGovernorStatus) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateGovernorStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Msg/UpdateGovernorStatus", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateGovernorStatus(ctx, req.(*MsgUpdateGovernorStatus)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_DelegateGovernor_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDelegateGovernor) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).DelegateGovernor(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Msg/DelegateGovernor", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).DelegateGovernor(ctx, req.(*MsgDelegateGovernor)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UndelegateGovernor_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUndelegateGovernor) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UndelegateGovernor(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Msg/UndelegateGovernor", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UndelegateGovernor(ctx, req.(*MsgUndelegateGovernor)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "atomone.gov.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SubmitProposal", + Handler: _Msg_SubmitProposal_Handler, + }, + { + MethodName: "ExecLegacyContent", + Handler: _Msg_ExecLegacyContent_Handler, }, { MethodName: "Vote", @@ -1318,6 +1905,26 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "ProposeConstitutionAmendment", Handler: _Msg_ProposeConstitutionAmendment_Handler, }, + { + MethodName: "CreateGovernor", + Handler: _Msg_CreateGovernor_Handler, + }, + { + MethodName: "EditGovernor", + Handler: _Msg_EditGovernor_Handler, + }, + { + MethodName: "UpdateGovernorStatus", + Handler: _Msg_UpdateGovernorStatus_Handler, + }, + { + MethodName: "DelegateGovernor", + Handler: _Msg_DelegateGovernor_Handler, + }, + { + MethodName: "UndelegateGovernor", + Handler: _Msg_UndelegateGovernor_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "atomone/gov/v1/tx.proto", @@ -1892,127 +2499,424 @@ func (m *MsgProposeConstitutionAmendmentResponse) MarshalToSizedBuffer(dAtA []by return len(dAtA) - i, nil } -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *MsgCreateGovernor) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *MsgSubmitProposal) Size() (n int) { - if m == nil { - return 0 - } + +func (m *MsgCreateGovernor) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateGovernor) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.Messages) > 0 { - for _, e := range m.Messages { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - if len(m.InitialDeposit) > 0 { - for _, e := range m.InitialDeposit { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) + { + size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) } - l = len(m.Proposer) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Metadata) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Title) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Summary) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + i-- + dAtA[i] = 0x12 + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintTx(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *MsgSubmitProposalResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovTx(uint64(m.ProposalId)) +func (m *MsgCreateGovernorResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return n + return dAtA[:n], nil } -func (m *MsgExecLegacyContent) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Content != nil { - l = m.Content.Size() - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Authority) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n +func (m *MsgCreateGovernorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgExecLegacyContentResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *MsgCreateGovernorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - return n + return len(dAtA) - i, nil } -func (m *MsgVote) Size() (n int) { - if m == nil { - return 0 +func (m *MsgEditGovernor) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *MsgEditGovernor) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEditGovernor) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.ProposalId != 0 { - n += 1 + sovTx(uint64(m.ProposalId)) - } - l = len(m.Voter) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.Option != 0 { - n += 1 + sovTx(uint64(m.Option)) + { + size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) } - l = len(m.Metadata) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + i-- + dAtA[i] = 0x12 + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintTx(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *MsgVoteResponse) Size() (n int) { - if m == nil { - return 0 +func (m *MsgEditGovernorResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *MsgEditGovernorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEditGovernorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - return n + return len(dAtA) - i, nil } -func (m *MsgVoteWeighted) Size() (n int) { - if m == nil { - return 0 +func (m *MsgUpdateGovernorStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateGovernorStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateGovernorStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Status != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x10 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintTx(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateGovernorStatusResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateGovernorStatusResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateGovernorStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgDelegateGovernor) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgDelegateGovernor) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDelegateGovernor) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.GovernorAddress) > 0 { + i -= len(m.GovernorAddress) + copy(dAtA[i:], m.GovernorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.GovernorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgDelegateGovernorResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgDelegateGovernorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDelegateGovernorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUndelegateGovernor) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUndelegateGovernor) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUndelegateGovernor) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUndelegateGovernorResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUndelegateGovernorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUndelegateGovernorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgSubmitProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Messages) > 0 { + for _, e := range m.Messages { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + if len(m.InitialDeposit) > 0 { + for _, e := range m.InitialDeposit { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Proposer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Metadata) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Title) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Summary) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSubmitProposalResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovTx(uint64(m.ProposalId)) + } + return n +} + +func (m *MsgExecLegacyContent) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Content != nil { + l = m.Content.Size() + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgExecLegacyContentResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgVote) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovTx(uint64(m.ProposalId)) + } + l = len(m.Voter) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Option != 0 { + n += 1 + sovTx(uint64(m.Option)) + } + l = len(m.Metadata) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgVoteResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgVoteWeighted) Size() (n int) { + if m == nil { + return 0 } var l int _ = l @@ -2148,12 +3052,133 @@ func (m *MsgProposeConstitutionAmendmentResponse) Size() (n int) { return n } -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} +func (m *MsgCreateGovernor) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Description.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgCreateGovernorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgEditGovernor) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Description.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgEditGovernorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateGovernorStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Status != 0 { + n += 1 + sovTx(uint64(m.Status)) + } + return n +} + +func (m *MsgUpdateGovernorStatusResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgDelegateGovernor) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.GovernorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgDelegateGovernorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUndelegateGovernor) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUndelegateGovernorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2221,7 +3246,875 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field InitialDeposit", wireType) } - var msglen int + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.InitialDeposit = append(m.InitialDeposit, types1.Coin{}) + if err := m.InitialDeposit[len(m.InitialDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proposer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Proposer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Metadata = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Summary", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Summary = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSubmitProposalResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSubmitProposalResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitProposalResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgExecLegacyContent) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgExecLegacyContent: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgExecLegacyContent: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Content == nil { + m.Content = &types.Any{} + } + if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgExecLegacyContentResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgExecLegacyContentResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgExecLegacyContentResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgVote) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgVote: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgVote: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Voter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Option", wireType) + } + m.Option = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Option |= VoteOption(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Metadata = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgVoteResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgVoteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgVoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgVoteWeighted) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgVoteWeighted: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgVoteWeighted: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Voter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Options = append(m.Options, &WeightedVoteOption{}) + if err := m.Options[len(m.Options)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Metadata = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgVoteWeightedResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgVoteWeightedResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgVoteWeightedResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDeposit) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDeposit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDeposit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2231,29 +4124,14 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.ProposalId |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.InitialDeposit = append(m.InitialDeposit, types1.Coin{}) - if err := m.InitialDeposit[len(m.InitialDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proposer", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2281,13 +4159,13 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Proposer = string(dAtA[iNdEx:postIndex]) + m.Depositor = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2297,27 +4175,129 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Metadata = string(dAtA[iNdEx:postIndex]) + m.Amount = append(m.Amount, types1.Coin{}) + if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 5: + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDepositResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDepositResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2345,13 +4325,13 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Title = string(dAtA[iNdEx:postIndex]) + m.Authority = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Summary", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2361,23 +4341,24 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Summary = string(dAtA[iNdEx:postIndex]) + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -2400,7 +4381,7 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSubmitProposalResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2423,31 +4404,12 @@ func (m *MsgSubmitProposalResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSubmitProposalResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSubmitProposalResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -2469,7 +4431,7 @@ func (m *MsgSubmitProposalResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgExecLegacyContent) Unmarshal(dAtA []byte) error { +func (m *MsgProposeLaw) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2492,49 +4454,13 @@ func (m *MsgExecLegacyContent) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgExecLegacyContent: wiretype end group for non-group") + return fmt.Errorf("proto: MsgProposeLaw: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgExecLegacyContent: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgProposeLaw: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Content == nil { - m.Content = &types.Any{} - } - if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) } @@ -2587,7 +4513,7 @@ func (m *MsgExecLegacyContent) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgExecLegacyContentResponse) Unmarshal(dAtA []byte) error { +func (m *MsgProposeLawResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2610,10 +4536,10 @@ func (m *MsgExecLegacyContentResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgExecLegacyContentResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgProposeLawResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgExecLegacyContentResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgProposeLawResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2637,7 +4563,7 @@ func (m *MsgExecLegacyContentResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgVote) Unmarshal(dAtA []byte) error { +func (m *MsgProposeConstitutionAmendment) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2660,34 +4586,15 @@ func (m *MsgVote) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgVote: wiretype end group for non-group") + return fmt.Errorf("proto: MsgProposeConstitutionAmendment: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgVote: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgProposeConstitutionAmendment: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2715,30 +4622,11 @@ func (m *MsgVote) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Voter = string(dAtA[iNdEx:postIndex]) + m.Authority = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Option", wireType) - } - m.Option = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Option |= VoteOption(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Amendment", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2766,7 +4654,7 @@ func (m *MsgVote) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Metadata = string(dAtA[iNdEx:postIndex]) + m.Amendment = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2789,7 +4677,7 @@ func (m *MsgVote) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgVoteResponse) Unmarshal(dAtA []byte) error { +func (m *MsgProposeConstitutionAmendmentResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2812,10 +4700,10 @@ func (m *MsgVoteResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgVoteResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgProposeConstitutionAmendmentResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgVoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgProposeConstitutionAmendmentResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2839,7 +4727,7 @@ func (m *MsgVoteResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgVoteWeighted) Unmarshal(dAtA []byte) error { +func (m *MsgCreateGovernor) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2862,34 +4750,15 @@ func (m *MsgVoteWeighted) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgVoteWeighted: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCreateGovernor: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgVoteWeighted: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCreateGovernor: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2917,11 +4786,11 @@ func (m *MsgVoteWeighted) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Voter = string(dAtA[iNdEx:postIndex]) + m.Address = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2948,43 +4817,10 @@ func (m *MsgVoteWeighted) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Options = append(m.Options, &WeightedVoteOption{}) - if err := m.Options[len(m.Options)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Metadata = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -3006,7 +4842,7 @@ func (m *MsgVoteWeighted) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgVoteWeightedResponse) Unmarshal(dAtA []byte) error { +func (m *MsgCreateGovernorResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3029,10 +4865,10 @@ func (m *MsgVoteWeightedResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgVoteWeightedResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCreateGovernorResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgVoteWeightedResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCreateGovernorResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3056,7 +4892,7 @@ func (m *MsgVoteWeightedResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgDeposit) Unmarshal(dAtA []byte) error { +func (m *MsgEditGovernor) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3079,34 +4915,15 @@ func (m *MsgDeposit) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgDeposit: wiretype end group for non-group") + return fmt.Errorf("proto: MsgEditGovernor: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDeposit: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgEditGovernor: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3134,11 +4951,11 @@ func (m *MsgDeposit) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Depositor = string(dAtA[iNdEx:postIndex]) + m.Address = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3165,8 +4982,7 @@ func (m *MsgDeposit) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = append(m.Amount, types1.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3191,7 +5007,7 @@ func (m *MsgDeposit) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgDepositResponse) Unmarshal(dAtA []byte) error { +func (m *MsgEditGovernorResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3214,10 +5030,10 @@ func (m *MsgDepositResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgDepositResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgEditGovernorResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgEditGovernorResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3241,7 +5057,7 @@ func (m *MsgDepositResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateGovernorStatus) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3264,15 +5080,15 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateGovernorStatus: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateGovernorStatus: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3300,13 +5116,13 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Authority = string(dAtA[iNdEx:postIndex]) + m.Address = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } - var msglen int + m.Status = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3316,25 +5132,11 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.Status |= GovernorStatus(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -3356,7 +5158,7 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateGovernorStatusResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3379,10 +5181,10 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateGovernorStatusResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateGovernorStatusResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3406,7 +5208,7 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgProposeLaw) Unmarshal(dAtA []byte) error { +func (m *MsgDelegateGovernor) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3429,15 +5231,15 @@ func (m *MsgProposeLaw) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgProposeLaw: wiretype end group for non-group") + return fmt.Errorf("proto: MsgDelegateGovernor: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgProposeLaw: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgDelegateGovernor: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3465,7 +5267,39 @@ func (m *MsgProposeLaw) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Authority = string(dAtA[iNdEx:postIndex]) + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GovernorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GovernorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3488,7 +5322,7 @@ func (m *MsgProposeLaw) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgProposeLawResponse) Unmarshal(dAtA []byte) error { +func (m *MsgDelegateGovernorResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3511,10 +5345,10 @@ func (m *MsgProposeLawResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgProposeLawResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgDelegateGovernorResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgProposeLawResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgDelegateGovernorResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3538,7 +5372,7 @@ func (m *MsgProposeLawResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgProposeConstitutionAmendment) Unmarshal(dAtA []byte) error { +func (m *MsgUndelegateGovernor) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3561,47 +5395,15 @@ func (m *MsgProposeConstitutionAmendment) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgProposeConstitutionAmendment: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUndelegateGovernor: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgProposeConstitutionAmendment: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUndelegateGovernor: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amendment", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3629,7 +5431,7 @@ func (m *MsgProposeConstitutionAmendment) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Amendment = string(dAtA[iNdEx:postIndex]) + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3652,7 +5454,7 @@ func (m *MsgProposeConstitutionAmendment) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgProposeConstitutionAmendmentResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUndelegateGovernorResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3675,10 +5477,10 @@ func (m *MsgProposeConstitutionAmendmentResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgProposeConstitutionAmendmentResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUndelegateGovernorResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgProposeConstitutionAmendmentResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUndelegateGovernorResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: