diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md index 1a3a69891..3ad157ba5 100644 --- a/docs/proto/proto-docs.md +++ b/docs/proto/proto-docs.md @@ -83,9 +83,27 @@ - [stargaze/globalfee/v1/proposal.proto](#stargaze/globalfee/v1/proposal.proto) - [stargaze/globalfee/v1/query.proto](#stargaze/globalfee/v1/query.proto) + - [QueryAuthorizationsRequest](#publicawesome.stargaze.globalfee.v1.QueryAuthorizationsRequest) + - [QueryAuthorizationsResponse](#publicawesome.stargaze.globalfee.v1.QueryAuthorizationsResponse) + - [QueryCodeAuthorizationRequest](#publicawesome.stargaze.globalfee.v1.QueryCodeAuthorizationRequest) + - [QueryCodeAuthorizationResponse](#publicawesome.stargaze.globalfee.v1.QueryCodeAuthorizationResponse) + - [QueryContractAuthorizationRequest](#publicawesome.stargaze.globalfee.v1.QueryContractAuthorizationRequest) + - [QueryContractAuthorizationResponse](#publicawesome.stargaze.globalfee.v1.QueryContractAuthorizationResponse) + - [QueryParamsRequest](#publicawesome.stargaze.globalfee.v1.QueryParamsRequest) + - [QueryParamsResponse](#publicawesome.stargaze.globalfee.v1.QueryParamsResponse) + - [Query](#publicawesome.stargaze.globalfee.v1.Query) - [stargaze/globalfee/v1/tx.proto](#stargaze/globalfee/v1/tx.proto) + - [MsgRemoveCodeAuthorization](#publicawesome.stargaze.globalfee.v1.MsgRemoveCodeAuthorization) + - [MsgRemoveCodeAuthorizationResponse](#publicawesome.stargaze.globalfee.v1.MsgRemoveCodeAuthorizationResponse) + - [MsgRemoveContractAuthorization](#publicawesome.stargaze.globalfee.v1.MsgRemoveContractAuthorization) + - [MsgRemoveContractAuthorizationResponse](#publicawesome.stargaze.globalfee.v1.MsgRemoveContractAuthorizationResponse) + - [MsgSetCodeAuthorization](#publicawesome.stargaze.globalfee.v1.MsgSetCodeAuthorization) + - [MsgSetCodeAuthorizationResponse](#publicawesome.stargaze.globalfee.v1.MsgSetCodeAuthorizationResponse) + - [MsgSetContractAuthorization](#publicawesome.stargaze.globalfee.v1.MsgSetContractAuthorization) + - [MsgSetContractAuthorizationResponse](#publicawesome.stargaze.globalfee.v1.MsgSetContractAuthorizationResponse) + - [Msg](#publicawesome.stargaze.globalfee.v1.Msg) - [stargaze/mint/v1beta1/mint.proto](#stargaze/mint/v1beta1/mint.proto) @@ -982,6 +1000,117 @@ Params holds parameters for the globalfee module. ## stargaze/globalfee/v1/query.proto + + + +### QueryAuthorizationsRequest + + + + + + + + + +### QueryAuthorizationsResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `code_authorizations` | [CodeAuthorization](#publicawesome.stargaze.globalfee.v1.CodeAuthorization) | repeated | | +| `contract_authorizations` | [ContractAuthorization](#publicawesome.stargaze.globalfee.v1.ContractAuthorization) | repeated | | + + + + + + + + +### QueryCodeAuthorizationRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `code_id` | [uint64](#uint64) | | | + + + + + + + + +### QueryCodeAuthorizationResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `methods` | [string](#string) | repeated | | + + + + + + + + +### QueryContractAuthorizationRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `contract_address` | [string](#string) | | | + + + + + + + + +### QueryContractAuthorizationResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `methods` | [string](#string) | repeated | | + + + + + + + + +### QueryParamsRequest + + + + + + + + + +### QueryParamsResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `params` | [Params](#publicawesome.stargaze.globalfee.v1.Params) | | | + + + + + @@ -996,6 +1125,10 @@ Query defines the gRPC querier service. | Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | | ----------- | ------------ | ------------- | ------------| ------- | -------- | +| `CodeAuthorization` | [QueryCodeAuthorizationRequest](#publicawesome.stargaze.globalfee.v1.QueryCodeAuthorizationRequest) | [QueryCodeAuthorizationResponse](#publicawesome.stargaze.globalfee.v1.QueryCodeAuthorizationResponse) | | GET|/stargaze/globalfee/v1/code_authorization/{code_id}| +| `ContractAuthorization` | [QueryContractAuthorizationRequest](#publicawesome.stargaze.globalfee.v1.QueryContractAuthorizationRequest) | [QueryContractAuthorizationResponse](#publicawesome.stargaze.globalfee.v1.QueryContractAuthorizationResponse) | | GET|/stargaze/globalfee/v1/contract_authorization/{contract_address}| +| `Params` | [QueryParamsRequest](#publicawesome.stargaze.globalfee.v1.QueryParamsRequest) | [QueryParamsResponse](#publicawesome.stargaze.globalfee.v1.QueryParamsResponse) | | GET|/stargaze/globalfee/v1/params| +| `Authorizations` | [QueryAuthorizationsRequest](#publicawesome.stargaze.globalfee.v1.QueryAuthorizationsRequest) | [QueryAuthorizationsResponse](#publicawesome.stargaze.globalfee.v1.QueryAuthorizationsResponse) | | GET|/stargaze/globalfee/v1/authorizations| @@ -1007,6 +1140,110 @@ Query defines the gRPC querier service. ## stargaze/globalfee/v1/tx.proto + + + +### MsgRemoveCodeAuthorization + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `code_id` | [uint64](#uint64) | | | + + + + + + + + +### MsgRemoveCodeAuthorizationResponse + + + + + + + + + +### MsgRemoveContractAuthorization + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `contract_address` | [string](#string) | | | + + + + + + + + +### MsgRemoveContractAuthorizationResponse + + + + + + + + + +### MsgSetCodeAuthorization + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `code_authorization` | [CodeAuthorization](#publicawesome.stargaze.globalfee.v1.CodeAuthorization) | | | + + + + + + + + +### MsgSetCodeAuthorizationResponse + + + + + + + + + +### MsgSetContractAuthorization + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `sender` | [string](#string) | | | +| `contract_authorization` | [ContractAuthorization](#publicawesome.stargaze.globalfee.v1.ContractAuthorization) | | | + + + + + + + + +### MsgSetContractAuthorizationResponse + + + + + + @@ -1021,6 +1258,10 @@ Msg defines the alloc Msg service. | Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | | ----------- | ------------ | ------------- | ------------| ------- | -------- | +| `SetCodeAuthorization` | [MsgSetCodeAuthorization](#publicawesome.stargaze.globalfee.v1.MsgSetCodeAuthorization) | [MsgSetCodeAuthorizationResponse](#publicawesome.stargaze.globalfee.v1.MsgSetCodeAuthorizationResponse) | | | +| `RemoveCodeAuthorization` | [MsgRemoveCodeAuthorization](#publicawesome.stargaze.globalfee.v1.MsgRemoveCodeAuthorization) | [MsgRemoveCodeAuthorizationResponse](#publicawesome.stargaze.globalfee.v1.MsgRemoveCodeAuthorizationResponse) | | | +| `SetContractAuthorization` | [MsgSetContractAuthorization](#publicawesome.stargaze.globalfee.v1.MsgSetContractAuthorization) | [MsgSetContractAuthorizationResponse](#publicawesome.stargaze.globalfee.v1.MsgSetContractAuthorizationResponse) | | | +| `RemoveContractAuthorization` | [MsgRemoveContractAuthorization](#publicawesome.stargaze.globalfee.v1.MsgRemoveContractAuthorization) | [MsgRemoveContractAuthorizationResponse](#publicawesome.stargaze.globalfee.v1.MsgRemoveContractAuthorizationResponse) | | | diff --git a/proto/stargaze/globalfee/v1/query.proto b/proto/stargaze/globalfee/v1/query.proto index d1b1d578c..eaf9b2af4 100644 --- a/proto/stargaze/globalfee/v1/query.proto +++ b/proto/stargaze/globalfee/v1/query.proto @@ -1,9 +1,54 @@ syntax = "proto3"; package publicawesome.stargaze.globalfee.v1; +import "google/api/annotations.proto"; +import "stargaze/globalfee/v1/globalfee.proto"; + option go_package = "github.com/public-awesome/stargaze/v9/x/globalfee/types"; // Query defines the gRPC querier service. service Query { + rpc CodeAuthorization(QueryCodeAuthorizationRequest) returns (QueryCodeAuthorizationResponse) { + option (google.api.http).get = + "/stargaze/globalfee/v1/code_authorization/{code_id}"; + } + rpc ContractAuthorization(QueryContractAuthorizationRequest) returns (QueryContractAuthorizationResponse) { + option (google.api.http).get = + "/stargaze/globalfee/v1/contract_authorization/{contract_address}"; + } + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/stargaze/globalfee/v1/params"; + } + rpc Authorizations(QueryAuthorizationsRequest) returns (QueryAuthorizationsResponse) { + option (google.api.http).get = "/stargaze/globalfee/v1/authorizations"; + } +} + +message QueryCodeAuthorizationRequest { + uint64 code_id = 1; +} +message QueryCodeAuthorizationResponse { + repeated string methods = 1; } + +message QueryContractAuthorizationRequest { + string contract_address = 1; +} + +message QueryContractAuthorizationResponse { + repeated string methods = 1; +} + +message QueryParamsRequest {} + +message QueryParamsResponse { + Params params = 1; +} + +message QueryAuthorizationsRequest {} + +message QueryAuthorizationsResponse { + repeated CodeAuthorization code_authorizations = 1; + repeated ContractAuthorization contract_authorizations = 2; +} \ No newline at end of file diff --git a/proto/stargaze/globalfee/v1/tx.proto b/proto/stargaze/globalfee/v1/tx.proto index ebf66c9d7..e4a33a114 100644 --- a/proto/stargaze/globalfee/v1/tx.proto +++ b/proto/stargaze/globalfee/v1/tx.proto @@ -1,9 +1,45 @@ syntax = "proto3"; package publicawesome.stargaze.globalfee.v1; +import "stargaze/globalfee/v1/globalfee.proto"; + option go_package = "github.com/public-awesome/stargaze/v9/x/globalfee/types"; // Msg defines the alloc Msg service. service Msg { + rpc SetCodeAuthorization (MsgSetCodeAuthorization) returns (MsgSetCodeAuthorizationResponse); + + rpc RemoveCodeAuthorization(MsgRemoveCodeAuthorization) returns (MsgRemoveCodeAuthorizationResponse); + + rpc SetContractAuthorization (MsgSetContractAuthorization ) returns (MsgSetContractAuthorizationResponse); + + rpc RemoveContractAuthorization(MsgRemoveContractAuthorization) returns (MsgRemoveContractAuthorizationResponse); +} + +message MsgSetCodeAuthorization { + string sender = 1; + CodeAuthorization code_authorization = 2; +} + +message MsgSetCodeAuthorizationResponse {} +message MsgRemoveCodeAuthorization { + string sender = 1; + uint64 code_id = 2; } + +message MsgRemoveCodeAuthorizationResponse {} + +message MsgSetContractAuthorization { + string sender = 1; + ContractAuthorization contract_authorization = 2; +} + +message MsgSetContractAuthorizationResponse {} + +message MsgRemoveContractAuthorization { + string sender = 1; + string contract_address = 2; +} + +message MsgRemoveContractAuthorizationResponse {} \ No newline at end of file diff --git a/testutil/keeper/globalfee.go b/testutil/keeper/globalfee.go index b0ae21d42..f601b609d 100644 --- a/testutil/keeper/globalfee.go +++ b/testutil/keeper/globalfee.go @@ -9,10 +9,12 @@ import ( "github.com/cosmos/cosmos-sdk/store" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" + paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" + "github.com/public-awesome/stargaze/v9/app" "github.com/public-awesome/stargaze/v9/x/globalfee/keeper" "github.com/public-awesome/stargaze/v9/x/globalfee/types" "github.com/stretchr/testify/require" + "github.com/tendermint/spm/cosmoscmd" "github.com/tendermint/tendermint/libs/log" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" tmdb "github.com/tendermint/tm-db" @@ -22,22 +24,23 @@ import ( func GlobalFeeKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { storeKey := sdk.NewKVStoreKey(types.StoreKey) memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) + tStoreKey := storetypes.NewTransientStoreKey("t_globalfee") db := tmdb.NewMemDB() stateStore := store.NewCommitMultiStore(db) stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) + stateStore.MountStoreWithDB(tStoreKey, sdk.StoreTypeTransient, db) require.NoError(t, stateStore.LoadLatestVersion()) registry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(registry) + encoding := cosmoscmd.MakeEncodingConfig(app.ModuleBasics) + appCodec := encoding.Marshaler + + paramsKeeper := paramskeeper.NewKeeper(appCodec, encoding.Amino, storeKey, tStoreKey) + paramsKeeper.Subspace(types.ModuleName).WithKeyTable(types.ParamKeyTable()) + subspace, _ := paramsKeeper.GetSubspace(types.ModuleName) - paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, - storeKey, - memStoreKey, - "GlobalFeeParams", - ) wk := MockWasmKeeper{ HasContractInfoFn: func(ctx sdk.Context, contractAddr sdk.AccAddress) bool { switch contractAddr.String() { @@ -71,13 +74,16 @@ func GlobalFeeKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { } k := keeper.NewKeeper( - cdc, + codec.NewProtoCodec(registry), storeKey, - paramsSubspace, + subspace, wk, ) ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) + params := types.Params{PrivilegedAddress: []string{}} + k.SetParams(ctx, params) + return k, ctx } diff --git a/x/globalfee/keeper/grpc_keeper.go b/x/globalfee/keeper/grpc_keeper.go index ad3b4ff56..94e78bac9 100644 --- a/x/globalfee/keeper/grpc_keeper.go +++ b/x/globalfee/keeper/grpc_keeper.go @@ -1,7 +1,12 @@ package keeper import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/public-awesome/stargaze/v9/x/globalfee/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) var _ types.QueryServer = &QueryServer{} @@ -17,3 +22,59 @@ func NewQueryServer(keeper Keeper) *QueryServer { keeper: keeper, } } + +func (q QueryServer) CodeAuthorization(c context.Context, req *types.QueryCodeAuthorizationRequest) (*types.QueryCodeAuthorizationResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + ctx := sdk.UnwrapSDKContext(c) + ca, found := q.keeper.GetCodeAuthorization(ctx, req.GetCodeId()) + if !found { + return nil, status.Errorf(codes.NotFound, "code authorization: not found") + } + + return &types.QueryCodeAuthorizationResponse{ + Methods: ca.GetMethods(), + }, nil +} + +func (q QueryServer) ContractAuthorization(c context.Context, req *types.QueryContractAuthorizationRequest) (*types.QueryContractAuthorizationResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + contractAddr, err := sdk.AccAddressFromBech32(req.GetContractAddress()) + if err != nil { + return nil, err + } + + ctx := sdk.UnwrapSDKContext(c) + ca, found := q.keeper.GetContractAuthorization(ctx, contractAddr) + if !found { + return nil, status.Errorf(codes.NotFound, "contract authorization: not found") + } + + return &types.QueryContractAuthorizationResponse{ + Methods: ca.GetMethods(), + }, nil +} + +func (q QueryServer) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + params := q.keeper.GetParams(ctx) + return &types.QueryParamsResponse{Params: ¶ms}, nil +} + +func (q QueryServer) Authorizations(c context.Context, _ *types.QueryAuthorizationsRequest) (*types.QueryAuthorizationsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + + res := types.QueryAuthorizationsResponse{} + q.keeper.IterateCodeAuthorizations(ctx, func(ca types.CodeAuthorization) bool { + res.CodeAuthorizations = append(res.CodeAuthorizations, &ca) + return false + }) + q.keeper.IterateContractAuthorizations(ctx, func(ca types.ContractAuthorization) bool { + res.ContractAuthorizations = append(res.ContractAuthorizations, &ca) + return false + }) + return &res, nil +} diff --git a/x/globalfee/keeper/msg_server.go b/x/globalfee/keeper/msg_server.go index 98d4fe45e..911c8f0c2 100644 --- a/x/globalfee/keeper/msg_server.go +++ b/x/globalfee/keeper/msg_server.go @@ -1,6 +1,11 @@ package keeper import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/public-awesome/stargaze/v9/x/globalfee/types" ) @@ -15,3 +20,65 @@ func NewMsgServerImpl(keeper Keeper) types.MsgServer { } var _ types.MsgServer = msgServer{} + +func (k msgServer) SetCodeAuthorization(goCtx context.Context, msg *types.MsgSetCodeAuthorization) (*types.MsgSetCodeAuthorizationResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + _, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, err + } + if !k.IsPrivilegedAddress(ctx, msg.Sender) { + return nil, sdkerrors.Wrap(types.ErrUnauthorized, "sender address is not privileged address") + } + err = k.Keeper.SetCodeAuthorization(ctx, *msg.CodeAuthorization) + if err != nil { + return nil, err + } + return &types.MsgSetCodeAuthorizationResponse{}, nil +} + +func (k msgServer) RemoveCodeAuthorization(goCtx context.Context, msg *types.MsgRemoveCodeAuthorization) (*types.MsgRemoveCodeAuthorizationResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + _, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, err + } + if !k.IsPrivilegedAddress(ctx, msg.Sender) { + return nil, sdkerrors.Wrap(types.ErrUnauthorized, "sender address is not privileged address") + } + k.Keeper.DeleteCodeAuthorization(ctx, msg.GetCodeId()) + return &types.MsgRemoveCodeAuthorizationResponse{}, nil +} + +func (k msgServer) SetContractAuthorization(goCtx context.Context, msg *types.MsgSetContractAuthorization) (*types.MsgSetContractAuthorizationResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + _, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, err + } + if !k.IsPrivilegedAddress(ctx, msg.Sender) { + return nil, sdkerrors.Wrap(types.ErrUnauthorized, "sender address is not privileged address") + } + err = k.Keeper.SetContractAuthorization(ctx, *msg.ContractAuthorization) + if err != nil { + return nil, err + } + return &types.MsgSetContractAuthorizationResponse{}, nil +} + +func (k msgServer) RemoveContractAuthorization(goCtx context.Context, msg *types.MsgRemoveContractAuthorization) (*types.MsgRemoveContractAuthorizationResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + _, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, err + } + if !k.IsPrivilegedAddress(ctx, msg.Sender) { + return nil, sdkerrors.Wrap(types.ErrUnauthorized, "sender address is not privileged address") + } + contractAddr, err := sdk.AccAddressFromBech32(msg.ContractAddress) + if err != nil { + return nil, err + } + k.Keeper.DeleteContractAuthorization(ctx, contractAddr) + return &types.MsgRemoveContractAuthorizationResponse{}, nil +} diff --git a/x/globalfee/keeper/msg_server_test.go b/x/globalfee/keeper/msg_server_test.go new file mode 100644 index 000000000..9b9485220 --- /dev/null +++ b/x/globalfee/keeper/msg_server_test.go @@ -0,0 +1,416 @@ +package keeper_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + keepertest "github.com/public-awesome/stargaze/v9/testutil/keeper" + "github.com/public-awesome/stargaze/v9/testutil/sample" + "github.com/public-awesome/stargaze/v9/x/globalfee/keeper" + "github.com/public-awesome/stargaze/v9/x/globalfee/types" + "github.com/stretchr/testify/require" +) + +func TestSetCodeAuthorization(t *testing.T) { + testCases := []struct { + testCase string + prepare func(ctx sdk.Context, keeper keeper.Keeper) *types.MsgSetCodeAuthorization + expectError bool + }{ + { + "invalid sender address", + func(ctx sdk.Context, keeper keeper.Keeper) *types.MsgSetCodeAuthorization { + msg := types.MsgSetCodeAuthorization{ + Sender: "👻", + CodeAuthorization: &types.CodeAuthorization{ + CodeId: 2, + Methods: []string{"2"}, + }, + } + return &msg + }, + true, + }, + { + "sender not privileged", + func(ctx sdk.Context, keeper keeper.Keeper) *types.MsgSetCodeAuthorization { + sender := sample.AccAddress() + msg := types.MsgSetCodeAuthorization{ + Sender: sender.String(), + CodeAuthorization: &types.CodeAuthorization{ + CodeId: 2, + Methods: []string{"2"}, + }, + } + return &msg + }, + true, + }, + { + "invalid methods", + func(ctx sdk.Context, keeper keeper.Keeper) *types.MsgSetCodeAuthorization { + sender := sample.AccAddress() + params := types.Params{ + PrivilegedAddress: []string{sender.String()}, + } + keeper.SetParams(ctx, params) + + msg := types.MsgSetCodeAuthorization{ + Sender: sender.String(), + CodeAuthorization: &types.CodeAuthorization{ + CodeId: 2, + }, + } + return &msg + }, + true, + }, + { + "valid", + func(ctx sdk.Context, keeper keeper.Keeper) *types.MsgSetCodeAuthorization { + sender := sample.AccAddress() + params := types.Params{ + PrivilegedAddress: []string{sender.String()}, + } + keeper.SetParams(ctx, params) + + msg := types.MsgSetCodeAuthorization{ + Sender: sender.String(), + CodeAuthorization: &types.CodeAuthorization{ + CodeId: 2, + Methods: []string{"2"}, + }, + } + return &msg + }, + false, + }, + } + + for _, tc := range testCases { + tc := tc + t.Run(tc.testCase, func(t *testing.T) { + k, c := keepertest.GlobalFeeKeeper(t) + msgSrvr, ctx := keeper.NewMsgServerImpl(k), sdk.WrapSDKContext(c) + + msg := tc.prepare(c, k) + + _, err := msgSrvr.SetCodeAuthorization(ctx, msg) + + if tc.expectError { + require.Error(t, err, tc) + } else { + require.NoError(t, err, tc) + _, found := k.GetCodeAuthorization(c, msg.GetCodeAuthorization().GetCodeId()) + require.True(t, found) + } + }) + } +} + +func TestRemoveCodeAuthorization(t *testing.T) { + testCases := []struct { + testCase string + prepare func(ctx sdk.Context, keeper keeper.Keeper) *types.MsgRemoveCodeAuthorization + expectError bool + }{ + { + "invalid sender address", + func(ctx sdk.Context, keeper keeper.Keeper) *types.MsgRemoveCodeAuthorization { + msg := types.MsgRemoveCodeAuthorization{ + Sender: "👻", + CodeId: 2, + } + return &msg + }, + true, + }, + { + "sender not privileged", + func(ctx sdk.Context, keeper keeper.Keeper) *types.MsgRemoveCodeAuthorization { + sender := sample.AccAddress() + msg := types.MsgRemoveCodeAuthorization{ + Sender: sender.String(), + CodeId: 2, + } + return &msg + }, + true, + }, + { + "valid", + func(ctx sdk.Context, keeper keeper.Keeper) *types.MsgRemoveCodeAuthorization { + sender := sample.AccAddress() + params := types.Params{ + PrivilegedAddress: []string{sender.String()}, + } + keeper.SetParams(ctx, params) + + msg := types.MsgRemoveCodeAuthorization{ + Sender: sender.String(), + CodeId: 2, + } + return &msg + }, + false, + }, + } + + for _, tc := range testCases { + tc := tc + t.Run(tc.testCase, func(t *testing.T) { + k, c := keepertest.GlobalFeeKeeper(t) + msgSrvr, ctx := keeper.NewMsgServerImpl(k), sdk.WrapSDKContext(c) + err := k.SetCodeAuthorization(c, types.CodeAuthorization{ + CodeId: 2, + Methods: []string{"mint"}, + }) + require.NoError(t, err) + + msg := tc.prepare(c, k) + + _, err = msgSrvr.RemoveCodeAuthorization(ctx, msg) + + if tc.expectError { + require.Error(t, err, tc) + _, found := k.GetCodeAuthorization(c, msg.GetCodeId()) + require.True(t, found) + } else { + require.NoError(t, err, tc) + _, found := k.GetCodeAuthorization(c, msg.GetCodeId()) + require.False(t, found) + } + }) + } +} + +func TestSetContractAuthorization(t *testing.T) { + testCases := []struct { + testCase string + prepare func(ctx sdk.Context, keeper keeper.Keeper) *types.MsgSetContractAuthorization + expectError bool + }{ + { + "invalid sender address", + func(ctx sdk.Context, keeper keeper.Keeper) *types.MsgSetContractAuthorization { + msg := types.MsgSetContractAuthorization{ + Sender: "👻", + ContractAuthorization: &types.ContractAuthorization{ + ContractAddress: sample.AccAddress().String(), + Methods: []string{"2"}, + }, + } + return &msg + }, + true, + }, + { + "sender not privileged", + func(ctx sdk.Context, keeper keeper.Keeper) *types.MsgSetContractAuthorization { + sender := sample.AccAddress() + msg := types.MsgSetContractAuthorization{ + Sender: sender.String(), + ContractAuthorization: &types.ContractAuthorization{ + ContractAddress: sample.AccAddress().String(), + Methods: []string{"2"}, + }, + } + return &msg + }, + true, + }, + { + "invalid contract address", + func(ctx sdk.Context, keeper keeper.Keeper) *types.MsgSetContractAuthorization { + sender := sample.AccAddress() + params := types.Params{ + PrivilegedAddress: []string{sender.String()}, + } + keeper.SetParams(ctx, params) + + msg := types.MsgSetContractAuthorization{ + Sender: sender.String(), + ContractAuthorization: &types.ContractAuthorization{ + ContractAddress: "👻", + Methods: []string{"2"}, + }, + } + return &msg + }, + true, + }, + { + "contract doesnt exist", + func(ctx sdk.Context, keeper keeper.Keeper) *types.MsgSetContractAuthorization { + sender := sample.AccAddress() + params := types.Params{ + PrivilegedAddress: []string{sender.String()}, + } + keeper.SetParams(ctx, params) + + msg := types.MsgSetContractAuthorization{ + Sender: sender.String(), + ContractAuthorization: &types.ContractAuthorization{ + ContractAddress: sample.AccAddress().String(), + Methods: []string{"2"}, + }, + } + return &msg + }, + true, + }, + { + "invalid methods", + func(ctx sdk.Context, keeper keeper.Keeper) *types.MsgSetContractAuthorization { + sender := sample.AccAddress() + params := types.Params{ + PrivilegedAddress: []string{sender.String()}, + } + keeper.SetParams(ctx, params) + + msg := types.MsgSetContractAuthorization{ + Sender: sender.String(), + ContractAuthorization: &types.ContractAuthorization{ + ContractAddress: sample.AccAddress().String(), + }, + } + return &msg + }, + true, + }, + { + "valid", + func(ctx sdk.Context, keeper keeper.Keeper) *types.MsgSetContractAuthorization { + sender := sample.AccAddress() + params := types.Params{ + PrivilegedAddress: []string{sender.String()}, + } + keeper.SetParams(ctx, params) + + msg := types.MsgSetContractAuthorization{ + Sender: sender.String(), + ContractAuthorization: &types.ContractAuthorization{ + ContractAddress: "cosmos1qyqszqgpqyqszqgpqyqszqgpqyqszqgpjnp7du", + Methods: []string{"2"}, + }, + } + return &msg + }, + false, + }, + } + + for _, tc := range testCases { + tc := tc + t.Run(tc.testCase, func(t *testing.T) { + k, c := keepertest.GlobalFeeKeeper(t) + msgSrvr, ctx := keeper.NewMsgServerImpl(k), sdk.WrapSDKContext(c) + + msg := tc.prepare(c, k) + + _, err := msgSrvr.SetContractAuthorization(ctx, msg) + + if tc.expectError { + require.Error(t, err, tc) + } else { + require.NoError(t, err, tc) + _, found := k.GetContractAuthorization(c, sdk.MustAccAddressFromBech32(msg.GetContractAuthorization().GetContractAddress())) + require.True(t, found) + } + }) + } +} + +func TestRemoveContractAuthorization(t *testing.T) { + testCases := []struct { + testCase string + prepare func(ctx sdk.Context, keeper keeper.Keeper, contractAddress string) *types.MsgRemoveContractAuthorization + expectError bool + }{ + { + "invalid sender address", + func(ctx sdk.Context, keeper keeper.Keeper, contractAddress string) *types.MsgRemoveContractAuthorization { + msg := types.MsgRemoveContractAuthorization{ + Sender: "👻", + ContractAddress: contractAddress, + } + return &msg + }, + true, + }, + { + "sender not privileged", + func(ctx sdk.Context, keeper keeper.Keeper, contractAddress string) *types.MsgRemoveContractAuthorization { + sender := sample.AccAddress() + msg := types.MsgRemoveContractAuthorization{ + Sender: sender.String(), + ContractAddress: contractAddress, + } + return &msg + }, + true, + }, + { + "invalid contract address", + func(ctx sdk.Context, keeper keeper.Keeper, contractAddress string) *types.MsgRemoveContractAuthorization { + sender := sample.AccAddress() + params := types.Params{ + PrivilegedAddress: []string{sender.String()}, + } + keeper.SetParams(ctx, params) + + msg := types.MsgRemoveContractAuthorization{ + Sender: sender.String(), + ContractAddress: "👻", + } + return &msg + }, + true, + }, + { + "valid", + func(ctx sdk.Context, keeper keeper.Keeper, contractAddress string) *types.MsgRemoveContractAuthorization { + sender := sample.AccAddress() + params := types.Params{ + PrivilegedAddress: []string{sender.String()}, + } + keeper.SetParams(ctx, params) + + msg := types.MsgRemoveContractAuthorization{ + Sender: sender.String(), + ContractAddress: "cosmos1qyqszqgpqyqszqgpqyqszqgpqyqszqgpjnp7du", + } + return &msg + }, + false, + }, + } + + for _, tc := range testCases { + tc := tc + t.Run(tc.testCase, func(t *testing.T) { + k, c := keepertest.GlobalFeeKeeper(t) + msgSrvr, ctx := keeper.NewMsgServerImpl(k), sdk.WrapSDKContext(c) + contractAddr := sdk.MustAccAddressFromBech32("cosmos1qyqszqgpqyqszqgpqyqszqgpqyqszqgpjnp7du") + err := k.SetContractAuthorization(c, types.ContractAuthorization{ + ContractAddress: contractAddr.String(), + Methods: []string{"mint"}, + }) + require.NoError(t, err) + + msg := tc.prepare(c, k, contractAddr.String()) + + _, err = msgSrvr.RemoveContractAuthorization(ctx, msg) + + if tc.expectError { + require.Error(t, err, tc) + _, found := k.GetContractAuthorization(c, contractAddr) + require.True(t, found) + } else { + require.NoError(t, err, tc) + _, found := k.GetContractAuthorization(c, contractAddr) + require.False(t, found) + } + }) + } +} diff --git a/x/globalfee/keeper/params.go b/x/globalfee/keeper/params.go index b8ef95284..96876861d 100644 --- a/x/globalfee/keeper/params.go +++ b/x/globalfee/keeper/params.go @@ -19,3 +19,13 @@ func (k Keeper) GetParams(ctx sdk.Context) types.Params { k.paramStore.GetParamSet(ctx, ¶ms) return params } + +func (k Keeper) IsPrivilegedAddress(ctx sdk.Context, address string) bool { + privilegedAddresses := k.GetParams(ctx).PrivilegedAddress + for _, paddr := range privilegedAddresses { + if address == paddr { + return true + } + } + return false +} diff --git a/x/globalfee/module.go b/x/globalfee/module.go index 0423c3e46..81c6d1d05 100644 --- a/x/globalfee/module.go +++ b/x/globalfee/module.go @@ -1,6 +1,7 @@ package globalfee import ( + "context" "encoding/json" "fmt" "math/rand" @@ -63,7 +64,10 @@ func (a AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncoding // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. func (a AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, serveMux *runtime.ServeMux) { - + err := types.RegisterQueryHandlerClient(context.Background(), serveMux, types.NewQueryClient(clientCtx)) + if err != nil { + panic(err) + } } func (a AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {} @@ -115,6 +119,7 @@ func (a AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { // RegisterServices registers the module services. func (a AppModule) RegisterServices(cfg module.Configurator) { types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServer(a.keeper)) + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(a.keeper)) } // InitGenesis performs genesis initialization for the module. It returns no validator updates. diff --git a/x/globalfee/types/codec.go b/x/globalfee/types/codec.go index 3affd6a56..77e38540a 100644 --- a/x/globalfee/types/codec.go +++ b/x/globalfee/types/codec.go @@ -5,15 +5,27 @@ import ( "github.com/cosmos/cosmos-sdk/codec/types" cryptoCodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" ) // RegisterLegacyAminoCodec registers the necessary interfaces and concrete types on the provided LegacyAmino codec. // These types are used for Amino JSON serialization. func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgSetCodeAuthorization{}, "globalfee/MsgSetCodeAuthorization", nil) + cdc.RegisterConcrete(&MsgRemoveCodeAuthorization{}, "globalfee/MsgRemoveCodeAuthorization", nil) + cdc.RegisterConcrete(&MsgSetContractAuthorization{}, "globalfee/MsgSetContractAuthorization", nil) + cdc.RegisterConcrete(&MsgRemoveContractAuthorization{}, "globalfee/MsgRemoveContractAuthorization", nil) } // RegisterInterfaces registers interfaces types with the interface registry. func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgSetCodeAuthorization{}, + &MsgRemoveCodeAuthorization{}, + &MsgSetContractAuthorization{}, + &MsgRemoveContractAuthorization{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } var ( diff --git a/x/globalfee/types/errors.go b/x/globalfee/types/errors.go index 3fce29617..b86d799f1 100644 --- a/x/globalfee/types/errors.go +++ b/x/globalfee/types/errors.go @@ -7,4 +7,5 @@ var ( ErrInvalidMethods = sdkErrors.Register(DefaultCodespace, 2, "invalid method in code/contract authorization") // Code or Contract Authorizations have invalid methods configured ErrContractNotExist = sdkErrors.Register(DefaultCodespace, 3, "contract with given address does not exist") ErrCodeIdNotExist = sdkErrors.Register(DefaultCodespace, 4, "code id does not exist") + ErrUnauthorized = sdkErrors.Register(DefaultCodespace, 5, "sender is unauthorized to perform the operation") ) diff --git a/x/globalfee/types/query.pb.go b/x/globalfee/types/query.pb.go index 6713e3753..5fa3de5f8 100644 --- a/x/globalfee/types/query.pb.go +++ b/x/globalfee/types/query.pb.go @@ -8,8 +8,13 @@ import ( fmt "fmt" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. @@ -23,20 +28,401 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type QueryCodeAuthorizationRequest struct { + CodeId uint64 `protobuf:"varint,1,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` +} + +func (m *QueryCodeAuthorizationRequest) Reset() { *m = QueryCodeAuthorizationRequest{} } +func (m *QueryCodeAuthorizationRequest) String() string { return proto.CompactTextString(m) } +func (*QueryCodeAuthorizationRequest) ProtoMessage() {} +func (*QueryCodeAuthorizationRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_47d932d0017ba0ee, []int{0} +} +func (m *QueryCodeAuthorizationRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCodeAuthorizationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCodeAuthorizationRequest.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 *QueryCodeAuthorizationRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCodeAuthorizationRequest.Merge(m, src) +} +func (m *QueryCodeAuthorizationRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryCodeAuthorizationRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCodeAuthorizationRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCodeAuthorizationRequest proto.InternalMessageInfo + +func (m *QueryCodeAuthorizationRequest) GetCodeId() uint64 { + if m != nil { + return m.CodeId + } + return 0 +} + +type QueryCodeAuthorizationResponse struct { + Methods []string `protobuf:"bytes,1,rep,name=methods,proto3" json:"methods,omitempty"` +} + +func (m *QueryCodeAuthorizationResponse) Reset() { *m = QueryCodeAuthorizationResponse{} } +func (m *QueryCodeAuthorizationResponse) String() string { return proto.CompactTextString(m) } +func (*QueryCodeAuthorizationResponse) ProtoMessage() {} +func (*QueryCodeAuthorizationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_47d932d0017ba0ee, []int{1} +} +func (m *QueryCodeAuthorizationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCodeAuthorizationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCodeAuthorizationResponse.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 *QueryCodeAuthorizationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCodeAuthorizationResponse.Merge(m, src) +} +func (m *QueryCodeAuthorizationResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryCodeAuthorizationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCodeAuthorizationResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCodeAuthorizationResponse proto.InternalMessageInfo + +func (m *QueryCodeAuthorizationResponse) GetMethods() []string { + if m != nil { + return m.Methods + } + return nil +} + +type QueryContractAuthorizationRequest struct { + ContractAddress string `protobuf:"bytes,1,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` +} + +func (m *QueryContractAuthorizationRequest) Reset() { *m = QueryContractAuthorizationRequest{} } +func (m *QueryContractAuthorizationRequest) String() string { return proto.CompactTextString(m) } +func (*QueryContractAuthorizationRequest) ProtoMessage() {} +func (*QueryContractAuthorizationRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_47d932d0017ba0ee, []int{2} +} +func (m *QueryContractAuthorizationRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryContractAuthorizationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryContractAuthorizationRequest.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 *QueryContractAuthorizationRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryContractAuthorizationRequest.Merge(m, src) +} +func (m *QueryContractAuthorizationRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryContractAuthorizationRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryContractAuthorizationRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryContractAuthorizationRequest proto.InternalMessageInfo + +func (m *QueryContractAuthorizationRequest) GetContractAddress() string { + if m != nil { + return m.ContractAddress + } + return "" +} + +type QueryContractAuthorizationResponse struct { + Methods []string `protobuf:"bytes,1,rep,name=methods,proto3" json:"methods,omitempty"` +} + +func (m *QueryContractAuthorizationResponse) Reset() { *m = QueryContractAuthorizationResponse{} } +func (m *QueryContractAuthorizationResponse) String() string { return proto.CompactTextString(m) } +func (*QueryContractAuthorizationResponse) ProtoMessage() {} +func (*QueryContractAuthorizationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_47d932d0017ba0ee, []int{3} +} +func (m *QueryContractAuthorizationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryContractAuthorizationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryContractAuthorizationResponse.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 *QueryContractAuthorizationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryContractAuthorizationResponse.Merge(m, src) +} +func (m *QueryContractAuthorizationResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryContractAuthorizationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryContractAuthorizationResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryContractAuthorizationResponse proto.InternalMessageInfo + +func (m *QueryContractAuthorizationResponse) GetMethods() []string { + if m != nil { + return m.Methods + } + return nil +} + +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_47d932d0017ba0ee, []int{4} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.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 *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +type QueryParamsResponse struct { + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_47d932d0017ba0ee, []int{5} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.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 *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() *Params { + if m != nil { + return m.Params + } + return nil +} + +type QueryAuthorizationsRequest struct { +} + +func (m *QueryAuthorizationsRequest) Reset() { *m = QueryAuthorizationsRequest{} } +func (m *QueryAuthorizationsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAuthorizationsRequest) ProtoMessage() {} +func (*QueryAuthorizationsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_47d932d0017ba0ee, []int{6} +} +func (m *QueryAuthorizationsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAuthorizationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAuthorizationsRequest.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 *QueryAuthorizationsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAuthorizationsRequest.Merge(m, src) +} +func (m *QueryAuthorizationsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAuthorizationsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAuthorizationsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAuthorizationsRequest proto.InternalMessageInfo + +type QueryAuthorizationsResponse struct { + CodeAuthorizations []*CodeAuthorization `protobuf:"bytes,1,rep,name=code_authorizations,json=codeAuthorizations,proto3" json:"code_authorizations,omitempty"` + ContractAuthorizations []*ContractAuthorization `protobuf:"bytes,2,rep,name=contract_authorizations,json=contractAuthorizations,proto3" json:"contract_authorizations,omitempty"` +} + +func (m *QueryAuthorizationsResponse) Reset() { *m = QueryAuthorizationsResponse{} } +func (m *QueryAuthorizationsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAuthorizationsResponse) ProtoMessage() {} +func (*QueryAuthorizationsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_47d932d0017ba0ee, []int{7} +} +func (m *QueryAuthorizationsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAuthorizationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAuthorizationsResponse.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 *QueryAuthorizationsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAuthorizationsResponse.Merge(m, src) +} +func (m *QueryAuthorizationsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAuthorizationsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAuthorizationsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAuthorizationsResponse proto.InternalMessageInfo + +func (m *QueryAuthorizationsResponse) GetCodeAuthorizations() []*CodeAuthorization { + if m != nil { + return m.CodeAuthorizations + } + return nil +} + +func (m *QueryAuthorizationsResponse) GetContractAuthorizations() []*ContractAuthorization { + if m != nil { + return m.ContractAuthorizations + } + return nil +} + +func init() { + proto.RegisterType((*QueryCodeAuthorizationRequest)(nil), "publicawesome.stargaze.globalfee.v1.QueryCodeAuthorizationRequest") + proto.RegisterType((*QueryCodeAuthorizationResponse)(nil), "publicawesome.stargaze.globalfee.v1.QueryCodeAuthorizationResponse") + proto.RegisterType((*QueryContractAuthorizationRequest)(nil), "publicawesome.stargaze.globalfee.v1.QueryContractAuthorizationRequest") + proto.RegisterType((*QueryContractAuthorizationResponse)(nil), "publicawesome.stargaze.globalfee.v1.QueryContractAuthorizationResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "publicawesome.stargaze.globalfee.v1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "publicawesome.stargaze.globalfee.v1.QueryParamsResponse") + proto.RegisterType((*QueryAuthorizationsRequest)(nil), "publicawesome.stargaze.globalfee.v1.QueryAuthorizationsRequest") + proto.RegisterType((*QueryAuthorizationsResponse)(nil), "publicawesome.stargaze.globalfee.v1.QueryAuthorizationsResponse") +} + func init() { proto.RegisterFile("stargaze/globalfee/v1/query.proto", fileDescriptor_47d932d0017ba0ee) } var fileDescriptor_47d932d0017ba0ee = []byte{ - // 156 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2c, 0x2e, 0x49, 0x2c, - 0x4a, 0x4f, 0xac, 0x4a, 0xd5, 0x4f, 0xcf, 0xc9, 0x4f, 0x4a, 0xcc, 0x49, 0x4b, 0x4d, 0xd5, 0x2f, - 0x33, 0xd4, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52, 0x2e, - 0x28, 0x4d, 0xca, 0xc9, 0x4c, 0x4e, 0x2c, 0x4f, 0x2d, 0xce, 0xcf, 0x4d, 0xd5, 0x83, 0x69, 0xd0, - 0x83, 0x6b, 0xd0, 0x2b, 0x33, 0x34, 0x62, 0xe7, 0x62, 0x0d, 0x04, 0xe9, 0x71, 0x0a, 0x3c, 0xf1, - 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, - 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xf3, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, - 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0x88, 0x91, 0xba, 0x50, 0x33, 0xf5, 0xe1, 0x8e, 0x28, 0xb3, 0xd4, - 0xaf, 0x40, 0x72, 0x49, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0xd8, 0x1d, 0xc6, 0x80, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xec, 0xd2, 0xee, 0x12, 0xac, 0x00, 0x00, 0x00, + // 562 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x4d, 0x4f, 0xd4, 0x40, + 0x18, 0x66, 0x50, 0x4b, 0x78, 0x49, 0xfc, 0x18, 0x54, 0x36, 0x15, 0x2a, 0xd4, 0x6c, 0xc4, 0x18, + 0xda, 0xb0, 0x44, 0x41, 0x4c, 0x14, 0x76, 0x13, 0x3f, 0x2e, 0x46, 0xf6, 0xc8, 0x85, 0xcc, 0xb6, + 0x63, 0xb7, 0xc9, 0x6e, 0xa7, 0x74, 0xa6, 0xab, 0x60, 0xb8, 0xf8, 0x0b, 0x4c, 0xfc, 0x07, 0xfe, + 0x14, 0x4e, 0x1e, 0x49, 0xbc, 0xe8, 0xcd, 0xec, 0xfa, 0x0b, 0xbc, 0x7a, 0x31, 0x3b, 0x9d, 0x65, + 0x2d, 0xdb, 0x62, 0x91, 0xe3, 0xbc, 0xb3, 0xef, 0xf3, 0xb1, 0xcf, 0x3c, 0x29, 0x2c, 0x70, 0x41, + 0x22, 0x8f, 0xec, 0x53, 0xdb, 0x6b, 0xb1, 0x06, 0x69, 0xbd, 0xa1, 0xd4, 0xee, 0x2c, 0xdb, 0xbb, + 0x31, 0x8d, 0xf6, 0xac, 0x30, 0x62, 0x82, 0xe1, 0x3b, 0x61, 0xdc, 0x68, 0xf9, 0x0e, 0x79, 0x4b, + 0x39, 0x6b, 0x53, 0x6b, 0xb0, 0x60, 0x1d, 0x2f, 0x58, 0x9d, 0x65, 0x7d, 0xd6, 0x63, 0xcc, 0x6b, + 0x51, 0x9b, 0x84, 0xbe, 0x4d, 0x82, 0x80, 0x09, 0x22, 0x7c, 0x16, 0xf0, 0x04, 0x42, 0x2f, 0x67, + 0xb3, 0x0c, 0x11, 0xe4, 0xcf, 0xcc, 0x35, 0x98, 0xdb, 0xea, 0x13, 0xd7, 0x98, 0x4b, 0x37, 0x63, + 0xd1, 0x64, 0x91, 0xbf, 0x2f, 0x71, 0xea, 0x74, 0x37, 0xa6, 0x5c, 0xe0, 0x19, 0x98, 0x70, 0x98, + 0x4b, 0x77, 0x7c, 0xb7, 0x84, 0xe6, 0xd1, 0xe2, 0xc5, 0xba, 0xd6, 0x3f, 0xbe, 0x74, 0xcd, 0x75, + 0x30, 0xf2, 0x36, 0x79, 0xc8, 0x02, 0x4e, 0x71, 0x09, 0x26, 0xda, 0x54, 0x34, 0x99, 0xcb, 0x4b, + 0x68, 0xfe, 0xc2, 0xe2, 0x64, 0x7d, 0x70, 0x34, 0x5f, 0xc1, 0x82, 0xda, 0x0d, 0x44, 0x44, 0x1c, + 0x91, 0xc9, 0x7c, 0x0f, 0xae, 0x3a, 0xea, 0x7e, 0x87, 0xb8, 0x6e, 0x44, 0x39, 0x97, 0x12, 0x26, + 0xeb, 0x57, 0x06, 0xf3, 0xcd, 0x64, 0x6c, 0x3e, 0x01, 0xf3, 0x34, 0xbc, 0x7f, 0xea, 0xb9, 0x0e, + 0x58, 0xee, 0xbf, 0x26, 0x11, 0x69, 0x73, 0x25, 0xc0, 0xdc, 0x86, 0xe9, 0xd4, 0x54, 0xc1, 0xd4, + 0x40, 0x0b, 0xe5, 0x44, 0xaa, 0x99, 0xaa, 0xdc, 0xb7, 0x0a, 0xa4, 0x65, 0x29, 0x10, 0xb5, 0x6a, + 0xce, 0x82, 0x2e, 0xb1, 0x53, 0x4a, 0x8f, 0x99, 0x7f, 0x23, 0xb8, 0x95, 0x79, 0xad, 0x24, 0x78, + 0x30, 0x2d, 0x43, 0x21, 0xa9, 0x6b, 0xe9, 0x6a, 0xaa, 0xf2, 0xb0, 0x90, 0x9e, 0xd1, 0xd8, 0xb0, + 0x73, 0x72, 0xc4, 0x31, 0x87, 0x99, 0x61, 0x06, 0x69, 0xb2, 0x71, 0x49, 0xb6, 0x5e, 0x90, 0x2c, + 0x2b, 0x97, 0x9b, 0x4e, 0xd6, 0x98, 0x57, 0x0e, 0x35, 0xb8, 0x24, 0xdd, 0xe3, 0xef, 0x08, 0xae, + 0x8d, 0x08, 0xc5, 0xd5, 0x42, 0x9c, 0xa7, 0x3e, 0x6b, 0xbd, 0x76, 0x2e, 0x8c, 0x24, 0x06, 0xf3, + 0xf1, 0x87, 0xaf, 0x3f, 0x3f, 0x8d, 0x3f, 0xc0, 0x2b, 0x76, 0x76, 0xd9, 0x46, 0x33, 0xb2, 0xdf, + 0xab, 0x32, 0x1d, 0xe0, 0x5f, 0x08, 0x6e, 0x64, 0xfe, 0x2f, 0xf8, 0xd9, 0x59, 0xb4, 0xe5, 0x17, + 0x48, 0x7f, 0x7e, 0x6e, 0x1c, 0xe5, 0xf3, 0x85, 0xf4, 0x59, 0xc5, 0x1b, 0xb9, 0x3e, 0xb3, 0x9e, + 0x48, 0xdf, 0x6b, 0xba, 0xbe, 0x07, 0xf8, 0x33, 0x02, 0x2d, 0x69, 0x02, 0x5e, 0x2d, 0xae, 0x2e, + 0x55, 0x4b, 0x7d, 0xed, 0xec, 0x8b, 0xca, 0x47, 0x59, 0xfa, 0xb8, 0x8d, 0xe7, 0x72, 0x7c, 0x24, + 0xdd, 0xc4, 0x87, 0x08, 0x2e, 0x9f, 0xe8, 0xc1, 0xd3, 0xe2, 0x9c, 0x99, 0x8d, 0xd6, 0x37, 0xfe, + 0x1f, 0x40, 0x89, 0x5f, 0x92, 0xe2, 0xef, 0xe2, 0x72, 0x8e, 0xf8, 0x74, 0x3d, 0xab, 0x5b, 0x5f, + 0xba, 0x06, 0x3a, 0xea, 0x1a, 0xe8, 0x47, 0xd7, 0x40, 0x1f, 0x7b, 0xc6, 0xd8, 0x51, 0xcf, 0x18, + 0xfb, 0xd6, 0x33, 0xc6, 0xb6, 0x57, 0x3d, 0x5f, 0x34, 0xe3, 0x86, 0xe5, 0xb0, 0xb6, 0x9d, 0x88, + 0x5a, 0x52, 0xaa, 0x86, 0xc8, 0x9d, 0x47, 0xf6, 0xbb, 0xbf, 0xe0, 0xc5, 0x5e, 0x48, 0x79, 0x43, + 0x93, 0x9f, 0x8c, 0x95, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x14, 0xbb, 0x11, 0x09, 0xc1, 0x06, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -51,6 +437,10 @@ const _ = grpc.SupportPackageIsVersion4 // // 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 { + CodeAuthorization(ctx context.Context, in *QueryCodeAuthorizationRequest, opts ...grpc.CallOption) (*QueryCodeAuthorizationResponse, error) + ContractAuthorization(ctx context.Context, in *QueryContractAuthorizationRequest, opts ...grpc.CallOption) (*QueryContractAuthorizationResponse, error) + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + Authorizations(ctx context.Context, in *QueryAuthorizationsRequest, opts ...grpc.CallOption) (*QueryAuthorizationsResponse, error) } type queryClient struct { @@ -61,22 +451,1246 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } +func (c *queryClient) CodeAuthorization(ctx context.Context, in *QueryCodeAuthorizationRequest, opts ...grpc.CallOption) (*QueryCodeAuthorizationResponse, error) { + out := new(QueryCodeAuthorizationResponse) + err := c.cc.Invoke(ctx, "/publicawesome.stargaze.globalfee.v1.Query/CodeAuthorization", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) ContractAuthorization(ctx context.Context, in *QueryContractAuthorizationRequest, opts ...grpc.CallOption) (*QueryContractAuthorizationResponse, error) { + out := new(QueryContractAuthorizationResponse) + err := c.cc.Invoke(ctx, "/publicawesome.stargaze.globalfee.v1.Query/ContractAuthorization", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/publicawesome.stargaze.globalfee.v1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Authorizations(ctx context.Context, in *QueryAuthorizationsRequest, opts ...grpc.CallOption) (*QueryAuthorizationsResponse, error) { + out := new(QueryAuthorizationsResponse) + err := c.cc.Invoke(ctx, "/publicawesome.stargaze.globalfee.v1.Query/Authorizations", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { + CodeAuthorization(context.Context, *QueryCodeAuthorizationRequest) (*QueryCodeAuthorizationResponse, error) + ContractAuthorization(context.Context, *QueryContractAuthorizationRequest) (*QueryContractAuthorizationResponse, error) + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + Authorizations(context.Context, *QueryAuthorizationsRequest) (*QueryAuthorizationsResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. type UnimplementedQueryServer struct { } +func (*UnimplementedQueryServer) CodeAuthorization(ctx context.Context, req *QueryCodeAuthorizationRequest) (*QueryCodeAuthorizationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CodeAuthorization not implemented") +} +func (*UnimplementedQueryServer) ContractAuthorization(ctx context.Context, req *QueryContractAuthorizationRequest) (*QueryContractAuthorizationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ContractAuthorization not implemented") +} +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) Authorizations(ctx context.Context, req *QueryAuthorizationsRequest) (*QueryAuthorizationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Authorizations not implemented") +} + func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } +func _Query_CodeAuthorization_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryCodeAuthorizationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).CodeAuthorization(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/publicawesome.stargaze.globalfee.v1.Query/CodeAuthorization", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).CodeAuthorization(ctx, req.(*QueryCodeAuthorizationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_ContractAuthorization_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryContractAuthorizationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ContractAuthorization(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/publicawesome.stargaze.globalfee.v1.Query/ContractAuthorization", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ContractAuthorization(ctx, req.(*QueryContractAuthorizationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +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: "/publicawesome.stargaze.globalfee.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) +} + +func _Query_Authorizations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAuthorizationsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Authorizations(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/publicawesome.stargaze.globalfee.v1.Query/Authorizations", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Authorizations(ctx, req.(*QueryAuthorizationsRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "publicawesome.stargaze.globalfee.v1.Query", HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{}, - Metadata: "stargaze/globalfee/v1/query.proto", + Methods: []grpc.MethodDesc{ + { + MethodName: "CodeAuthorization", + Handler: _Query_CodeAuthorization_Handler, + }, + { + MethodName: "ContractAuthorization", + Handler: _Query_ContractAuthorization_Handler, + }, + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "Authorizations", + Handler: _Query_Authorizations_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "stargaze/globalfee/v1/query.proto", +} + +func (m *QueryCodeAuthorizationRequest) 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 *QueryCodeAuthorizationRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCodeAuthorizationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CodeId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.CodeId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryCodeAuthorizationResponse) 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 *QueryCodeAuthorizationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCodeAuthorizationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Methods) > 0 { + for iNdEx := len(m.Methods) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Methods[iNdEx]) + copy(dAtA[i:], m.Methods[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Methods[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryContractAuthorizationRequest) 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 *QueryContractAuthorizationRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryContractAuthorizationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryContractAuthorizationResponse) 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 *QueryContractAuthorizationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryContractAuthorizationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Methods) > 0 { + for iNdEx := len(m.Methods) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Methods[iNdEx]) + copy(dAtA[i:], m.Methods[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Methods[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +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 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 + return len(dAtA) - i, nil +} + +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 dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +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] = 0xa + } + return len(dAtA) - i, nil } + +func (m *QueryAuthorizationsRequest) 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 *QueryAuthorizationsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAuthorizationsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryAuthorizationsResponse) 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 *QueryAuthorizationsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAuthorizationsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ContractAuthorizations) > 0 { + for iNdEx := len(m.ContractAuthorizations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ContractAuthorizations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.CodeAuthorizations) > 0 { + for iNdEx := len(m.CodeAuthorizations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.CodeAuthorizations[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 *QueryCodeAuthorizationRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CodeId != 0 { + n += 1 + sovQuery(uint64(m.CodeId)) + } + return n +} + +func (m *QueryCodeAuthorizationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Methods) > 0 { + for _, s := range m.Methods { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryContractAuthorizationRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryContractAuthorizationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Methods) > 0 { + for _, s := range m.Methods { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Params != nil { + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAuthorizationsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryAuthorizationsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.CodeAuthorizations) > 0 { + for _, e := range m.CodeAuthorizations { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if len(m.ContractAuthorizations) > 0 { + for _, e := range m.ContractAuthorizations { + l = e.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 *QueryCodeAuthorizationRequest) 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: QueryCodeAuthorizationRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCodeAuthorizationRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeId", wireType) + } + m.CodeId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CodeId |= 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 *QueryCodeAuthorizationResponse) 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: QueryCodeAuthorizationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCodeAuthorizationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Methods", 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.Methods = append(m.Methods, 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 *QueryContractAuthorizationRequest) 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: QueryContractAuthorizationRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryContractAuthorizationRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", 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.ContractAddress = 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 *QueryContractAuthorizationResponse) 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: QueryContractAuthorizationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryContractAuthorizationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Methods", 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.Methods = append(m.Methods, 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 *QueryParamsRequest) 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: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: 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 *QueryParamsResponse) 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: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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:]) + 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 *QueryAuthorizationsRequest) 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: QueryAuthorizationsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAuthorizationsRequest: 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 *QueryAuthorizationsResponse) 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: QueryAuthorizationsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAuthorizationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeAuthorizations", 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.CodeAuthorizations = append(m.CodeAuthorizations, &CodeAuthorization{}) + if err := m.CodeAuthorizations[len(m.CodeAuthorizations)-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 ContractAuthorizations", 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.ContractAuthorizations = append(m.ContractAuthorizations, &ContractAuthorization{}) + if err := m.ContractAuthorizations[len(m.ContractAuthorizations)-1].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 skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/globalfee/types/query.pb.gw.go b/x/globalfee/types/query.pb.gw.go new file mode 100644 index 000000000..f028fa47a --- /dev/null +++ b/x/globalfee/types/query.pb.gw.go @@ -0,0 +1,406 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: stargaze/globalfee/v1/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage + +func request_Query_CodeAuthorization_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCodeAuthorizationRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["code_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "code_id") + } + + protoReq.CodeId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "code_id", err) + } + + msg, err := client.CodeAuthorization(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_CodeAuthorization_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCodeAuthorizationRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["code_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "code_id") + } + + protoReq.CodeId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "code_id", err) + } + + msg, err := server.CodeAuthorization(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_ContractAuthorization_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryContractAuthorizationRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["contract_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "contract_address") + } + + protoReq.ContractAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "contract_address", err) + } + + msg, err := client.ContractAuthorization(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ContractAuthorization_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryContractAuthorizationRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["contract_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "contract_address") + } + + protoReq.ContractAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "contract_address", err) + } + + msg, err := server.ContractAuthorization(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Authorizations_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAuthorizationsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Authorizations(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Authorizations_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAuthorizationsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Authorizations(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. +// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_CodeAuthorization_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_CodeAuthorization_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_CodeAuthorization_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ContractAuthorization_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ContractAuthorization_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ContractAuthorization_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Params_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Authorizations_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Authorizations_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Authorizations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_CodeAuthorization_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_CodeAuthorization_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_CodeAuthorization_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ContractAuthorization_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_ContractAuthorization_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_ContractAuthorization_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Params_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_Params_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_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Authorizations_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_Authorizations_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_Authorizations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_CodeAuthorization_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"stargaze", "globalfee", "v1", "code_authorization", "code_id"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_ContractAuthorization_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"stargaze", "globalfee", "v1", "contract_authorization", "contract_address"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stargaze", "globalfee", "v1", "params"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Authorizations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"stargaze", "globalfee", "v1", "authorizations"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_Query_CodeAuthorization_0 = runtime.ForwardResponseMessage + + forward_Query_ContractAuthorization_0 = runtime.ForwardResponseMessage + + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_Authorizations_0 = runtime.ForwardResponseMessage +) diff --git a/x/globalfee/types/tx.pb.go b/x/globalfee/types/tx.pb.go index 1b2007c8c..c81b55d95 100644 --- a/x/globalfee/types/tx.pb.go +++ b/x/globalfee/types/tx.pb.go @@ -9,7 +9,11 @@ import ( grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. @@ -23,20 +27,404 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type MsgSetCodeAuthorization struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + CodeAuthorization *CodeAuthorization `protobuf:"bytes,2,opt,name=code_authorization,json=codeAuthorization,proto3" json:"code_authorization,omitempty"` +} + +func (m *MsgSetCodeAuthorization) Reset() { *m = MsgSetCodeAuthorization{} } +func (m *MsgSetCodeAuthorization) String() string { return proto.CompactTextString(m) } +func (*MsgSetCodeAuthorization) ProtoMessage() {} +func (*MsgSetCodeAuthorization) Descriptor() ([]byte, []int) { + return fileDescriptor_f5157c8f1c83ee51, []int{0} +} +func (m *MsgSetCodeAuthorization) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetCodeAuthorization) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetCodeAuthorization.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 *MsgSetCodeAuthorization) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetCodeAuthorization.Merge(m, src) +} +func (m *MsgSetCodeAuthorization) XXX_Size() int { + return m.Size() +} +func (m *MsgSetCodeAuthorization) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetCodeAuthorization.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetCodeAuthorization proto.InternalMessageInfo + +func (m *MsgSetCodeAuthorization) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgSetCodeAuthorization) GetCodeAuthorization() *CodeAuthorization { + if m != nil { + return m.CodeAuthorization + } + return nil +} + +type MsgSetCodeAuthorizationResponse struct { +} + +func (m *MsgSetCodeAuthorizationResponse) Reset() { *m = MsgSetCodeAuthorizationResponse{} } +func (m *MsgSetCodeAuthorizationResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSetCodeAuthorizationResponse) ProtoMessage() {} +func (*MsgSetCodeAuthorizationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f5157c8f1c83ee51, []int{1} +} +func (m *MsgSetCodeAuthorizationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetCodeAuthorizationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetCodeAuthorizationResponse.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 *MsgSetCodeAuthorizationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetCodeAuthorizationResponse.Merge(m, src) +} +func (m *MsgSetCodeAuthorizationResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSetCodeAuthorizationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetCodeAuthorizationResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetCodeAuthorizationResponse proto.InternalMessageInfo + +type MsgRemoveCodeAuthorization struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + CodeId uint64 `protobuf:"varint,2,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` +} + +func (m *MsgRemoveCodeAuthorization) Reset() { *m = MsgRemoveCodeAuthorization{} } +func (m *MsgRemoveCodeAuthorization) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveCodeAuthorization) ProtoMessage() {} +func (*MsgRemoveCodeAuthorization) Descriptor() ([]byte, []int) { + return fileDescriptor_f5157c8f1c83ee51, []int{2} +} +func (m *MsgRemoveCodeAuthorization) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveCodeAuthorization) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveCodeAuthorization.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 *MsgRemoveCodeAuthorization) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveCodeAuthorization.Merge(m, src) +} +func (m *MsgRemoveCodeAuthorization) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveCodeAuthorization) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveCodeAuthorization.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveCodeAuthorization proto.InternalMessageInfo + +func (m *MsgRemoveCodeAuthorization) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgRemoveCodeAuthorization) GetCodeId() uint64 { + if m != nil { + return m.CodeId + } + return 0 +} + +type MsgRemoveCodeAuthorizationResponse struct { +} + +func (m *MsgRemoveCodeAuthorizationResponse) Reset() { *m = MsgRemoveCodeAuthorizationResponse{} } +func (m *MsgRemoveCodeAuthorizationResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveCodeAuthorizationResponse) ProtoMessage() {} +func (*MsgRemoveCodeAuthorizationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f5157c8f1c83ee51, []int{3} +} +func (m *MsgRemoveCodeAuthorizationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveCodeAuthorizationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveCodeAuthorizationResponse.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 *MsgRemoveCodeAuthorizationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveCodeAuthorizationResponse.Merge(m, src) +} +func (m *MsgRemoveCodeAuthorizationResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveCodeAuthorizationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveCodeAuthorizationResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveCodeAuthorizationResponse proto.InternalMessageInfo + +type MsgSetContractAuthorization struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + ContractAuthorization *ContractAuthorization `protobuf:"bytes,2,opt,name=contract_authorization,json=contractAuthorization,proto3" json:"contract_authorization,omitempty"` +} + +func (m *MsgSetContractAuthorization) Reset() { *m = MsgSetContractAuthorization{} } +func (m *MsgSetContractAuthorization) String() string { return proto.CompactTextString(m) } +func (*MsgSetContractAuthorization) ProtoMessage() {} +func (*MsgSetContractAuthorization) Descriptor() ([]byte, []int) { + return fileDescriptor_f5157c8f1c83ee51, []int{4} +} +func (m *MsgSetContractAuthorization) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetContractAuthorization) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetContractAuthorization.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 *MsgSetContractAuthorization) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetContractAuthorization.Merge(m, src) +} +func (m *MsgSetContractAuthorization) XXX_Size() int { + return m.Size() +} +func (m *MsgSetContractAuthorization) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetContractAuthorization.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetContractAuthorization proto.InternalMessageInfo + +func (m *MsgSetContractAuthorization) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgSetContractAuthorization) GetContractAuthorization() *ContractAuthorization { + if m != nil { + return m.ContractAuthorization + } + return nil +} + +type MsgSetContractAuthorizationResponse struct { +} + +func (m *MsgSetContractAuthorizationResponse) Reset() { *m = MsgSetContractAuthorizationResponse{} } +func (m *MsgSetContractAuthorizationResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSetContractAuthorizationResponse) ProtoMessage() {} +func (*MsgSetContractAuthorizationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f5157c8f1c83ee51, []int{5} +} +func (m *MsgSetContractAuthorizationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetContractAuthorizationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetContractAuthorizationResponse.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 *MsgSetContractAuthorizationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetContractAuthorizationResponse.Merge(m, src) +} +func (m *MsgSetContractAuthorizationResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSetContractAuthorizationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetContractAuthorizationResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetContractAuthorizationResponse proto.InternalMessageInfo + +type MsgRemoveContractAuthorization struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + ContractAddress string `protobuf:"bytes,2,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` +} + +func (m *MsgRemoveContractAuthorization) Reset() { *m = MsgRemoveContractAuthorization{} } +func (m *MsgRemoveContractAuthorization) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveContractAuthorization) ProtoMessage() {} +func (*MsgRemoveContractAuthorization) Descriptor() ([]byte, []int) { + return fileDescriptor_f5157c8f1c83ee51, []int{6} +} +func (m *MsgRemoveContractAuthorization) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveContractAuthorization) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveContractAuthorization.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 *MsgRemoveContractAuthorization) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveContractAuthorization.Merge(m, src) +} +func (m *MsgRemoveContractAuthorization) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveContractAuthorization) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveContractAuthorization.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveContractAuthorization proto.InternalMessageInfo + +func (m *MsgRemoveContractAuthorization) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgRemoveContractAuthorization) GetContractAddress() string { + if m != nil { + return m.ContractAddress + } + return "" +} + +type MsgRemoveContractAuthorizationResponse struct { +} + +func (m *MsgRemoveContractAuthorizationResponse) Reset() { + *m = MsgRemoveContractAuthorizationResponse{} +} +func (m *MsgRemoveContractAuthorizationResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveContractAuthorizationResponse) ProtoMessage() {} +func (*MsgRemoveContractAuthorizationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f5157c8f1c83ee51, []int{7} +} +func (m *MsgRemoveContractAuthorizationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveContractAuthorizationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveContractAuthorizationResponse.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 *MsgRemoveContractAuthorizationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveContractAuthorizationResponse.Merge(m, src) +} +func (m *MsgRemoveContractAuthorizationResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveContractAuthorizationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveContractAuthorizationResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveContractAuthorizationResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgSetCodeAuthorization)(nil), "publicawesome.stargaze.globalfee.v1.MsgSetCodeAuthorization") + proto.RegisterType((*MsgSetCodeAuthorizationResponse)(nil), "publicawesome.stargaze.globalfee.v1.MsgSetCodeAuthorizationResponse") + proto.RegisterType((*MsgRemoveCodeAuthorization)(nil), "publicawesome.stargaze.globalfee.v1.MsgRemoveCodeAuthorization") + proto.RegisterType((*MsgRemoveCodeAuthorizationResponse)(nil), "publicawesome.stargaze.globalfee.v1.MsgRemoveCodeAuthorizationResponse") + proto.RegisterType((*MsgSetContractAuthorization)(nil), "publicawesome.stargaze.globalfee.v1.MsgSetContractAuthorization") + proto.RegisterType((*MsgSetContractAuthorizationResponse)(nil), "publicawesome.stargaze.globalfee.v1.MsgSetContractAuthorizationResponse") + proto.RegisterType((*MsgRemoveContractAuthorization)(nil), "publicawesome.stargaze.globalfee.v1.MsgRemoveContractAuthorization") + proto.RegisterType((*MsgRemoveContractAuthorizationResponse)(nil), "publicawesome.stargaze.globalfee.v1.MsgRemoveContractAuthorizationResponse") +} + func init() { proto.RegisterFile("stargaze/globalfee/v1/tx.proto", fileDescriptor_f5157c8f1c83ee51) } var fileDescriptor_f5157c8f1c83ee51 = []byte{ - // 153 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2b, 0x2e, 0x49, 0x2c, - 0x4a, 0x4f, 0xac, 0x4a, 0xd5, 0x4f, 0xcf, 0xc9, 0x4f, 0x4a, 0xcc, 0x49, 0x4b, 0x4d, 0xd5, 0x2f, - 0x33, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52, 0x2e, 0x28, 0x4d, 0xca, - 0xc9, 0x4c, 0x4e, 0x2c, 0x4f, 0x2d, 0xce, 0xcf, 0x4d, 0xd5, 0x83, 0xa9, 0xd6, 0x83, 0xab, 0xd6, - 0x2b, 0x33, 0x34, 0x62, 0xe5, 0x62, 0xf6, 0x2d, 0x4e, 0x77, 0x0a, 0x3c, 0xf1, 0x48, 0x8e, 0xf1, - 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, - 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xf3, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, - 0x5c, 0x7d, 0x88, 0x81, 0xba, 0x50, 0x13, 0xf5, 0xe1, 0xf6, 0x97, 0x59, 0xea, 0x57, 0x20, 0x39, - 0xa2, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0xec, 0x0a, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x6a, 0x9f, 0x39, 0x7e, 0xa7, 0x00, 0x00, 0x00, + // 452 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0x4d, 0xeb, 0xd3, 0x40, + 0x10, 0xc6, 0xbb, 0xbe, 0x54, 0xfe, 0xe3, 0x41, 0x0d, 0xda, 0x96, 0x14, 0xd6, 0x9a, 0x5a, 0xa9, + 0x07, 0x13, 0x5a, 0x41, 0x51, 0x04, 0x5f, 0x2a, 0xa8, 0x48, 0x0e, 0xc6, 0x9b, 0x17, 0x49, 0x36, + 0x63, 0x1a, 0x68, 0xb3, 0x31, 0xbb, 0x8d, 0xb5, 0x9f, 0xc2, 0xa3, 0x78, 0x2d, 0x88, 0x37, 0xbf, + 0x86, 0xc7, 0x1e, 0x3d, 0x4a, 0xfb, 0x45, 0xc4, 0xb4, 0x49, 0x8b, 0x26, 0x25, 0xa5, 0x1e, 0x77, + 0x98, 0x7d, 0x9e, 0xdf, 0x0c, 0x0f, 0x03, 0x54, 0x48, 0x3b, 0xf2, 0xec, 0x19, 0x1a, 0xde, 0x88, + 0x3b, 0xf6, 0xe8, 0x1d, 0xa2, 0x11, 0xf7, 0x0c, 0x39, 0xd5, 0xc3, 0x88, 0x4b, 0xae, 0xb4, 0xc3, + 0x89, 0x33, 0xf2, 0x99, 0xfd, 0x01, 0x05, 0x1f, 0xa3, 0x9e, 0x76, 0xeb, 0x59, 0xb7, 0x1e, 0xf7, + 0xd4, 0x4e, 0xbe, 0xc8, 0xb6, 0x27, 0xd1, 0xd2, 0x3e, 0x13, 0xa8, 0x9b, 0xc2, 0x7b, 0x8d, 0x72, + 0xc0, 0x5d, 0x7c, 0x3c, 0x91, 0x43, 0x1e, 0xf9, 0x33, 0x5b, 0xfa, 0x3c, 0x50, 0x6a, 0x50, 0x15, + 0x18, 0xb8, 0x18, 0x35, 0x48, 0x8b, 0x74, 0x4f, 0xac, 0xcd, 0x4b, 0x41, 0x50, 0x18, 0x77, 0xf1, + 0xad, 0xbd, 0xdb, 0xdd, 0x38, 0xd5, 0x22, 0xdd, 0xf3, 0xfd, 0x3b, 0x7a, 0x09, 0x38, 0xfd, 0x1f, + 0x2f, 0xeb, 0x12, 0xfb, 0xbb, 0xa4, 0x5d, 0x83, 0xab, 0x05, 0x64, 0x16, 0x8a, 0x90, 0x07, 0x02, + 0x35, 0x13, 0x54, 0x53, 0x78, 0x16, 0x8e, 0x79, 0x8c, 0xe5, 0xf9, 0xeb, 0x70, 0x2e, 0xe1, 0xf7, + 0xdd, 0x04, 0xfa, 0x8c, 0x55, 0xfd, 0xf3, 0x7c, 0xe1, 0x6a, 0xd7, 0x41, 0x2b, 0x96, 0xcb, 0x4c, + 0xbf, 0x11, 0x68, 0xa6, 0x60, 0x81, 0x8c, 0x6c, 0x26, 0xcb, 0xd9, 0xbe, 0x87, 0x1a, 0xdb, 0x7c, + 0xc8, 0x5d, 0xdd, 0xfd, 0x92, 0xab, 0xcb, 0xf1, 0xb4, 0xae, 0xb0, 0xbc, 0xb2, 0xd6, 0x81, 0xf6, + 0x1e, 0xd2, 0x6c, 0x22, 0x06, 0x74, 0x67, 0xee, 0x43, 0x66, 0xba, 0x09, 0x17, 0xb7, 0x33, 0xb9, + 0x6e, 0x84, 0x42, 0x24, 0xd3, 0x9c, 0x58, 0x17, 0x32, 0xa2, 0x75, 0x59, 0xeb, 0xc2, 0x8d, 0xfd, + 0x26, 0x29, 0x4e, 0x7f, 0x7e, 0x16, 0x4e, 0x9b, 0xc2, 0x53, 0xbe, 0x10, 0xb8, 0x9c, 0x1b, 0xcc, + 0x07, 0xa5, 0x36, 0x55, 0x10, 0x1e, 0xf5, 0xe9, 0x31, 0xbf, 0x53, 0x48, 0x65, 0x4e, 0xa0, 0x5e, + 0x14, 0xbc, 0x87, 0x65, 0x1d, 0x0a, 0x04, 0xd4, 0x67, 0x47, 0x0a, 0x64, 0x94, 0x5f, 0x09, 0x34, + 0x0a, 0x83, 0xfa, 0xe8, 0xa0, 0x45, 0xe4, 0x28, 0xa8, 0xcf, 0x8f, 0x55, 0xc8, 0x40, 0xbf, 0x13, + 0x68, 0xee, 0x0b, 0xe0, 0xe0, 0xd0, 0x8d, 0xe4, 0xe1, 0xbe, 0xfc, 0x0f, 0x22, 0x29, 0xf1, 0x93, + 0x57, 0x3f, 0x96, 0x94, 0x2c, 0x96, 0x94, 0xfc, 0x5a, 0x52, 0xf2, 0x69, 0x45, 0x2b, 0x8b, 0x15, + 0xad, 0xfc, 0x5c, 0xd1, 0xca, 0x9b, 0xbb, 0x9e, 0x2f, 0x87, 0x13, 0x47, 0x67, 0x7c, 0x6c, 0xac, + 0x0d, 0x6f, 0x6d, 0x1c, 0x8d, 0xec, 0x28, 0xc7, 0xf7, 0x8c, 0xe9, 0xce, 0x65, 0x96, 0x1f, 0x43, + 0x14, 0x4e, 0x35, 0xb9, 0xc9, 0xb7, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0xc8, 0x04, 0x61, 0x6d, + 0x01, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -51,6 +439,10 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { + SetCodeAuthorization(ctx context.Context, in *MsgSetCodeAuthorization, opts ...grpc.CallOption) (*MsgSetCodeAuthorizationResponse, error) + RemoveCodeAuthorization(ctx context.Context, in *MsgRemoveCodeAuthorization, opts ...grpc.CallOption) (*MsgRemoveCodeAuthorizationResponse, error) + SetContractAuthorization(ctx context.Context, in *MsgSetContractAuthorization, opts ...grpc.CallOption) (*MsgSetContractAuthorizationResponse, error) + RemoveContractAuthorization(ctx context.Context, in *MsgRemoveContractAuthorization, opts ...grpc.CallOption) (*MsgRemoveContractAuthorizationResponse, error) } type msgClient struct { @@ -61,22 +453,1268 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } +func (c *msgClient) SetCodeAuthorization(ctx context.Context, in *MsgSetCodeAuthorization, opts ...grpc.CallOption) (*MsgSetCodeAuthorizationResponse, error) { + out := new(MsgSetCodeAuthorizationResponse) + err := c.cc.Invoke(ctx, "/publicawesome.stargaze.globalfee.v1.Msg/SetCodeAuthorization", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) RemoveCodeAuthorization(ctx context.Context, in *MsgRemoveCodeAuthorization, opts ...grpc.CallOption) (*MsgRemoveCodeAuthorizationResponse, error) { + out := new(MsgRemoveCodeAuthorizationResponse) + err := c.cc.Invoke(ctx, "/publicawesome.stargaze.globalfee.v1.Msg/RemoveCodeAuthorization", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) SetContractAuthorization(ctx context.Context, in *MsgSetContractAuthorization, opts ...grpc.CallOption) (*MsgSetContractAuthorizationResponse, error) { + out := new(MsgSetContractAuthorizationResponse) + err := c.cc.Invoke(ctx, "/publicawesome.stargaze.globalfee.v1.Msg/SetContractAuthorization", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) RemoveContractAuthorization(ctx context.Context, in *MsgRemoveContractAuthorization, opts ...grpc.CallOption) (*MsgRemoveContractAuthorizationResponse, error) { + out := new(MsgRemoveContractAuthorizationResponse) + err := c.cc.Invoke(ctx, "/publicawesome.stargaze.globalfee.v1.Msg/RemoveContractAuthorization", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { + SetCodeAuthorization(context.Context, *MsgSetCodeAuthorization) (*MsgSetCodeAuthorizationResponse, error) + RemoveCodeAuthorization(context.Context, *MsgRemoveCodeAuthorization) (*MsgRemoveCodeAuthorizationResponse, error) + SetContractAuthorization(context.Context, *MsgSetContractAuthorization) (*MsgSetContractAuthorizationResponse, error) + RemoveContractAuthorization(context.Context, *MsgRemoveContractAuthorization) (*MsgRemoveContractAuthorizationResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. type UnimplementedMsgServer struct { } +func (*UnimplementedMsgServer) SetCodeAuthorization(ctx context.Context, req *MsgSetCodeAuthorization) (*MsgSetCodeAuthorizationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetCodeAuthorization not implemented") +} +func (*UnimplementedMsgServer) RemoveCodeAuthorization(ctx context.Context, req *MsgRemoveCodeAuthorization) (*MsgRemoveCodeAuthorizationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveCodeAuthorization not implemented") +} +func (*UnimplementedMsgServer) SetContractAuthorization(ctx context.Context, req *MsgSetContractAuthorization) (*MsgSetContractAuthorizationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetContractAuthorization not implemented") +} +func (*UnimplementedMsgServer) RemoveContractAuthorization(ctx context.Context, req *MsgRemoveContractAuthorization) (*MsgRemoveContractAuthorizationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveContractAuthorization not implemented") +} + func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } +func _Msg_SetCodeAuthorization_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSetCodeAuthorization) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SetCodeAuthorization(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/publicawesome.stargaze.globalfee.v1.Msg/SetCodeAuthorization", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SetCodeAuthorization(ctx, req.(*MsgSetCodeAuthorization)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_RemoveCodeAuthorization_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRemoveCodeAuthorization) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RemoveCodeAuthorization(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/publicawesome.stargaze.globalfee.v1.Msg/RemoveCodeAuthorization", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RemoveCodeAuthorization(ctx, req.(*MsgRemoveCodeAuthorization)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_SetContractAuthorization_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSetContractAuthorization) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SetContractAuthorization(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/publicawesome.stargaze.globalfee.v1.Msg/SetContractAuthorization", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SetContractAuthorization(ctx, req.(*MsgSetContractAuthorization)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_RemoveContractAuthorization_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRemoveContractAuthorization) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RemoveContractAuthorization(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/publicawesome.stargaze.globalfee.v1.Msg/RemoveContractAuthorization", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RemoveContractAuthorization(ctx, req.(*MsgRemoveContractAuthorization)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "publicawesome.stargaze.globalfee.v1.Msg", HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{}, - Metadata: "stargaze/globalfee/v1/tx.proto", + Methods: []grpc.MethodDesc{ + { + MethodName: "SetCodeAuthorization", + Handler: _Msg_SetCodeAuthorization_Handler, + }, + { + MethodName: "RemoveCodeAuthorization", + Handler: _Msg_RemoveCodeAuthorization_Handler, + }, + { + MethodName: "SetContractAuthorization", + Handler: _Msg_SetContractAuthorization_Handler, + }, + { + MethodName: "RemoveContractAuthorization", + Handler: _Msg_RemoveContractAuthorization_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "stargaze/globalfee/v1/tx.proto", +} + +func (m *MsgSetCodeAuthorization) 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 *MsgSetCodeAuthorization) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetCodeAuthorization) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CodeAuthorization != nil { + { + size, err := m.CodeAuthorization.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSetCodeAuthorizationResponse) 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 *MsgSetCodeAuthorizationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetCodeAuthorizationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgRemoveCodeAuthorization) 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 *MsgRemoveCodeAuthorization) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveCodeAuthorization) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CodeId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.CodeId)) + i-- + dAtA[i] = 0x10 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRemoveCodeAuthorizationResponse) 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 *MsgRemoveCodeAuthorizationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveCodeAuthorizationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgSetContractAuthorization) 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 *MsgSetContractAuthorization) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetContractAuthorization) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ContractAuthorization != nil { + { + size, err := m.ContractAuthorization.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSetContractAuthorizationResponse) 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 *MsgSetContractAuthorizationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetContractAuthorizationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil } + +func (m *MsgRemoveContractAuthorization) 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 *MsgRemoveContractAuthorization) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveContractAuthorization) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRemoveContractAuthorizationResponse) 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 *MsgRemoveContractAuthorizationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveContractAuthorizationResponse) 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 *MsgSetCodeAuthorization) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.CodeAuthorization != nil { + l = m.CodeAuthorization.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSetCodeAuthorizationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgRemoveCodeAuthorization) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.CodeId != 0 { + n += 1 + sovTx(uint64(m.CodeId)) + } + return n +} + +func (m *MsgRemoveCodeAuthorizationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgSetContractAuthorization) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.ContractAuthorization != nil { + l = m.ContractAuthorization.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSetContractAuthorizationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgRemoveContractAuthorization) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRemoveContractAuthorizationResponse) 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 *MsgSetCodeAuthorization) 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: MsgSetCodeAuthorization: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetCodeAuthorization: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeAuthorization", 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.CodeAuthorization == nil { + m.CodeAuthorization = &CodeAuthorization{} + } + if err := m.CodeAuthorization.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 *MsgSetCodeAuthorizationResponse) 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: MsgSetCodeAuthorizationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetCodeAuthorizationResponse: 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 *MsgRemoveCodeAuthorization) 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: MsgRemoveCodeAuthorization: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveCodeAuthorization: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeId", wireType) + } + m.CodeId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CodeId |= 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 *MsgRemoveCodeAuthorizationResponse) 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: MsgRemoveCodeAuthorizationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveCodeAuthorizationResponse: 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 *MsgSetContractAuthorization) 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: MsgSetContractAuthorization: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetContractAuthorization: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAuthorization", 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.ContractAuthorization == nil { + m.ContractAuthorization = &ContractAuthorization{} + } + if err := m.ContractAuthorization.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 *MsgSetContractAuthorizationResponse) 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: MsgSetContractAuthorizationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetContractAuthorizationResponse: 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 *MsgRemoveContractAuthorization) 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: MsgRemoveContractAuthorization: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveContractAuthorization: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", 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.ContractAddress = 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 *MsgRemoveContractAuthorizationResponse) 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: MsgRemoveContractAuthorizationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveContractAuthorizationResponse: 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 skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +)