From 2c0d9bde98dd24cc94a24b12c4a792e17c1d38d5 Mon Sep 17 00:00:00 2001 From: Riccardo Date: Mon, 15 Jul 2024 07:01:49 -0500 Subject: [PATCH] feat(restaking): add genesis and querier (#46) ## Description This PR adds the genesis and querier implementations for the `x/restaking` module. The CLI and invariants implementations will be left for another PR. **Note**. I still need to add some more tests for the querier, but it's otherwise good to go. --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [x] targeted the correct branch (see [PR Targeting](https://github.com/desmos-labs/desmos/blob/master/CONTRIBUTING.md#pr-targeting)) - [x] provided a link to the relevant issue or specification - [x] followed the guidelines for [building modules](https://docs.cosmos.network/v0.44/building-modules/intro.html) - [ ] included the necessary unit and integration [tests](https://github.com/desmos-labs/desmos/blob/master/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [x] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [x] reviewed "Files changed" and left comments if necessary - [x] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable) --------- Co-authored-by: Hanjun Kim --- app/app.go | 21 +- proto/milkyway/pools/v1/query.proto | 6 +- proto/milkyway/restaking/v1/models.proto | 47 +- proto/milkyway/restaking/v1/query.proto | 470 ++ utils/restaking.go | 89 + x/operators/types/errors.go | 7 +- x/operators/types/models.go | 44 +- x/operators/types/models_test.go | 94 +- x/pools/types/errors.go | 2 + x/pools/types/models.go | 5 + x/pools/types/query.pb.go | 64 +- x/pools/types/query.pb.gw.go | 6 +- x/restaking/keeper/alias_functions.go | 32 + x/restaking/keeper/genesis.go | 38 + x/restaking/keeper/genesis_test.go | 280 + x/restaking/keeper/grpc_query.go | 658 ++ x/restaking/keeper/grpc_query_test.go | 1747 +++++ x/restaking/module.go | 143 + x/restaking/types/expected_keepers.go | 1 + x/restaking/types/keys.go | 18 +- x/restaking/types/models.go | 37 + x/restaking/types/models.pb.go | 802 ++- x/restaking/types/query.go | 85 + x/restaking/types/query.pb.go | 7781 ++++++++++++++++++++++ x/restaking/types/query.pb.gw.go | 1962 ++++++ x/services/types/errors.go | 5 +- x/services/types/models.go | 44 +- x/services/types/models_test.go | 90 + 28 files changed, 14410 insertions(+), 168 deletions(-) create mode 100644 proto/milkyway/restaking/v1/query.proto create mode 100644 utils/restaking.go create mode 100644 x/restaking/keeper/genesis.go create mode 100644 x/restaking/keeper/genesis_test.go create mode 100644 x/restaking/keeper/grpc_query.go create mode 100644 x/restaking/keeper/grpc_query_test.go create mode 100644 x/restaking/module.go create mode 100644 x/restaking/types/query.go create mode 100644 x/restaking/types/query.pb.go create mode 100644 x/restaking/types/query.pb.gw.go diff --git a/app/app.go b/app/app.go index 0efa58da..a56fa0fd 100644 --- a/app/app.go +++ b/app/app.go @@ -168,6 +168,9 @@ import ( "github.com/milkyway-labs/milkyway/x/records" recordskeeper "github.com/milkyway-labs/milkyway/x/records/keeper" recordstypes "github.com/milkyway-labs/milkyway/x/records/types" + "github.com/milkyway-labs/milkyway/x/restaking" + restakingkeeper "github.com/milkyway-labs/milkyway/x/restaking/keeper" + restakingtypes "github.com/milkyway-labs/milkyway/x/restaking/types" "github.com/milkyway-labs/milkyway/x/services" serviceskeeper "github.com/milkyway-labs/milkyway/x/services/keeper" servicestypes "github.com/milkyway-labs/milkyway/x/services/types" @@ -289,6 +292,7 @@ type MilkyWayApp struct { ServicesKeeper *serviceskeeper.Keeper OperatorsKeeper *operatorskeeper.Keeper PoolsKeeper *poolskeeper.Keeper + RestakingKeeper *restakingkeeper.Keeper // make scoped keepers public for test purposes ScopedIBCKeeper capabilitykeeper.ScopedKeeper @@ -352,7 +356,7 @@ func NewMilkyWayApp( icacallbackstypes.StoreKey, recordstypes.StoreKey, stakeibctypes.StoreKey, // Custom modules - servicestypes.StoreKey, operatorstypes.StoreKey, poolstypes.StoreKey, + servicestypes.StoreKey, operatorstypes.StoreKey, poolstypes.StoreKey, restakingtypes.StoreKey, ) tkeys := storetypes.NewTransientStoreKeys(forwardingtypes.TransientStoreKey) memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) @@ -884,6 +888,16 @@ func NewMilkyWayApp( keys[poolstypes.StoreKey], app.AccountKeeper, ) + app.RestakingKeeper = restakingkeeper.NewKeeper( + app.appCodec, + keys[restakingtypes.StoreKey], + app.AccountKeeper, + app.BankKeeper, + app.PoolsKeeper, + app.OperatorsKeeper, + app.ServicesKeeper, + authorityAddr, + ) /**** Module Options ****/ @@ -934,6 +948,7 @@ func NewMilkyWayApp( services.NewAppModule(appCodec, app.ServicesKeeper), operators.NewAppModule(appCodec, app.OperatorsKeeper), pools.NewAppModule(appCodec, app.PoolsKeeper), + restaking.NewAppModule(appCodec, app.RestakingKeeper), ) if err := app.setupIndexer(appOpts, homePath, ac, vc, appCodec); err != nil { @@ -975,6 +990,7 @@ func NewMilkyWayApp( servicestypes.ModuleName, operatorstypes.ModuleName, poolstypes.ModuleName, + restakingtypes.ModuleName, ) app.ModuleManager.SetOrderEndBlockers( @@ -992,6 +1008,7 @@ func NewMilkyWayApp( servicestypes.ModuleName, operatorstypes.ModuleName, poolstypes.ModuleName, + restakingtypes.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -1011,7 +1028,7 @@ func NewMilkyWayApp( stakeibctypes.ModuleName, epochstypes.ModuleName, icqtypes.ModuleName, recordstypes.ModuleName, ratelimittypes.ModuleName, icacallbackstypes.ModuleName, - servicestypes.ModuleName, operatorstypes.ModuleName, poolstypes.ModuleName, + servicestypes.ModuleName, operatorstypes.ModuleName, poolstypes.ModuleName, restakingtypes.ModuleName, } app.ModuleManager.SetOrderInitGenesis(genesisModuleOrder...) diff --git a/proto/milkyway/pools/v1/query.proto b/proto/milkyway/pools/v1/query.proto index db2d1bdc..4dafeb38 100644 --- a/proto/milkyway/pools/v1/query.proto +++ b/proto/milkyway/pools/v1/query.proto @@ -12,18 +12,18 @@ option go_package = "github.com/milkyway-labs/milkyway/x/pools/types"; service Query { // PoolById defines a gRPC query method that returns the pool by the given ID. rpc PoolById(QueryPoolByIdRequest) returns (QueryPoolResponse) { - option (google.api.http).get = "/milkyway/pool/v1/pool/{pool_id}"; + option (google.api.http).get = "/milkyway/pools/v1/pools/{pool_id}"; } // PoolByDenom defines a gRPC query method that returns the pool by the given // denom. rpc PoolByDenom(QueryPoolByDenomRequest) returns (QueryPoolResponse) { - option (google.api.http).get = "/milkyway/pool/v1/pool/denom/{denom}"; + option (google.api.http).get = "/milkyway/pools/v1/pool/denom/{denom}"; } // Pools defines a gRPC query method that returns all pools. rpc Pools(QueryPoolsRequest) returns (QueryPoolsResponse) { - option (google.api.http).get = "/milkyway/pool/v1/pools"; + option (google.api.http).get = "/milkyway/pools/v1/pools"; } } diff --git a/proto/milkyway/restaking/v1/models.proto b/proto/milkyway/restaking/v1/models.proto index 753efd86..7d33d983 100644 --- a/proto/milkyway/restaking/v1/models.proto +++ b/proto/milkyway/restaking/v1/models.proto @@ -28,6 +28,19 @@ message PoolDelegation { ]; } +// PoolDelegationResponse is equivalent to PoolDelegation except that it +// contains a balance in addition to shares which is more suitable for client +// responses. +message PoolDelegationResponse { + option (gogoproto.equal) = false; + + PoolDelegation delegation = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + + cosmos.base.v1beta1.Coin balance = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + // OperatorDelegation represents the bond with tokens held by an account with a // given operator. It is owned by one delegator, and is associated with a // operator. @@ -48,6 +61,22 @@ message OperatorDelegation { ]; } +// OperatorDelegationResponse is equivalent to OperatorDelegation except that it +// contains a balance in addition to shares which is more suitable for client +// responses. +message OperatorDelegationResponse { + option (gogoproto.equal) = false; + + OperatorDelegation delegation = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + + repeated cosmos.base.v1beta1.Coin balance = 2 [ + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; +} + // ServiceDelegation represents the bond with tokens held by an account with a // given service. It is owned by one delegator, and is associated with a // service. @@ -66,4 +95,20 @@ message ServiceDelegation { (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false ]; -} \ No newline at end of file +} + +// ServiceDelegationResponse is equivalent to ServiceDelegation except that it +// contains a balance in addition to shares which is more suitable for client +// responses. +message ServiceDelegationResponse { + option (gogoproto.equal) = false; + + ServiceDelegation delegation = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + + repeated cosmos.base.v1beta1.Coin balance = 2 [ + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; +} diff --git a/proto/milkyway/restaking/v1/query.proto b/proto/milkyway/restaking/v1/query.proto new file mode 100644 index 00000000..8d712586 --- /dev/null +++ b/proto/milkyway/restaking/v1/query.proto @@ -0,0 +1,470 @@ +syntax = "proto3"; +package milkyway.restaking.v1; + +import "cosmos/base/query/v1beta1/pagination.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/query/v1/query.proto"; +import "amino/amino.proto"; +import "milkyway/restaking/v1/models.proto"; +import "milkyway/restaking/v1/params.proto"; +import "milkyway/operators/v1/models.proto"; +import "milkyway/pools/v1/models.proto"; +import "milkyway/services/v1/models.proto"; + +option go_package = "github.com/milkyway-labs/milkyway/x/restaking/types"; + +// Query defines the gRPC querier service. +service Query { + + // PoolDelegations queries the delegations info for the given pool. + rpc PoolDelegations(QueryPoolDelegationsRequest) + returns (QueryPoolDelegationsResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = + "/milkyway/restaking/v1/pools/{pool_id}/delegations"; + } + + // PoolDelegation queries the delegation info for the given pool and + // delegator. + rpc PoolDelegation(QueryPoolDelegationRequest) + returns (QueryPoolDelegationResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/milkyway/restaking/v1/pools/{pool_id}/" + "delegations/{delegator_address}"; + } + + // OperatorDelegations queries the delegations info for the given operator. + rpc OperatorDelegations(QueryOperatorDelegationsRequest) + returns (QueryOperatorDelegationsResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = + "/milkyway/restaking/v1/operators/{operator_id}/delegations"; + } + + // OperatorDelegation queries the delegation info for the given operator and + // delegator. + rpc OperatorDelegation(QueryOperatorDelegationRequest) + returns (QueryOperatorDelegationResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = + "/milkyway/restaking/v1/operators/{operator_id}/delegations/" + "{delegator_address}"; + } + + // ServiceDelegations queries the delegations info for the given service. + rpc ServiceDelegations(QueryServiceDelegationsRequest) + returns (QueryServiceDelegationsResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = + "/milkyway/restaking/v1/services/{service_id}/delegations"; + } + + // ServiceDelegation queries the delegation info for the given service and + // delegator. + rpc ServiceDelegation(QueryServiceDelegationRequest) + returns (QueryServiceDelegationResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = + "/milkyway/restaking/v1/services/{service_id}/delegations/" + "{delegator_address}"; + } + + // DelegatorPoolDelegations queries all the pool delegations of a given + // delegator address. + rpc DelegatorPoolDelegations(QueryDelegatorPoolDelegationsRequest) + returns (QueryDelegatorPoolDelegationsResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = + "/milkyway/restaking/v1/delegations/{delegator_address}/pools"; + } + + // DelegatorOperatorDelegations queries all the operator delegations of a + // given delegator address. + rpc DelegatorOperatorDelegations(QueryDelegatorOperatorDelegationsRequest) + returns (QueryDelegatorOperatorDelegationsResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = + "/milkyway/restaking/v1/delegations/{delegator_address}/operators"; + } + + // DelegatorServiceDelegations queries all the service delegations of a given + // delegator address. + rpc DelegatorServiceDelegations(QueryDelegatorServiceDelegationsRequest) + returns (QueryDelegatorServiceDelegationsResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = + "/milkyway/restaking/v1/delegations/{delegator_address}/services"; + } + + // DelegatorPools queries all pools info for given delegator + // address. + rpc DelegatorPools(QueryDelegatorPoolsRequest) + returns (QueryDelegatorPoolsResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = + "/milkyway/restaking/v1/delegators/{delegator_address}/pools"; + } + + // DelegatorPool queries the pool info for given delegator and pool id. + rpc DelegatorPool(QueryDelegatorPoolRequest) + returns (QueryDelegatorPoolResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = + "/milkyway/restaking/v1/delegators/{delegator_address}/pools/{pool_id}"; + } + + // DelegatorOperators queries all operators info for given delegator + rpc DelegatorOperators(QueryDelegatorOperatorsRequest) + returns (QueryDelegatorOperatorsResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = + "/milkyway/restaking/v1/delegators/{delegator_address}/operators"; + } + + // DelegatorOperator queries the operator info for given delegator and + // operator id. + rpc DelegatorOperator(QueryDelegatorOperatorRequest) + returns (QueryDelegatorOperatorResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = + "/milkyway/restaking/v1/delegators/{delegator_address}/operators/" + "{operator_id}"; + } + + // DelegatorServices queries all services info for given delegator + rpc DelegatorServices(QueryDelegatorServicesRequest) + returns (QueryDelegatorServicesResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = + "/milkyway/restaking/v1/delegators/{delegator_address}/services"; + } + + // DelegatorService queries the service info for given delegator and service + // id. + rpc DelegatorService(QueryDelegatorServiceRequest) + returns (QueryDelegatorServiceResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/milkyway/restaking/v1/delegators/" + "{delegator_address}/services/{service_id}"; + } + + // Params queries the restaking parameters. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/milkyway/restaking/v1/params"; + } +} + +// QueryPoolDelegationsRequest is request type for the Query/PoolDelegations RPC +// method. +message QueryPoolDelegationsRequest { + // PoolId is the ID of the pool to query + uint32 pool_id = 1; + + // Pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryPoolDelegationsResponse is response type for the Query/PoolDelegations +// RPC method. +message QueryPoolDelegationsResponse { + // Delegations is the list of delegations + repeated PoolDelegationResponse delegations = 1 + [ (gogoproto.nullable) = false ]; + + // Pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryPoolDelegationRequest is request type for the Query/PoolDelegation RPC +// method. +message QueryPoolDelegationRequest { + // PoolId is the ID of the pool to query + uint32 pool_id = 1; + + // DelegatorAddress is the address of the delegator to query + string delegator_address = 2 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; +} + +// QueryPoolDelegationResponse is response type for the Query/PoolDelegation RPC +// method. +message QueryPoolDelegationResponse { + // Delegation is the delegation + PoolDelegationResponse delegation = 1 [ (gogoproto.nullable) = false ]; +} + +// QueryOperatorDelegationsRequest is request type for the +// Query/OperatorDelegations RPC method. +message QueryOperatorDelegationsRequest { + // OperatorId is the ID of the operator to query + uint32 operator_id = 1; + + // Pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryOperatorDelegationsResponse is response type for the +// Query/OperatorDelegations RPC method. +message QueryOperatorDelegationsResponse { + // Delegations is the list of delegations + repeated OperatorDelegationResponse delegations = 1 + [ (gogoproto.nullable) = false ]; + + // Pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryOperatorDelegationRequest is request type for the +// Query/OperatorDelegation RPC method. +message QueryOperatorDelegationRequest { + // OperatorId is the ID of the operator to query + uint32 operator_id = 1; + + // DelegatorAddress is the address of the delegator to query + string delegator_address = 2 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; +} + +// QueryOperatorDelegationResponse is response type for the +// Query/OperatorDelegation RPC method. +message QueryOperatorDelegationResponse { + // Delegation is the delegation + OperatorDelegationResponse delegation = 1 [ (gogoproto.nullable) = false ]; +} + +// QueryServiceDelegationsRequest is request type for the +// Query/ServiceDelegations RPC method. +message QueryServiceDelegationsRequest { + // ServiceId is the ID of the service to query + uint32 service_id = 1; + + // Pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryServiceDelegationsResponse is response type for the +// Query/ServiceDelegations RPC method. +message QueryServiceDelegationsResponse { + // Delegations is the list of delegations + repeated ServiceDelegationResponse delegations = 1 + [ (gogoproto.nullable) = false ]; + + // Pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryServiceDelegationRequest is request type for the Query/ServiceDelegation +// RPC method. +message QueryServiceDelegationRequest { + // ServiceId is the ID of the service to query + uint32 service_id = 1; + + // DelegatorAddress is the address of the delegator to query + string delegator_address = 2 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; +} + +// QueryServiceDelegationResponse is response type for the +// Query/ServiceDelegation RPC method. +message QueryServiceDelegationResponse { + // Delegation is the delegation + ServiceDelegationResponse delegation = 1 [ (gogoproto.nullable) = false ]; +} + +// QueryDelegatorPoolDelegationsRequest is request type for the +// Query/DelegatorPoolDelegations RPC method. +message QueryDelegatorPoolDelegationsRequest { + // DelegatorAddress is the address of the delegator to query + string delegator_address = 1 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // Pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryDelegatorPoolDelegationsResponse is response type for the +// Query/DelegatorPoolDelegations RPC method. +message QueryDelegatorPoolDelegationsResponse { + // Delegations is the list of delegations + repeated PoolDelegationResponse delegations = 1 + [ (gogoproto.nullable) = false ]; + + // Pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryDelegatorOperatorDelegationsRequest is request type for the +// Query/DelegatorOperatorDelegations RPC method. +message QueryDelegatorOperatorDelegationsRequest { + // DelegatorAddress is the address of the delegator to query + string delegator_address = 1 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // Pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryDelegatorOperatorDelegationsResponse is response type for the +// Query/DelegatorOperatorDelegations RPC method. +message QueryDelegatorOperatorDelegationsResponse { + // Delegations is the list of delegations + repeated OperatorDelegationResponse delegations = 1 + [ (gogoproto.nullable) = false ]; + + // Pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryDelegatorServiceDelegationsRequest is request type for the +// Query/DelegatorServiceDelegations RPC method. +message QueryDelegatorServiceDelegationsRequest { + // DelegatorAddress is the address of the delegator to query + string delegator_address = 1 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // Pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryDelegatorServiceDelegationsResponse is response type for the +// Query/DelegatorServiceDelegations RPC method. +message QueryDelegatorServiceDelegationsResponse { + // Delegations is the list of delegations + repeated ServiceDelegationResponse delegations = 1 + [ (gogoproto.nullable) = false ]; + + // Pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryDelegatorPoolsRequest is request type for the Query/DelegatorPools RPC +// method. +message QueryDelegatorPoolsRequest { + // DelegatorAddress is the address of the delegator to query + string delegator_address = 1 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // Pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryDelegatorPoolsResponse is response type for the Query/DelegatorPools RPC +// method. +message QueryDelegatorPoolsResponse { + // Pools is the list of pools + repeated milkyway.pools.v1.Pool pools = 1 [ (gogoproto.nullable) = false ]; + + // Pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryDelegatorPoolRequest is request type for the Query/DelegatorPool RPC +// method. +message QueryDelegatorPoolRequest { + // DelegatorAddress is the address of the delegator to query + string delegator_address = 1 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // PoolId is the ID of the pool to query + uint32 pool_id = 2; +} + +// QueryDelegatorPoolResponse is response type for the Query/DelegatorPool RPC +// method. +message QueryDelegatorPoolResponse { + // Pool is the pool + milkyway.pools.v1.Pool pool = 1 [ (gogoproto.nullable) = false ]; +} + +// QueryDelegatorOperatorsRequest is request type for the +// Query/DelegatorOperators RPC method. +message QueryDelegatorOperatorsRequest { + // DelegatorAddress is the address of the delegator to query + string delegator_address = 1 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // Pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryDelegatorOperatorsResponse is response type for the +// Query/DelegatorOperators RPC method. +message QueryDelegatorOperatorsResponse { + // Operators is the list of operators + repeated milkyway.operators.v1.Operator operators = 1 + [ (gogoproto.nullable) = false ]; + + // Pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryDelegatorOperatorRequest is request type for the Query/DelegatorOperator +// RPC method. +message QueryDelegatorOperatorRequest { + // DelegatorAddress is the address of the delegator to query + string delegator_address = 1 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // OperatorId is the ID of the operator to query + uint32 operator_id = 2; +} + +// QueryDelegatorOperatorResponse is response type for the +// Query/DelegatorOperator RPC method. +message QueryDelegatorOperatorResponse { + // Operator is the operator + milkyway.operators.v1.Operator operator = 1 [ (gogoproto.nullable) = false ]; +} + +// QueryDelegatorServicesRequest is request type for the Query/DelegatorServices +// RPC method. +message QueryDelegatorServicesRequest { + // DelegatorAddress is the address of the delegator to query + string delegator_address = 1 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // Pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryDelegatorServicesResponse is response type for the +// Query/DelegatorServices RPC method. +message QueryDelegatorServicesResponse { + // Services is the list of services + repeated milkyway.services.v1.Service services = 1 + [ (gogoproto.nullable) = false ]; + + // Pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryDelegatorServiceRequest is request type for the Query/DelegatorService +// RPC method. +message QueryDelegatorServiceRequest { + // DelegatorAddress is the address of the delegator to query + string delegator_address = 1 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // ServiceId is the ID of the service to query + uint32 service_id = 2; +} + +// QueryDelegatorServiceResponse is response type for the Query/DelegatorService +// RPC method. +message QueryDelegatorServiceResponse { + // Service is the service + milkyway.services.v1.Service service = 1 [ (gogoproto.nullable) = false ]; +} + +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + // params holds all the parameters of this module. + Params params = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} diff --git a/utils/restaking.go b/utils/restaking.go new file mode 100644 index 00000000..c0265c44 --- /dev/null +++ b/utils/restaking.go @@ -0,0 +1,89 @@ +package utils + +import ( + "fmt" + "strings" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// GetSharesDenomFromTokenDenom returns the shares denom from the token denom. +// The returned shares denom will be in the format "{prefix}/{id}/{tokenDenom}". +func GetSharesDenomFromTokenDenom(prefix string, id uint32, tokenDenom string) string { + return fmt.Sprintf("%s/%d/%s", prefix, id, tokenDenom) +} + +// GetTokenDenomFromSharesDenom returns the token denom from the shares denom. +// It expects the shares denom to be in the format "{xxxxxx}/{xxxxxx}/{tokenDenom}". +func GetTokenDenomFromSharesDenom(sharesDenom string) string { + parts := strings.Split(sharesDenom, "/") + if len(parts) != 3 { + return "" + } + return parts[2] +} + +// IsInvalidExRate returns true if the delegated tokens are zero and the delegators shares are positive. +func IsInvalidExRate(delegatedTokens sdk.Coins, delegatorsShares sdk.DecCoins) bool { + for _, token := range delegatedTokens { + if token.IsZero() && delegatorsShares.AmountOf(token.Denom).IsPositive() { + return true + } + } + return false +} + +// ComputeTokensFromShares calculates the token worth of provided shares. +func ComputeTokensFromShares(shares sdk.DecCoins, delegatedTokens sdk.Coins, delegatorShares sdk.DecCoins) sdk.DecCoins { + tokens := sdk.NewDecCoins() + for _, share := range shares { + tokenDenom := GetTokenDenomFromSharesDenom(share.Denom) + + operatorTokenAmount := delegatedTokens.AmountOf(tokenDenom) + delegatorSharesAmount := delegatorShares.AmountOf(share.Denom) + + tokenAmount := share.Amount.MulInt(operatorTokenAmount).Quo(delegatorSharesAmount) + + tokens = tokens.Add(sdk.NewDecCoinFromDec(tokenDenom, tokenAmount)) + } + + return tokens +} + +// ShareDenomGetter represents a function that returns the shares denom given a token denom. +type ShareDenomGetter func(tokenDenom string) (shareDenom string) + +// SharesFromTokens returns the shares of a delegation given a bond amount. +func SharesFromTokens(tokens sdk.Coin, getShareDenom ShareDenomGetter, delegatedTokens sdk.Coins, delegatorsShares sdk.DecCoins) (sdkmath.LegacyDec, error) { + sharesDenom := getShareDenom(tokens.Denom) + delegatorTokenShares := delegatorsShares.AmountOf(sharesDenom) + operatorTokenAmount := delegatedTokens.AmountOf(tokens.Denom) + return delegatorTokenShares.MulInt(tokens.Amount).QuoInt(operatorTokenAmount), nil +} + +// IssueShares calculates the shares to issue for a delegation of the given amount. +func IssueShares(amount sdk.Coins, getShareDenom ShareDenomGetter, delegatedTokens sdk.Coins, delegatorsShares sdk.DecCoins) sdk.DecCoins { + // calculate the shares to issue + issuedShares := sdk.NewDecCoins() + for _, token := range amount { + var tokenShares sdk.DecCoin + sharesDenom := getShareDenom(token.Denom) + + delegatorShares := delegatorsShares.AmountOf(sharesDenom) + if delegatorShares.IsZero() { + // The first delegation to an operator sets the exchange rate to one + tokenShares = sdk.NewDecCoin(sharesDenom, token.Amount) + } else { + shares, err := SharesFromTokens(token, getShareDenom, delegatedTokens, delegatorsShares) + if err != nil { + panic(err) + } + tokenShares = sdk.NewDecCoinFromDec(sharesDenom, shares) + } + + issuedShares = issuedShares.Add(tokenShares) + } + + return issuedShares +} diff --git a/x/operators/types/errors.go b/x/operators/types/errors.go index 6684402f..070758dd 100644 --- a/x/operators/types/errors.go +++ b/x/operators/types/errors.go @@ -2,12 +2,13 @@ package types import ( "cosmossdk.io/errors" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) var ( + ErrOperatorNotFound = errors.Wrap(sdkerrors.ErrNotFound, "operator not found") ErrInvalidGenesis = errors.Register(ModuleName, 1, "invalid genesis state") - ErrInvalidDeactivationTime = errors.Register(ModuleName, 2, "invalid deactivation time") - ErrOperatorNotFound = errors.Register(ModuleName, 3, "operator not found") + ErrInsufficientShares = errors.Register(ModuleName, 2, "insufficient delegation shares") + ErrInvalidDeactivationTime = errors.Register(ModuleName, 3, "invalid deactivation time") ErrOperatorNotActive = errors.Register(ModuleName, 4, "operator not active") - ErrInsufficientShares = errors.Register(ModuleName, 5, "insufficient delegation shares") ) diff --git a/x/operators/types/models.go b/x/operators/types/models.go index 93dce306..97c3dedd 100644 --- a/x/operators/types/models.go +++ b/x/operators/types/models.go @@ -8,6 +8,8 @@ import ( sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + + "github.com/milkyway-labs/milkyway/utils" ) // GetOperatorAddress generates an operator address from its id @@ -75,7 +77,7 @@ func (o *Operator) Validate() error { // GetSharesDenom returns the shares denom for an operator and token denom func (o Operator) GetSharesDenom(tokenDenom string) string { - return fmt.Sprintf("operator/%d/%s", o.ID, tokenDenom) + return utils.GetSharesDenomFromTokenDenom("operator", o.ID, tokenDenom) } // IsActive returns whether the operator is active. @@ -87,12 +89,12 @@ func (o Operator) IsActive() bool { // This can happen e.g. if Operator loses all tokens due to slashing. In this case, // make all future delegations invalid. func (o Operator) InvalidExRate() bool { - for _, token := range o.Tokens { - if token.IsZero() && o.DelegatorShares.AmountOf(token.Denom).IsPositive() { - return true - } - } - return false + return utils.IsInvalidExRate(o.Tokens, o.DelegatorShares) +} + +// TokensFromShares calculates the token worth of provided shares +func (o Operator) TokensFromShares(shares sdk.DecCoins) sdk.DecCoins { + return utils.ComputeTokensFromShares(shares, o.Tokens, o.DelegatorShares) } // SharesFromTokens returns the shares of a delegation given a bond amount. It @@ -101,38 +103,14 @@ func (o Operator) SharesFromTokens(tokens sdk.Coin) (sdkmath.LegacyDec, error) { if o.Tokens.IsZero() { return sdkmath.LegacyZeroDec(), ErrInsufficientShares } - - sharesDenom := o.GetSharesDenom(tokens.Denom) - delegatorTokenShares := o.DelegatorShares.AmountOf(sharesDenom) - operatorTokenAmount := o.Tokens.AmountOf(tokens.Denom) - - return delegatorTokenShares.MulInt(tokens.Amount).QuoInt(operatorTokenAmount), nil + return utils.SharesFromTokens(tokens, o.GetSharesDenom, o.Tokens, o.DelegatorShares) } // AddTokensFromDelegation adds the given amount of tokens to the operator's total tokens, // also updating the operator's delegator shares. // It returns the updated operator and the shares issued. func (o Operator) AddTokensFromDelegation(amount sdk.Coins) (Operator, sdk.DecCoins) { - // calculate the shares to issue - issuedShares := sdk.NewDecCoins() - for _, token := range amount { - var tokenShares sdk.DecCoin - sharesDenom := o.GetSharesDenom(token.Denom) - - delegatorShares := o.DelegatorShares.AmountOf(sharesDenom) - if delegatorShares.IsZero() { - // The first delegation to an operator sets the exchange rate to one - tokenShares = sdk.NewDecCoin(sharesDenom, token.Amount) - } else { - shares, err := o.SharesFromTokens(token) - if err != nil { - panic(err) - } - tokenShares = sdk.NewDecCoinFromDec(sharesDenom, shares) - } - - issuedShares = issuedShares.Add(tokenShares) - } + issuedShares := utils.IssueShares(amount, o.GetSharesDenom, o.Tokens, o.DelegatorShares) o.Tokens = o.Tokens.Add(amount...) o.DelegatorShares = o.DelegatorShares.Add(issuedShares...) diff --git a/x/operators/types/models_test.go b/x/operators/types/models_test.go index 4c58b43a..5e9099bf 100644 --- a/x/operators/types/models_test.go +++ b/x/operators/types/models_test.go @@ -3,12 +3,14 @@ package types_test import ( "testing" + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "github.com/milkyway-labs/milkyway/x/operators/types" ) -func TestParseServiceID(t *testing.T) { +func TestParseOperatorID(t *testing.T) { testCases := []struct { name string value string @@ -155,7 +157,7 @@ func TestOperator_Validate(t *testing.T) { } } -func TestService_Update(t *testing.T) { +func TestOperator_Update(t *testing.T) { testCases := []struct { name string operator types.Operator @@ -244,3 +246,91 @@ func TestService_Update(t *testing.T) { }) } } + +func TestOperator_SharesFromTokens(t *testing.T) { + testCases := []struct { + name string + operator types.Operator + tokens sdk.Coin + shouldErr bool + expShares sdkmath.LegacyDec + }{ + { + name: "operator with no delegation shares returns error", + operator: types.Operator{ + ID: 1, + Address: types.GetOperatorAddress(1).String(), + DelegatorShares: sdk.NewDecCoins(), + Tokens: sdk.NewCoins(), + }, + tokens: sdk.NewCoin("umilk", sdkmath.NewInt(100)), + shouldErr: true, + }, + { + name: "shares are computed properly for non empty operator", + operator: types.Operator{ + ID: 1, + Address: types.GetOperatorAddress(1).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(50)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operator/1/umilk", sdkmath.LegacyNewDec(100)), + ), + }, + tokens: sdk.NewCoin("umilk", sdkmath.NewInt(20)), + shouldErr: false, + expShares: sdkmath.LegacyNewDec(40), + }, + } + + for _, tc := range testCases { + tc := tc + t.Run(tc.name, func(t *testing.T) { + shares, err := tc.operator.SharesFromTokens(tc.tokens) + if tc.shouldErr { + require.Error(t, err) + } else { + require.NoError(t, err) + require.Equal(t, tc.expShares, shares) + } + }) + } +} + +func TestOperator_TokensFromShares(t *testing.T) { + testCases := []struct { + name string + operator types.Operator + shares sdk.DecCoins + expTokens sdk.DecCoins + }{ + { + name: "operator with shares returns correct amount", + operator: types.Operator{ + ID: 1, + Address: types.GetOperatorAddress(1).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(70)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operator/1/umilk", sdkmath.LegacyNewDec(140)), + ), + }, + shares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operator/1/umilk", sdkmath.LegacyNewDec(40)), + ), + expTokens: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("umilk", sdkmath.LegacyNewDec(20)), + ), + }, + } + + for _, tc := range testCases { + tc := tc + t.Run(tc.name, func(t *testing.T) { + tokens := tc.operator.TokensFromShares(tc.shares) + require.Equal(t, tc.expTokens, tokens) + }) + } +} diff --git a/x/pools/types/errors.go b/x/pools/types/errors.go index 7bf8a20f..0b6bbda2 100644 --- a/x/pools/types/errors.go +++ b/x/pools/types/errors.go @@ -2,9 +2,11 @@ package types import ( "cosmossdk.io/errors" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) var ( + ErrPoolNotFound = errors.Wrap(sdkerrors.ErrNotFound, "pool not found") ErrInvalidGenesis = errors.Register(ModuleName, 1, "invalid genesis state") ErrInsufficientShares = errors.Register(ModuleName, 2, "insufficient delegation shares") ) diff --git a/x/pools/types/models.go b/x/pools/types/models.go index a8699e3e..f7fb39e6 100644 --- a/x/pools/types/models.go +++ b/x/pools/types/models.go @@ -66,6 +66,11 @@ func (p Pool) InvalidExRate() bool { return p.Tokens.IsZero() && p.DelegatorShares.IsPositive() } +// TokensFromShares calculates the token worth of provided shares +func (p Pool) TokensFromShares(shares sdkmath.LegacyDec) sdkmath.LegacyDec { + return (shares.MulInt(p.Tokens)).Quo(p.DelegatorShares) +} + // SharesFromTokens returns the shares of a delegation given a bond amount. It // returns an error if the pool has no tokens. func (p Pool) SharesFromTokens(amt sdkmath.Int) (sdkmath.LegacyDec, error) { diff --git a/x/pools/types/query.pb.go b/x/pools/types/query.pb.go index a32595dc..649ffd4f 100644 --- a/x/pools/types/query.pb.go +++ b/x/pools/types/query.pb.go @@ -281,38 +281,38 @@ func init() { func init() { proto.RegisterFile("milkyway/pools/v1/query.proto", fileDescriptor_bb7667236b657a7d) } var fileDescriptor_bb7667236b657a7d = []byte{ - // 487 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x41, 0x6f, 0xd3, 0x30, - 0x14, 0xc7, 0xeb, 0x6d, 0x1d, 0xe0, 0x89, 0xc3, 0xac, 0x4a, 0x1d, 0x15, 0x64, 0x55, 0x34, 0xb6, - 0x69, 0x02, 0x5b, 0xd9, 0xbe, 0xc1, 0x84, 0x86, 0x7a, 0x1b, 0x39, 0xc2, 0x01, 0x39, 0x8b, 0x15, - 0x22, 0x92, 0xbc, 0x6c, 0x4e, 0x0b, 0xd1, 0xb4, 0x0b, 0x9c, 0x91, 0x10, 0xf0, 0xa1, 0x76, 0x9c, - 0xc4, 0x85, 0x13, 0x42, 0x2d, 0x1f, 0x04, 0xf9, 0xc5, 0xd9, 0x32, 0xb5, 0xb4, 0x3b, 0xa5, 0xd6, - 0xfb, 0xff, 0xff, 0xfe, 0xf5, 0xbd, 0x67, 0xfa, 0x24, 0x8d, 0x93, 0xf7, 0xe5, 0x07, 0x59, 0x8a, - 0x1c, 0x20, 0xd1, 0x62, 0xe4, 0x89, 0xd3, 0xa1, 0x3a, 0x2b, 0x79, 0x7e, 0x06, 0x05, 0xb0, 0xf5, - 0xba, 0xcc, 0xb1, 0xcc, 0x47, 0x5e, 0xaf, 0x13, 0x41, 0x04, 0x58, 0x15, 0xe6, 0x57, 0x25, 0xec, - 0x3d, 0x8e, 0x00, 0xa2, 0x44, 0x09, 0x99, 0xc7, 0x42, 0x66, 0x19, 0x14, 0xb2, 0x88, 0x21, 0xd3, - 0xb6, 0xba, 0x77, 0x02, 0x3a, 0x05, 0x2d, 0x02, 0xa9, 0x55, 0x95, 0x2f, 0x46, 0x5e, 0xa0, 0x0a, - 0xe9, 0x89, 0x5c, 0x46, 0x71, 0x86, 0x62, 0xab, 0x75, 0xa6, 0x89, 0x52, 0x08, 0x55, 0x62, 0xb3, - 0x5c, 0x41, 0x3b, 0xaf, 0x4c, 0xc2, 0x31, 0x40, 0x72, 0x58, 0x0e, 0x42, 0x5f, 0x9d, 0x0e, 0x95, - 0x2e, 0x58, 0x97, 0xde, 0x33, 0x86, 0xb7, 0x71, 0xb8, 0x41, 0xfa, 0x64, 0xf7, 0xa1, 0xbf, 0x6a, - 0x8e, 0x83, 0xd0, 0x15, 0xb4, 0xdb, 0x30, 0xbc, 0x50, 0x19, 0xa4, 0xb5, 0xa7, 0x43, 0xdb, 0xa1, - 0x39, 0xa3, 0xe3, 0x81, 0x5f, 0x1d, 0xdc, 0x23, 0xba, 0x7e, 0x6d, 0xf0, 0x95, 0xce, 0x21, 0xd3, - 0x8a, 0x79, 0x74, 0xc5, 0xe4, 0xa1, 0x72, 0x6d, 0xbf, 0xcb, 0xa7, 0x1a, 0xc3, 0x31, 0x7f, 0xe5, - 0xf2, 0xf7, 0x66, 0xcb, 0x47, 0xa9, 0xfb, 0xa6, 0x91, 0xa3, 0xeb, 0x2b, 0x8f, 0x28, 0xbd, 0xf9, - 0xcb, 0x36, 0x6d, 0x9b, 0x57, 0xfd, 0xe1, 0xa6, 0x3f, 0xbc, 0xea, 0xbf, 0xed, 0x0f, 0x3f, 0x96, - 0x91, 0xb2, 0x5e, 0xbf, 0xe1, 0x74, 0xbf, 0x11, 0xca, 0x9a, 0xe9, 0x16, 0xf3, 0x80, 0xb6, 0x11, - 0x68, 0x83, 0xf4, 0x97, 0x17, 0x73, 0x56, 0x5a, 0xf6, 0xf2, 0x16, 0xd3, 0x12, 0x32, 0xed, 0x2c, - 0x64, 0xaa, 0x6e, 0x6c, 0x42, 0xed, 0xff, 0x58, 0xa6, 0x6d, 0x84, 0x62, 0x9f, 0x09, 0xbd, 0x5f, - 0x4f, 0x88, 0xed, 0xcc, 0xa0, 0x98, 0x35, 0xc3, 0xde, 0xd6, 0x3c, 0x61, 0x7d, 0xa3, 0xbb, 0xfb, - 0xe9, 0xe7, 0xdf, 0xef, 0x4b, 0x2e, 0xeb, 0x8b, 0x5b, 0xab, 0x62, 0x36, 0x05, 0xbf, 0xe7, 0x76, - 0x0f, 0x2e, 0xd8, 0x17, 0x42, 0xd7, 0x1a, 0x63, 0x67, 0x7b, 0xf3, 0x41, 0x9a, 0xbb, 0x71, 0x47, - 0x96, 0x67, 0xc8, 0xb2, 0xcd, 0xb6, 0xfe, 0xc3, 0x82, 0x1b, 0x25, 0xce, 0xf1, 0x73, 0xc1, 0x86, - 0xb4, 0x8d, 0xe3, 0x62, 0x73, 0xc3, 0xeb, 0x5d, 0xe9, 0x3d, 0x5d, 0xa0, 0xb2, 0x0c, 0x9b, 0xc8, - 0xf0, 0x88, 0x75, 0x67, 0x33, 0xe8, 0xc3, 0xc1, 0xe5, 0xd8, 0x21, 0x57, 0x63, 0x87, 0xfc, 0x19, - 0x3b, 0xe4, 0xeb, 0xc4, 0x69, 0x5d, 0x4d, 0x9c, 0xd6, 0xaf, 0x89, 0xd3, 0x7a, 0x2d, 0xa2, 0xb8, - 0x78, 0x37, 0x0c, 0xf8, 0x09, 0xa4, 0xd7, 0xe6, 0xe7, 0x89, 0x0c, 0xf4, 0x4d, 0xd4, 0x47, 0xfb, - 0x0e, 0x8b, 0x32, 0x57, 0x3a, 0x58, 0xc5, 0x47, 0x78, 0xf0, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x0b, - 0x98, 0x79, 0xe5, 0x38, 0x04, 0x00, 0x00, + // 485 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x41, 0x6b, 0xd4, 0x40, + 0x14, 0xc7, 0x77, 0xda, 0x6e, 0xd5, 0x29, 0x1e, 0x3a, 0x2c, 0xec, 0x12, 0x34, 0x2e, 0xa1, 0x75, + 0x65, 0xa1, 0x33, 0xa4, 0xfd, 0x06, 0x45, 0x2a, 0x7b, 0xab, 0x39, 0xea, 0x41, 0x26, 0xcd, 0x10, + 0x83, 0x49, 0x5e, 0xda, 0xc9, 0x46, 0x43, 0xe9, 0x45, 0xf0, 0x2a, 0xa2, 0x17, 0x3f, 0x52, 0x8f, + 0x05, 0x2f, 0x9e, 0x44, 0x76, 0xfd, 0x20, 0x92, 0x97, 0x49, 0x1b, 0xd9, 0x76, 0xd7, 0xd3, 0xce, + 0xf0, 0xfe, 0xff, 0xff, 0xfc, 0xf6, 0xbd, 0x17, 0xfa, 0x38, 0x89, 0xe2, 0x77, 0xe5, 0x7b, 0x59, + 0x8a, 0x0c, 0x20, 0xd6, 0xa2, 0x70, 0xc5, 0xe9, 0x54, 0x9d, 0x95, 0x3c, 0x3b, 0x83, 0x1c, 0xd8, + 0x76, 0x53, 0xe6, 0x58, 0xe6, 0x85, 0x6b, 0xf5, 0x42, 0x08, 0x01, 0xab, 0xa2, 0x3a, 0xd5, 0x42, + 0xeb, 0x51, 0x08, 0x10, 0xc6, 0x4a, 0xc8, 0x2c, 0x12, 0x32, 0x4d, 0x21, 0x97, 0x79, 0x04, 0xa9, + 0x36, 0xd5, 0xf1, 0x09, 0xe8, 0x04, 0xb4, 0xf0, 0xa5, 0x56, 0x75, 0xbe, 0x28, 0x5c, 0x5f, 0xe5, + 0xd2, 0x15, 0x99, 0x0c, 0xa3, 0x14, 0xc5, 0x46, 0x6b, 0x2f, 0x12, 0x25, 0x10, 0xa8, 0xd8, 0x64, + 0x39, 0x82, 0xf6, 0x5e, 0x56, 0x09, 0xc7, 0x00, 0xf1, 0x61, 0x39, 0x09, 0x3c, 0x75, 0x3a, 0x55, + 0x3a, 0x67, 0x7d, 0x7a, 0xaf, 0x32, 0xbc, 0x89, 0x82, 0x01, 0x19, 0x92, 0x67, 0x0f, 0xbd, 0xcd, + 0xea, 0x3a, 0x09, 0x1c, 0x41, 0xfb, 0x2d, 0xc3, 0x73, 0x95, 0x42, 0xd2, 0x78, 0x7a, 0xb4, 0x1b, + 0x54, 0x77, 0x74, 0x3c, 0xf0, 0xea, 0x8b, 0x73, 0x44, 0xb7, 0xaf, 0x0d, 0x9e, 0xd2, 0x19, 0xa4, + 0x5a, 0x31, 0x97, 0x6e, 0x54, 0x79, 0xa8, 0xdc, 0xda, 0xef, 0xf3, 0x85, 0xc6, 0x70, 0xcc, 0xdf, + 0xb8, 0xfc, 0xf5, 0xa4, 0xe3, 0xa1, 0xd4, 0x79, 0xdd, 0xca, 0xd1, 0xcd, 0x93, 0x47, 0x94, 0xde, + 0xfc, 0x65, 0x93, 0xf6, 0x94, 0xd7, 0xfd, 0xe1, 0x55, 0x7f, 0x78, 0xdd, 0x7f, 0xd3, 0x1f, 0x7e, + 0x2c, 0x43, 0x65, 0xbc, 0x5e, 0xcb, 0xe9, 0x7c, 0x25, 0x94, 0xb5, 0xd3, 0x0d, 0xe6, 0x01, 0xed, + 0x22, 0xd0, 0x80, 0x0c, 0xd7, 0x57, 0x73, 0xd6, 0x5a, 0xf6, 0xe2, 0x1f, 0xa6, 0x35, 0x64, 0x1a, + 0xad, 0x64, 0xaa, 0x5f, 0x6c, 0x43, 0xed, 0x7f, 0x5f, 0xa7, 0x5d, 0x84, 0x62, 0x9f, 0x08, 0xbd, + 0xdf, 0x4c, 0x88, 0x8d, 0x6e, 0xa1, 0xb8, 0x6d, 0x86, 0xd6, 0xce, 0x32, 0x61, 0xf3, 0xa2, 0x33, + 0xfe, 0xf8, 0xe3, 0xcf, 0xb7, 0xb5, 0x1d, 0xe6, 0x88, 0xc5, 0x55, 0xa9, 0x0f, 0xe7, 0x66, 0x13, + 0x2e, 0xd8, 0x67, 0x42, 0xb7, 0x5a, 0x83, 0x67, 0xe3, 0xe5, 0x28, 0xed, 0xed, 0xf8, 0x4f, 0x9a, + 0x3d, 0xa4, 0x19, 0xb1, 0xdd, 0x3b, 0x68, 0x04, 0x2e, 0x95, 0x38, 0xc7, 0x9f, 0x0b, 0x56, 0xd0, + 0x2e, 0x4e, 0x8c, 0x2d, 0x4d, 0x6f, 0xd6, 0xc5, 0xda, 0x5d, 0xa1, 0x32, 0x10, 0x43, 0x84, 0xb0, + 0xd8, 0xe0, 0xae, 0x96, 0x1c, 0x4e, 0x2e, 0x67, 0x36, 0xb9, 0x9a, 0xd9, 0xe4, 0xf7, 0xcc, 0x26, + 0x5f, 0xe6, 0x76, 0xe7, 0x6a, 0x6e, 0x77, 0x7e, 0xce, 0xed, 0xce, 0x2b, 0x11, 0x46, 0xf9, 0xdb, + 0xa9, 0xcf, 0x4f, 0x20, 0xb9, 0x76, 0xef, 0xc5, 0xd2, 0xd7, 0x37, 0x59, 0x1f, 0x4c, 0x5a, 0x5e, + 0x66, 0x4a, 0xfb, 0x9b, 0xf8, 0x21, 0x1e, 0xfc, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x50, 0xc0, 0xb5, + 0xbf, 0x3c, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/pools/types/query.pb.gw.go b/x/pools/types/query.pb.gw.go index b9116fd2..29186236 100644 --- a/x/pools/types/query.pb.gw.go +++ b/x/pools/types/query.pb.gw.go @@ -357,11 +357,11 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_PoolById_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 1, 1, 0, 4, 1, 5, 3}, []string{"milkyway", "pool", "v1", "pool_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_PoolById_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 1, 1, 0, 4, 1, 5, 3}, []string{"milkyway", "pools", "v1", "pool_id"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_PoolByDenom_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 1, 2, 3, 1, 0, 4, 1, 5, 3}, []string{"milkyway", "pool", "v1", "denom"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_PoolByDenom_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 4}, []string{"milkyway", "pools", "v1", "pool", "denom"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_Pools_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"milkyway", "pool", "v1", "pools"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Pools_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 1}, []string{"milkyway", "pools", "v1"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( diff --git a/x/restaking/keeper/alias_functions.go b/x/restaking/keeper/alias_functions.go index 8b25557d..7c1cd66d 100644 --- a/x/restaking/keeper/alias_functions.go +++ b/x/restaking/keeper/alias_functions.go @@ -65,3 +65,35 @@ func (k *Keeper) GetPoolDelegations(ctx sdk.Context, poolID uint32) ([]types.Poo return delegations, nil } + +// -------------------------------------------------------------------------------------------------------------------- + +func (k *Keeper) GetAllOperatorDelegations(ctx sdk.Context) []types.OperatorDelegation { + store := ctx.KVStore(k.storeKey) + iterator := store.Iterator(types.OperatorDelegationPrefix, storetypes.PrefixEndBytes(types.OperatorDelegationPrefix)) + defer iterator.Close() + + var delegations []types.OperatorDelegation + for ; iterator.Valid(); iterator.Next() { + delegation := types.MustUnmarshalOperatorDelegation(k.cdc, iterator.Value()) + delegations = append(delegations, delegation) + } + + return delegations +} + +// -------------------------------------------------------------------------------------------------------------------- + +func (k *Keeper) GetAllServiceDelegations(ctx sdk.Context) []types.ServiceDelegation { + store := ctx.KVStore(k.storeKey) + iterator := store.Iterator(types.ServiceDelegationPrefix, storetypes.PrefixEndBytes(types.ServiceDelegationPrefix)) + defer iterator.Close() + + var delegations []types.ServiceDelegation + for ; iterator.Valid(); iterator.Next() { + delegation := types.MustUnmarshalServiceDelegation(k.cdc, iterator.Value()) + delegations = append(delegations, delegation) + } + + return delegations +} diff --git a/x/restaking/keeper/genesis.go b/x/restaking/keeper/genesis.go new file mode 100644 index 00000000..c555dd9b --- /dev/null +++ b/x/restaking/keeper/genesis.go @@ -0,0 +1,38 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/milkyway-labs/milkyway/x/restaking/types" +) + +// ExportGenesis returns a new GenesisState instance containing the information currently present inside the store +func (k *Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { + return types.NewGenesis( + k.GetAllPoolDelegations(ctx), + k.GetAllServiceDelegations(ctx), + k.GetAllOperatorDelegations(ctx), + k.GetParams(ctx), + ) +} + +// InitGenesis initializes the genesis store using the provided data +func (k *Keeper) InitGenesis(ctx sdk.Context, data *types.GenesisState) { + // Store the pools delegations + for _, delegation := range data.PoolsDelegations { + k.SavePoolDelegation(ctx, delegation) + } + + // Store the services delegations + for _, delegation := range data.ServicesDelegations { + k.SaveServiceDelegation(ctx, delegation) + } + + // Store the operators delegations + for _, delegation := range data.OperatorsDelegations { + k.SaveOperatorDelegation(ctx, delegation) + } + + // Store the params + k.SetParams(ctx, data.Params) +} diff --git a/x/restaking/keeper/genesis_test.go b/x/restaking/keeper/genesis_test.go new file mode 100644 index 00000000..23ecf1de --- /dev/null +++ b/x/restaking/keeper/genesis_test.go @@ -0,0 +1,280 @@ +package keeper_test + +import ( + "time" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/milkyway-labs/milkyway/x/restaking/types" +) + +func (suite *KeeperTestSuite) TestKeeper_ExportGenesis() { + testCases := []struct { + name string + setup func() + store func(ctx sdk.Context) + expGenesis *types.GenesisState + }{ + { + name: "pool delegations are exported properly", + store: func(ctx sdk.Context) { + suite.k.SetParams(ctx, types.DefaultParams()) + + suite.k.SavePoolDelegation(ctx, types.NewPoolDelegation( + 1, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdkmath.LegacyNewDec(100), + )) + suite.k.SavePoolDelegation(ctx, types.NewPoolDelegation( + 2, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdkmath.LegacyNewDec(200), + )) + }, + expGenesis: &types.GenesisState{ + Params: types.DefaultParams(), + PoolsDelegations: []types.PoolDelegation{ + types.NewPoolDelegation( + 1, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdkmath.LegacyNewDec(100), + ), + types.NewPoolDelegation( + 2, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdkmath.LegacyNewDec(200), + ), + }, + }, + }, + { + name: "service delegations are exported properly", + store: func(ctx sdk.Context) { + suite.k.SetParams(ctx, types.DefaultParams()) + + suite.k.SaveServiceDelegation(ctx, types.NewServiceDelegation( + 1, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(100)), + ), + )) + suite.k.SaveServiceDelegation(ctx, types.NewServiceDelegation( + 2, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/2/utia", sdkmath.LegacyNewDec(50)), + ), + )) + }, + expGenesis: &types.GenesisState{ + Params: types.DefaultParams(), + ServicesDelegations: []types.ServiceDelegation{ + types.NewServiceDelegation( + 1, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(100)), + ), + ), + types.NewServiceDelegation( + 2, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/2/utia", sdkmath.LegacyNewDec(50)), + ), + ), + }, + }, + }, + { + name: "operators delegations are exported properly", + store: func(ctx sdk.Context) { + suite.k.SetParams(ctx, types.DefaultParams()) + + suite.k.SaveOperatorDelegation(ctx, types.NewOperatorDelegation( + 1, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(100)), + ), + )) + suite.k.SaveOperatorDelegation(ctx, types.NewOperatorDelegation( + 2, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/2/utia", sdkmath.LegacyNewDec(50)), + ), + )) + }, + expGenesis: &types.GenesisState{ + Params: types.DefaultParams(), + OperatorsDelegations: []types.OperatorDelegation{ + types.NewOperatorDelegation( + 1, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(100)), + ), + ), + types.NewOperatorDelegation( + 2, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/2/utia", sdkmath.LegacyNewDec(50)), + ), + ), + }, + }, + }, + { + name: "params are exported properly", + store: func(ctx sdk.Context) { + suite.k.SetParams(ctx, types.NewParams( + 30*24*time.Hour, + )) + }, + expGenesis: &types.GenesisState{ + Params: types.NewParams( + 30 * 24 * time.Hour, + ), + }, + }, + } + + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + ctx, _ := suite.ctx.CacheContext() + if tc.setup != nil { + tc.setup() + } + if tc.store != nil { + tc.store(ctx) + } + + genesis := suite.k.ExportGenesis(ctx) + suite.Require().Equal(tc.expGenesis, genesis) + }) + } +} + +func (suite *KeeperTestSuite) TestKeeper_InitGenesis() { + testCases := []struct { + name string + genesis *types.GenesisState + check func(ctx sdk.Context) + }{ + { + name: "pool delegations are stored properly", + genesis: &types.GenesisState{ + Params: types.DefaultParams(), + PoolsDelegations: []types.PoolDelegation{ + types.NewPoolDelegation( + 1, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdkmath.LegacyNewDec(100), + ), + types.NewPoolDelegation( + 2, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdkmath.LegacyNewDec(200), + ), + }, + }, + check: func(ctx sdk.Context) { + _, pool1DelegationFound := suite.k.GetPoolDelegation(ctx, 1, "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4") + suite.Require().True(pool1DelegationFound) + + _, pool2DelegationFound := suite.k.GetPoolDelegation(ctx, 2, "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4") + suite.Require().True(pool2DelegationFound) + }, + }, + { + name: "services delegations are stored properly", + genesis: &types.GenesisState{ + Params: types.DefaultParams(), + ServicesDelegations: []types.ServiceDelegation{ + types.NewServiceDelegation( + 1, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(100)), + ), + ), + types.NewServiceDelegation( + 2, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/2/utia", sdkmath.LegacyNewDec(50)), + ), + ), + }, + }, + check: func(ctx sdk.Context) { + _, service1DelegationFound := suite.k.GetServiceDelegation(ctx, 1, "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4") + suite.Require().True(service1DelegationFound) + + _, service2DelegationFound := suite.k.GetServiceDelegation(ctx, 2, "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4") + suite.Require().True(service2DelegationFound) + }, + }, + { + name: "operators delegations are stored properly", + genesis: &types.GenesisState{ + Params: types.DefaultParams(), + OperatorsDelegations: []types.OperatorDelegation{ + types.NewOperatorDelegation( + 1, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(100)), + ), + ), + types.NewOperatorDelegation( + 2, + "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/2/utia", sdkmath.LegacyNewDec(50)), + ), + ), + }, + }, + check: func(ctx sdk.Context) { + _, operator1DelegationFound := suite.k.GetOperatorDelegation(ctx, 1, "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4") + suite.Require().True(operator1DelegationFound) + + _, operator2DelegationFound := suite.k.GetOperatorDelegation(ctx, 2, "cosmos167x6ehhple8gwz5ezy9x0464jltvdpzl6qfdt4") + suite.Require().True(operator2DelegationFound) + }, + }, + { + name: "params are stored properly", + genesis: &types.GenesisState{ + Params: types.NewParams( + 30 * 24 * time.Hour, + ), + }, + check: func(ctx sdk.Context) { + params := suite.k.GetParams(ctx) + suite.Require().Equal(types.NewParams( + 30*24*time.Hour, + ), params) + }, + }, + } + + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + ctx, _ := suite.ctx.CacheContext() + + suite.k.InitGenesis(ctx, tc.genesis) + + if tc.check != nil { + tc.check(ctx) + } + }) + } +} diff --git a/x/restaking/keeper/grpc_query.go b/x/restaking/keeper/grpc_query.go new file mode 100644 index 00000000..2e3ad038 --- /dev/null +++ b/x/restaking/keeper/grpc_query.go @@ -0,0 +1,658 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + operatorstypes "github.com/milkyway-labs/milkyway/x/operators/types" + poolstypes "github.com/milkyway-labs/milkyway/x/pools/types" + "github.com/milkyway-labs/milkyway/x/restaking/types" + servicestypes "github.com/milkyway-labs/milkyway/x/services/types" +) + +type Querier struct { + *Keeper +} + +var _ types.QueryServer = Querier{} + +func NewQuerier(keeper *Keeper) Querier { + return Querier{Keeper: keeper} +} + +// PoolDelegations queries the pool delegations for the given pool id +func (k Querier) PoolDelegations(goCtx context.Context, req *types.QueryPoolDelegationsRequest) (*types.QueryPoolDelegationsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + if req.PoolId == 0 { + return nil, status.Error(codes.InvalidArgument, "pool id cannot be 0") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + // Get the pool delegations store + store := ctx.KVStore(k.storeKey) + delegationsStore := prefix.NewStore(store, types.PoolDelegationPrefix) + + // Query the pool delegations for the given pool id + delegations, pageRes, err := query.GenericFilteredPaginate(k.cdc, delegationsStore, req.Pagination, func(key []byte, delegation *types.PoolDelegation) (*types.PoolDelegation, error) { + if delegation.PoolID != req.PoolId { + return nil, nil + } + return delegation, nil + }, func() *types.PoolDelegation { + return &types.PoolDelegation{} + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + poolDelegations := make([]types.PoolDelegationResponse, len(delegations)) + for i, delegation := range delegations { + response, err := PoolDelegationToPoolDelegationResponse(ctx, k.Keeper, *delegation) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + poolDelegations[i] = response + } + + return &types.QueryPoolDelegationsResponse{ + Delegations: poolDelegations, + Pagination: pageRes, + }, nil +} + +// PoolDelegation queries the pool delegation for the given pool id and user address +func (k Querier) PoolDelegation(goCtx context.Context, req *types.QueryPoolDelegationRequest) (*types.QueryPoolDelegationResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + if req.DelegatorAddress == "" { + return nil, status.Error(codes.InvalidArgument, "delegator address cannot be empty") + } + if req.PoolId == 0 { + return nil, status.Error(codes.InvalidArgument, "pool id cannot be zero") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + poolDelegation, found := k.GetPoolDelegation(ctx, req.PoolId, req.DelegatorAddress) + if !found { + return nil, status.Error(codes.NotFound, "pool delegation not found") + } + + response, err := PoolDelegationToPoolDelegationResponse(ctx, k.Keeper, poolDelegation) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryPoolDelegationResponse{ + Delegation: response, + }, nil +} + +// OperatorDelegations queries the operator delegations for the given operator id +func (k Querier) OperatorDelegations(goCtx context.Context, req *types.QueryOperatorDelegationsRequest) (*types.QueryOperatorDelegationsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + if req.OperatorId == 0 { + return nil, status.Error(codes.InvalidArgument, "operator id cannot be 0") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + // Get the operator delegations store + store := ctx.KVStore(k.storeKey) + delegationsStore := prefix.NewStore(store, types.OperatorDelegationPrefix) + + // Query the operator delegations for the given pool id + delegations, pageRes, err := query.GenericFilteredPaginate(k.cdc, delegationsStore, req.Pagination, func(key []byte, delegation *types.OperatorDelegation) (*types.OperatorDelegation, error) { + if delegation.OperatorID != req.OperatorId { + return nil, nil + } + return delegation, nil + }, func() *types.OperatorDelegation { + return &types.OperatorDelegation{} + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + operatorDelegations := make([]types.OperatorDelegationResponse, len(delegations)) + for i, delegation := range delegations { + response, err := OperatorDelegationToOperatorDelegationResponse(ctx, k.Keeper, *delegation) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + operatorDelegations[i] = response + } + + return &types.QueryOperatorDelegationsResponse{ + Delegations: operatorDelegations, + Pagination: pageRes, + }, nil +} + +// OperatorDelegation queries the operator delegation for the given operator id and user address +func (k Querier) OperatorDelegation(goCtx context.Context, req *types.QueryOperatorDelegationRequest) (*types.QueryOperatorDelegationResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + if req.DelegatorAddress == "" { + return nil, status.Error(codes.InvalidArgument, "delegator address cannot be empty") + } + if req.OperatorId == 0 { + return nil, status.Error(codes.InvalidArgument, "operator id cannot be zero") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + operatorDelegation, found := k.GetOperatorDelegation(ctx, req.OperatorId, req.DelegatorAddress) + if !found { + return nil, status.Error(codes.NotFound, "operator delegation not found") + } + + response, err := OperatorDelegationToOperatorDelegationResponse(ctx, k.Keeper, operatorDelegation) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryOperatorDelegationResponse{ + Delegation: response, + }, nil +} + +// ServiceDelegations queries the service delegations for the given service id +func (k Querier) ServiceDelegations(goCtx context.Context, req *types.QueryServiceDelegationsRequest) (*types.QueryServiceDelegationsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + if req.ServiceId == 0 { + return nil, status.Error(codes.InvalidArgument, "service id cannot be 0") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + // Get the service delegations store + store := ctx.KVStore(k.storeKey) + delegationsStore := prefix.NewStore(store, types.ServiceDelegationPrefix) + + // Query the service delegations for the given pool id + delegations, pageRes, err := query.GenericFilteredPaginate(k.cdc, delegationsStore, req.Pagination, func(key []byte, delegation *types.ServiceDelegation) (*types.ServiceDelegation, error) { + if delegation.ServiceID != req.ServiceId { + return nil, nil + } + return delegation, nil + }, func() *types.ServiceDelegation { + return &types.ServiceDelegation{} + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + serviceDelegationResponses := make([]types.ServiceDelegationResponse, len(delegations)) + for i, delegation := range delegations { + response, err := ServiceDelegationToServiceDelegationResponse(ctx, k.Keeper, *delegation) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + serviceDelegationResponses[i] = response + } + + return &types.QueryServiceDelegationsResponse{ + Delegations: serviceDelegationResponses, + Pagination: pageRes, + }, nil +} + +// ServiceDelegation queries the service delegation for the given service id and user address +func (k Querier) ServiceDelegation(goCtx context.Context, req *types.QueryServiceDelegationRequest) (*types.QueryServiceDelegationResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + if req.DelegatorAddress == "" { + return nil, status.Error(codes.InvalidArgument, "delegator address cannot be empty") + } + if req.ServiceId == 0 { + return nil, status.Error(codes.InvalidArgument, "service id cannot be zero") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + serviceDelegation, found := k.GetServiceDelegation(ctx, req.ServiceId, req.DelegatorAddress) + if !found { + return nil, status.Error(codes.NotFound, "pool delegation not found") + } + + response, err := ServiceDelegationToServiceDelegationResponse(ctx, k.Keeper, serviceDelegation) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryServiceDelegationResponse{ + Delegation: response, + }, nil +} + +// DelegatorPoolDelegations queries the pool delegations for the given delegator address +func (k Querier) DelegatorPoolDelegations(goCtx context.Context, req *types.QueryDelegatorPoolDelegationsRequest) (*types.QueryDelegatorPoolDelegationsResponse, error) { + if req == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + + if req.DelegatorAddress == "" { + return nil, status.Error(codes.InvalidArgument, "delegator address cannot be empty") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + // Get the user pool delegations store + store := ctx.KVStore(k.storeKey) + delStore := prefix.NewStore(store, types.UserPoolDelegationsStorePrefix(req.DelegatorAddress)) + + // Get the delegations + var delegations []types.PoolDelegation + pageRes, err := query.Paginate(delStore, req.Pagination, func(key []byte, value []byte) error { + delegation, err := types.UnmarshalPoolDelegation(k.cdc, value) + if err != nil { + return err + } + delegations = append(delegations, delegation) + return nil + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + delegationsResponses := make([]types.PoolDelegationResponse, len(delegations)) + for i, delegation := range delegations { + response, err := PoolDelegationToPoolDelegationResponse(ctx, k.Keeper, delegation) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + delegationsResponses[i] = response + } + + return &types.QueryDelegatorPoolDelegationsResponse{ + Delegations: delegationsResponses, + Pagination: pageRes, + }, nil +} + +// DelegatorOperatorDelegations queries the operator delegations for the given delegator address +func (k Querier) DelegatorOperatorDelegations(goCtx context.Context, req *types.QueryDelegatorOperatorDelegationsRequest) (*types.QueryDelegatorOperatorDelegationsResponse, error) { + if req == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + + if req.DelegatorAddress == "" { + return nil, status.Error(codes.InvalidArgument, "delegator address cannot be empty") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + // Get the user operator delegations store + store := ctx.KVStore(k.storeKey) + delStore := prefix.NewStore(store, types.UserOperatorDelegationsStorePrefix(req.DelegatorAddress)) + + // Get the delegations + var delegations []types.OperatorDelegation + pageRes, err := query.Paginate(delStore, req.Pagination, func(key []byte, value []byte) error { + delegation, err := types.UnmarshalOperatorDelegation(k.cdc, value) + if err != nil { + return err + } + delegations = append(delegations, delegation) + return nil + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + delegationsResponses := make([]types.OperatorDelegationResponse, len(delegations)) + for i, delegation := range delegations { + response, err := OperatorDelegationToOperatorDelegationResponse(ctx, k.Keeper, delegation) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + delegationsResponses[i] = response + } + + return &types.QueryDelegatorOperatorDelegationsResponse{ + Delegations: delegationsResponses, + Pagination: pageRes, + }, nil +} + +// DelegatorServiceDelegations queries the service delegations for the given delegator address +func (k Querier) DelegatorServiceDelegations(goCtx context.Context, req *types.QueryDelegatorServiceDelegationsRequest) (*types.QueryDelegatorServiceDelegationsResponse, error) { + if req == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + + if req.DelegatorAddress == "" { + return nil, status.Error(codes.InvalidArgument, "delegator address cannot be empty") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + // Get the user services delegations store + store := ctx.KVStore(k.storeKey) + delStore := prefix.NewStore(store, types.UserServiceDelegationsStorePrefix(req.DelegatorAddress)) + + // Get the delegations + var delegations []types.ServiceDelegation + pageRes, err := query.Paginate(delStore, req.Pagination, func(key []byte, value []byte) error { + delegation, err := types.UnmarshalServiceDelegation(k.cdc, value) + if err != nil { + return err + } + delegations = append(delegations, delegation) + return nil + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + delegationsResponses := make([]types.ServiceDelegationResponse, len(delegations)) + for i, delegation := range delegations { + response, err := ServiceDelegationToServiceDelegationResponse(ctx, k.Keeper, delegation) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + delegationsResponses[i] = response + } + + return &types.QueryDelegatorServiceDelegationsResponse{ + Delegations: delegationsResponses, + Pagination: pageRes, + }, nil +} + +// DelegatorPools queries the pools for the given delegator address +func (k Querier) DelegatorPools(goCtx context.Context, req *types.QueryDelegatorPoolsRequest) (*types.QueryDelegatorPoolsResponse, error) { + if req == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + + if req.DelegatorAddress == "" { + return nil, status.Error(codes.InvalidArgument, "delegator address cannot be empty") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + // Get the user pools delegations store + store := ctx.KVStore(k.storeKey) + delStore := prefix.NewStore(store, types.UserPoolDelegationsStorePrefix(req.DelegatorAddress)) + + // Get the pools + var pools []poolstypes.Pool + pageRes, err := query.Paginate(delStore, req.Pagination, func(key []byte, value []byte) error { + delegation, err := types.UnmarshalPoolDelegation(k.cdc, value) + if err != nil { + return err + } + + pool, found := k.poolsKeeper.GetPool(ctx, delegation.PoolID) + if !found { + return poolstypes.ErrPoolNotFound + } + + pools = append(pools, pool) + + return nil + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryDelegatorPoolsResponse{ + Pools: pools, + Pagination: pageRes, + }, nil +} + +// DelegatorPool queries the pool for the given delegator address and pool id +func (k Querier) DelegatorPool(goCtx context.Context, req *types.QueryDelegatorPoolRequest) (*types.QueryDelegatorPoolResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + if req.DelegatorAddress == "" { + return nil, status.Error(codes.InvalidArgument, "delegator address cannot be empty") + } + if req.PoolId == 0 { + return nil, status.Error(codes.InvalidArgument, "pool id cannot be zero") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + delegation, found := k.GetPoolDelegation(ctx, req.PoolId, req.DelegatorAddress) + if !found { + return nil, status.Error(codes.NotFound, "pool delegation not found") + } + + pool, found := k.poolsKeeper.GetPool(ctx, delegation.PoolID) + if !found { + return nil, status.Error(codes.NotFound, "pool not found") + } + + return &types.QueryDelegatorPoolResponse{ + Pool: pool, + }, nil +} + +// DelegatorOperators queries the operators for the given delegator address +func (k Querier) DelegatorOperators(goCtx context.Context, req *types.QueryDelegatorOperatorsRequest) (*types.QueryDelegatorOperatorsResponse, error) { + if req == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + + if req.DelegatorAddress == "" { + return nil, status.Error(codes.InvalidArgument, "delegator address cannot be empty") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + // Get the user operators delegations store + store := ctx.KVStore(k.storeKey) + delStore := prefix.NewStore(store, types.UserOperatorDelegationsStorePrefix(req.DelegatorAddress)) + + // Get the operators + var operators []operatorstypes.Operator + pageRes, err := query.Paginate(delStore, req.Pagination, func(key []byte, value []byte) error { + delegation, err := types.UnmarshalOperatorDelegation(k.cdc, value) + if err != nil { + return err + } + + operator, found := k.operatorsKeeper.GetOperator(ctx, delegation.OperatorID) + if !found { + return operatorstypes.ErrOperatorNotFound + } + + operators = append(operators, operator) + + return nil + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryDelegatorOperatorsResponse{ + Operators: operators, + Pagination: pageRes, + }, nil +} + +// DelegatorOperator queries the operator for the given delegator address and operator id +func (k Querier) DelegatorOperator(goCtx context.Context, req *types.QueryDelegatorOperatorRequest) (*types.QueryDelegatorOperatorResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + if req.DelegatorAddress == "" { + return nil, status.Error(codes.InvalidArgument, "delegator address cannot be empty") + } + if req.OperatorId == 0 { + return nil, status.Error(codes.InvalidArgument, "operator id cannot be zero") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + delegation, found := k.GetOperatorDelegation(ctx, req.OperatorId, req.DelegatorAddress) + if !found { + return nil, status.Error(codes.NotFound, "operator delegation not found") + } + + operator, found := k.operatorsKeeper.GetOperator(ctx, delegation.OperatorID) + if !found { + return nil, status.Error(codes.NotFound, "operator not found") + } + + return &types.QueryDelegatorOperatorResponse{ + Operator: operator, + }, nil +} + +// DelegatorServices queries the services for the given delegator address +func (k Querier) DelegatorServices(goCtx context.Context, req *types.QueryDelegatorServicesRequest) (*types.QueryDelegatorServicesResponse, error) { + if req == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + + if req.DelegatorAddress == "" { + return nil, status.Error(codes.InvalidArgument, "delegator address cannot be empty") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + // Get the user services delegations store + store := ctx.KVStore(k.storeKey) + delStore := prefix.NewStore(store, types.UserServiceDelegationsStorePrefix(req.DelegatorAddress)) + + // Get the services + var services []servicestypes.Service + pageRes, err := query.Paginate(delStore, req.Pagination, func(key []byte, value []byte) error { + delegation, err := types.UnmarshalServiceDelegation(k.cdc, value) + if err != nil { + return err + } + + pool, found := k.servicesKeeper.GetService(ctx, delegation.ServiceID) + if !found { + return servicestypes.ErrServiceNotFound + } + + services = append(services, pool) + + return nil + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryDelegatorServicesResponse{ + Services: services, + Pagination: pageRes, + }, nil +} + +// DelegatorService queries the service for the given delegator address and service id +func (k Querier) DelegatorService(goCtx context.Context, req *types.QueryDelegatorServiceRequest) (*types.QueryDelegatorServiceResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + if req.DelegatorAddress == "" { + return nil, status.Error(codes.InvalidArgument, "delegator address cannot be empty") + } + if req.ServiceId == 0 { + return nil, status.Error(codes.InvalidArgument, "service id cannot be zero") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + delegation, found := k.GetServiceDelegation(ctx, req.ServiceId, req.DelegatorAddress) + if !found { + return nil, status.Error(codes.NotFound, "service delegation not found") + } + + service, found := k.servicesKeeper.GetService(ctx, delegation.ServiceID) + if !found { + return nil, status.Error(codes.NotFound, "service not found") + } + + return &types.QueryDelegatorServiceResponse{ + Service: service, + }, nil +} + +// Params queries the restaking module parameters +func (k Querier) Params(goCtx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + params := k.GetParams(ctx) + return &types.QueryParamsResponse{Params: params}, nil +} + +// -------------------------------------------------------------------------------------------------------------------- + +// PoolDelegationToPoolDelegationResponse converts a PoolDelegation to a PoolDelegationResponse +func PoolDelegationToPoolDelegationResponse(ctx sdk.Context, k *Keeper, delegation types.PoolDelegation) (types.PoolDelegationResponse, error) { + pool, found := k.poolsKeeper.GetPool(ctx, delegation.PoolID) + if !found { + return types.PoolDelegationResponse{}, poolstypes.ErrPoolNotFound + } + + return types.NewPoolDelegationResponse( + pool.ID, + delegation.UserAddress, + delegation.Shares, + sdk.NewCoin(pool.Denom, pool.TokensFromShares(delegation.Shares).TruncateInt()), + ), nil +} + +// OperatorDelegationToOperatorDelegationResponse converts a OperatorDelegation to a OperatorDelegationResponse +func OperatorDelegationToOperatorDelegationResponse(ctx sdk.Context, k *Keeper, delegation types.OperatorDelegation) (types.OperatorDelegationResponse, error) { + operator, found := k.operatorsKeeper.GetOperator(ctx, delegation.OperatorID) + if !found { + return types.OperatorDelegationResponse{}, operatorstypes.ErrOperatorNotFound + } + + truncatedBalance, _ := operator.TokensFromShares(delegation.Shares).TruncateDecimal() + return types.NewOperatorDelegationResponse( + operator.ID, + delegation.UserAddress, + delegation.Shares, + truncatedBalance, + ), nil +} + +// ServiceDelegationToServiceDelegationResponse converts a ServiceDelegation to a ServiceDelegationResponse +func ServiceDelegationToServiceDelegationResponse(ctx sdk.Context, k *Keeper, delegation types.ServiceDelegation) (types.ServiceDelegationResponse, error) { + service, found := k.servicesKeeper.GetService(ctx, delegation.ServiceID) + if !found { + return types.ServiceDelegationResponse{}, servicestypes.ErrServiceNotFound + } + + truncatedBalance, _ := service.TokensFromShares(delegation.Shares).TruncateDecimal() + return types.NewServiceDelegationResponse( + service.ID, + delegation.UserAddress, + delegation.Shares, + truncatedBalance, + ), nil +} diff --git a/x/restaking/keeper/grpc_query_test.go b/x/restaking/keeper/grpc_query_test.go new file mode 100644 index 00000000..82e0d97f --- /dev/null +++ b/x/restaking/keeper/grpc_query_test.go @@ -0,0 +1,1747 @@ +package keeper_test + +import ( + "time" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" + + operatorstypes "github.com/milkyway-labs/milkyway/x/operators/types" + poolstypes "github.com/milkyway-labs/milkyway/x/pools/types" + "github.com/milkyway-labs/milkyway/x/restaking/keeper" + "github.com/milkyway-labs/milkyway/x/restaking/types" + servicestypes "github.com/milkyway-labs/milkyway/x/services/types" +) + +func (suite *KeeperTestSuite) TestQuerier_PoolDelegations() { + testCases := []struct { + name string + store func(ctx sdk.Context) + request *types.QueryPoolDelegationsRequest + shouldErr bool + expDelegations []types.PoolDelegationResponse + }{ + { + name: "query without pagination returns data properly", + store: func(ctx sdk.Context) { + err := suite.pk.SavePool(ctx, poolstypes.Pool{ + ID: 1, + Denom: "umilk", + Address: poolstypes.GetPoolAddress(1).String(), + Tokens: sdkmath.NewInt(150), + DelegatorShares: sdkmath.LegacyNewDec(150), + }) + suite.Require().NoError(err) + + suite.k.SavePoolDelegation(ctx, types.NewPoolDelegation( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdkmath.LegacyNewDec(50), + )) + suite.k.SavePoolDelegation(ctx, types.NewPoolDelegation( + 1, + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdkmath.LegacyNewDec(100), + )) + }, + request: types.NewQueryPoolDelegationsRequest(1, nil), + shouldErr: false, + expDelegations: []types.PoolDelegationResponse{ + types.NewPoolDelegationResponse( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdkmath.LegacyNewDec(50), + sdk.NewCoin("umilk", sdkmath.NewInt(50)), + ), + types.NewPoolDelegationResponse( + 1, + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdkmath.LegacyNewDec(100), + sdk.NewCoin("umilk", sdkmath.NewInt(100)), + ), + }, + }, + { + name: "query with pagination returns data properly", + store: func(ctx sdk.Context) { + err := suite.pk.SavePool(ctx, poolstypes.Pool{ + ID: 1, + Denom: "umilk", + Address: poolstypes.GetPoolAddress(1).String(), + Tokens: sdkmath.NewInt(150), + DelegatorShares: sdkmath.LegacyNewDec(150), + }) + suite.Require().NoError(err) + + suite.k.SavePoolDelegation(ctx, types.NewPoolDelegation( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdkmath.LegacyNewDec(50), + )) + suite.k.SavePoolDelegation(ctx, types.NewPoolDelegation( + 1, + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdkmath.LegacyNewDec(100), + )) + }, + request: types.NewQueryPoolDelegationsRequest(1, &query.PageRequest{ + Offset: 1, + Limit: 1, + }), + shouldErr: false, + expDelegations: []types.PoolDelegationResponse{ + types.NewPoolDelegationResponse( + 1, + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdkmath.LegacyNewDec(100), + sdk.NewCoin("umilk", sdkmath.NewInt(100)), + ), + }, + }, + } + + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) + } + + querier := keeper.NewQuerier(suite.k) + res, err := querier.PoolDelegations(sdk.WrapSDKContext(ctx), tc.request) + if tc.shouldErr { + suite.Require().Error(err) + } else { + suite.Require().NoError(err) + suite.Require().Equal(tc.expDelegations, res.Delegations) + } + }) + } +} + +func (suite *KeeperTestSuite) TestQuerier_PoolDelegation() { + testCases := []struct { + name string + store func(ctx sdk.Context) + request *types.QueryPoolDelegationRequest + shouldErr bool + expDelegation types.PoolDelegationResponse + }{ + { + name: "not found delegation returns error", + store: func(ctx sdk.Context) { + err := suite.pk.SavePool(ctx, poolstypes.Pool{ + ID: 1, + Denom: "umilk", + Address: poolstypes.GetPoolAddress(1).String(), + Tokens: sdkmath.NewInt(150), + DelegatorShares: sdkmath.LegacyNewDec(150), + }) + suite.Require().NoError(err) + }, + request: types.NewQueryPoolDelegationRequest( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + ), + shouldErr: true, + }, + { + name: "found delegation is returned properly", + store: func(ctx sdk.Context) { + err := suite.pk.SavePool(ctx, poolstypes.Pool{ + ID: 1, + Denom: "umilk", + Address: poolstypes.GetPoolAddress(1).String(), + Tokens: sdkmath.NewInt(150), + DelegatorShares: sdkmath.LegacyNewDec(150), + }) + suite.Require().NoError(err) + + suite.k.SavePoolDelegation(ctx, types.NewPoolDelegation( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdkmath.LegacyNewDec(50), + )) + }, + request: types.NewQueryPoolDelegationRequest( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + ), + shouldErr: false, + expDelegation: types.NewPoolDelegationResponse( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdkmath.LegacyNewDec(50), + sdk.NewCoin("umilk", sdkmath.NewInt(50)), + ), + }, + } + + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) + } + + querier := keeper.NewQuerier(suite.k) + res, err := querier.PoolDelegation(sdk.WrapSDKContext(ctx), tc.request) + if tc.shouldErr { + suite.Require().Error(err) + } else { + suite.Require().NoError(err) + suite.Require().Equal(tc.expDelegation, res.Delegation) + } + }) + } +} + +func (suite *KeeperTestSuite) TestQuerier_OperatorDelegations() { + testCases := []struct { + name string + store func(ctx sdk.Context) + request *types.QueryOperatorDelegationsRequest + shouldErr bool + expDelegations []types.OperatorDelegationResponse + }{ + { + name: "query without pagination returns data properly", + store: func(ctx sdk.Context) { + suite.ok.SaveOperator(ctx, operatorstypes.Operator{ + ID: 1, + Address: operatorstypes.GetOperatorAddress(1).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(150)), + ), + }) + + suite.k.SaveOperatorDelegation(ctx, types.NewOperatorDelegation( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(50)), + ), + )) + suite.k.SaveOperatorDelegation(ctx, types.NewOperatorDelegation( + 1, + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(100)), + ), + )) + }, + request: types.NewQueryOperatorDelegationsRequest(1, nil), + shouldErr: false, + expDelegations: []types.OperatorDelegationResponse{ + types.NewOperatorDelegationResponse( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(50)), + ), + sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(50)), + ), + ), + types.NewOperatorDelegationResponse( + 1, + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(100)), + ), + sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(100)), + ), + ), + }, + }, + { + name: "query with pagination returns data properly", + store: func(ctx sdk.Context) { + suite.ok.SaveOperator(ctx, operatorstypes.Operator{ + ID: 1, + Address: operatorstypes.GetOperatorAddress(1).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(150)), + ), + }) + + suite.k.SaveOperatorDelegation(ctx, types.NewOperatorDelegation( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(50)), + ), + )) + suite.k.SaveOperatorDelegation(ctx, types.NewOperatorDelegation( + 1, + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(100)), + ), + )) + }, + request: types.NewQueryOperatorDelegationsRequest(1, &query.PageRequest{ + Offset: 1, + Limit: 1, + }), + shouldErr: false, + expDelegations: []types.OperatorDelegationResponse{ + types.NewOperatorDelegationResponse( + 1, + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(100)), + ), + sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(100)), + ), + ), + }, + }, + } + + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) + } + + querier := keeper.NewQuerier(suite.k) + res, err := querier.OperatorDelegations(sdk.WrapSDKContext(ctx), tc.request) + if tc.shouldErr { + suite.Require().Error(err) + } else { + suite.Require().NoError(err) + suite.Require().Equal(tc.expDelegations, res.Delegations) + } + }) + } +} + +func (suite *KeeperTestSuite) TestQuerier_OperatorDelegation() { + testCases := []struct { + name string + store func(ctx sdk.Context) + request *types.QueryOperatorDelegationRequest + shouldErr bool + expDelegation types.OperatorDelegationResponse + }{ + { + name: "not found delegation returns error", + store: func(ctx sdk.Context) { + suite.ok.SaveOperator(ctx, operatorstypes.Operator{ + ID: 1, + Address: operatorstypes.GetOperatorAddress(1).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(150)), + ), + }) + }, + request: types.NewQueryOperatorDelegationRequest( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + ), + shouldErr: true, + }, + { + name: "found delegation is returned properly", + store: func(ctx sdk.Context) { + suite.ok.SaveOperator(ctx, operatorstypes.Operator{ + ID: 1, + Address: operatorstypes.GetOperatorAddress(1).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(150)), + ), + }) + + suite.k.SaveOperatorDelegation(ctx, types.NewOperatorDelegation( + 1, + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(100)), + ), + )) + }, + request: types.NewQueryOperatorDelegationRequest( + 1, + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + ), + shouldErr: false, + expDelegation: types.NewOperatorDelegationResponse( + 1, + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(100)), + ), + sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(100)), + ), + ), + }, + } + + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) + } + + querier := keeper.NewQuerier(suite.k) + res, err := querier.OperatorDelegation(sdk.WrapSDKContext(ctx), tc.request) + if tc.shouldErr { + suite.Require().Error(err) + } else { + suite.Require().NoError(err) + suite.Require().Equal(tc.expDelegation, res.Delegation) + } + }) + } +} + +func (suite *KeeperTestSuite) TestQuerier_ServiceDelegations() { + testCases := []struct { + name string + store func(ctx sdk.Context) + request *types.QueryServiceDelegationsRequest + shouldErr bool + expDelegations []types.ServiceDelegationResponse + }{ + { + name: "query without pagination returns data properly", + store: func(ctx sdk.Context) { + suite.sk.SaveService(ctx, servicestypes.Service{ + ID: 1, + Address: servicestypes.GetServiceAddress(1).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(150)), + ), + }) + + suite.k.SaveServiceDelegation(ctx, types.NewServiceDelegation( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(50)), + ), + )) + suite.k.SaveServiceDelegation(ctx, types.NewServiceDelegation( + 1, + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(100)), + ), + )) + }, + request: types.NewQueryServiceDelegationsRequest(1, nil), + shouldErr: false, + expDelegations: []types.ServiceDelegationResponse{ + types.NewServiceDelegationResponse( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(50)), + ), + sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(50)), + ), + ), + types.NewServiceDelegationResponse( + 1, + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(100)), + ), + sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(100)), + ), + ), + }, + }, + { + name: "query with pagination returns data properly", + store: func(ctx sdk.Context) { + suite.sk.SaveService(ctx, servicestypes.Service{ + ID: 1, + Address: servicestypes.GetServiceAddress(1).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(150)), + ), + }) + + suite.k.SaveServiceDelegation(ctx, types.NewServiceDelegation( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(50)), + ), + )) + suite.k.SaveServiceDelegation(ctx, types.NewServiceDelegation( + 1, + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(100)), + ), + )) + }, + request: types.NewQueryServiceDelegationsRequest(1, &query.PageRequest{ + Offset: 1, + Limit: 1, + }), + shouldErr: false, + expDelegations: []types.ServiceDelegationResponse{ + types.NewServiceDelegationResponse( + 1, + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(100)), + ), + sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(100)), + ), + ), + }, + }, + } + + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) + } + + querier := keeper.NewQuerier(suite.k) + res, err := querier.ServiceDelegations(sdk.WrapSDKContext(ctx), tc.request) + if tc.shouldErr { + suite.Require().Error(err) + } else { + suite.Require().NoError(err) + suite.Require().Equal(tc.expDelegations, res.Delegations) + } + }) + } +} + +func (suite *KeeperTestSuite) TestQuerier_ServiceDelegation() { + testCases := []struct { + name string + store func(ctx sdk.Context) + request *types.QueryServiceDelegationRequest + shouldErr bool + expDelegation types.ServiceDelegationResponse + }{ + { + name: "not found delegation returns error", + store: func(ctx sdk.Context) { + suite.sk.SaveService(ctx, servicestypes.Service{ + ID: 1, + Address: servicestypes.GetServiceAddress(1).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(150)), + ), + }) + }, + request: types.NewQueryServiceDelegationRequest( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + ), + shouldErr: true, + }, + { + name: "found delegation is returned properly", + store: func(ctx sdk.Context) { + suite.sk.SaveService(ctx, servicestypes.Service{ + ID: 1, + Address: servicestypes.GetServiceAddress(1).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(150)), + ), + }) + + suite.k.SaveServiceDelegation(ctx, types.NewServiceDelegation( + 1, + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(100)), + ), + )) + }, + request: types.NewQueryServiceDelegationRequest( + 1, + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + ), + shouldErr: false, + expDelegation: types.NewServiceDelegationResponse( + 1, + "cosmos1d03wa9qd8flfjtvldndw5csv94tvg5hzfcmcgn", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(100)), + ), + sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(100)), + ), + ), + }, + } + + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) + } + + querier := keeper.NewQuerier(suite.k) + res, err := querier.ServiceDelegation(sdk.WrapSDKContext(ctx), tc.request) + if tc.shouldErr { + suite.Require().Error(err) + } else { + suite.Require().NoError(err) + suite.Require().Equal(tc.expDelegation, res.Delegation) + } + }) + } +} + +func (suite *KeeperTestSuite) TestQuerier_DelegatorPoolDelegations() { + testCases := []struct { + name string + store func(ctx sdk.Context) + request *types.QueryDelegatorPoolDelegationsRequest + shouldErr bool + expDelegations []types.PoolDelegationResponse + }{ + { + name: "query without pagination returns data properly", + store: func(ctx sdk.Context) { + err := suite.pk.SavePool(ctx, poolstypes.Pool{ + ID: 1, + Denom: "umilk", + Address: poolstypes.GetPoolAddress(1).String(), + Tokens: sdkmath.NewInt(150), + DelegatorShares: sdkmath.LegacyNewDec(150), + }) + suite.Require().NoError(err) + + err = suite.pk.SavePool(ctx, poolstypes.Pool{ + ID: 2, + Denom: "utia", + Address: poolstypes.GetPoolAddress(2).String(), + Tokens: sdkmath.NewInt(100), + DelegatorShares: sdkmath.LegacyNewDec(100), + }) + suite.Require().NoError(err) + + suite.k.SavePoolDelegation(ctx, types.NewPoolDelegation( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdkmath.LegacyNewDec(50), + )) + suite.k.SavePoolDelegation(ctx, types.NewPoolDelegation( + 2, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdkmath.LegacyNewDec(100), + )) + }, + request: types.NewQueryDelegatorPoolDelegationsRequest("cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", nil), + shouldErr: false, + expDelegations: []types.PoolDelegationResponse{ + types.NewPoolDelegationResponse( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdkmath.LegacyNewDec(50), + sdk.NewCoin("umilk", sdkmath.NewInt(50)), + ), + types.NewPoolDelegationResponse( + 2, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdkmath.LegacyNewDec(100), + sdk.NewCoin("utia", sdkmath.NewInt(100)), + ), + }, + }, + { + name: "query with pagination returns data properly", + store: func(ctx sdk.Context) { + err := suite.pk.SavePool(ctx, poolstypes.Pool{ + ID: 1, + Denom: "umilk", + Address: poolstypes.GetPoolAddress(1).String(), + Tokens: sdkmath.NewInt(150), + DelegatorShares: sdkmath.LegacyNewDec(150), + }) + suite.Require().NoError(err) + + err = suite.pk.SavePool(ctx, poolstypes.Pool{ + ID: 2, + Denom: "utia", + Address: poolstypes.GetPoolAddress(2).String(), + Tokens: sdkmath.NewInt(100), + DelegatorShares: sdkmath.LegacyNewDec(100), + }) + suite.Require().NoError(err) + + suite.k.SavePoolDelegation(ctx, types.NewPoolDelegation( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdkmath.LegacyNewDec(50), + )) + suite.k.SavePoolDelegation(ctx, types.NewPoolDelegation( + 2, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdkmath.LegacyNewDec(100), + )) + }, + request: types.NewQueryDelegatorPoolDelegationsRequest("cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", &query.PageRequest{ + Offset: 1, + Limit: 1, + }), + shouldErr: false, + expDelegations: []types.PoolDelegationResponse{ + types.NewPoolDelegationResponse( + 2, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdkmath.LegacyNewDec(100), + sdk.NewCoin("utia", sdkmath.NewInt(100)), + ), + }, + }, + } + + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) + } + + querier := keeper.NewQuerier(suite.k) + res, err := querier.DelegatorPoolDelegations(sdk.WrapSDKContext(ctx), tc.request) + if tc.shouldErr { + suite.Require().Error(err) + } else { + suite.Require().NoError(err) + suite.Require().Equal(tc.expDelegations, res.Delegations) + } + }) + } +} + +func (suite *KeeperTestSuite) TestQuerier_DelegatorOperatorDelegations() { + testCases := []struct { + name string + store func(ctx sdk.Context) + request *types.QueryDelegatorOperatorDelegationsRequest + shouldErr bool + expDelegations []types.OperatorDelegationResponse + }{ + { + name: "query without pagination returns data properly", + store: func(ctx sdk.Context) { + suite.ok.SaveOperator(ctx, operatorstypes.Operator{ + ID: 1, + Address: operatorstypes.GetOperatorAddress(1).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(150)), + ), + }) + + suite.ok.SaveOperator(ctx, operatorstypes.Operator{ + ID: 2, + Address: operatorstypes.GetOperatorAddress(2).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("utia", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/2/utia", sdkmath.LegacyNewDec(150)), + ), + }) + + suite.k.SaveOperatorDelegation(ctx, types.NewOperatorDelegation( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(50)), + ), + )) + suite.k.SaveOperatorDelegation(ctx, types.NewOperatorDelegation( + 2, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/2/utia", sdkmath.LegacyNewDec(100)), + ), + )) + }, + request: types.NewQueryDelegatorOperatorDelegationsRequest("cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", nil), + shouldErr: false, + expDelegations: []types.OperatorDelegationResponse{ + types.NewOperatorDelegationResponse( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(50)), + ), + sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(50)), + ), + ), + types.NewOperatorDelegationResponse( + 2, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/2/utia", sdkmath.LegacyNewDec(100)), + ), + sdk.NewCoins( + sdk.NewCoin("utia", sdkmath.NewInt(100)), + ), + ), + }, + }, + { + name: "query with pagination returns data properly", + store: func(ctx sdk.Context) { + suite.ok.SaveOperator(ctx, operatorstypes.Operator{ + ID: 1, + Address: operatorstypes.GetOperatorAddress(1).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(150)), + ), + }) + + suite.ok.SaveOperator(ctx, operatorstypes.Operator{ + ID: 2, + Address: operatorstypes.GetOperatorAddress(2).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("utia", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/2/utia", sdkmath.LegacyNewDec(150)), + ), + }) + + suite.k.SaveOperatorDelegation(ctx, types.NewOperatorDelegation( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(50)), + ), + )) + suite.k.SaveOperatorDelegation(ctx, types.NewOperatorDelegation( + 2, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/2/utia", sdkmath.LegacyNewDec(100)), + ), + )) + }, + request: types.NewQueryDelegatorOperatorDelegationsRequest("cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", &query.PageRequest{ + Offset: 1, + Limit: 1, + }), + shouldErr: false, + expDelegations: []types.OperatorDelegationResponse{ + types.NewOperatorDelegationResponse( + 2, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/2/utia", sdkmath.LegacyNewDec(100)), + ), + sdk.NewCoins( + sdk.NewCoin("utia", sdkmath.NewInt(100)), + ), + ), + }, + }, + } + + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) + } + + querier := keeper.NewQuerier(suite.k) + res, err := querier.DelegatorOperatorDelegations(sdk.WrapSDKContext(ctx), tc.request) + if tc.shouldErr { + suite.Require().Error(err) + } else { + suite.Require().NoError(err) + suite.Require().Equal(tc.expDelegations, res.Delegations) + } + }) + } +} + +func (suite *KeeperTestSuite) TestQuerier_DelegatorServiceDelegations() { + testCases := []struct { + name string + store func(ctx sdk.Context) + request *types.QueryDelegatorServiceDelegationsRequest + shouldErr bool + expDelegations []types.ServiceDelegationResponse + }{ + { + name: "query without pagination returns data properly", + store: func(ctx sdk.Context) { + suite.sk.SaveService(ctx, servicestypes.Service{ + ID: 1, + Address: servicestypes.GetServiceAddress(1).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(150)), + ), + }) + + suite.sk.SaveService(ctx, servicestypes.Service{ + ID: 2, + Address: servicestypes.GetServiceAddress(2).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("utia", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/2/utia", sdkmath.LegacyNewDec(150)), + ), + }) + + suite.k.SaveServiceDelegation(ctx, types.NewServiceDelegation( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(50)), + ), + )) + suite.k.SaveServiceDelegation(ctx, types.NewServiceDelegation( + 2, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/2/utia", sdkmath.LegacyNewDec(100)), + ), + )) + }, + request: types.NewQueryDelegatorServiceDelegationsRequest("cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", nil), + shouldErr: false, + expDelegations: []types.ServiceDelegationResponse{ + types.NewServiceDelegationResponse( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(50)), + ), + sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(50)), + ), + ), + types.NewServiceDelegationResponse( + 2, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/2/utia", sdkmath.LegacyNewDec(100)), + ), + sdk.NewCoins( + sdk.NewCoin("utia", sdkmath.NewInt(100)), + ), + ), + }, + }, + { + name: "query with pagination returns data properly", + store: func(ctx sdk.Context) { + suite.sk.SaveService(ctx, servicestypes.Service{ + ID: 1, + Address: servicestypes.GetServiceAddress(1).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(150)), + ), + }) + + suite.sk.SaveService(ctx, servicestypes.Service{ + ID: 2, + Address: servicestypes.GetServiceAddress(2).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("utia", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/2/utia", sdkmath.LegacyNewDec(150)), + ), + }) + + suite.k.SaveServiceDelegation(ctx, types.NewServiceDelegation( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(50)), + ), + )) + suite.k.SaveServiceDelegation(ctx, types.NewServiceDelegation( + 2, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/2/utia", sdkmath.LegacyNewDec(100)), + ), + )) + }, + request: types.NewQueryDelegatorServiceDelegationsRequest("cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", &query.PageRequest{ + Offset: 1, + Limit: 1, + }), + shouldErr: false, + expDelegations: []types.ServiceDelegationResponse{ + types.NewServiceDelegationResponse( + 2, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/2/utia", sdkmath.LegacyNewDec(100)), + ), + sdk.NewCoins( + sdk.NewCoin("utia", sdkmath.NewInt(100)), + ), + ), + }, + }, + } + + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) + } + + querier := keeper.NewQuerier(suite.k) + res, err := querier.DelegatorServiceDelegations(sdk.WrapSDKContext(ctx), tc.request) + if tc.shouldErr { + suite.Require().Error(err) + } else { + suite.Require().NoError(err) + suite.Require().Equal(tc.expDelegations, res.Delegations) + } + }) + } +} + +func (suite *KeeperTestSuite) TestQuerier_DelegatorPools() { + testCases := []struct { + name string + store func(ctx sdk.Context) + request *types.QueryDelegatorPoolsRequest + shouldErr bool + expPools []poolstypes.Pool + }{ + { + name: "query without pagination returns data properly", + store: func(ctx sdk.Context) { + err := suite.pk.SavePool(ctx, poolstypes.Pool{ + ID: 1, + Denom: "umilk", + Address: poolstypes.GetPoolAddress(1).String(), + Tokens: sdkmath.NewInt(150), + DelegatorShares: sdkmath.LegacyNewDec(150), + }) + suite.Require().NoError(err) + + err = suite.pk.SavePool(ctx, poolstypes.Pool{ + ID: 2, + Denom: "utia", + Address: poolstypes.GetPoolAddress(2).String(), + Tokens: sdkmath.NewInt(100), + DelegatorShares: sdkmath.LegacyNewDec(100), + }) + suite.Require().NoError(err) + + suite.k.SavePoolDelegation(ctx, types.NewPoolDelegation( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdkmath.LegacyNewDec(50), + )) + suite.k.SavePoolDelegation(ctx, types.NewPoolDelegation( + 2, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdkmath.LegacyNewDec(100), + )) + }, + request: types.NewQueryDelegatorPoolsRequest("cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", nil), + shouldErr: false, + expPools: []poolstypes.Pool{ + { + ID: 1, + Denom: "umilk", + Address: poolstypes.GetPoolAddress(1).String(), + Tokens: sdkmath.NewInt(150), + DelegatorShares: sdkmath.LegacyNewDec(150), + }, + { + ID: 2, + Denom: "utia", + Address: poolstypes.GetPoolAddress(2).String(), + Tokens: sdkmath.NewInt(100), + DelegatorShares: sdkmath.LegacyNewDec(100), + }, + }, + }, + { + name: "query with pagination returns data properly", + store: func(ctx sdk.Context) { + err := suite.pk.SavePool(ctx, poolstypes.Pool{ + ID: 1, + Denom: "umilk", + Address: poolstypes.GetPoolAddress(1).String(), + Tokens: sdkmath.NewInt(150), + DelegatorShares: sdkmath.LegacyNewDec(150), + }) + suite.Require().NoError(err) + + err = suite.pk.SavePool(ctx, poolstypes.Pool{ + ID: 2, + Denom: "utia", + Address: poolstypes.GetPoolAddress(2).String(), + Tokens: sdkmath.NewInt(100), + DelegatorShares: sdkmath.LegacyNewDec(100), + }) + suite.Require().NoError(err) + + suite.k.SavePoolDelegation(ctx, types.NewPoolDelegation( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdkmath.LegacyNewDec(50), + )) + suite.k.SavePoolDelegation(ctx, types.NewPoolDelegation( + 2, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdkmath.LegacyNewDec(100), + )) + }, + request: types.NewQueryDelegatorPoolsRequest("cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", &query.PageRequest{ + Offset: 1, + Limit: 1, + }), + shouldErr: false, + expPools: []poolstypes.Pool{ + { + ID: 2, + Denom: "utia", + Address: poolstypes.GetPoolAddress(2).String(), + Tokens: sdkmath.NewInt(100), + DelegatorShares: sdkmath.LegacyNewDec(100), + }, + }, + }, + } + + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) + } + + querier := keeper.NewQuerier(suite.k) + res, err := querier.DelegatorPools(sdk.WrapSDKContext(ctx), tc.request) + if tc.shouldErr { + suite.Require().Error(err) + } else { + suite.Require().NoError(err) + suite.Require().Equal(tc.expPools, res.Pools) + } + }) + } +} + +func (suite *KeeperTestSuite) TestQuerier_DelegatorPool() { + testCases := []struct { + name string + store func(ctx sdk.Context) + request *types.QueryDelegatorPoolRequest + shouldErr bool + expPool poolstypes.Pool + }{ + { + name: "non existing pool returns error", + request: types.NewQueryDelegatorPoolRequest("cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", 1), + shouldErr: true, + }, + { + name: "existing pool is returned properly", + store: func(ctx sdk.Context) { + err := suite.pk.SavePool(ctx, poolstypes.Pool{ + ID: 1, + Denom: "umilk", + Address: poolstypes.GetPoolAddress(1).String(), + Tokens: sdkmath.NewInt(150), + DelegatorShares: sdkmath.LegacyNewDec(150), + }) + suite.Require().NoError(err) + + suite.k.SavePoolDelegation(ctx, types.NewPoolDelegation( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdkmath.LegacyNewDec(50), + )) + }, + request: types.NewQueryDelegatorPoolRequest("cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", 1), + shouldErr: false, + expPool: poolstypes.Pool{ + ID: 1, + Denom: "umilk", + Address: poolstypes.GetPoolAddress(1).String(), + Tokens: sdkmath.NewInt(150), + DelegatorShares: sdkmath.LegacyNewDec(150), + }, + }, + } + + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) + } + + querier := keeper.NewQuerier(suite.k) + res, err := querier.DelegatorPool(sdk.WrapSDKContext(ctx), tc.request) + if tc.shouldErr { + suite.Require().Error(err) + } else { + suite.Require().NoError(err) + suite.Require().Equal(tc.expPool, res.Pool) + } + }) + } +} + +func (suite *KeeperTestSuite) TestQuerier_DelegatorOperators() { + testCases := []struct { + name string + store func(ctx sdk.Context) + request *types.QueryDelegatorOperatorsRequest + shouldErr bool + expOperators []operatorstypes.Operator + }{ + { + name: "query without pagination returns data properly", + store: func(ctx sdk.Context) { + suite.ok.SaveOperator(ctx, operatorstypes.Operator{ + ID: 1, + Address: operatorstypes.GetOperatorAddress(1).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(150)), + ), + }) + + suite.ok.SaveOperator(ctx, operatorstypes.Operator{ + ID: 2, + Address: operatorstypes.GetOperatorAddress(2).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("utia", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/2/utia", sdkmath.LegacyNewDec(150)), + ), + }) + + suite.k.SaveOperatorDelegation(ctx, types.NewOperatorDelegation( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(50)), + ), + )) + suite.k.SaveOperatorDelegation(ctx, types.NewOperatorDelegation( + 2, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/2/utia", sdkmath.LegacyNewDec(100)), + ), + )) + }, + request: types.NewQueryDelegatorOperatorsRequest("cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", nil), + shouldErr: false, + expOperators: []operatorstypes.Operator{ + { + ID: 1, + Address: operatorstypes.GetOperatorAddress(1).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(150)), + ), + }, + { + ID: 2, + Address: operatorstypes.GetOperatorAddress(2).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("utia", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/2/utia", sdkmath.LegacyNewDec(150)), + ), + }, + }, + }, + { + name: "query with pagination returns data properly", + store: func(ctx sdk.Context) { + suite.ok.SaveOperator(ctx, operatorstypes.Operator{ + ID: 1, + Address: operatorstypes.GetOperatorAddress(1).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(150)), + ), + }) + + suite.ok.SaveOperator(ctx, operatorstypes.Operator{ + ID: 2, + Address: operatorstypes.GetOperatorAddress(2).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("utia", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/2/utia", sdkmath.LegacyNewDec(150)), + ), + }) + + suite.k.SaveOperatorDelegation(ctx, types.NewOperatorDelegation( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(50)), + ), + )) + suite.k.SaveOperatorDelegation(ctx, types.NewOperatorDelegation( + 2, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/2/utia", sdkmath.LegacyNewDec(100)), + ), + )) + }, + request: types.NewQueryDelegatorOperatorsRequest("cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", &query.PageRequest{ + Offset: 1, + Limit: 1, + }), + shouldErr: false, + expOperators: []operatorstypes.Operator{ + { + ID: 2, + Address: operatorstypes.GetOperatorAddress(2).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("utia", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/2/utia", sdkmath.LegacyNewDec(150)), + ), + }, + }, + }, + } + + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) + } + + querier := keeper.NewQuerier(suite.k) + res, err := querier.DelegatorOperators(sdk.WrapSDKContext(ctx), tc.request) + if tc.shouldErr { + suite.Require().Error(err) + } else { + suite.Require().NoError(err) + suite.Require().Equal(tc.expOperators, res.Operators) + } + }) + } +} + +func (suite *KeeperTestSuite) TestQuerier_DelegatorOperator() { + testCases := []struct { + name string + store func(ctx sdk.Context) + request *types.QueryDelegatorOperatorRequest + shouldErr bool + expOperator operatorstypes.Operator + }{ + { + name: "non existing operator returns error", + request: types.NewQueryDelegatorOperatorRequest("cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", 1), + shouldErr: true, + }, + { + name: "existing operator is returned properly", + store: func(ctx sdk.Context) { + suite.ok.SaveOperator(ctx, operatorstypes.Operator{ + ID: 1, + Address: operatorstypes.GetOperatorAddress(1).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(150)), + ), + }) + + suite.k.SaveOperatorDelegation(ctx, types.NewOperatorDelegation( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(50)), + ), + )) + }, + request: types.NewQueryDelegatorOperatorRequest("cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", 1), + shouldErr: false, + expOperator: operatorstypes.Operator{ + + ID: 1, + Address: operatorstypes.GetOperatorAddress(1).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("operators/1/umilk", sdkmath.LegacyNewDec(150)), + ), + }, + }, + } + + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) + } + + querier := keeper.NewQuerier(suite.k) + res, err := querier.DelegatorOperator(sdk.WrapSDKContext(ctx), tc.request) + if tc.shouldErr { + suite.Require().Error(err) + } else { + suite.Require().NoError(err) + suite.Require().Equal(tc.expOperator, res.Operator) + } + }) + } +} + +func (suite *KeeperTestSuite) TestQuerier_DelegatorServices() { + testCases := []struct { + name string + store func(ctx sdk.Context) + request *types.QueryDelegatorServicesRequest + shouldErr bool + expServices []servicestypes.Service + }{ + { + name: "query without pagination returns data properly", + store: func(ctx sdk.Context) { + suite.sk.SaveService(ctx, servicestypes.Service{ + ID: 1, + Address: servicestypes.GetServiceAddress(1).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(150)), + ), + }) + + suite.sk.SaveService(ctx, servicestypes.Service{ + ID: 2, + Address: servicestypes.GetServiceAddress(2).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("utia", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/2/utia", sdkmath.LegacyNewDec(150)), + ), + }) + + suite.k.SaveServiceDelegation(ctx, types.NewServiceDelegation( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(50)), + ), + )) + suite.k.SaveServiceDelegation(ctx, types.NewServiceDelegation( + 2, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/2/utia", sdkmath.LegacyNewDec(100)), + ), + )) + }, + request: types.NewQueryDelegatorServicesRequest("cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", nil), + shouldErr: false, + expServices: []servicestypes.Service{ + { + ID: 1, + Address: servicestypes.GetServiceAddress(1).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(150)), + ), + }, + { + ID: 2, + Address: servicestypes.GetServiceAddress(2).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("utia", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/2/utia", sdkmath.LegacyNewDec(150)), + ), + }, + }, + }, + { + name: "query with pagination returns data properly", + store: func(ctx sdk.Context) { + suite.sk.SaveService(ctx, servicestypes.Service{ + ID: 1, + Address: servicestypes.GetServiceAddress(1).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(150)), + ), + }) + + suite.sk.SaveService(ctx, servicestypes.Service{ + ID: 2, + Address: servicestypes.GetServiceAddress(2).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("utia", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/2/utia", sdkmath.LegacyNewDec(150)), + ), + }) + + suite.k.SaveServiceDelegation(ctx, types.NewServiceDelegation( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(50)), + ), + )) + suite.k.SaveServiceDelegation(ctx, types.NewServiceDelegation( + 2, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/2/utia", sdkmath.LegacyNewDec(100)), + ), + )) + }, + request: types.NewQueryDelegatorServicesRequest("cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", &query.PageRequest{ + Offset: 1, + Limit: 1, + }), + shouldErr: false, + expServices: []servicestypes.Service{ + { + ID: 2, + Address: servicestypes.GetServiceAddress(2).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("utia", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/2/utia", sdkmath.LegacyNewDec(150)), + ), + }, + }, + }, + } + + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) + } + + querier := keeper.NewQuerier(suite.k) + res, err := querier.DelegatorServices(sdk.WrapSDKContext(ctx), tc.request) + if tc.shouldErr { + suite.Require().Error(err) + } else { + suite.Require().NoError(err) + suite.Require().Equal(tc.expServices, res.Services) + } + }) + } +} + +func (suite *KeeperTestSuite) TestQuerier_DelegatorService() { + testCases := []struct { + name string + store func(ctx sdk.Context) + request *types.QueryDelegatorServiceRequest + shouldErr bool + expService servicestypes.Service + }{ + { + name: "non existing service returns error", + request: types.NewQueryDelegatorServiceRequest("cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", 1), + shouldErr: true, + }, + { + name: "existing service is returned properly", + store: func(ctx sdk.Context) { + suite.sk.SaveService(ctx, servicestypes.Service{ + ID: 1, + Address: servicestypes.GetServiceAddress(1).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(150)), + ), + }) + + suite.k.SaveServiceDelegation(ctx, types.NewServiceDelegation( + 1, + "cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", + sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(50)), + ), + )) + }, + request: types.NewQueryDelegatorServiceRequest("cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", 1), + shouldErr: false, + expService: servicestypes.Service{ + ID: 1, + Address: servicestypes.GetServiceAddress(1).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(150)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("services/1/umilk", sdkmath.LegacyNewDec(150)), + ), + }, + }, + } + + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) + } + + querier := keeper.NewQuerier(suite.k) + res, err := querier.DelegatorService(sdk.WrapSDKContext(ctx), tc.request) + if tc.shouldErr { + suite.Require().Error(err) + } else { + suite.Require().NoError(err) + suite.Require().Equal(tc.expService, res.Service) + } + }) + } +} + +func (suite *KeeperTestSuite) TestQuerier_Params() { + testCases := []struct { + name string + store func(ctx sdk.Context) + request *types.QueryParamsRequest + shouldErr bool + expParams types.Params + }{ + { + name: "params are returned properly", + store: func(ctx sdk.Context) { + params := types.NewParams(30 * 24 * time.Hour) + suite.k.SetParams(ctx, params) + }, + request: types.NewQueryParamsRequest(), + shouldErr: false, + expParams: types.NewParams(30 * 24 * time.Hour), + }, + } + + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + ctx, _ := suite.ctx.CacheContext() + if tc.store != nil { + tc.store(ctx) + } + + querier := keeper.NewQuerier(suite.k) + res, err := querier.Params(sdk.WrapSDKContext(ctx), tc.request) + if tc.shouldErr { + suite.Require().Error(err) + } else { + suite.Require().NoError(err) + suite.Require().Equal(tc.expParams, res.Params) + } + }) + } +} diff --git a/x/restaking/module.go b/x/restaking/module.go new file mode 100644 index 00000000..7b2788f6 --- /dev/null +++ b/x/restaking/module.go @@ -0,0 +1,143 @@ +package restaking + +import ( + "context" + "encoding/json" + "fmt" + + "cosmossdk.io/core/appmodule" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + abci "github.com/cometbft/cometbft/abci/types" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + + "github.com/milkyway-labs/milkyway/x/restaking/keeper" + "github.com/milkyway-labs/milkyway/x/restaking/types" +) + +const ( + consensusVersion = 1 +) + +var ( + _ appmodule.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface for the restaking module. +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the restaking module's name. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) +} + +// RegisterInterfaces registers the module's interface types +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns the restaking module's default genesis state. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis performs genesis state validation for the restaking module. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return genState.Validate() +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) + if err != nil { + panic(err) + } +} + +// GetTxCmd returns the restaking module's root tx command. +func (a AppModuleBasic) GetTxCmd() *cobra.Command { + return nil +} + +// GetQueryCmd returns the restaking module's root query command. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return nil +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface for the restaking module. +type AppModule struct { + AppModuleBasic + + // To ensure setting hooks properly, keeper must be a reference + keeper *keeper.Keeper +} + +func NewAppModule(cdc codec.Codec, keeper *keeper.Keeper) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + } +} + +// Name returns the restaking module's name. +func (am AppModule) Name() string { + return am.AppModuleBasic.Name() +} + +// RegisterServices registers a GRPC query service to respond to the module-specific GRPC queries. +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQuerier(am.keeper)) +} + +// RegisterInvariants registers the restaking module's invariants. +func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {} + +// InitGenesis performs the restaking module's genesis initialization It returns no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { + var genState types.GenesisState + cdc.MustUnmarshalJSON(gs, &genState) + am.keeper.InitGenesis(ctx, &genState) + return []abci.ValidatorUpdate{} +} + +// ExportGenesis returns the restaking module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := am.keeper.ExportGenesis(ctx) + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion implements ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return consensusVersion } + +func (am AppModule) IsOnePerModuleType() {} + +func (am AppModule) IsAppModule() {} diff --git a/x/restaking/types/expected_keepers.go b/x/restaking/types/expected_keepers.go index e0505c81..6f197849 100644 --- a/x/restaking/types/expected_keepers.go +++ b/x/restaking/types/expected_keepers.go @@ -21,6 +21,7 @@ type BankKeeper interface { type PoolsKeeper interface { CreateOrGetPoolByDenom(ctx sdk.Context, denom string) (poolstypes.Pool, error) + GetPool(ctx sdk.Context, poolID uint32) (poolstypes.Pool, bool) SavePool(ctx sdk.Context, pool poolstypes.Pool) error } diff --git a/x/restaking/types/keys.go b/x/restaking/types/keys.go index 226b644b..48e3b816 100644 --- a/x/restaking/types/keys.go +++ b/x/restaking/types/keys.go @@ -18,14 +18,16 @@ var ( ParamsKey = []byte{0x01} PoolDelegationPrefix = []byte{0xa1} - UnbondingPoolDelegationPrefix = []byte{0xa2} - PoolDelegationsByPoolIDPrefix = []byte{0x71} + PoolDelegationsByPoolIDPrefix = []byte{0xa2} + UnbondingPoolDelegationPrefix = []byte{0xa3} - ServiceDelegationPrefix = []byte{0xb1} - UnbondingServiceDelegationPrefix = []byte{0xb2} + OperatorDelegationPrefix = []byte{0xb1} + OperatorDelegationByOperatorID = []byte{0xb2} + UnbondingOperatorDelegationPrefix = []byte{0xb3} - OperatorDelegationPrefix = []byte{0xc1} - UnbondingOperatorDelegationPrefix = []byte{0xc2} + ServiceDelegationPrefix = []byte{0xc1} + ServiceDelegationByServiceIDPrefix = []byte{0xc2} + UnbondingServiceDelegationPrefix = []byte{0xc3} ) // UserPoolDelegationsStorePrefix returns the prefix used to store all the delegations to a given pool @@ -82,7 +84,7 @@ func UserOperatorDelegationStoreKey(delegator string, operatorID uint32) []byte // DelegationsByOperatorIDStorePrefix returns the prefix used to store the delegations to a given operator func DelegationsByOperatorIDStorePrefix(operatorID uint32) []byte { - return append(OperatorDelegationPrefix, operatorstypes.GetOperatorIDBytes(operatorID)...) + return append(OperatorDelegationByOperatorID, operatorstypes.GetOperatorIDBytes(operatorID)...) } // DelegationByOperatorIDStoreKey returns the key used to store the operator -> user delegation association @@ -124,7 +126,7 @@ func UserServiceDelegationStoreKey(delegator string, serviceID uint32) []byte { // DelegationsByServiceIDStorePrefix returns the prefix used to store the delegations to a given service func DelegationsByServiceIDStorePrefix(serviceID uint32) []byte { - return append(ServiceDelegationPrefix, servicestypes.GetServiceIDBytes(serviceID)...) + return append(ServiceDelegationByServiceIDPrefix, servicestypes.GetServiceIDBytes(serviceID)...) } // DelegationByServiceIDStoreKey returns the key used to store the service -> user delegation association diff --git a/x/restaking/types/models.go b/x/restaking/types/models.go index 0df899b7..dcfdee7f 100644 --- a/x/restaking/types/models.go +++ b/x/restaking/types/models.go @@ -66,6 +66,19 @@ func MustUnmarshalPoolDelegation(cdc codec.BinaryCodec, bz []byte) PoolDelegatio return delegation } +// NewPoolDelegationResponse creates a new PoolDelegationResponse instance +func NewPoolDelegationResponse(poolID uint32, userAddress string, shares sdkmath.LegacyDec, balance sdk.Coin) PoolDelegationResponse { + return PoolDelegationResponse{ + Delegation: PoolDelegation{ + UserAddress: userAddress, + PoolID: poolID, + Shares: shares, + }, + Balance: balance, + } + +} + // -------------------------------------------------------------------------------------------------------------------- func NewOperatorDelegation(operatorID uint32, userAddress string, shares sdk.DecCoins) OperatorDelegation { @@ -123,6 +136,18 @@ func MustUnmarshalOperatorDelegation(cdc codec.BinaryCodec, bz []byte) OperatorD return delegation } +// NewOperatorDelegationResponse creates a new OperatorDelegationResponse instance +func NewOperatorDelegationResponse(operatorID uint32, userAddress string, shares sdk.DecCoins, balance sdk.Coins) OperatorDelegationResponse { + return OperatorDelegationResponse{ + Delegation: OperatorDelegation{ + UserAddress: userAddress, + OperatorID: operatorID, + Shares: shares, + }, + Balance: balance, + } +} + // -------------------------------------------------------------------------------------------------------------------- func NewServiceDelegation(serviceID uint32, userAddress string, shares sdk.DecCoins) ServiceDelegation { @@ -181,3 +206,15 @@ func MustUnmarshalServiceDelegation(cdc codec.BinaryCodec, bz []byte) ServiceDel } return delegation } + +// NewServiceDelegationResponse creates a new ServiceDelegationResponse instance +func NewServiceDelegationResponse(serviceID uint32, userAddress string, shares sdk.DecCoins, balance sdk.Coins) ServiceDelegationResponse { + return ServiceDelegationResponse{ + Delegation: ServiceDelegation{ + UserAddress: userAddress, + ServiceID: serviceID, + Shares: shares, + }, + Balance: balance, + } +} diff --git a/x/restaking/types/models.pb.go b/x/restaking/types/models.pb.go index e2287513..da052587 100644 --- a/x/restaking/types/models.pb.go +++ b/x/restaking/types/models.pb.go @@ -72,6 +72,61 @@ func (m *PoolDelegation) XXX_DiscardUnknown() { var xxx_messageInfo_PoolDelegation proto.InternalMessageInfo +// PoolDelegationResponse is equivalent to PoolDelegation except that it +// contains a balance in addition to shares which is more suitable for client +// responses. +type PoolDelegationResponse struct { + Delegation PoolDelegation `protobuf:"bytes,1,opt,name=delegation,proto3" json:"delegation"` + Balance types.Coin `protobuf:"bytes,2,opt,name=balance,proto3" json:"balance"` +} + +func (m *PoolDelegationResponse) Reset() { *m = PoolDelegationResponse{} } +func (m *PoolDelegationResponse) String() string { return proto.CompactTextString(m) } +func (*PoolDelegationResponse) ProtoMessage() {} +func (*PoolDelegationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_86f4cd48423b1e2f, []int{1} +} +func (m *PoolDelegationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PoolDelegationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PoolDelegationResponse.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 *PoolDelegationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_PoolDelegationResponse.Merge(m, src) +} +func (m *PoolDelegationResponse) XXX_Size() int { + return m.Size() +} +func (m *PoolDelegationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_PoolDelegationResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_PoolDelegationResponse proto.InternalMessageInfo + +func (m *PoolDelegationResponse) GetDelegation() PoolDelegation { + if m != nil { + return m.Delegation + } + return PoolDelegation{} +} + +func (m *PoolDelegationResponse) GetBalance() types.Coin { + if m != nil { + return m.Balance + } + return types.Coin{} +} + // OperatorDelegation represents the bond with tokens held by an account with a // given operator. It is owned by one delegator, and is associated with a // operator. @@ -88,7 +143,7 @@ func (m *OperatorDelegation) Reset() { *m = OperatorDelegation{} } func (m *OperatorDelegation) String() string { return proto.CompactTextString(m) } func (*OperatorDelegation) ProtoMessage() {} func (*OperatorDelegation) Descriptor() ([]byte, []int) { - return fileDescriptor_86f4cd48423b1e2f, []int{1} + return fileDescriptor_86f4cd48423b1e2f, []int{2} } func (m *OperatorDelegation) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -117,6 +172,61 @@ func (m *OperatorDelegation) XXX_DiscardUnknown() { var xxx_messageInfo_OperatorDelegation proto.InternalMessageInfo +// OperatorDelegationResponse is equivalent to OperatorDelegation except that it +// contains a balance in addition to shares which is more suitable for client +// responses. +type OperatorDelegationResponse struct { + Delegation OperatorDelegation `protobuf:"bytes,1,opt,name=delegation,proto3" json:"delegation"` + Balance github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=balance,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"balance"` +} + +func (m *OperatorDelegationResponse) Reset() { *m = OperatorDelegationResponse{} } +func (m *OperatorDelegationResponse) String() string { return proto.CompactTextString(m) } +func (*OperatorDelegationResponse) ProtoMessage() {} +func (*OperatorDelegationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_86f4cd48423b1e2f, []int{3} +} +func (m *OperatorDelegationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *OperatorDelegationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_OperatorDelegationResponse.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 *OperatorDelegationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_OperatorDelegationResponse.Merge(m, src) +} +func (m *OperatorDelegationResponse) XXX_Size() int { + return m.Size() +} +func (m *OperatorDelegationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_OperatorDelegationResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_OperatorDelegationResponse proto.InternalMessageInfo + +func (m *OperatorDelegationResponse) GetDelegation() OperatorDelegation { + if m != nil { + return m.Delegation + } + return OperatorDelegation{} +} + +func (m *OperatorDelegationResponse) GetBalance() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Balance + } + return nil +} + // ServiceDelegation represents the bond with tokens held by an account with a // given service. It is owned by one delegator, and is associated with a // service. @@ -133,7 +243,7 @@ func (m *ServiceDelegation) Reset() { *m = ServiceDelegation{} } func (m *ServiceDelegation) String() string { return proto.CompactTextString(m) } func (*ServiceDelegation) ProtoMessage() {} func (*ServiceDelegation) Descriptor() ([]byte, []int) { - return fileDescriptor_86f4cd48423b1e2f, []int{2} + return fileDescriptor_86f4cd48423b1e2f, []int{4} } func (m *ServiceDelegation) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -162,10 +272,68 @@ func (m *ServiceDelegation) XXX_DiscardUnknown() { var xxx_messageInfo_ServiceDelegation proto.InternalMessageInfo +// ServiceDelegationResponse is equivalent to ServiceDelegation except that it +// contains a balance in addition to shares which is more suitable for client +// responses. +type ServiceDelegationResponse struct { + Delegation ServiceDelegation `protobuf:"bytes,1,opt,name=delegation,proto3" json:"delegation"` + Balance github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=balance,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"balance"` +} + +func (m *ServiceDelegationResponse) Reset() { *m = ServiceDelegationResponse{} } +func (m *ServiceDelegationResponse) String() string { return proto.CompactTextString(m) } +func (*ServiceDelegationResponse) ProtoMessage() {} +func (*ServiceDelegationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_86f4cd48423b1e2f, []int{5} +} +func (m *ServiceDelegationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ServiceDelegationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ServiceDelegationResponse.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 *ServiceDelegationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceDelegationResponse.Merge(m, src) +} +func (m *ServiceDelegationResponse) XXX_Size() int { + return m.Size() +} +func (m *ServiceDelegationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ServiceDelegationResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ServiceDelegationResponse proto.InternalMessageInfo + +func (m *ServiceDelegationResponse) GetDelegation() ServiceDelegation { + if m != nil { + return m.Delegation + } + return ServiceDelegation{} +} + +func (m *ServiceDelegationResponse) GetBalance() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Balance + } + return nil +} + func init() { proto.RegisterType((*PoolDelegation)(nil), "milkyway.restaking.v1.PoolDelegation") + proto.RegisterType((*PoolDelegationResponse)(nil), "milkyway.restaking.v1.PoolDelegationResponse") proto.RegisterType((*OperatorDelegation)(nil), "milkyway.restaking.v1.OperatorDelegation") + proto.RegisterType((*OperatorDelegationResponse)(nil), "milkyway.restaking.v1.OperatorDelegationResponse") proto.RegisterType((*ServiceDelegation)(nil), "milkyway.restaking.v1.ServiceDelegation") + proto.RegisterType((*ServiceDelegationResponse)(nil), "milkyway.restaking.v1.ServiceDelegationResponse") } func init() { @@ -173,37 +341,45 @@ func init() { } var fileDescriptor_86f4cd48423b1e2f = []byte{ - // 473 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x93, 0x31, 0x6f, 0xd3, 0x40, - 0x14, 0xc7, 0x7d, 0x54, 0x0a, 0xe4, 0x42, 0x2b, 0xd5, 0x2a, 0x52, 0x28, 0xc8, 0xae, 0xc2, 0x12, - 0x09, 0xe2, 0x93, 0xc9, 0x06, 0x13, 0xc1, 0x8b, 0x25, 0x10, 0xc8, 0xdd, 0x58, 0xa2, 0xb3, 0x7d, - 0x72, 0x4e, 0xb1, 0xfd, 0xa2, 0xbb, 0x6b, 0xc0, 0xdf, 0x80, 0x91, 0x8f, 0xd0, 0x99, 0xb9, 0xdf, - 0x81, 0x8e, 0x55, 0x27, 0xc4, 0x60, 0x90, 0xb3, 0xb0, 0x33, 0xb0, 0x22, 0xdb, 0xe7, 0x36, 0x03, - 0x63, 0xa5, 0x2e, 0xb6, 0xdf, 0x7b, 0x7f, 0xff, 0xff, 0xfa, 0xdd, 0xe9, 0xe1, 0x51, 0xc6, 0xd3, - 0x65, 0xf1, 0x91, 0x16, 0x44, 0x30, 0xa9, 0xe8, 0x92, 0xe7, 0x09, 0x59, 0xbb, 0x24, 0x83, 0x98, - 0xa5, 0xd2, 0x59, 0x09, 0x50, 0x60, 0x3e, 0xe8, 0x34, 0xce, 0x95, 0xc6, 0x59, 0xbb, 0x87, 0xfb, - 0x34, 0xe3, 0x39, 0x90, 0xe6, 0xd9, 0x2a, 0x0f, 0x1f, 0x46, 0x20, 0x33, 0x90, 0xf3, 0xa6, 0x22, - 0x6d, 0xa1, 0x47, 0x07, 0x09, 0x24, 0xd0, 0xf6, 0xeb, 0x2f, 0xdd, 0xb5, 0x5a, 0x0d, 0x09, 0xa9, - 0x64, 0x64, 0xed, 0x86, 0x4c, 0x51, 0x97, 0x44, 0xc0, 0xf3, 0x76, 0x3e, 0xfa, 0x86, 0xf0, 0xde, - 0x7b, 0x80, 0xd4, 0x63, 0x29, 0x4b, 0xa8, 0xe2, 0x90, 0x9b, 0x2f, 0xf1, 0xfd, 0x13, 0xc9, 0xc4, - 0x9c, 0xc6, 0xb1, 0x60, 0x52, 0x0e, 0xd1, 0x11, 0x1a, 0xf7, 0x67, 0xc3, 0xcb, 0xb3, 0xc9, 0x81, - 0x0e, 0x7c, 0xd5, 0x4e, 0x8e, 0x95, 0xe0, 0x79, 0x12, 0x0c, 0x6a, 0xb5, 0x6e, 0x99, 0x4f, 0xf0, - 0xdd, 0x15, 0x40, 0x3a, 0xe7, 0xf1, 0xf0, 0xce, 0x11, 0x1a, 0xef, 0xce, 0x70, 0x55, 0xda, 0xbd, - 0x3a, 0xc1, 0xf7, 0x82, 0x5e, 0x3d, 0xf2, 0x63, 0xd3, 0xc7, 0x3d, 0xb9, 0xa0, 0x82, 0xc9, 0xe1, - 0x4e, 0xe3, 0xed, 0x9e, 0x97, 0xb6, 0xf1, 0xa3, 0xb4, 0x1f, 0xb5, 0xfe, 0x32, 0x5e, 0x3a, 0x1c, - 0x48, 0x46, 0xd5, 0xc2, 0x79, 0xc3, 0x12, 0x1a, 0x15, 0x1e, 0x8b, 0x2e, 0xcf, 0x26, 0x58, 0xc7, - 0x7b, 0x2c, 0x0a, 0xb4, 0xc1, 0x8b, 0x7b, 0x9f, 0x4f, 0x6d, 0xe3, 0xf7, 0xa9, 0x6d, 0x8c, 0xfe, - 0x22, 0x6c, 0xbe, 0x5b, 0x31, 0x41, 0x15, 0x88, 0x9b, 0xa2, 0x21, 0x78, 0x00, 0xda, 0xf2, 0x9a, - 0x68, 0xaf, 0x2a, 0x6d, 0xdc, 0x25, 0xf9, 0x5e, 0x80, 0x3b, 0x89, 0x1f, 0x9b, 0x7c, 0x8b, 0x6c, - 0x67, 0x3c, 0x78, 0xfe, 0xd8, 0xd1, 0x21, 0xf5, 0xf9, 0x3b, 0xfa, 0xfc, 0x6b, 0x80, 0xd7, 0xc0, - 0xf3, 0xd9, 0xb4, 0xe6, 0xfe, 0xfa, 0xd3, 0x7e, 0x9a, 0x70, 0xb5, 0x38, 0x09, 0x9d, 0x08, 0x32, - 0x7d, 0xa7, 0xfa, 0x35, 0x91, 0xf1, 0x92, 0xa8, 0x62, 0xc5, 0x64, 0xf7, 0x8f, 0xfc, 0x0f, 0xf9, - 0x1f, 0x84, 0xf7, 0x8f, 0x99, 0x58, 0xf3, 0x88, 0xdd, 0x14, 0xf8, 0x33, 0x8c, 0x65, 0xeb, 0x78, - 0xcd, 0xbd, 0x5b, 0x95, 0x76, 0x5f, 0xe7, 0xf8, 0x5e, 0xd0, 0xd7, 0x82, 0x5b, 0xa2, 0x9e, 0xbd, - 0x3d, 0xaf, 0x2c, 0x74, 0x51, 0x59, 0xe8, 0x57, 0x65, 0xa1, 0x2f, 0x1b, 0xcb, 0xb8, 0xd8, 0x58, - 0xc6, 0xf7, 0x8d, 0x65, 0x7c, 0x98, 0x6e, 0x19, 0x77, 0x9b, 0x35, 0x49, 0x69, 0x28, 0xaf, 0x2a, - 0xf2, 0x69, 0x6b, 0x1b, 0x9b, 0xa4, 0xb0, 0xd7, 0xec, 0xc3, 0xf4, 0x5f, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x09, 0xdd, 0x16, 0xcb, 0xb0, 0x03, 0x00, 0x00, + // 606 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x95, 0x3f, 0x6f, 0xd3, 0x40, + 0x18, 0xc6, 0x7d, 0x14, 0xa5, 0xe4, 0x42, 0x2b, 0xd5, 0x2a, 0x28, 0x2d, 0xc8, 0xae, 0x8a, 0x90, + 0xc2, 0x9f, 0xf8, 0x94, 0x44, 0x2c, 0x45, 0x42, 0x22, 0x78, 0xb1, 0x04, 0xa2, 0x72, 0x98, 0x58, + 0xa2, 0xb3, 0x7d, 0x72, 0x8e, 0xd8, 0xbe, 0xc8, 0xe7, 0x06, 0xf2, 0x0d, 0x18, 0xf9, 0x08, 0x1d, + 0x11, 0x53, 0x87, 0x7e, 0x07, 0x3a, 0x56, 0x9d, 0x10, 0x43, 0x40, 0x0e, 0x12, 0xec, 0x0c, 0xac, + 0xc8, 0xf6, 0x39, 0x4d, 0x14, 0x07, 0x31, 0x54, 0x82, 0x25, 0xc9, 0xbd, 0xef, 0x73, 0xcf, 0x7b, + 0xcf, 0xfd, 0x22, 0x1b, 0xee, 0xfa, 0xd4, 0xeb, 0x8f, 0x5e, 0xe3, 0x11, 0x0a, 0x09, 0x8f, 0x70, + 0x9f, 0x06, 0x2e, 0x1a, 0x36, 0x90, 0xcf, 0x1c, 0xe2, 0x71, 0x6d, 0x10, 0xb2, 0x88, 0xc9, 0xd7, + 0x72, 0x8d, 0x36, 0xd5, 0x68, 0xc3, 0xc6, 0xf6, 0x06, 0xf6, 0x69, 0xc0, 0x50, 0xfa, 0x99, 0x29, + 0xb7, 0xb7, 0x6c, 0xc6, 0x7d, 0xc6, 0xbb, 0xe9, 0x0a, 0x65, 0x0b, 0xd1, 0xda, 0x74, 0x99, 0xcb, + 0xb2, 0x7a, 0xf2, 0x4b, 0x54, 0x95, 0x4c, 0x83, 0x2c, 0xcc, 0x09, 0x1a, 0x36, 0x2c, 0x12, 0xe1, + 0x06, 0xb2, 0x19, 0x0d, 0xb2, 0xfe, 0xee, 0x47, 0x00, 0xd7, 0xf7, 0x19, 0xf3, 0x74, 0xe2, 0x11, + 0x17, 0x47, 0x94, 0x05, 0xf2, 0x43, 0x78, 0xf5, 0x80, 0x93, 0xb0, 0x8b, 0x1d, 0x27, 0x24, 0x9c, + 0x57, 0xc1, 0x0e, 0xa8, 0x95, 0xdb, 0xd5, 0xb3, 0xe3, 0xfa, 0xa6, 0x18, 0xf8, 0x38, 0xeb, 0x74, + 0xa2, 0x90, 0x06, 0xae, 0x59, 0x49, 0xd4, 0xa2, 0x24, 0xdf, 0x82, 0xab, 0x03, 0xc6, 0xbc, 0x2e, + 0x75, 0xaa, 0x97, 0x76, 0x40, 0x6d, 0xad, 0x0d, 0xe3, 0xb1, 0x5a, 0x4a, 0x26, 0x18, 0xba, 0x59, + 0x4a, 0x5a, 0x86, 0x23, 0x1b, 0xb0, 0xc4, 0x7b, 0x38, 0x24, 0xbc, 0xba, 0x92, 0x7a, 0x37, 0x4e, + 0xc6, 0xaa, 0xf4, 0x79, 0xac, 0xde, 0xc8, 0xfc, 0xb9, 0xd3, 0xd7, 0x28, 0x43, 0x3e, 0x8e, 0x7a, + 0xda, 0x53, 0xe2, 0x62, 0x7b, 0xa4, 0x13, 0xfb, 0xec, 0xb8, 0x0e, 0xc5, 0x78, 0x9d, 0xd8, 0xa6, + 0x30, 0xd8, 0xbb, 0xf2, 0xf6, 0x50, 0x95, 0x7e, 0x1c, 0xaa, 0xd2, 0xee, 0x11, 0x80, 0xd7, 0xe7, + 0x93, 0x98, 0x84, 0x0f, 0x58, 0xc0, 0x89, 0xbc, 0x0f, 0xa1, 0x33, 0xad, 0xa6, 0x79, 0x2a, 0xcd, + 0xdb, 0x5a, 0xe1, 0xa5, 0x6b, 0xf3, 0x16, 0xed, 0x72, 0x72, 0xb4, 0xf7, 0xdf, 0x8f, 0xee, 0x02, + 0x73, 0xc6, 0x43, 0x7e, 0x04, 0x57, 0x2d, 0xec, 0xe1, 0xc0, 0x26, 0x69, 0xcc, 0x4a, 0x73, 0x4b, + 0x13, 0x87, 0x4b, 0x2e, 0x5a, 0x13, 0x17, 0xad, 0x3d, 0x61, 0x74, 0xce, 0x22, 0xdf, 0xb4, 0x77, + 0x39, 0x3d, 0xf2, 0x2f, 0x00, 0xe5, 0xe7, 0x03, 0x12, 0xe2, 0x88, 0x85, 0x17, 0x05, 0x00, 0xc1, + 0x0a, 0x13, 0x96, 0xe7, 0x10, 0xd6, 0xe3, 0xb1, 0x0a, 0xf3, 0x49, 0x86, 0x6e, 0xc2, 0x5c, 0x62, + 0x38, 0x32, 0x9d, 0x81, 0xb1, 0x52, 0xab, 0x34, 0x6f, 0x16, 0x26, 0xd1, 0x89, 0x9d, 0x86, 0x69, + 0x25, 0x61, 0x3e, 0x7c, 0x51, 0xef, 0xb9, 0x34, 0xea, 0x1d, 0x58, 0x9a, 0xcd, 0x7c, 0xf1, 0x37, + 0x14, 0x5f, 0x75, 0xee, 0xf4, 0x51, 0x34, 0x1a, 0x10, 0x9e, 0xef, 0xe1, 0x05, 0xb0, 0xbe, 0x01, + 0xb8, 0xbd, 0x98, 0x7c, 0x0a, 0xec, 0x45, 0x01, 0xb0, 0x3b, 0x4b, 0x80, 0x2d, 0xda, 0x2c, 0x83, + 0xf6, 0x6a, 0x16, 0xda, 0xca, 0x9f, 0xa1, 0x3d, 0x10, 0x39, 0x6b, 0x7f, 0x91, 0x33, 0x0d, 0x59, + 0x08, 0xf8, 0x27, 0x80, 0x1b, 0x1d, 0x12, 0x0e, 0xa9, 0x4d, 0x2e, 0x8a, 0xef, 0x7d, 0x08, 0x79, + 0xe6, 0x78, 0x8e, 0x77, 0x2d, 0x1e, 0xab, 0x65, 0x31, 0xc7, 0xd0, 0xcd, 0xb2, 0x10, 0xfc, 0x2b, + 0xb8, 0x31, 0x80, 0x5b, 0x0b, 0xa9, 0xa7, 0x6c, 0x3b, 0x05, 0x6c, 0x6b, 0x4b, 0xd8, 0x2e, 0xb8, + 0xfc, 0x37, 0x68, 0xdb, 0xcf, 0x4e, 0x62, 0x05, 0x9c, 0xc6, 0x0a, 0xf8, 0x1a, 0x2b, 0xe0, 0xdd, + 0x44, 0x91, 0x4e, 0x27, 0x8a, 0xf4, 0x69, 0xa2, 0x48, 0x2f, 0x5b, 0x33, 0xbe, 0x79, 0xac, 0xba, + 0x87, 0x2d, 0x3e, 0x5d, 0xa1, 0x37, 0x33, 0x2f, 0x83, 0x74, 0x90, 0x55, 0x4a, 0x1f, 0xc7, 0xad, + 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf4, 0x2d, 0x77, 0x9d, 0x2f, 0x06, 0x00, 0x00, } func (m *PoolDelegation) Marshal() (dAtA []byte, err error) { @@ -251,6 +427,49 @@ func (m *PoolDelegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *PoolDelegationResponse) 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 *PoolDelegationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PoolDelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Balance.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintModels(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.Delegation.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintModels(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *OperatorDelegation) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -300,6 +519,53 @@ func (m *OperatorDelegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *OperatorDelegationResponse) 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 *OperatorDelegationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *OperatorDelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Balance) > 0 { + for iNdEx := len(m.Balance) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Balance[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintModels(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Delegation.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintModels(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *ServiceDelegation) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -349,6 +615,53 @@ func (m *ServiceDelegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ServiceDelegationResponse) 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 *ServiceDelegationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ServiceDelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Balance) > 0 { + for iNdEx := len(m.Balance) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Balance[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintModels(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Delegation.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintModels(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func encodeVarintModels(dAtA []byte, offset int, v uint64) int { offset -= sovModels(v) base := offset @@ -378,6 +691,19 @@ func (m *PoolDelegation) Size() (n int) { return n } +func (m *PoolDelegationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Delegation.Size() + n += 1 + l + sovModels(uint64(l)) + l = m.Balance.Size() + n += 1 + l + sovModels(uint64(l)) + return n +} + func (m *OperatorDelegation) Size() (n int) { if m == nil { return 0 @@ -400,6 +726,23 @@ func (m *OperatorDelegation) Size() (n int) { return n } +func (m *OperatorDelegationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Delegation.Size() + n += 1 + l + sovModels(uint64(l)) + if len(m.Balance) > 0 { + for _, e := range m.Balance { + l = e.Size() + n += 1 + l + sovModels(uint64(l)) + } + } + return n +} + func (m *ServiceDelegation) Size() (n int) { if m == nil { return 0 @@ -422,6 +765,23 @@ func (m *ServiceDelegation) Size() (n int) { return n } +func (m *ServiceDelegationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Delegation.Size() + n += 1 + l + sovModels(uint64(l)) + if len(m.Balance) > 0 { + for _, e := range m.Balance { + l = e.Size() + n += 1 + l + sovModels(uint64(l)) + } + } + return n +} + func sovModels(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -563,7 +923,7 @@ func (m *PoolDelegation) Unmarshal(dAtA []byte) error { } return nil } -func (m *OperatorDelegation) Unmarshal(dAtA []byte) error { +func (m *PoolDelegationResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -586,17 +946,17 @@ func (m *OperatorDelegation) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: OperatorDelegation: wiretype end group for non-group") + return fmt.Errorf("proto: PoolDelegationResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: OperatorDelegation: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PoolDelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Delegation", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowModels @@ -606,29 +966,145 @@ func (m *OperatorDelegation) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthModels } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthModels } if postIndex > l { return io.ErrUnexpectedEOF } - m.UserAddress = string(dAtA[iNdEx:postIndex]) + if err := m.Delegation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field OperatorID", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType) } - m.OperatorID = 0 + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowModels + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthModels + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthModels + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Balance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipModels(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthModels + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *OperatorDelegation) 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 ErrIntOverflowModels + } + 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: OperatorDelegation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OperatorDelegation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UserAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowModels + } + 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 ErrInvalidLengthModels + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthModels + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UserAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorID", wireType) + } + m.OperatorID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowModels @@ -698,6 +1174,123 @@ func (m *OperatorDelegation) Unmarshal(dAtA []byte) error { } return nil } +func (m *OperatorDelegationResponse) 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 ErrIntOverflowModels + } + 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: OperatorDelegationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OperatorDelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delegation", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowModels + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthModels + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthModels + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Delegation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowModels + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthModels + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthModels + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Balance = append(m.Balance, types.Coin{}) + if err := m.Balance[len(m.Balance)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipModels(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthModels + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *ServiceDelegation) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -833,6 +1426,123 @@ func (m *ServiceDelegation) Unmarshal(dAtA []byte) error { } return nil } +func (m *ServiceDelegationResponse) 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 ErrIntOverflowModels + } + 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: ServiceDelegationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ServiceDelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delegation", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowModels + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthModels + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthModels + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Delegation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowModels + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthModels + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthModels + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Balance = append(m.Balance, types.Coin{}) + if err := m.Balance[len(m.Balance)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipModels(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthModels + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipModels(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/restaking/types/query.go b/x/restaking/types/query.go new file mode 100644 index 00000000..9fac89e6 --- /dev/null +++ b/x/restaking/types/query.go @@ -0,0 +1,85 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/types/query" +) + +// NewQueryPoolDelegationsRequest creates a new QueryPoolDelegationsRequest instance +func NewQueryPoolDelegationsRequest(poolID uint32, pagination *query.PageRequest) *QueryPoolDelegationsRequest { + return &QueryPoolDelegationsRequest{PoolId: poolID, Pagination: pagination} +} + +// NewQueryPoolDelegationRequest creates a new QueryPoolDelegationRequest instance +func NewQueryPoolDelegationRequest(poolID uint32, delegatorAddress string) *QueryPoolDelegationRequest { + return &QueryPoolDelegationRequest{PoolId: poolID, DelegatorAddress: delegatorAddress} +} + +// NewQueryOperatorDelegationsRequest creates a new QueryOperatorDelegationsRequest instance +func NewQueryOperatorDelegationsRequest(operatorID uint32, pagination *query.PageRequest) *QueryOperatorDelegationsRequest { + return &QueryOperatorDelegationsRequest{OperatorId: operatorID, Pagination: pagination} +} + +// NewQueryOperatorDelegationRequest creates a new QueryOperatorDelegationRequest instance +func NewQueryOperatorDelegationRequest(operatorID uint32, delegatorAddress string) *QueryOperatorDelegationRequest { + return &QueryOperatorDelegationRequest{OperatorId: operatorID, DelegatorAddress: delegatorAddress} +} + +// NewQueryServiceDelegationsRequest creates a new QueryServiceDelegationsRequest instance +func NewQueryServiceDelegationsRequest(serviceID uint32, pagination *query.PageRequest) *QueryServiceDelegationsRequest { + return &QueryServiceDelegationsRequest{ServiceId: serviceID, Pagination: pagination} +} + +// NewQueryServiceDelegationRequest creates a new QueryServiceDelegationRequest instance +func NewQueryServiceDelegationRequest(serviceID uint32, delegatorAddress string) *QueryServiceDelegationRequest { + return &QueryServiceDelegationRequest{ServiceId: serviceID, DelegatorAddress: delegatorAddress} +} + +// NewQueryDelegatorPoolDelegationsRequest creates a new QueryDelegatorPoolDelegationsRequest instance +func NewQueryDelegatorPoolDelegationsRequest(delegatorAddress string, pagination *query.PageRequest) *QueryDelegatorPoolDelegationsRequest { + return &QueryDelegatorPoolDelegationsRequest{DelegatorAddress: delegatorAddress, Pagination: pagination} +} + +// NewQueryDelegatorOperatorDelegationsRequest creates a new QueryDelegatorOperatorDelegationsRequest instance +func NewQueryDelegatorOperatorDelegationsRequest(delegatorAddress string, pagination *query.PageRequest) *QueryDelegatorOperatorDelegationsRequest { + return &QueryDelegatorOperatorDelegationsRequest{DelegatorAddress: delegatorAddress, Pagination: pagination} +} + +// NewQueryDelegatorServiceDelegationsRequest creates a new QueryDelegatorServiceDelegationsRequest instance +func NewQueryDelegatorServiceDelegationsRequest(delegatorAddress string, pagination *query.PageRequest) *QueryDelegatorServiceDelegationsRequest { + return &QueryDelegatorServiceDelegationsRequest{DelegatorAddress: delegatorAddress, Pagination: pagination} +} + +// NewQueryDelegatorPoolsRequest creates a new QueryDelegatorPoolsRequest instance +func NewQueryDelegatorPoolsRequest(delegatorAddress string, pagination *query.PageRequest) *QueryDelegatorPoolsRequest { + return &QueryDelegatorPoolsRequest{DelegatorAddress: delegatorAddress, Pagination: pagination} +} + +// NewQueryDelegatorPoolRequest creates a new QueryDelegatorPoolRequest instance +func NewQueryDelegatorPoolRequest(delegatorAddress string, poolID uint32) *QueryDelegatorPoolRequest { + return &QueryDelegatorPoolRequest{DelegatorAddress: delegatorAddress, PoolId: poolID} +} + +// NewQueryDelegatorOperatorsRequest creates a new QueryDelegatorOperatorsRequest instance +func NewQueryDelegatorOperatorsRequest(delegatorAddress string, pagination *query.PageRequest) *QueryDelegatorOperatorsRequest { + return &QueryDelegatorOperatorsRequest{DelegatorAddress: delegatorAddress, Pagination: pagination} +} + +// NewQueryDelegatorOperatorRequest creates a new QueryDelegatorOperatorRequest instance +func NewQueryDelegatorOperatorRequest(delegatorAddress string, operatorID uint32) *QueryDelegatorOperatorRequest { + return &QueryDelegatorOperatorRequest{DelegatorAddress: delegatorAddress, OperatorId: operatorID} +} + +// NewQueryDelegatorServicesRequest creates a new QueryDelegatorServicesRequest instance +func NewQueryDelegatorServicesRequest(delegatorAddress string, pagination *query.PageRequest) *QueryDelegatorServicesRequest { + return &QueryDelegatorServicesRequest{DelegatorAddress: delegatorAddress, Pagination: pagination} +} + +// NewQueryDelegatorServiceRequest creates a new QueryDelegatorServiceRequest instance +func NewQueryDelegatorServiceRequest(delegatorAddress string, serviceID uint32) *QueryDelegatorServiceRequest { + return &QueryDelegatorServiceRequest{DelegatorAddress: delegatorAddress, ServiceId: serviceID} +} + +// NewQueryParamsRequest creates a new QueryParamsRequest instance +func NewQueryParamsRequest() *QueryParamsRequest { + return &QueryParamsRequest{} +} diff --git a/x/restaking/types/query.pb.go b/x/restaking/types/query.pb.go new file mode 100644 index 00000000..265e06fd --- /dev/null +++ b/x/restaking/types/query.pb.go @@ -0,0 +1,7781 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: milkyway/restaking/v1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + query "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + types1 "github.com/milkyway-labs/milkyway/x/operators/types" + types "github.com/milkyway-labs/milkyway/x/pools/types" + types2 "github.com/milkyway-labs/milkyway/x/services/types" + _ "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. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryPoolDelegationsRequest is request type for the Query/PoolDelegations RPC +// method. +type QueryPoolDelegationsRequest struct { + // PoolId is the ID of the pool to query + PoolId uint32 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + // Pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryPoolDelegationsRequest) Reset() { *m = QueryPoolDelegationsRequest{} } +func (m *QueryPoolDelegationsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryPoolDelegationsRequest) ProtoMessage() {} +func (*QueryPoolDelegationsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{0} +} +func (m *QueryPoolDelegationsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPoolDelegationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPoolDelegationsRequest.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 *QueryPoolDelegationsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPoolDelegationsRequest.Merge(m, src) +} +func (m *QueryPoolDelegationsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryPoolDelegationsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPoolDelegationsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPoolDelegationsRequest proto.InternalMessageInfo + +func (m *QueryPoolDelegationsRequest) GetPoolId() uint32 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *QueryPoolDelegationsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryPoolDelegationsResponse is response type for the Query/PoolDelegations +// RPC method. +type QueryPoolDelegationsResponse struct { + // Delegations is the list of delegations + Delegations []PoolDelegationResponse `protobuf:"bytes,1,rep,name=delegations,proto3" json:"delegations"` + // Pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryPoolDelegationsResponse) Reset() { *m = QueryPoolDelegationsResponse{} } +func (m *QueryPoolDelegationsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryPoolDelegationsResponse) ProtoMessage() {} +func (*QueryPoolDelegationsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{1} +} +func (m *QueryPoolDelegationsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPoolDelegationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPoolDelegationsResponse.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 *QueryPoolDelegationsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPoolDelegationsResponse.Merge(m, src) +} +func (m *QueryPoolDelegationsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryPoolDelegationsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPoolDelegationsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPoolDelegationsResponse proto.InternalMessageInfo + +func (m *QueryPoolDelegationsResponse) GetDelegations() []PoolDelegationResponse { + if m != nil { + return m.Delegations + } + return nil +} + +func (m *QueryPoolDelegationsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryPoolDelegationRequest is request type for the Query/PoolDelegation RPC +// method. +type QueryPoolDelegationRequest struct { + // PoolId is the ID of the pool to query + PoolId uint32 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + // DelegatorAddress is the address of the delegator to query + DelegatorAddress string `protobuf:"bytes,2,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` +} + +func (m *QueryPoolDelegationRequest) Reset() { *m = QueryPoolDelegationRequest{} } +func (m *QueryPoolDelegationRequest) String() string { return proto.CompactTextString(m) } +func (*QueryPoolDelegationRequest) ProtoMessage() {} +func (*QueryPoolDelegationRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{2} +} +func (m *QueryPoolDelegationRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPoolDelegationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPoolDelegationRequest.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 *QueryPoolDelegationRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPoolDelegationRequest.Merge(m, src) +} +func (m *QueryPoolDelegationRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryPoolDelegationRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPoolDelegationRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPoolDelegationRequest proto.InternalMessageInfo + +func (m *QueryPoolDelegationRequest) GetPoolId() uint32 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *QueryPoolDelegationRequest) GetDelegatorAddress() string { + if m != nil { + return m.DelegatorAddress + } + return "" +} + +// QueryPoolDelegationResponse is response type for the Query/PoolDelegation RPC +// method. +type QueryPoolDelegationResponse struct { + // Delegation is the delegation + Delegation PoolDelegationResponse `protobuf:"bytes,1,opt,name=delegation,proto3" json:"delegation"` +} + +func (m *QueryPoolDelegationResponse) Reset() { *m = QueryPoolDelegationResponse{} } +func (m *QueryPoolDelegationResponse) String() string { return proto.CompactTextString(m) } +func (*QueryPoolDelegationResponse) ProtoMessage() {} +func (*QueryPoolDelegationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{3} +} +func (m *QueryPoolDelegationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPoolDelegationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPoolDelegationResponse.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 *QueryPoolDelegationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPoolDelegationResponse.Merge(m, src) +} +func (m *QueryPoolDelegationResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryPoolDelegationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPoolDelegationResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPoolDelegationResponse proto.InternalMessageInfo + +func (m *QueryPoolDelegationResponse) GetDelegation() PoolDelegationResponse { + if m != nil { + return m.Delegation + } + return PoolDelegationResponse{} +} + +// QueryOperatorDelegationsRequest is request type for the +// Query/OperatorDelegations RPC method. +type QueryOperatorDelegationsRequest struct { + // OperatorId is the ID of the operator to query + OperatorId uint32 `protobuf:"varint,1,opt,name=operator_id,json=operatorId,proto3" json:"operator_id,omitempty"` + // Pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryOperatorDelegationsRequest) Reset() { *m = QueryOperatorDelegationsRequest{} } +func (m *QueryOperatorDelegationsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryOperatorDelegationsRequest) ProtoMessage() {} +func (*QueryOperatorDelegationsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{4} +} +func (m *QueryOperatorDelegationsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOperatorDelegationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOperatorDelegationsRequest.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 *QueryOperatorDelegationsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOperatorDelegationsRequest.Merge(m, src) +} +func (m *QueryOperatorDelegationsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryOperatorDelegationsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOperatorDelegationsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOperatorDelegationsRequest proto.InternalMessageInfo + +func (m *QueryOperatorDelegationsRequest) GetOperatorId() uint32 { + if m != nil { + return m.OperatorId + } + return 0 +} + +func (m *QueryOperatorDelegationsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryOperatorDelegationsResponse is response type for the +// Query/OperatorDelegations RPC method. +type QueryOperatorDelegationsResponse struct { + // Delegations is the list of delegations + Delegations []OperatorDelegationResponse `protobuf:"bytes,1,rep,name=delegations,proto3" json:"delegations"` + // Pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryOperatorDelegationsResponse) Reset() { *m = QueryOperatorDelegationsResponse{} } +func (m *QueryOperatorDelegationsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryOperatorDelegationsResponse) ProtoMessage() {} +func (*QueryOperatorDelegationsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{5} +} +func (m *QueryOperatorDelegationsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOperatorDelegationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOperatorDelegationsResponse.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 *QueryOperatorDelegationsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOperatorDelegationsResponse.Merge(m, src) +} +func (m *QueryOperatorDelegationsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryOperatorDelegationsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOperatorDelegationsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOperatorDelegationsResponse proto.InternalMessageInfo + +func (m *QueryOperatorDelegationsResponse) GetDelegations() []OperatorDelegationResponse { + if m != nil { + return m.Delegations + } + return nil +} + +func (m *QueryOperatorDelegationsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryOperatorDelegationRequest is request type for the +// Query/OperatorDelegation RPC method. +type QueryOperatorDelegationRequest struct { + // OperatorId is the ID of the operator to query + OperatorId uint32 `protobuf:"varint,1,opt,name=operator_id,json=operatorId,proto3" json:"operator_id,omitempty"` + // DelegatorAddress is the address of the delegator to query + DelegatorAddress string `protobuf:"bytes,2,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` +} + +func (m *QueryOperatorDelegationRequest) Reset() { *m = QueryOperatorDelegationRequest{} } +func (m *QueryOperatorDelegationRequest) String() string { return proto.CompactTextString(m) } +func (*QueryOperatorDelegationRequest) ProtoMessage() {} +func (*QueryOperatorDelegationRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{6} +} +func (m *QueryOperatorDelegationRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOperatorDelegationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOperatorDelegationRequest.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 *QueryOperatorDelegationRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOperatorDelegationRequest.Merge(m, src) +} +func (m *QueryOperatorDelegationRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryOperatorDelegationRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOperatorDelegationRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOperatorDelegationRequest proto.InternalMessageInfo + +func (m *QueryOperatorDelegationRequest) GetOperatorId() uint32 { + if m != nil { + return m.OperatorId + } + return 0 +} + +func (m *QueryOperatorDelegationRequest) GetDelegatorAddress() string { + if m != nil { + return m.DelegatorAddress + } + return "" +} + +// QueryOperatorDelegationResponse is response type for the +// Query/OperatorDelegation RPC method. +type QueryOperatorDelegationResponse struct { + // Delegation is the delegation + Delegation OperatorDelegationResponse `protobuf:"bytes,1,opt,name=delegation,proto3" json:"delegation"` +} + +func (m *QueryOperatorDelegationResponse) Reset() { *m = QueryOperatorDelegationResponse{} } +func (m *QueryOperatorDelegationResponse) String() string { return proto.CompactTextString(m) } +func (*QueryOperatorDelegationResponse) ProtoMessage() {} +func (*QueryOperatorDelegationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{7} +} +func (m *QueryOperatorDelegationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOperatorDelegationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOperatorDelegationResponse.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 *QueryOperatorDelegationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOperatorDelegationResponse.Merge(m, src) +} +func (m *QueryOperatorDelegationResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryOperatorDelegationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOperatorDelegationResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOperatorDelegationResponse proto.InternalMessageInfo + +func (m *QueryOperatorDelegationResponse) GetDelegation() OperatorDelegationResponse { + if m != nil { + return m.Delegation + } + return OperatorDelegationResponse{} +} + +// QueryServiceDelegationsRequest is request type for the +// Query/ServiceDelegations RPC method. +type QueryServiceDelegationsRequest struct { + // ServiceId is the ID of the service to query + ServiceId uint32 `protobuf:"varint,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` + // Pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryServiceDelegationsRequest) Reset() { *m = QueryServiceDelegationsRequest{} } +func (m *QueryServiceDelegationsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryServiceDelegationsRequest) ProtoMessage() {} +func (*QueryServiceDelegationsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{8} +} +func (m *QueryServiceDelegationsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryServiceDelegationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryServiceDelegationsRequest.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 *QueryServiceDelegationsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryServiceDelegationsRequest.Merge(m, src) +} +func (m *QueryServiceDelegationsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryServiceDelegationsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryServiceDelegationsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryServiceDelegationsRequest proto.InternalMessageInfo + +func (m *QueryServiceDelegationsRequest) GetServiceId() uint32 { + if m != nil { + return m.ServiceId + } + return 0 +} + +func (m *QueryServiceDelegationsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryServiceDelegationsResponse is response type for the +// Query/ServiceDelegations RPC method. +type QueryServiceDelegationsResponse struct { + // Delegations is the list of delegations + Delegations []ServiceDelegationResponse `protobuf:"bytes,1,rep,name=delegations,proto3" json:"delegations"` + // Pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryServiceDelegationsResponse) Reset() { *m = QueryServiceDelegationsResponse{} } +func (m *QueryServiceDelegationsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryServiceDelegationsResponse) ProtoMessage() {} +func (*QueryServiceDelegationsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{9} +} +func (m *QueryServiceDelegationsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryServiceDelegationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryServiceDelegationsResponse.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 *QueryServiceDelegationsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryServiceDelegationsResponse.Merge(m, src) +} +func (m *QueryServiceDelegationsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryServiceDelegationsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryServiceDelegationsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryServiceDelegationsResponse proto.InternalMessageInfo + +func (m *QueryServiceDelegationsResponse) GetDelegations() []ServiceDelegationResponse { + if m != nil { + return m.Delegations + } + return nil +} + +func (m *QueryServiceDelegationsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryServiceDelegationRequest is request type for the Query/ServiceDelegation +// RPC method. +type QueryServiceDelegationRequest struct { + // ServiceId is the ID of the service to query + ServiceId uint32 `protobuf:"varint,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` + // DelegatorAddress is the address of the delegator to query + DelegatorAddress string `protobuf:"bytes,2,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` +} + +func (m *QueryServiceDelegationRequest) Reset() { *m = QueryServiceDelegationRequest{} } +func (m *QueryServiceDelegationRequest) String() string { return proto.CompactTextString(m) } +func (*QueryServiceDelegationRequest) ProtoMessage() {} +func (*QueryServiceDelegationRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{10} +} +func (m *QueryServiceDelegationRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryServiceDelegationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryServiceDelegationRequest.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 *QueryServiceDelegationRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryServiceDelegationRequest.Merge(m, src) +} +func (m *QueryServiceDelegationRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryServiceDelegationRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryServiceDelegationRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryServiceDelegationRequest proto.InternalMessageInfo + +func (m *QueryServiceDelegationRequest) GetServiceId() uint32 { + if m != nil { + return m.ServiceId + } + return 0 +} + +func (m *QueryServiceDelegationRequest) GetDelegatorAddress() string { + if m != nil { + return m.DelegatorAddress + } + return "" +} + +// QueryServiceDelegationResponse is response type for the +// Query/ServiceDelegation RPC method. +type QueryServiceDelegationResponse struct { + // Delegation is the delegation + Delegation ServiceDelegationResponse `protobuf:"bytes,1,opt,name=delegation,proto3" json:"delegation"` +} + +func (m *QueryServiceDelegationResponse) Reset() { *m = QueryServiceDelegationResponse{} } +func (m *QueryServiceDelegationResponse) String() string { return proto.CompactTextString(m) } +func (*QueryServiceDelegationResponse) ProtoMessage() {} +func (*QueryServiceDelegationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{11} +} +func (m *QueryServiceDelegationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryServiceDelegationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryServiceDelegationResponse.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 *QueryServiceDelegationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryServiceDelegationResponse.Merge(m, src) +} +func (m *QueryServiceDelegationResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryServiceDelegationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryServiceDelegationResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryServiceDelegationResponse proto.InternalMessageInfo + +func (m *QueryServiceDelegationResponse) GetDelegation() ServiceDelegationResponse { + if m != nil { + return m.Delegation + } + return ServiceDelegationResponse{} +} + +// QueryDelegatorPoolDelegationsRequest is request type for the +// Query/DelegatorPoolDelegations RPC method. +type QueryDelegatorPoolDelegationsRequest struct { + // DelegatorAddress is the address of the delegator to query + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + // Pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDelegatorPoolDelegationsRequest) Reset() { *m = QueryDelegatorPoolDelegationsRequest{} } +func (m *QueryDelegatorPoolDelegationsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDelegatorPoolDelegationsRequest) ProtoMessage() {} +func (*QueryDelegatorPoolDelegationsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{12} +} +func (m *QueryDelegatorPoolDelegationsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorPoolDelegationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorPoolDelegationsRequest.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 *QueryDelegatorPoolDelegationsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorPoolDelegationsRequest.Merge(m, src) +} +func (m *QueryDelegatorPoolDelegationsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorPoolDelegationsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorPoolDelegationsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorPoolDelegationsRequest proto.InternalMessageInfo + +func (m *QueryDelegatorPoolDelegationsRequest) GetDelegatorAddress() string { + if m != nil { + return m.DelegatorAddress + } + return "" +} + +func (m *QueryDelegatorPoolDelegationsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryDelegatorPoolDelegationsResponse is response type for the +// Query/DelegatorPoolDelegations RPC method. +type QueryDelegatorPoolDelegationsResponse struct { + // Delegations is the list of delegations + Delegations []PoolDelegationResponse `protobuf:"bytes,1,rep,name=delegations,proto3" json:"delegations"` + // Pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDelegatorPoolDelegationsResponse) Reset() { *m = QueryDelegatorPoolDelegationsResponse{} } +func (m *QueryDelegatorPoolDelegationsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDelegatorPoolDelegationsResponse) ProtoMessage() {} +func (*QueryDelegatorPoolDelegationsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{13} +} +func (m *QueryDelegatorPoolDelegationsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorPoolDelegationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorPoolDelegationsResponse.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 *QueryDelegatorPoolDelegationsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorPoolDelegationsResponse.Merge(m, src) +} +func (m *QueryDelegatorPoolDelegationsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorPoolDelegationsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorPoolDelegationsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorPoolDelegationsResponse proto.InternalMessageInfo + +func (m *QueryDelegatorPoolDelegationsResponse) GetDelegations() []PoolDelegationResponse { + if m != nil { + return m.Delegations + } + return nil +} + +func (m *QueryDelegatorPoolDelegationsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryDelegatorOperatorDelegationsRequest is request type for the +// Query/DelegatorOperatorDelegations RPC method. +type QueryDelegatorOperatorDelegationsRequest struct { + // DelegatorAddress is the address of the delegator to query + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + // Pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDelegatorOperatorDelegationsRequest) Reset() { + *m = QueryDelegatorOperatorDelegationsRequest{} +} +func (m *QueryDelegatorOperatorDelegationsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDelegatorOperatorDelegationsRequest) ProtoMessage() {} +func (*QueryDelegatorOperatorDelegationsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{14} +} +func (m *QueryDelegatorOperatorDelegationsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorOperatorDelegationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorOperatorDelegationsRequest.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 *QueryDelegatorOperatorDelegationsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorOperatorDelegationsRequest.Merge(m, src) +} +func (m *QueryDelegatorOperatorDelegationsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorOperatorDelegationsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorOperatorDelegationsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorOperatorDelegationsRequest proto.InternalMessageInfo + +func (m *QueryDelegatorOperatorDelegationsRequest) GetDelegatorAddress() string { + if m != nil { + return m.DelegatorAddress + } + return "" +} + +func (m *QueryDelegatorOperatorDelegationsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryDelegatorOperatorDelegationsResponse is response type for the +// Query/DelegatorOperatorDelegations RPC method. +type QueryDelegatorOperatorDelegationsResponse struct { + // Delegations is the list of delegations + Delegations []OperatorDelegationResponse `protobuf:"bytes,1,rep,name=delegations,proto3" json:"delegations"` + // Pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDelegatorOperatorDelegationsResponse) Reset() { + *m = QueryDelegatorOperatorDelegationsResponse{} +} +func (m *QueryDelegatorOperatorDelegationsResponse) String() string { + return proto.CompactTextString(m) +} +func (*QueryDelegatorOperatorDelegationsResponse) ProtoMessage() {} +func (*QueryDelegatorOperatorDelegationsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{15} +} +func (m *QueryDelegatorOperatorDelegationsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorOperatorDelegationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorOperatorDelegationsResponse.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 *QueryDelegatorOperatorDelegationsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorOperatorDelegationsResponse.Merge(m, src) +} +func (m *QueryDelegatorOperatorDelegationsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorOperatorDelegationsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorOperatorDelegationsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorOperatorDelegationsResponse proto.InternalMessageInfo + +func (m *QueryDelegatorOperatorDelegationsResponse) GetDelegations() []OperatorDelegationResponse { + if m != nil { + return m.Delegations + } + return nil +} + +func (m *QueryDelegatorOperatorDelegationsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryDelegatorServiceDelegationsRequest is request type for the +// Query/DelegatorServiceDelegations RPC method. +type QueryDelegatorServiceDelegationsRequest struct { + // DelegatorAddress is the address of the delegator to query + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + // Pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDelegatorServiceDelegationsRequest) Reset() { + *m = QueryDelegatorServiceDelegationsRequest{} +} +func (m *QueryDelegatorServiceDelegationsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDelegatorServiceDelegationsRequest) ProtoMessage() {} +func (*QueryDelegatorServiceDelegationsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{16} +} +func (m *QueryDelegatorServiceDelegationsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorServiceDelegationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorServiceDelegationsRequest.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 *QueryDelegatorServiceDelegationsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorServiceDelegationsRequest.Merge(m, src) +} +func (m *QueryDelegatorServiceDelegationsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorServiceDelegationsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorServiceDelegationsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorServiceDelegationsRequest proto.InternalMessageInfo + +func (m *QueryDelegatorServiceDelegationsRequest) GetDelegatorAddress() string { + if m != nil { + return m.DelegatorAddress + } + return "" +} + +func (m *QueryDelegatorServiceDelegationsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryDelegatorServiceDelegationsResponse is response type for the +// Query/DelegatorServiceDelegations RPC method. +type QueryDelegatorServiceDelegationsResponse struct { + // Delegations is the list of delegations + Delegations []ServiceDelegationResponse `protobuf:"bytes,1,rep,name=delegations,proto3" json:"delegations"` + // Pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDelegatorServiceDelegationsResponse) Reset() { + *m = QueryDelegatorServiceDelegationsResponse{} +} +func (m *QueryDelegatorServiceDelegationsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDelegatorServiceDelegationsResponse) ProtoMessage() {} +func (*QueryDelegatorServiceDelegationsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{17} +} +func (m *QueryDelegatorServiceDelegationsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorServiceDelegationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorServiceDelegationsResponse.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 *QueryDelegatorServiceDelegationsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorServiceDelegationsResponse.Merge(m, src) +} +func (m *QueryDelegatorServiceDelegationsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorServiceDelegationsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorServiceDelegationsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorServiceDelegationsResponse proto.InternalMessageInfo + +func (m *QueryDelegatorServiceDelegationsResponse) GetDelegations() []ServiceDelegationResponse { + if m != nil { + return m.Delegations + } + return nil +} + +func (m *QueryDelegatorServiceDelegationsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryDelegatorPoolsRequest is request type for the Query/DelegatorPools RPC +// method. +type QueryDelegatorPoolsRequest struct { + // DelegatorAddress is the address of the delegator to query + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + // Pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDelegatorPoolsRequest) Reset() { *m = QueryDelegatorPoolsRequest{} } +func (m *QueryDelegatorPoolsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDelegatorPoolsRequest) ProtoMessage() {} +func (*QueryDelegatorPoolsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{18} +} +func (m *QueryDelegatorPoolsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorPoolsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorPoolsRequest.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 *QueryDelegatorPoolsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorPoolsRequest.Merge(m, src) +} +func (m *QueryDelegatorPoolsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorPoolsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorPoolsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorPoolsRequest proto.InternalMessageInfo + +func (m *QueryDelegatorPoolsRequest) GetDelegatorAddress() string { + if m != nil { + return m.DelegatorAddress + } + return "" +} + +func (m *QueryDelegatorPoolsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryDelegatorPoolsResponse is response type for the Query/DelegatorPools RPC +// method. +type QueryDelegatorPoolsResponse struct { + // Pools is the list of pools + Pools []types.Pool `protobuf:"bytes,1,rep,name=pools,proto3" json:"pools"` + // Pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDelegatorPoolsResponse) Reset() { *m = QueryDelegatorPoolsResponse{} } +func (m *QueryDelegatorPoolsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDelegatorPoolsResponse) ProtoMessage() {} +func (*QueryDelegatorPoolsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{19} +} +func (m *QueryDelegatorPoolsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorPoolsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorPoolsResponse.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 *QueryDelegatorPoolsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorPoolsResponse.Merge(m, src) +} +func (m *QueryDelegatorPoolsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorPoolsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorPoolsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorPoolsResponse proto.InternalMessageInfo + +func (m *QueryDelegatorPoolsResponse) GetPools() []types.Pool { + if m != nil { + return m.Pools + } + return nil +} + +func (m *QueryDelegatorPoolsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryDelegatorPoolRequest is request type for the Query/DelegatorPool RPC +// method. +type QueryDelegatorPoolRequest struct { + // DelegatorAddress is the address of the delegator to query + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + // PoolId is the ID of the pool to query + PoolId uint32 `protobuf:"varint,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` +} + +func (m *QueryDelegatorPoolRequest) Reset() { *m = QueryDelegatorPoolRequest{} } +func (m *QueryDelegatorPoolRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDelegatorPoolRequest) ProtoMessage() {} +func (*QueryDelegatorPoolRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{20} +} +func (m *QueryDelegatorPoolRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorPoolRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorPoolRequest.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 *QueryDelegatorPoolRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorPoolRequest.Merge(m, src) +} +func (m *QueryDelegatorPoolRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorPoolRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorPoolRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorPoolRequest proto.InternalMessageInfo + +func (m *QueryDelegatorPoolRequest) GetDelegatorAddress() string { + if m != nil { + return m.DelegatorAddress + } + return "" +} + +func (m *QueryDelegatorPoolRequest) GetPoolId() uint32 { + if m != nil { + return m.PoolId + } + return 0 +} + +// QueryDelegatorPoolResponse is response type for the Query/DelegatorPool RPC +// method. +type QueryDelegatorPoolResponse struct { + // Pool is the pool + Pool types.Pool `protobuf:"bytes,1,opt,name=pool,proto3" json:"pool"` +} + +func (m *QueryDelegatorPoolResponse) Reset() { *m = QueryDelegatorPoolResponse{} } +func (m *QueryDelegatorPoolResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDelegatorPoolResponse) ProtoMessage() {} +func (*QueryDelegatorPoolResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{21} +} +func (m *QueryDelegatorPoolResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorPoolResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorPoolResponse.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 *QueryDelegatorPoolResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorPoolResponse.Merge(m, src) +} +func (m *QueryDelegatorPoolResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorPoolResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorPoolResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorPoolResponse proto.InternalMessageInfo + +func (m *QueryDelegatorPoolResponse) GetPool() types.Pool { + if m != nil { + return m.Pool + } + return types.Pool{} +} + +// QueryDelegatorOperatorsRequest is request type for the +// Query/DelegatorOperators RPC method. +type QueryDelegatorOperatorsRequest struct { + // DelegatorAddress is the address of the delegator to query + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + // Pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDelegatorOperatorsRequest) Reset() { *m = QueryDelegatorOperatorsRequest{} } +func (m *QueryDelegatorOperatorsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDelegatorOperatorsRequest) ProtoMessage() {} +func (*QueryDelegatorOperatorsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{22} +} +func (m *QueryDelegatorOperatorsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorOperatorsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorOperatorsRequest.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 *QueryDelegatorOperatorsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorOperatorsRequest.Merge(m, src) +} +func (m *QueryDelegatorOperatorsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorOperatorsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorOperatorsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorOperatorsRequest proto.InternalMessageInfo + +func (m *QueryDelegatorOperatorsRequest) GetDelegatorAddress() string { + if m != nil { + return m.DelegatorAddress + } + return "" +} + +func (m *QueryDelegatorOperatorsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryDelegatorOperatorsResponse is response type for the +// Query/DelegatorOperators RPC method. +type QueryDelegatorOperatorsResponse struct { + // Operators is the list of operators + Operators []types1.Operator `protobuf:"bytes,1,rep,name=operators,proto3" json:"operators"` + // Pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDelegatorOperatorsResponse) Reset() { *m = QueryDelegatorOperatorsResponse{} } +func (m *QueryDelegatorOperatorsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDelegatorOperatorsResponse) ProtoMessage() {} +func (*QueryDelegatorOperatorsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{23} +} +func (m *QueryDelegatorOperatorsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorOperatorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorOperatorsResponse.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 *QueryDelegatorOperatorsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorOperatorsResponse.Merge(m, src) +} +func (m *QueryDelegatorOperatorsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorOperatorsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorOperatorsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorOperatorsResponse proto.InternalMessageInfo + +func (m *QueryDelegatorOperatorsResponse) GetOperators() []types1.Operator { + if m != nil { + return m.Operators + } + return nil +} + +func (m *QueryDelegatorOperatorsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryDelegatorOperatorRequest is request type for the Query/DelegatorOperator +// RPC method. +type QueryDelegatorOperatorRequest struct { + // DelegatorAddress is the address of the delegator to query + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + // OperatorId is the ID of the operator to query + OperatorId uint32 `protobuf:"varint,2,opt,name=operator_id,json=operatorId,proto3" json:"operator_id,omitempty"` +} + +func (m *QueryDelegatorOperatorRequest) Reset() { *m = QueryDelegatorOperatorRequest{} } +func (m *QueryDelegatorOperatorRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDelegatorOperatorRequest) ProtoMessage() {} +func (*QueryDelegatorOperatorRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{24} +} +func (m *QueryDelegatorOperatorRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorOperatorRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorOperatorRequest.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 *QueryDelegatorOperatorRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorOperatorRequest.Merge(m, src) +} +func (m *QueryDelegatorOperatorRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorOperatorRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorOperatorRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorOperatorRequest proto.InternalMessageInfo + +func (m *QueryDelegatorOperatorRequest) GetDelegatorAddress() string { + if m != nil { + return m.DelegatorAddress + } + return "" +} + +func (m *QueryDelegatorOperatorRequest) GetOperatorId() uint32 { + if m != nil { + return m.OperatorId + } + return 0 +} + +// QueryDelegatorOperatorResponse is response type for the +// Query/DelegatorOperator RPC method. +type QueryDelegatorOperatorResponse struct { + // Operator is the operator + Operator types1.Operator `protobuf:"bytes,1,opt,name=operator,proto3" json:"operator"` +} + +func (m *QueryDelegatorOperatorResponse) Reset() { *m = QueryDelegatorOperatorResponse{} } +func (m *QueryDelegatorOperatorResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDelegatorOperatorResponse) ProtoMessage() {} +func (*QueryDelegatorOperatorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{25} +} +func (m *QueryDelegatorOperatorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorOperatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorOperatorResponse.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 *QueryDelegatorOperatorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorOperatorResponse.Merge(m, src) +} +func (m *QueryDelegatorOperatorResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorOperatorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorOperatorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorOperatorResponse proto.InternalMessageInfo + +func (m *QueryDelegatorOperatorResponse) GetOperator() types1.Operator { + if m != nil { + return m.Operator + } + return types1.Operator{} +} + +// QueryDelegatorServicesRequest is request type for the Query/DelegatorServices +// RPC method. +type QueryDelegatorServicesRequest struct { + // DelegatorAddress is the address of the delegator to query + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + // Pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDelegatorServicesRequest) Reset() { *m = QueryDelegatorServicesRequest{} } +func (m *QueryDelegatorServicesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDelegatorServicesRequest) ProtoMessage() {} +func (*QueryDelegatorServicesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{26} +} +func (m *QueryDelegatorServicesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorServicesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorServicesRequest.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 *QueryDelegatorServicesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorServicesRequest.Merge(m, src) +} +func (m *QueryDelegatorServicesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorServicesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorServicesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorServicesRequest proto.InternalMessageInfo + +func (m *QueryDelegatorServicesRequest) GetDelegatorAddress() string { + if m != nil { + return m.DelegatorAddress + } + return "" +} + +func (m *QueryDelegatorServicesRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryDelegatorServicesResponse is response type for the +// Query/DelegatorServices RPC method. +type QueryDelegatorServicesResponse struct { + // Services is the list of services + Services []types2.Service `protobuf:"bytes,1,rep,name=services,proto3" json:"services"` + // Pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDelegatorServicesResponse) Reset() { *m = QueryDelegatorServicesResponse{} } +func (m *QueryDelegatorServicesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDelegatorServicesResponse) ProtoMessage() {} +func (*QueryDelegatorServicesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{27} +} +func (m *QueryDelegatorServicesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorServicesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorServicesResponse.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 *QueryDelegatorServicesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorServicesResponse.Merge(m, src) +} +func (m *QueryDelegatorServicesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorServicesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorServicesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorServicesResponse proto.InternalMessageInfo + +func (m *QueryDelegatorServicesResponse) GetServices() []types2.Service { + if m != nil { + return m.Services + } + return nil +} + +func (m *QueryDelegatorServicesResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryDelegatorServiceRequest is request type for the Query/DelegatorService +// RPC method. +type QueryDelegatorServiceRequest struct { + // DelegatorAddress is the address of the delegator to query + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + // ServiceId is the ID of the service to query + ServiceId uint32 `protobuf:"varint,2,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` +} + +func (m *QueryDelegatorServiceRequest) Reset() { *m = QueryDelegatorServiceRequest{} } +func (m *QueryDelegatorServiceRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDelegatorServiceRequest) ProtoMessage() {} +func (*QueryDelegatorServiceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{28} +} +func (m *QueryDelegatorServiceRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorServiceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorServiceRequest.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 *QueryDelegatorServiceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorServiceRequest.Merge(m, src) +} +func (m *QueryDelegatorServiceRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorServiceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorServiceRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorServiceRequest proto.InternalMessageInfo + +func (m *QueryDelegatorServiceRequest) GetDelegatorAddress() string { + if m != nil { + return m.DelegatorAddress + } + return "" +} + +func (m *QueryDelegatorServiceRequest) GetServiceId() uint32 { + if m != nil { + return m.ServiceId + } + return 0 +} + +// QueryDelegatorServiceResponse is response type for the Query/DelegatorService +// RPC method. +type QueryDelegatorServiceResponse struct { + // Service is the service + Service types2.Service `protobuf:"bytes,1,opt,name=service,proto3" json:"service"` +} + +func (m *QueryDelegatorServiceResponse) Reset() { *m = QueryDelegatorServiceResponse{} } +func (m *QueryDelegatorServiceResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDelegatorServiceResponse) ProtoMessage() {} +func (*QueryDelegatorServiceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_946984316b0f92c4, []int{29} +} +func (m *QueryDelegatorServiceResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorServiceResponse.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 *QueryDelegatorServiceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorServiceResponse.Merge(m, src) +} +func (m *QueryDelegatorServiceResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorServiceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorServiceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorServiceResponse proto.InternalMessageInfo + +func (m *QueryDelegatorServiceResponse) GetService() types2.Service { + if m != nil { + return m.Service + } + return types2.Service{} +} + +// QueryParamsRequest is request type for the Query/Params RPC method. +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_946984316b0f92c4, []int{30} +} +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 + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params holds all the parameters of this module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +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_946984316b0f92c4, []int{31} +} +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 Params{} +} + +func init() { + proto.RegisterType((*QueryPoolDelegationsRequest)(nil), "milkyway.restaking.v1.QueryPoolDelegationsRequest") + proto.RegisterType((*QueryPoolDelegationsResponse)(nil), "milkyway.restaking.v1.QueryPoolDelegationsResponse") + proto.RegisterType((*QueryPoolDelegationRequest)(nil), "milkyway.restaking.v1.QueryPoolDelegationRequest") + proto.RegisterType((*QueryPoolDelegationResponse)(nil), "milkyway.restaking.v1.QueryPoolDelegationResponse") + proto.RegisterType((*QueryOperatorDelegationsRequest)(nil), "milkyway.restaking.v1.QueryOperatorDelegationsRequest") + proto.RegisterType((*QueryOperatorDelegationsResponse)(nil), "milkyway.restaking.v1.QueryOperatorDelegationsResponse") + proto.RegisterType((*QueryOperatorDelegationRequest)(nil), "milkyway.restaking.v1.QueryOperatorDelegationRequest") + proto.RegisterType((*QueryOperatorDelegationResponse)(nil), "milkyway.restaking.v1.QueryOperatorDelegationResponse") + proto.RegisterType((*QueryServiceDelegationsRequest)(nil), "milkyway.restaking.v1.QueryServiceDelegationsRequest") + proto.RegisterType((*QueryServiceDelegationsResponse)(nil), "milkyway.restaking.v1.QueryServiceDelegationsResponse") + proto.RegisterType((*QueryServiceDelegationRequest)(nil), "milkyway.restaking.v1.QueryServiceDelegationRequest") + proto.RegisterType((*QueryServiceDelegationResponse)(nil), "milkyway.restaking.v1.QueryServiceDelegationResponse") + proto.RegisterType((*QueryDelegatorPoolDelegationsRequest)(nil), "milkyway.restaking.v1.QueryDelegatorPoolDelegationsRequest") + proto.RegisterType((*QueryDelegatorPoolDelegationsResponse)(nil), "milkyway.restaking.v1.QueryDelegatorPoolDelegationsResponse") + proto.RegisterType((*QueryDelegatorOperatorDelegationsRequest)(nil), "milkyway.restaking.v1.QueryDelegatorOperatorDelegationsRequest") + proto.RegisterType((*QueryDelegatorOperatorDelegationsResponse)(nil), "milkyway.restaking.v1.QueryDelegatorOperatorDelegationsResponse") + proto.RegisterType((*QueryDelegatorServiceDelegationsRequest)(nil), "milkyway.restaking.v1.QueryDelegatorServiceDelegationsRequest") + proto.RegisterType((*QueryDelegatorServiceDelegationsResponse)(nil), "milkyway.restaking.v1.QueryDelegatorServiceDelegationsResponse") + proto.RegisterType((*QueryDelegatorPoolsRequest)(nil), "milkyway.restaking.v1.QueryDelegatorPoolsRequest") + proto.RegisterType((*QueryDelegatorPoolsResponse)(nil), "milkyway.restaking.v1.QueryDelegatorPoolsResponse") + proto.RegisterType((*QueryDelegatorPoolRequest)(nil), "milkyway.restaking.v1.QueryDelegatorPoolRequest") + proto.RegisterType((*QueryDelegatorPoolResponse)(nil), "milkyway.restaking.v1.QueryDelegatorPoolResponse") + proto.RegisterType((*QueryDelegatorOperatorsRequest)(nil), "milkyway.restaking.v1.QueryDelegatorOperatorsRequest") + proto.RegisterType((*QueryDelegatorOperatorsResponse)(nil), "milkyway.restaking.v1.QueryDelegatorOperatorsResponse") + proto.RegisterType((*QueryDelegatorOperatorRequest)(nil), "milkyway.restaking.v1.QueryDelegatorOperatorRequest") + proto.RegisterType((*QueryDelegatorOperatorResponse)(nil), "milkyway.restaking.v1.QueryDelegatorOperatorResponse") + proto.RegisterType((*QueryDelegatorServicesRequest)(nil), "milkyway.restaking.v1.QueryDelegatorServicesRequest") + proto.RegisterType((*QueryDelegatorServicesResponse)(nil), "milkyway.restaking.v1.QueryDelegatorServicesResponse") + proto.RegisterType((*QueryDelegatorServiceRequest)(nil), "milkyway.restaking.v1.QueryDelegatorServiceRequest") + proto.RegisterType((*QueryDelegatorServiceResponse)(nil), "milkyway.restaking.v1.QueryDelegatorServiceResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "milkyway.restaking.v1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "milkyway.restaking.v1.QueryParamsResponse") +} + +func init() { proto.RegisterFile("milkyway/restaking/v1/query.proto", fileDescriptor_946984316b0f92c4) } + +var fileDescriptor_946984316b0f92c4 = []byte{ + // 1473 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x5a, 0xdf, 0x6b, 0x1c, 0xd5, + 0x17, 0xcf, 0xcd, 0xb7, 0x4d, 0x9b, 0x13, 0xda, 0x6f, 0x73, 0x5b, 0x69, 0xba, 0x4d, 0x36, 0x71, + 0x50, 0x9b, 0x06, 0xb2, 0xd3, 0xdd, 0x24, 0x55, 0xda, 0x34, 0xbf, 0x6c, 0x9a, 0x96, 0x36, 0x4d, + 0xdc, 0xa0, 0xfd, 0x21, 0x18, 0x26, 0xd9, 0x61, 0x5d, 0xba, 0xbb, 0xb3, 0xdd, 0xd9, 0xc4, 0xc6, + 0x58, 0x1f, 0x44, 0x69, 0xd1, 0x17, 0xc1, 0x47, 0xff, 0x01, 0x51, 0xb0, 0x82, 0x0a, 0x8a, 0x20, + 0x08, 0xa2, 0x41, 0x2c, 0xad, 0xfa, 0xa0, 0xa0, 0x48, 0x48, 0x04, 0x5f, 0x7c, 0xf0, 0x4f, 0x90, + 0x9d, 0x39, 0x77, 0xee, 0xcc, 0xce, 0xdc, 0xd9, 0x99, 0xcd, 0x50, 0x92, 0x97, 0x90, 0xdc, 0x7b, + 0xcf, 0xb9, 0x9f, 0xcf, 0xe7, 0x9e, 0x39, 0xf7, 0x9c, 0x4b, 0xe0, 0xf1, 0x42, 0x2e, 0x7f, 0x63, + 0xe5, 0x15, 0x65, 0x45, 0x2e, 0xab, 0x7a, 0x45, 0xb9, 0x91, 0x2b, 0x66, 0xe5, 0xe5, 0xa4, 0x7c, + 0x73, 0x49, 0x2d, 0xaf, 0x24, 0x4a, 0x65, 0xad, 0xa2, 0xd1, 0xc7, 0xd8, 0x92, 0x84, 0xb5, 0x24, + 0xb1, 0x9c, 0x8c, 0xf5, 0x2d, 0x6a, 0x7a, 0x41, 0xd3, 0xe5, 0x05, 0x45, 0x57, 0xcd, 0xf5, 0xf2, + 0x72, 0x72, 0x41, 0xad, 0x28, 0x49, 0xb9, 0xa4, 0x64, 0x73, 0x45, 0xa5, 0x92, 0xd3, 0x8a, 0xa6, + 0x8b, 0xd8, 0xa1, 0xac, 0x96, 0xd5, 0x8c, 0x5f, 0xe5, 0xea, 0x6f, 0x38, 0xda, 0x99, 0xd5, 0xb4, + 0x6c, 0x5e, 0x95, 0x95, 0x52, 0x4e, 0x56, 0x8a, 0x45, 0xad, 0x62, 0x98, 0xe8, 0x38, 0x7b, 0xc4, + 0xf4, 0x3f, 0x6f, 0x9a, 0x99, 0x7f, 0xe0, 0xd4, 0x51, 0xdc, 0x9a, 0xed, 0x6a, 0x87, 0x1b, 0x6b, + 0x57, 0x0a, 0xb9, 0xa2, 0x26, 0x1b, 0x3f, 0x71, 0x48, 0xf2, 0x26, 0x59, 0xd0, 0x32, 0x6a, 0x5e, + 0xf7, 0x5f, 0x53, 0x52, 0xca, 0x4a, 0xc1, 0xbd, 0x46, 0x2b, 0xa9, 0x65, 0xa5, 0xa2, 0x95, 0x75, + 0x97, 0x9f, 0xb8, 0xb5, 0xa6, 0xa4, 0x69, 0x79, 0xf7, 0x3c, 0x17, 0x5c, 0x57, 0xcb, 0xcb, 0xb9, + 0x45, 0xd5, 0xb5, 0x44, 0x7a, 0x1d, 0x8e, 0x3e, 0x57, 0x25, 0x34, 0xab, 0x69, 0xf9, 0xb3, 0x6a, + 0x5e, 0xcd, 0x9a, 0xba, 0xa4, 0xd5, 0x9b, 0x4b, 0xaa, 0x5e, 0xa1, 0x87, 0x61, 0x4f, 0xd5, 0xf5, + 0x7c, 0x2e, 0xd3, 0x41, 0x7a, 0x48, 0xef, 0xbe, 0x74, 0x4b, 0xf5, 0xcf, 0x0b, 0x19, 0x7a, 0x0e, + 0x80, 0x2b, 0xdf, 0xd1, 0xdc, 0x43, 0x7a, 0xdb, 0x52, 0x4f, 0x25, 0x50, 0xb9, 0xea, 0x31, 0x25, + 0x4c, 0x9d, 0xf0, 0x98, 0x12, 0xb3, 0x4a, 0x56, 0x45, 0xa7, 0x69, 0x9b, 0xa5, 0xf4, 0x35, 0x81, + 0x4e, 0x6f, 0x00, 0x7a, 0x49, 0x2b, 0xea, 0x2a, 0x7d, 0x1e, 0xda, 0x32, 0x7c, 0xb8, 0x83, 0xf4, + 0xfc, 0xaf, 0xb7, 0x2d, 0xd5, 0x9f, 0xf0, 0x8c, 0x93, 0x84, 0xd3, 0x09, 0xf3, 0x31, 0xb1, 0x6b, + 0xed, 0xcf, 0xee, 0xa6, 0xb4, 0xdd, 0x0f, 0x9d, 0xf2, 0xc0, 0x7f, 0xac, 0x2e, 0x7e, 0xd3, 0x9f, + 0x83, 0xc0, 0x6b, 0x10, 0xf3, 0xc0, 0x5f, 0x57, 0xbf, 0x49, 0x68, 0x47, 0x38, 0x5a, 0x79, 0x5e, + 0xc9, 0x64, 0xca, 0xaa, 0xae, 0x1b, 0x30, 0x5a, 0x27, 0x3a, 0x7e, 0xfe, 0xac, 0xff, 0x10, 0x22, + 0x19, 0x37, 0x67, 0xe6, 0x2a, 0xe5, 0x5c, 0x31, 0x9b, 0x3e, 0x60, 0x99, 0xe0, 0xb8, 0x54, 0xf6, + 0x3c, 0x3e, 0x4b, 0xbc, 0x39, 0x00, 0x4e, 0xda, 0x40, 0xd0, 0xa0, 0x76, 0x36, 0x37, 0xd2, 0xdb, + 0x04, 0xba, 0x8d, 0x4d, 0x67, 0x30, 0x30, 0x3d, 0xe2, 0xa6, 0x1b, 0xda, 0x58, 0xd8, 0x72, 0xee, + 0xc0, 0x86, 0x22, 0x8c, 0x9f, 0xef, 0x08, 0xf4, 0x88, 0xc1, 0xa0, 0x0c, 0xd7, 0xbc, 0x62, 0x28, + 0x29, 0xd0, 0xc1, 0xed, 0xe8, 0x91, 0xc4, 0xd1, 0x5d, 0x02, 0x71, 0x01, 0x91, 0xc0, 0xa2, 0x46, + 0x14, 0x54, 0xaf, 0x0a, 0xcf, 0xd7, 0x52, 0xf4, 0x8a, 0x47, 0x60, 0x35, 0x2c, 0xa8, 0x3d, 0xb8, + 0xee, 0x30, 0x19, 0xe6, 0xcc, 0x8c, 0xe5, 0x11, 0x5b, 0x5d, 0x00, 0x98, 0xce, 0xb8, 0x0a, 0xad, + 0x38, 0x12, 0x61, 0x64, 0x7d, 0xcb, 0xc2, 0xdc, 0x0b, 0x09, 0xca, 0x70, 0xd5, 0x2b, 0xb0, 0x4e, + 0x08, 0x74, 0x70, 0xf9, 0x79, 0x24, 0x71, 0xf5, 0x16, 0x81, 0x2e, 0x6f, 0x1a, 0x01, 0xf5, 0x8c, + 0x28, 0xa8, 0x6e, 0x89, 0xce, 0xd5, 0x12, 0xf3, 0x05, 0x8f, 0x98, 0x6a, 0x54, 0x4b, 0x7b, 0x48, + 0x7d, 0x4e, 0xe0, 0x09, 0x63, 0xeb, 0xb3, 0x0c, 0x93, 0xe0, 0xb2, 0xf3, 0x64, 0x4a, 0xc2, 0x32, + 0x8d, 0x2c, 0x00, 0xbf, 0x27, 0xf0, 0x64, 0x1d, 0xdc, 0x3b, 0xe4, 0x8e, 0xfc, 0x92, 0x40, 0xaf, + 0x93, 0x89, 0xcf, 0xd5, 0xb1, 0xcd, 0x4e, 0xe1, 0x01, 0x81, 0xe3, 0x01, 0xb0, 0xef, 0xa0, 0x9b, + 0xe6, 0x0b, 0x02, 0xc7, 0x9c, 0x8c, 0xc4, 0xb9, 0x76, 0x9b, 0x1d, 0xc6, 0x7d, 0x57, 0x20, 0xed, + 0xec, 0xe4, 0xfc, 0x11, 0xc1, 0xea, 0xd1, 0xf1, 0x89, 0x6f, 0x57, 0xf5, 0xdf, 0x27, 0x58, 0x6d, + 0xd6, 0xa2, 0x45, 0xc1, 0x07, 0x60, 0xb7, 0xd1, 0x87, 0xa0, 0xd4, 0x87, 0xb9, 0xd4, 0xc6, 0x30, + 0x4b, 0x3e, 0xa8, 0xa8, 0xb9, 0x36, 0x3a, 0x2d, 0x57, 0xe1, 0x88, 0x1b, 0x5c, 0xc4, 0x4a, 0xda, + 0xca, 0xf9, 0x66, 0x7b, 0x39, 0x2f, 0xcd, 0x78, 0x9d, 0xa3, 0x25, 0x4c, 0x12, 0x76, 0x55, 0xd7, + 0xe1, 0x9d, 0x56, 0x47, 0x17, 0x63, 0xa9, 0x74, 0x8f, 0xd5, 0x41, 0xae, 0xb4, 0xb3, 0x5d, 0xa3, + 0xe3, 0x1e, 0xab, 0x97, 0xbc, 0x10, 0xa3, 0x10, 0xcf, 0x42, 0xab, 0xd5, 0xcd, 0x62, 0x94, 0x74, + 0x73, 0x35, 0xac, 0x29, 0x7b, 0x72, 0x44, 0x55, 0xb8, 0x5d, 0x74, 0x11, 0x73, 0x87, 0x95, 0x46, + 0x2e, 0xc4, 0x11, 0x4b, 0x5c, 0x53, 0xb8, 0x37, 0xd7, 0x16, 0xee, 0xd2, 0xa2, 0xe8, 0xb0, 0x2d, + 0xe5, 0xc6, 0x61, 0x2f, 0x5b, 0x8f, 0x61, 0x14, 0x50, 0x38, 0xcb, 0x4c, 0xfa, 0xd8, 0x45, 0x17, + 0x93, 0xde, 0x76, 0x8d, 0xa8, 0x0f, 0x5d, 0xdf, 0x00, 0x07, 0x8c, 0xb2, 0x8c, 0xc2, 0x5e, 0xf6, + 0xb4, 0x81, 0xf1, 0xd4, 0xc5, 0x65, 0x61, 0x33, 0xb6, 0xfc, 0xce, 0x44, 0x61, 0x53, 0xd1, 0x05, + 0xd3, 0x9b, 0xec, 0x21, 0xa3, 0x16, 0x6c, 0xc4, 0xe2, 0x3a, 0xab, 0xf5, 0xe6, 0x9a, 0x6a, 0x5d, + 0x7a, 0x49, 0x70, 0xc6, 0x96, 0x62, 0x67, 0x60, 0x0f, 0xae, 0xc6, 0x38, 0x0a, 0x24, 0x18, 0xb3, + 0x91, 0x0e, 0x01, 0x35, 0x1f, 0x1c, 0x8c, 0xb7, 0x2a, 0xe4, 0x26, 0x5d, 0x81, 0x83, 0x8e, 0x51, + 0xdc, 0x6b, 0x0c, 0x5a, 0xcc, 0x37, 0x2d, 0xf7, 0x56, 0xce, 0x92, 0xd4, 0x58, 0x34, 0xd1, 0x5a, + 0xdd, 0xea, 0x83, 0xbf, 0x3f, 0xe9, 0x23, 0x69, 0xb4, 0x4b, 0x7d, 0x1a, 0x83, 0xdd, 0x86, 0x67, + 0xfa, 0x15, 0x81, 0xff, 0xd7, 0xd4, 0xbf, 0x34, 0x25, 0xf0, 0xe7, 0xf3, 0xa2, 0x15, 0x1b, 0x08, + 0x65, 0x63, 0x12, 0x91, 0x46, 0xef, 0x56, 0x51, 0xbd, 0xf1, 0xcb, 0x5f, 0xef, 0x35, 0x0f, 0xd2, + 0x94, 0x2c, 0x78, 0xbe, 0x33, 0xde, 0xe0, 0x56, 0xf1, 0x82, 0xb8, 0x2d, 0xdb, 0x2b, 0x86, 0x1f, + 0x09, 0xec, 0x77, 0x3a, 0xa7, 0xc9, 0xe0, 0x40, 0x18, 0xf6, 0x54, 0x18, 0x13, 0x84, 0x3e, 0xc7, + 0xa1, 0x9f, 0xa7, 0xe7, 0xc2, 0x43, 0x97, 0x57, 0x5d, 0x51, 0x7b, 0x9b, 0x3e, 0x20, 0x70, 0xd0, + 0xa3, 0x0c, 0xa6, 0x27, 0xfd, 0x00, 0x8a, 0x6b, 0xfe, 0xd8, 0xd3, 0xa1, 0xed, 0x90, 0xdd, 0x14, + 0x67, 0x37, 0x4c, 0x4f, 0x09, 0xd8, 0xf1, 0x07, 0xd4, 0x55, 0x5b, 0x1a, 0x76, 0x1e, 0xd0, 0x3a, + 0x01, 0xea, 0xde, 0x88, 0x0e, 0x85, 0x03, 0xc6, 0xf8, 0x9c, 0x0c, 0x6b, 0x86, 0x74, 0x5e, 0xe4, + 0x74, 0x66, 0xe9, 0xe5, 0xc6, 0xe9, 0x78, 0x1e, 0xda, 0x0f, 0x04, 0xa8, 0xbb, 0x5c, 0xf6, 0xa7, + 0x28, 0xec, 0x0c, 0xfc, 0x29, 0x8a, 0xab, 0x72, 0x69, 0x92, 0x53, 0x3c, 0x45, 0x9f, 0x11, 0x50, + 0xb4, 0x9e, 0xab, 0x57, 0x79, 0xae, 0x73, 0x9e, 0xd7, 0xef, 0x04, 0xda, 0x5d, 0xbb, 0xd0, 0xc1, + 0x50, 0xa0, 0x18, 0x95, 0xa1, 0x90, 0x56, 0xc8, 0xe4, 0x1a, 0x67, 0x72, 0x99, 0x5e, 0x6a, 0x94, + 0x89, 0xe7, 0x51, 0xad, 0x13, 0xe8, 0x10, 0x75, 0xfd, 0xf4, 0xb4, 0x1f, 0xdc, 0x3a, 0x6f, 0x1c, + 0xb1, 0xe1, 0xc6, 0x8c, 0x91, 0xf2, 0x05, 0x4e, 0x79, 0x84, 0x0e, 0x0b, 0x28, 0xd7, 0x21, 0x67, + 0x26, 0x1b, 0xfa, 0x2f, 0x81, 0x4e, 0xbf, 0x96, 0x9a, 0x8e, 0x06, 0x42, 0xea, 0x93, 0x54, 0xc6, + 0x1a, 0x77, 0x80, 0x74, 0xa7, 0x39, 0xdd, 0x09, 0x3a, 0xd6, 0x20, 0x5d, 0x5e, 0xb8, 0xfe, 0x43, + 0xe0, 0xa8, 0x4f, 0xe3, 0x4a, 0x47, 0x02, 0x01, 0x16, 0x7f, 0x92, 0xa3, 0x0d, 0xdb, 0x23, 0xdf, + 0x4b, 0x9c, 0xef, 0x38, 0x1d, 0x6d, 0x90, 0xaf, 0x55, 0x5a, 0x7d, 0x43, 0x60, 0xbf, 0xb3, 0x53, + 0xf4, 0xbf, 0xf3, 0x3c, 0x7b, 0x60, 0xff, 0x3b, 0xcf, 0xbb, 0x11, 0x95, 0xce, 0x73, 0x1e, 0x67, + 0xe8, 0x69, 0x7f, 0x1e, 0x46, 0x1e, 0x15, 0x46, 0xe9, 0x1a, 0x81, 0x7d, 0x8e, 0x4d, 0xe8, 0x89, + 0xc0, 0x78, 0x18, 0x83, 0x64, 0x08, 0x0b, 0x24, 0x90, 0xe6, 0x04, 0xa6, 0xe8, 0xe4, 0x16, 0x08, + 0xf0, 0x3b, 0x9d, 0xfe, 0x44, 0x80, 0xba, 0x5b, 0x33, 0xff, 0xf4, 0x2f, 0x6c, 0x3e, 0xfd, 0xd3, + 0xbf, 0xb8, 0x03, 0x0c, 0x15, 0x62, 0x22, 0x66, 0xfc, 0x8b, 0xfa, 0x83, 0x40, 0xbb, 0x6b, 0x33, + 0xff, 0x5b, 0x40, 0xd4, 0xeb, 0xc5, 0x86, 0x42, 0x5a, 0x21, 0xa1, 0xeb, 0x9c, 0xd0, 0x0c, 0x9d, + 0xde, 0x22, 0x21, 0xe7, 0x8d, 0x4e, 0xef, 0xdb, 0xe9, 0xb1, 0xde, 0x27, 0x20, 0xbd, 0x9a, 0xde, + 0x2e, 0x20, 0xbd, 0xda, 0x06, 0x4b, 0xba, 0xc8, 0xe9, 0x8d, 0xd1, 0x91, 0xc6, 0xe8, 0x59, 0x19, + 0xe1, 0x57, 0x02, 0x07, 0x6a, 0xb7, 0xa2, 0x03, 0x61, 0x80, 0x31, 0x36, 0x83, 0xe1, 0x8c, 0x90, + 0xcc, 0x55, 0x4e, 0x66, 0x9a, 0x5e, 0xdc, 0x1a, 0x19, 0xc7, 0x85, 0x4e, 0xdf, 0x21, 0xd0, 0x62, + 0x76, 0x31, 0xf4, 0xb8, 0x6f, 0x91, 0x6e, 0x6f, 0x9b, 0x62, 0x7d, 0x41, 0x96, 0x22, 0xf6, 0x3e, + 0x8e, 0xbd, 0x9b, 0x76, 0xc9, 0x7e, 0xff, 0x41, 0x30, 0x31, 0xbd, 0xb6, 0x11, 0x27, 0x0f, 0x37, + 0xe2, 0x64, 0x7d, 0x23, 0x4e, 0xde, 0xdd, 0x8c, 0x37, 0x3d, 0xdc, 0x8c, 0x37, 0xfd, 0xb6, 0x19, + 0x6f, 0xba, 0x3e, 0x90, 0xcd, 0x55, 0x5e, 0x5e, 0x5a, 0x48, 0x2c, 0x6a, 0x05, 0xcb, 0x45, 0x7f, + 0x5e, 0x59, 0xd0, 0xb9, 0xc3, 0x5b, 0x36, 0x97, 0x95, 0x95, 0x92, 0xaa, 0x2f, 0xb4, 0x18, 0xff, + 0x2a, 0x30, 0xf0, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9b, 0xf9, 0x27, 0xd8, 0xc0, 0x21, 0x00, + 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // PoolDelegations queries the delegations info for the given pool. + PoolDelegations(ctx context.Context, in *QueryPoolDelegationsRequest, opts ...grpc.CallOption) (*QueryPoolDelegationsResponse, error) + // PoolDelegation queries the delegation info for the given pool and + // delegator. + PoolDelegation(ctx context.Context, in *QueryPoolDelegationRequest, opts ...grpc.CallOption) (*QueryPoolDelegationResponse, error) + // OperatorDelegations queries the delegations info for the given operator. + OperatorDelegations(ctx context.Context, in *QueryOperatorDelegationsRequest, opts ...grpc.CallOption) (*QueryOperatorDelegationsResponse, error) + // OperatorDelegation queries the delegation info for the given operator and + // delegator. + OperatorDelegation(ctx context.Context, in *QueryOperatorDelegationRequest, opts ...grpc.CallOption) (*QueryOperatorDelegationResponse, error) + // ServiceDelegations queries the delegations info for the given service. + ServiceDelegations(ctx context.Context, in *QueryServiceDelegationsRequest, opts ...grpc.CallOption) (*QueryServiceDelegationsResponse, error) + // ServiceDelegation queries the delegation info for the given service and + // delegator. + ServiceDelegation(ctx context.Context, in *QueryServiceDelegationRequest, opts ...grpc.CallOption) (*QueryServiceDelegationResponse, error) + // DelegatorPoolDelegations queries all the pool delegations of a given + // delegator address. + DelegatorPoolDelegations(ctx context.Context, in *QueryDelegatorPoolDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorPoolDelegationsResponse, error) + // DelegatorOperatorDelegations queries all the operator delegations of a + // given delegator address. + DelegatorOperatorDelegations(ctx context.Context, in *QueryDelegatorOperatorDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorOperatorDelegationsResponse, error) + // DelegatorServiceDelegations queries all the service delegations of a given + // delegator address. + DelegatorServiceDelegations(ctx context.Context, in *QueryDelegatorServiceDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorServiceDelegationsResponse, error) + // DelegatorPools queries all pools info for given delegator + // address. + DelegatorPools(ctx context.Context, in *QueryDelegatorPoolsRequest, opts ...grpc.CallOption) (*QueryDelegatorPoolsResponse, error) + // DelegatorPool queries the pool info for given delegator and pool id. + DelegatorPool(ctx context.Context, in *QueryDelegatorPoolRequest, opts ...grpc.CallOption) (*QueryDelegatorPoolResponse, error) + // DelegatorOperators queries all operators info for given delegator + DelegatorOperators(ctx context.Context, in *QueryDelegatorOperatorsRequest, opts ...grpc.CallOption) (*QueryDelegatorOperatorsResponse, error) + // DelegatorOperator queries the operator info for given delegator and + // operator id. + DelegatorOperator(ctx context.Context, in *QueryDelegatorOperatorRequest, opts ...grpc.CallOption) (*QueryDelegatorOperatorResponse, error) + // DelegatorServices queries all services info for given delegator + DelegatorServices(ctx context.Context, in *QueryDelegatorServicesRequest, opts ...grpc.CallOption) (*QueryDelegatorServicesResponse, error) + // DelegatorService queries the service info for given delegator and service + // id. + DelegatorService(ctx context.Context, in *QueryDelegatorServiceRequest, opts ...grpc.CallOption) (*QueryDelegatorServiceResponse, error) + // Params queries the restaking parameters. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) PoolDelegations(ctx context.Context, in *QueryPoolDelegationsRequest, opts ...grpc.CallOption) (*QueryPoolDelegationsResponse, error) { + out := new(QueryPoolDelegationsResponse) + err := c.cc.Invoke(ctx, "/milkyway.restaking.v1.Query/PoolDelegations", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) PoolDelegation(ctx context.Context, in *QueryPoolDelegationRequest, opts ...grpc.CallOption) (*QueryPoolDelegationResponse, error) { + out := new(QueryPoolDelegationResponse) + err := c.cc.Invoke(ctx, "/milkyway.restaking.v1.Query/PoolDelegation", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) OperatorDelegations(ctx context.Context, in *QueryOperatorDelegationsRequest, opts ...grpc.CallOption) (*QueryOperatorDelegationsResponse, error) { + out := new(QueryOperatorDelegationsResponse) + err := c.cc.Invoke(ctx, "/milkyway.restaking.v1.Query/OperatorDelegations", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) OperatorDelegation(ctx context.Context, in *QueryOperatorDelegationRequest, opts ...grpc.CallOption) (*QueryOperatorDelegationResponse, error) { + out := new(QueryOperatorDelegationResponse) + err := c.cc.Invoke(ctx, "/milkyway.restaking.v1.Query/OperatorDelegation", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) ServiceDelegations(ctx context.Context, in *QueryServiceDelegationsRequest, opts ...grpc.CallOption) (*QueryServiceDelegationsResponse, error) { + out := new(QueryServiceDelegationsResponse) + err := c.cc.Invoke(ctx, "/milkyway.restaking.v1.Query/ServiceDelegations", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) ServiceDelegation(ctx context.Context, in *QueryServiceDelegationRequest, opts ...grpc.CallOption) (*QueryServiceDelegationResponse, error) { + out := new(QueryServiceDelegationResponse) + err := c.cc.Invoke(ctx, "/milkyway.restaking.v1.Query/ServiceDelegation", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) DelegatorPoolDelegations(ctx context.Context, in *QueryDelegatorPoolDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorPoolDelegationsResponse, error) { + out := new(QueryDelegatorPoolDelegationsResponse) + err := c.cc.Invoke(ctx, "/milkyway.restaking.v1.Query/DelegatorPoolDelegations", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) DelegatorOperatorDelegations(ctx context.Context, in *QueryDelegatorOperatorDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorOperatorDelegationsResponse, error) { + out := new(QueryDelegatorOperatorDelegationsResponse) + err := c.cc.Invoke(ctx, "/milkyway.restaking.v1.Query/DelegatorOperatorDelegations", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) DelegatorServiceDelegations(ctx context.Context, in *QueryDelegatorServiceDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorServiceDelegationsResponse, error) { + out := new(QueryDelegatorServiceDelegationsResponse) + err := c.cc.Invoke(ctx, "/milkyway.restaking.v1.Query/DelegatorServiceDelegations", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) DelegatorPools(ctx context.Context, in *QueryDelegatorPoolsRequest, opts ...grpc.CallOption) (*QueryDelegatorPoolsResponse, error) { + out := new(QueryDelegatorPoolsResponse) + err := c.cc.Invoke(ctx, "/milkyway.restaking.v1.Query/DelegatorPools", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) DelegatorPool(ctx context.Context, in *QueryDelegatorPoolRequest, opts ...grpc.CallOption) (*QueryDelegatorPoolResponse, error) { + out := new(QueryDelegatorPoolResponse) + err := c.cc.Invoke(ctx, "/milkyway.restaking.v1.Query/DelegatorPool", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) DelegatorOperators(ctx context.Context, in *QueryDelegatorOperatorsRequest, opts ...grpc.CallOption) (*QueryDelegatorOperatorsResponse, error) { + out := new(QueryDelegatorOperatorsResponse) + err := c.cc.Invoke(ctx, "/milkyway.restaking.v1.Query/DelegatorOperators", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) DelegatorOperator(ctx context.Context, in *QueryDelegatorOperatorRequest, opts ...grpc.CallOption) (*QueryDelegatorOperatorResponse, error) { + out := new(QueryDelegatorOperatorResponse) + err := c.cc.Invoke(ctx, "/milkyway.restaking.v1.Query/DelegatorOperator", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) DelegatorServices(ctx context.Context, in *QueryDelegatorServicesRequest, opts ...grpc.CallOption) (*QueryDelegatorServicesResponse, error) { + out := new(QueryDelegatorServicesResponse) + err := c.cc.Invoke(ctx, "/milkyway.restaking.v1.Query/DelegatorServices", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) DelegatorService(ctx context.Context, in *QueryDelegatorServiceRequest, opts ...grpc.CallOption) (*QueryDelegatorServiceResponse, error) { + out := new(QueryDelegatorServiceResponse) + err := c.cc.Invoke(ctx, "/milkyway.restaking.v1.Query/DelegatorService", 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, "/milkyway.restaking.v1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // PoolDelegations queries the delegations info for the given pool. + PoolDelegations(context.Context, *QueryPoolDelegationsRequest) (*QueryPoolDelegationsResponse, error) + // PoolDelegation queries the delegation info for the given pool and + // delegator. + PoolDelegation(context.Context, *QueryPoolDelegationRequest) (*QueryPoolDelegationResponse, error) + // OperatorDelegations queries the delegations info for the given operator. + OperatorDelegations(context.Context, *QueryOperatorDelegationsRequest) (*QueryOperatorDelegationsResponse, error) + // OperatorDelegation queries the delegation info for the given operator and + // delegator. + OperatorDelegation(context.Context, *QueryOperatorDelegationRequest) (*QueryOperatorDelegationResponse, error) + // ServiceDelegations queries the delegations info for the given service. + ServiceDelegations(context.Context, *QueryServiceDelegationsRequest) (*QueryServiceDelegationsResponse, error) + // ServiceDelegation queries the delegation info for the given service and + // delegator. + ServiceDelegation(context.Context, *QueryServiceDelegationRequest) (*QueryServiceDelegationResponse, error) + // DelegatorPoolDelegations queries all the pool delegations of a given + // delegator address. + DelegatorPoolDelegations(context.Context, *QueryDelegatorPoolDelegationsRequest) (*QueryDelegatorPoolDelegationsResponse, error) + // DelegatorOperatorDelegations queries all the operator delegations of a + // given delegator address. + DelegatorOperatorDelegations(context.Context, *QueryDelegatorOperatorDelegationsRequest) (*QueryDelegatorOperatorDelegationsResponse, error) + // DelegatorServiceDelegations queries all the service delegations of a given + // delegator address. + DelegatorServiceDelegations(context.Context, *QueryDelegatorServiceDelegationsRequest) (*QueryDelegatorServiceDelegationsResponse, error) + // DelegatorPools queries all pools info for given delegator + // address. + DelegatorPools(context.Context, *QueryDelegatorPoolsRequest) (*QueryDelegatorPoolsResponse, error) + // DelegatorPool queries the pool info for given delegator and pool id. + DelegatorPool(context.Context, *QueryDelegatorPoolRequest) (*QueryDelegatorPoolResponse, error) + // DelegatorOperators queries all operators info for given delegator + DelegatorOperators(context.Context, *QueryDelegatorOperatorsRequest) (*QueryDelegatorOperatorsResponse, error) + // DelegatorOperator queries the operator info for given delegator and + // operator id. + DelegatorOperator(context.Context, *QueryDelegatorOperatorRequest) (*QueryDelegatorOperatorResponse, error) + // DelegatorServices queries all services info for given delegator + DelegatorServices(context.Context, *QueryDelegatorServicesRequest) (*QueryDelegatorServicesResponse, error) + // DelegatorService queries the service info for given delegator and service + // id. + DelegatorService(context.Context, *QueryDelegatorServiceRequest) (*QueryDelegatorServiceResponse, error) + // Params queries the restaking parameters. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) PoolDelegations(ctx context.Context, req *QueryPoolDelegationsRequest) (*QueryPoolDelegationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PoolDelegations not implemented") +} +func (*UnimplementedQueryServer) PoolDelegation(ctx context.Context, req *QueryPoolDelegationRequest) (*QueryPoolDelegationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PoolDelegation not implemented") +} +func (*UnimplementedQueryServer) OperatorDelegations(ctx context.Context, req *QueryOperatorDelegationsRequest) (*QueryOperatorDelegationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method OperatorDelegations not implemented") +} +func (*UnimplementedQueryServer) OperatorDelegation(ctx context.Context, req *QueryOperatorDelegationRequest) (*QueryOperatorDelegationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method OperatorDelegation not implemented") +} +func (*UnimplementedQueryServer) ServiceDelegations(ctx context.Context, req *QueryServiceDelegationsRequest) (*QueryServiceDelegationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ServiceDelegations not implemented") +} +func (*UnimplementedQueryServer) ServiceDelegation(ctx context.Context, req *QueryServiceDelegationRequest) (*QueryServiceDelegationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ServiceDelegation not implemented") +} +func (*UnimplementedQueryServer) DelegatorPoolDelegations(ctx context.Context, req *QueryDelegatorPoolDelegationsRequest) (*QueryDelegatorPoolDelegationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DelegatorPoolDelegations not implemented") +} +func (*UnimplementedQueryServer) DelegatorOperatorDelegations(ctx context.Context, req *QueryDelegatorOperatorDelegationsRequest) (*QueryDelegatorOperatorDelegationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DelegatorOperatorDelegations not implemented") +} +func (*UnimplementedQueryServer) DelegatorServiceDelegations(ctx context.Context, req *QueryDelegatorServiceDelegationsRequest) (*QueryDelegatorServiceDelegationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DelegatorServiceDelegations not implemented") +} +func (*UnimplementedQueryServer) DelegatorPools(ctx context.Context, req *QueryDelegatorPoolsRequest) (*QueryDelegatorPoolsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DelegatorPools not implemented") +} +func (*UnimplementedQueryServer) DelegatorPool(ctx context.Context, req *QueryDelegatorPoolRequest) (*QueryDelegatorPoolResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DelegatorPool not implemented") +} +func (*UnimplementedQueryServer) DelegatorOperators(ctx context.Context, req *QueryDelegatorOperatorsRequest) (*QueryDelegatorOperatorsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DelegatorOperators not implemented") +} +func (*UnimplementedQueryServer) DelegatorOperator(ctx context.Context, req *QueryDelegatorOperatorRequest) (*QueryDelegatorOperatorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DelegatorOperator not implemented") +} +func (*UnimplementedQueryServer) DelegatorServices(ctx context.Context, req *QueryDelegatorServicesRequest) (*QueryDelegatorServicesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DelegatorServices not implemented") +} +func (*UnimplementedQueryServer) DelegatorService(ctx context.Context, req *QueryDelegatorServiceRequest) (*QueryDelegatorServiceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DelegatorService not implemented") +} +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_PoolDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPoolDelegationsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).PoolDelegations(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milkyway.restaking.v1.Query/PoolDelegations", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).PoolDelegations(ctx, req.(*QueryPoolDelegationsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_PoolDelegation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPoolDelegationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).PoolDelegation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milkyway.restaking.v1.Query/PoolDelegation", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).PoolDelegation(ctx, req.(*QueryPoolDelegationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_OperatorDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryOperatorDelegationsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).OperatorDelegations(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milkyway.restaking.v1.Query/OperatorDelegations", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).OperatorDelegations(ctx, req.(*QueryOperatorDelegationsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_OperatorDelegation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryOperatorDelegationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).OperatorDelegation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milkyway.restaking.v1.Query/OperatorDelegation", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).OperatorDelegation(ctx, req.(*QueryOperatorDelegationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_ServiceDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryServiceDelegationsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ServiceDelegations(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milkyway.restaking.v1.Query/ServiceDelegations", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ServiceDelegations(ctx, req.(*QueryServiceDelegationsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_ServiceDelegation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryServiceDelegationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ServiceDelegation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milkyway.restaking.v1.Query/ServiceDelegation", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ServiceDelegation(ctx, req.(*QueryServiceDelegationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_DelegatorPoolDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDelegatorPoolDelegationsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).DelegatorPoolDelegations(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milkyway.restaking.v1.Query/DelegatorPoolDelegations", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).DelegatorPoolDelegations(ctx, req.(*QueryDelegatorPoolDelegationsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_DelegatorOperatorDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDelegatorOperatorDelegationsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).DelegatorOperatorDelegations(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milkyway.restaking.v1.Query/DelegatorOperatorDelegations", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).DelegatorOperatorDelegations(ctx, req.(*QueryDelegatorOperatorDelegationsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_DelegatorServiceDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDelegatorServiceDelegationsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).DelegatorServiceDelegations(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milkyway.restaking.v1.Query/DelegatorServiceDelegations", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).DelegatorServiceDelegations(ctx, req.(*QueryDelegatorServiceDelegationsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_DelegatorPools_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDelegatorPoolsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).DelegatorPools(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milkyway.restaking.v1.Query/DelegatorPools", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).DelegatorPools(ctx, req.(*QueryDelegatorPoolsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_DelegatorPool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDelegatorPoolRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).DelegatorPool(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milkyway.restaking.v1.Query/DelegatorPool", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).DelegatorPool(ctx, req.(*QueryDelegatorPoolRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_DelegatorOperators_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDelegatorOperatorsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).DelegatorOperators(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milkyway.restaking.v1.Query/DelegatorOperators", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).DelegatorOperators(ctx, req.(*QueryDelegatorOperatorsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_DelegatorOperator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDelegatorOperatorRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).DelegatorOperator(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milkyway.restaking.v1.Query/DelegatorOperator", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).DelegatorOperator(ctx, req.(*QueryDelegatorOperatorRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_DelegatorServices_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDelegatorServicesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).DelegatorServices(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milkyway.restaking.v1.Query/DelegatorServices", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).DelegatorServices(ctx, req.(*QueryDelegatorServicesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_DelegatorService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDelegatorServiceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).DelegatorService(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milkyway.restaking.v1.Query/DelegatorService", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).DelegatorService(ctx, req.(*QueryDelegatorServiceRequest)) + } + 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: "/milkyway.restaking.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) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "milkyway.restaking.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "PoolDelegations", + Handler: _Query_PoolDelegations_Handler, + }, + { + MethodName: "PoolDelegation", + Handler: _Query_PoolDelegation_Handler, + }, + { + MethodName: "OperatorDelegations", + Handler: _Query_OperatorDelegations_Handler, + }, + { + MethodName: "OperatorDelegation", + Handler: _Query_OperatorDelegation_Handler, + }, + { + MethodName: "ServiceDelegations", + Handler: _Query_ServiceDelegations_Handler, + }, + { + MethodName: "ServiceDelegation", + Handler: _Query_ServiceDelegation_Handler, + }, + { + MethodName: "DelegatorPoolDelegations", + Handler: _Query_DelegatorPoolDelegations_Handler, + }, + { + MethodName: "DelegatorOperatorDelegations", + Handler: _Query_DelegatorOperatorDelegations_Handler, + }, + { + MethodName: "DelegatorServiceDelegations", + Handler: _Query_DelegatorServiceDelegations_Handler, + }, + { + MethodName: "DelegatorPools", + Handler: _Query_DelegatorPools_Handler, + }, + { + MethodName: "DelegatorPool", + Handler: _Query_DelegatorPool_Handler, + }, + { + MethodName: "DelegatorOperators", + Handler: _Query_DelegatorOperators_Handler, + }, + { + MethodName: "DelegatorOperator", + Handler: _Query_DelegatorOperator_Handler, + }, + { + MethodName: "DelegatorServices", + Handler: _Query_DelegatorServices_Handler, + }, + { + MethodName: "DelegatorService", + Handler: _Query_DelegatorService_Handler, + }, + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "milkyway/restaking/v1/query.proto", +} + +func (m *QueryPoolDelegationsRequest) 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 *QueryPoolDelegationsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPoolDelegationsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.PoolId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryPoolDelegationsResponse) 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 *QueryPoolDelegationsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPoolDelegationsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Delegations) > 0 { + for iNdEx := len(m.Delegations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Delegations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryPoolDelegationRequest) 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 *QueryPoolDelegationRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPoolDelegationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0x12 + } + if m.PoolId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryPoolDelegationResponse) 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 *QueryPoolDelegationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPoolDelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Delegation.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 *QueryOperatorDelegationsRequest) 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 *QueryOperatorDelegationsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOperatorDelegationsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.OperatorId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.OperatorId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryOperatorDelegationsResponse) 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 *QueryOperatorDelegationsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOperatorDelegationsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Delegations) > 0 { + for iNdEx := len(m.Delegations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Delegations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryOperatorDelegationRequest) 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 *QueryOperatorDelegationRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOperatorDelegationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0x12 + } + if m.OperatorId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.OperatorId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryOperatorDelegationResponse) 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 *QueryOperatorDelegationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOperatorDelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Delegation.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 *QueryServiceDelegationsRequest) 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 *QueryServiceDelegationsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryServiceDelegationsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.ServiceId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ServiceId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryServiceDelegationsResponse) 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 *QueryServiceDelegationsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryServiceDelegationsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Delegations) > 0 { + for iNdEx := len(m.Delegations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Delegations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryServiceDelegationRequest) 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 *QueryServiceDelegationRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryServiceDelegationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0x12 + } + if m.ServiceId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ServiceId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryServiceDelegationResponse) 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 *QueryServiceDelegationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryServiceDelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Delegation.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 *QueryDelegatorPoolDelegationsRequest) 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 *QueryDelegatorPoolDelegationsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorPoolDelegationsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDelegatorPoolDelegationsResponse) 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 *QueryDelegatorPoolDelegationsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorPoolDelegationsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Delegations) > 0 { + for iNdEx := len(m.Delegations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Delegations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryDelegatorOperatorDelegationsRequest) 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 *QueryDelegatorOperatorDelegationsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorOperatorDelegationsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDelegatorOperatorDelegationsResponse) 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 *QueryDelegatorOperatorDelegationsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorOperatorDelegationsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Delegations) > 0 { + for iNdEx := len(m.Delegations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Delegations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryDelegatorServiceDelegationsRequest) 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 *QueryDelegatorServiceDelegationsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorServiceDelegationsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDelegatorServiceDelegationsResponse) 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 *QueryDelegatorServiceDelegationsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorServiceDelegationsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Delegations) > 0 { + for iNdEx := len(m.Delegations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Delegations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryDelegatorPoolsRequest) 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 *QueryDelegatorPoolsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorPoolsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDelegatorPoolsResponse) 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 *QueryDelegatorPoolsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorPoolsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Pools) > 0 { + for iNdEx := len(m.Pools) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Pools[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryDelegatorPoolRequest) 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 *QueryDelegatorPoolRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorPoolRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PoolId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x10 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDelegatorPoolResponse) 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 *QueryDelegatorPoolResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Pool.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 *QueryDelegatorOperatorsRequest) 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 *QueryDelegatorOperatorsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorOperatorsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDelegatorOperatorsResponse) 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 *QueryDelegatorOperatorsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorOperatorsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Operators) > 0 { + for iNdEx := len(m.Operators) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Operators[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryDelegatorOperatorRequest) 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 *QueryDelegatorOperatorRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorOperatorRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.OperatorId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.OperatorId)) + i-- + dAtA[i] = 0x10 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDelegatorOperatorResponse) 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 *QueryDelegatorOperatorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorOperatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Operator.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 *QueryDelegatorServicesRequest) 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 *QueryDelegatorServicesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorServicesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDelegatorServicesResponse) 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 *QueryDelegatorServicesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorServicesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Services) > 0 { + for iNdEx := len(m.Services) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Services[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryDelegatorServiceRequest) 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 *QueryDelegatorServiceRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorServiceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ServiceId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ServiceId)) + i-- + dAtA[i] = 0x10 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDelegatorServiceResponse) 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 *QueryDelegatorServiceResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorServiceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Service.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 *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 + { + 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 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 *QueryPoolDelegationsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PoolId != 0 { + n += 1 + sovQuery(uint64(m.PoolId)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryPoolDelegationsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Delegations) > 0 { + for _, e := range m.Delegations { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryPoolDelegationRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PoolId != 0 { + n += 1 + sovQuery(uint64(m.PoolId)) + } + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryPoolDelegationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Delegation.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryOperatorDelegationsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.OperatorId != 0 { + n += 1 + sovQuery(uint64(m.OperatorId)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryOperatorDelegationsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Delegations) > 0 { + for _, e := range m.Delegations { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryOperatorDelegationRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.OperatorId != 0 { + n += 1 + sovQuery(uint64(m.OperatorId)) + } + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryOperatorDelegationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Delegation.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryServiceDelegationsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ServiceId != 0 { + n += 1 + sovQuery(uint64(m.ServiceId)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryServiceDelegationsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Delegations) > 0 { + for _, e := range m.Delegations { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryServiceDelegationRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ServiceId != 0 { + n += 1 + sovQuery(uint64(m.ServiceId)) + } + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryServiceDelegationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Delegation.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryDelegatorPoolDelegationsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDelegatorPoolDelegationsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Delegations) > 0 { + for _, e := range m.Delegations { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDelegatorOperatorDelegationsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDelegatorOperatorDelegationsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Delegations) > 0 { + for _, e := range m.Delegations { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDelegatorServiceDelegationsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDelegatorServiceDelegationsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Delegations) > 0 { + for _, e := range m.Delegations { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDelegatorPoolsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDelegatorPoolsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Pools) > 0 { + for _, e := range m.Pools { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDelegatorPoolRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.PoolId != 0 { + n += 1 + sovQuery(uint64(m.PoolId)) + } + return n +} + +func (m *QueryDelegatorPoolResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Pool.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryDelegatorOperatorsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDelegatorOperatorsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Operators) > 0 { + for _, e := range m.Operators { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDelegatorOperatorRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.OperatorId != 0 { + n += 1 + sovQuery(uint64(m.OperatorId)) + } + return n +} + +func (m *QueryDelegatorOperatorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Operator.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryDelegatorServicesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDelegatorServicesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Services) > 0 { + for _, e := range m.Services { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDelegatorServiceRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.ServiceId != 0 { + n += 1 + sovQuery(uint64(m.ServiceId)) + } + return n +} + +func (m *QueryDelegatorServiceResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Service.Size() + 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 + l = m.Params.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 *QueryPoolDelegationsRequest) 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: QueryPoolDelegationsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPoolDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryPoolDelegationsResponse) 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: QueryPoolDelegationsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPoolDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delegations", 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.Delegations = append(m.Delegations, PoolDelegationResponse{}) + if err := m.Delegations[len(m.Delegations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryPoolDelegationRequest) 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: QueryPoolDelegationRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPoolDelegationRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.DelegatorAddress = 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 *QueryPoolDelegationResponse) 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: QueryPoolDelegationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPoolDelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delegation", 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 err := m.Delegation.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 *QueryOperatorDelegationsRequest) 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: QueryOperatorDelegationsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOperatorDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorId", wireType) + } + m.OperatorId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OperatorId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryOperatorDelegationsResponse) 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: QueryOperatorDelegationsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOperatorDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delegations", 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.Delegations = append(m.Delegations, OperatorDelegationResponse{}) + if err := m.Delegations[len(m.Delegations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryOperatorDelegationRequest) 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: QueryOperatorDelegationRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOperatorDelegationRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorId", wireType) + } + m.OperatorId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OperatorId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.DelegatorAddress = 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 *QueryOperatorDelegationResponse) 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: QueryOperatorDelegationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOperatorDelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delegation", 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 err := m.Delegation.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 *QueryServiceDelegationsRequest) 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: QueryServiceDelegationsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryServiceDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceId", wireType) + } + m.ServiceId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ServiceId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryServiceDelegationsResponse) 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: QueryServiceDelegationsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryServiceDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delegations", 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.Delegations = append(m.Delegations, ServiceDelegationResponse{}) + if err := m.Delegations[len(m.Delegations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryServiceDelegationRequest) 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: QueryServiceDelegationRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryServiceDelegationRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceId", wireType) + } + m.ServiceId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ServiceId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.DelegatorAddress = 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 *QueryServiceDelegationResponse) 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: QueryServiceDelegationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryServiceDelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delegation", 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 err := m.Delegation.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 *QueryDelegatorPoolDelegationsRequest) 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: QueryDelegatorPoolDelegationsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorPoolDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDelegatorPoolDelegationsResponse) 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: QueryDelegatorPoolDelegationsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorPoolDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delegations", 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.Delegations = append(m.Delegations, PoolDelegationResponse{}) + if err := m.Delegations[len(m.Delegations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDelegatorOperatorDelegationsRequest) 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: QueryDelegatorOperatorDelegationsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorOperatorDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDelegatorOperatorDelegationsResponse) 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: QueryDelegatorOperatorDelegationsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorOperatorDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delegations", 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.Delegations = append(m.Delegations, OperatorDelegationResponse{}) + if err := m.Delegations[len(m.Delegations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDelegatorServiceDelegationsRequest) 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: QueryDelegatorServiceDelegationsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorServiceDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDelegatorServiceDelegationsResponse) 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: QueryDelegatorServiceDelegationsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorServiceDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delegations", 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.Delegations = append(m.Delegations, ServiceDelegationResponse{}) + if err := m.Delegations[len(m.Delegations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDelegatorPoolsRequest) 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: QueryDelegatorPoolsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorPoolsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDelegatorPoolsResponse) 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: QueryDelegatorPoolsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorPoolsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pools", 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.Pools = append(m.Pools, types.Pool{}) + if err := m.Pools[len(m.Pools)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDelegatorPoolRequest) 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: QueryDelegatorPoolRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorPoolRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint32(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 *QueryDelegatorPoolResponse) 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: QueryDelegatorPoolResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorPoolResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pool", 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 err := m.Pool.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 *QueryDelegatorOperatorsRequest) 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: QueryDelegatorOperatorsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorOperatorsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDelegatorOperatorsResponse) 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: QueryDelegatorOperatorsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorOperatorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Operators", 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.Operators = append(m.Operators, types1.Operator{}) + if err := m.Operators[len(m.Operators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDelegatorOperatorRequest) 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: QueryDelegatorOperatorRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorOperatorRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorId", wireType) + } + m.OperatorId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OperatorId |= uint32(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 *QueryDelegatorOperatorResponse) 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: QueryDelegatorOperatorResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorOperatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Operator", 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 err := m.Operator.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 *QueryDelegatorServicesRequest) 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: QueryDelegatorServicesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorServicesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDelegatorServicesResponse) 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: QueryDelegatorServicesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorServicesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Services", 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.Services = append(m.Services, types2.Service{}) + if err := m.Services[len(m.Services)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDelegatorServiceRequest) 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: QueryDelegatorServiceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorServiceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceId", wireType) + } + m.ServiceId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ServiceId |= uint32(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 *QueryDelegatorServiceResponse) 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: QueryDelegatorServiceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorServiceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Service", 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 err := m.Service.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 *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 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 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/restaking/types/query.pb.gw.go b/x/restaking/types/query.pb.gw.go new file mode 100644 index 00000000..1525a608 --- /dev/null +++ b/x/restaking/types/query.pb.gw.go @@ -0,0 +1,1962 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: milkyway/restaking/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/metadata" + "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 +var _ = metadata.Join + +var ( + filter_Query_PoolDelegations_0 = &utilities.DoubleArray{Encoding: map[string]int{"pool_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_PoolDelegations_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPoolDelegationsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["pool_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "pool_id") + } + + protoReq.PoolId, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "pool_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_PoolDelegations_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.PoolDelegations(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_PoolDelegations_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPoolDelegationsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["pool_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "pool_id") + } + + protoReq.PoolId, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "pool_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_PoolDelegations_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.PoolDelegations(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_PoolDelegation_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPoolDelegationRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["pool_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "pool_id") + } + + protoReq.PoolId, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "pool_id", err) + } + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + msg, err := client.PoolDelegation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_PoolDelegation_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPoolDelegationRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["pool_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "pool_id") + } + + protoReq.PoolId, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "pool_id", err) + } + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + msg, err := server.PoolDelegation(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_OperatorDelegations_0 = &utilities.DoubleArray{Encoding: map[string]int{"operator_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_OperatorDelegations_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOperatorDelegationsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["operator_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator_id") + } + + protoReq.OperatorId, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_OperatorDelegations_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.OperatorDelegations(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_OperatorDelegations_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOperatorDelegationsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["operator_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator_id") + } + + protoReq.OperatorId, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_OperatorDelegations_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.OperatorDelegations(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_OperatorDelegation_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOperatorDelegationRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["operator_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator_id") + } + + protoReq.OperatorId, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator_id", err) + } + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + msg, err := client.OperatorDelegation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_OperatorDelegation_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOperatorDelegationRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["operator_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator_id") + } + + protoReq.OperatorId, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator_id", err) + } + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + msg, err := server.OperatorDelegation(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_ServiceDelegations_0 = &utilities.DoubleArray{Encoding: map[string]int{"service_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_ServiceDelegations_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryServiceDelegationsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["service_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "service_id") + } + + protoReq.ServiceId, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "service_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ServiceDelegations_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ServiceDelegations(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ServiceDelegations_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryServiceDelegationsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["service_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "service_id") + } + + protoReq.ServiceId, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "service_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ServiceDelegations_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ServiceDelegations(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_ServiceDelegation_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryServiceDelegationRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["service_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "service_id") + } + + protoReq.ServiceId, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "service_id", err) + } + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + msg, err := client.ServiceDelegation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ServiceDelegation_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryServiceDelegationRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["service_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "service_id") + } + + protoReq.ServiceId, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "service_id", err) + } + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + msg, err := server.ServiceDelegation(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_DelegatorPoolDelegations_0 = &utilities.DoubleArray{Encoding: map[string]int{"delegator_address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_DelegatorPoolDelegations_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDelegatorPoolDelegationsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DelegatorPoolDelegations_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.DelegatorPoolDelegations(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_DelegatorPoolDelegations_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDelegatorPoolDelegationsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DelegatorPoolDelegations_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.DelegatorPoolDelegations(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_DelegatorOperatorDelegations_0 = &utilities.DoubleArray{Encoding: map[string]int{"delegator_address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_DelegatorOperatorDelegations_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDelegatorOperatorDelegationsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DelegatorOperatorDelegations_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.DelegatorOperatorDelegations(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_DelegatorOperatorDelegations_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDelegatorOperatorDelegationsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DelegatorOperatorDelegations_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.DelegatorOperatorDelegations(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_DelegatorServiceDelegations_0 = &utilities.DoubleArray{Encoding: map[string]int{"delegator_address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_DelegatorServiceDelegations_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDelegatorServiceDelegationsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DelegatorServiceDelegations_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.DelegatorServiceDelegations(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_DelegatorServiceDelegations_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDelegatorServiceDelegationsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DelegatorServiceDelegations_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.DelegatorServiceDelegations(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_DelegatorPools_0 = &utilities.DoubleArray{Encoding: map[string]int{"delegator_address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_DelegatorPools_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDelegatorPoolsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DelegatorPools_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.DelegatorPools(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_DelegatorPools_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDelegatorPoolsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DelegatorPools_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.DelegatorPools(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_DelegatorPool_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDelegatorPoolRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + val, ok = pathParams["pool_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "pool_id") + } + + protoReq.PoolId, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "pool_id", err) + } + + msg, err := client.DelegatorPool(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_DelegatorPool_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDelegatorPoolRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + val, ok = pathParams["pool_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "pool_id") + } + + protoReq.PoolId, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "pool_id", err) + } + + msg, err := server.DelegatorPool(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_DelegatorOperators_0 = &utilities.DoubleArray{Encoding: map[string]int{"delegator_address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_DelegatorOperators_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDelegatorOperatorsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DelegatorOperators_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.DelegatorOperators(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_DelegatorOperators_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDelegatorOperatorsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DelegatorOperators_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.DelegatorOperators(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_DelegatorOperator_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDelegatorOperatorRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + val, ok = pathParams["operator_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator_id") + } + + protoReq.OperatorId, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator_id", err) + } + + msg, err := client.DelegatorOperator(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_DelegatorOperator_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDelegatorOperatorRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + val, ok = pathParams["operator_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator_id") + } + + protoReq.OperatorId, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator_id", err) + } + + msg, err := server.DelegatorOperator(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_DelegatorServices_0 = &utilities.DoubleArray{Encoding: map[string]int{"delegator_address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_DelegatorServices_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDelegatorServicesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DelegatorServices_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.DelegatorServices(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_DelegatorServices_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDelegatorServicesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DelegatorServices_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.DelegatorServices(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_DelegatorService_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDelegatorServiceRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + val, ok = pathParams["service_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "service_id") + } + + protoReq.ServiceId, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "service_id", err) + } + + msg, err := client.DelegatorService(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_DelegatorService_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDelegatorServiceRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["delegator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") + } + + protoReq.DelegatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) + } + + val, ok = pathParams["service_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "service_id") + } + + protoReq.ServiceId, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "service_id", err) + } + + msg, err := server.DelegatorService(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 + +} + +// 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 to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_PoolDelegations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_PoolDelegations_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_PoolDelegations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_PoolDelegation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_PoolDelegation_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_PoolDelegation_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_OperatorDelegations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_OperatorDelegations_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_OperatorDelegations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_OperatorDelegation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_OperatorDelegation_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_OperatorDelegation_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ServiceDelegations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ServiceDelegations_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ServiceDelegations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ServiceDelegation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ServiceDelegation_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ServiceDelegation_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_DelegatorPoolDelegations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_DelegatorPoolDelegations_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_DelegatorPoolDelegations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_DelegatorOperatorDelegations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_DelegatorOperatorDelegations_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_DelegatorOperatorDelegations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_DelegatorServiceDelegations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_DelegatorServiceDelegations_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_DelegatorServiceDelegations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_DelegatorPools_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_DelegatorPools_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_DelegatorPools_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_DelegatorPool_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_DelegatorPool_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_DelegatorPool_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_DelegatorOperators_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_DelegatorOperators_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_DelegatorOperators_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_DelegatorOperator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_DelegatorOperator_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_DelegatorOperator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_DelegatorServices_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_DelegatorServices_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_DelegatorServices_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_DelegatorService_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_DelegatorService_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_DelegatorService_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() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_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_PoolDelegations_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_PoolDelegations_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_PoolDelegations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_PoolDelegation_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_PoolDelegation_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_PoolDelegation_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_OperatorDelegations_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_OperatorDelegations_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_OperatorDelegations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_OperatorDelegation_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_OperatorDelegation_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_OperatorDelegation_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ServiceDelegations_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_ServiceDelegations_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_ServiceDelegations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ServiceDelegation_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_ServiceDelegation_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_ServiceDelegation_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_DelegatorPoolDelegations_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_DelegatorPoolDelegations_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_DelegatorPoolDelegations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_DelegatorOperatorDelegations_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_DelegatorOperatorDelegations_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_DelegatorOperatorDelegations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_DelegatorServiceDelegations_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_DelegatorServiceDelegations_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_DelegatorServiceDelegations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_DelegatorPools_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_DelegatorPools_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_DelegatorPools_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_DelegatorPool_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_DelegatorPool_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_DelegatorPool_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_DelegatorOperators_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_DelegatorOperators_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_DelegatorOperators_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_DelegatorOperator_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_DelegatorOperator_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_DelegatorOperator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_DelegatorServices_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_DelegatorServices_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_DelegatorServices_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_DelegatorService_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_DelegatorService_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_DelegatorService_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()...) + + }) + + return nil +} + +var ( + pattern_Query_PoolDelegations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"milkyway", "restaking", "v1", "pools", "pool_id", "delegations"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_PoolDelegation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"milkyway", "restaking", "v1", "pools", "pool_id", "delegations", "delegator_address"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_OperatorDelegations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"milkyway", "restaking", "v1", "operators", "operator_id", "delegations"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_OperatorDelegation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"milkyway", "restaking", "v1", "operators", "operator_id", "delegations", "delegator_address"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_ServiceDelegations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"milkyway", "restaking", "v1", "services", "service_id", "delegations"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_ServiceDelegation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"milkyway", "restaking", "v1", "services", "service_id", "delegations", "delegator_address"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_DelegatorPoolDelegations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"milkyway", "restaking", "v1", "delegations", "delegator_address", "pools"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_DelegatorOperatorDelegations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"milkyway", "restaking", "v1", "delegations", "delegator_address", "operators"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_DelegatorServiceDelegations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"milkyway", "restaking", "v1", "delegations", "delegator_address", "services"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_DelegatorPools_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"milkyway", "restaking", "v1", "delegators", "delegator_address", "pools"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_DelegatorPool_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"milkyway", "restaking", "v1", "delegators", "delegator_address", "pools", "pool_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_DelegatorOperators_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"milkyway", "restaking", "v1", "delegators", "delegator_address", "operators"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_DelegatorOperator_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"milkyway", "restaking", "v1", "delegators", "delegator_address", "operators", "operator_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_DelegatorServices_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"milkyway", "restaking", "v1", "delegators", "delegator_address", "services"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_DelegatorService_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"milkyway", "restaking", "v1", "delegators", "delegator_address", "services", "service_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"milkyway", "restaking", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_PoolDelegations_0 = runtime.ForwardResponseMessage + + forward_Query_PoolDelegation_0 = runtime.ForwardResponseMessage + + forward_Query_OperatorDelegations_0 = runtime.ForwardResponseMessage + + forward_Query_OperatorDelegation_0 = runtime.ForwardResponseMessage + + forward_Query_ServiceDelegations_0 = runtime.ForwardResponseMessage + + forward_Query_ServiceDelegation_0 = runtime.ForwardResponseMessage + + forward_Query_DelegatorPoolDelegations_0 = runtime.ForwardResponseMessage + + forward_Query_DelegatorOperatorDelegations_0 = runtime.ForwardResponseMessage + + forward_Query_DelegatorServiceDelegations_0 = runtime.ForwardResponseMessage + + forward_Query_DelegatorPools_0 = runtime.ForwardResponseMessage + + forward_Query_DelegatorPool_0 = runtime.ForwardResponseMessage + + forward_Query_DelegatorOperators_0 = runtime.ForwardResponseMessage + + forward_Query_DelegatorOperator_0 = runtime.ForwardResponseMessage + + forward_Query_DelegatorServices_0 = runtime.ForwardResponseMessage + + forward_Query_DelegatorService_0 = runtime.ForwardResponseMessage + + forward_Query_Params_0 = runtime.ForwardResponseMessage +) diff --git a/x/services/types/errors.go b/x/services/types/errors.go index a2ab5ede..a489413e 100644 --- a/x/services/types/errors.go +++ b/x/services/types/errors.go @@ -2,12 +2,13 @@ package types import ( "cosmossdk.io/errors" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) var ( + ErrServiceNotFound = errors.Wrap(sdkerrors.ErrNotFound, "service not found") ErrInvalidGenesis = errors.Register(ModuleName, 1, "invalid genesis state") - ErrServiceNotFound = errors.Register(ModuleName, 2, "service not found") + ErrInsufficientShares = errors.Register(ModuleName, 2, "insufficient delegation shares") ErrServiceAlreadyActive = errors.Register(ModuleName, 3, "service is already active") ErrServiceNotActive = errors.Register(ModuleName, 4, "service is not active") - ErrInsufficientShares = errors.Register(ModuleName, 5, "insufficient delegation shares") ) diff --git a/x/services/types/models.go b/x/services/types/models.go index 59d5ef7d..9af917f5 100644 --- a/x/services/types/models.go +++ b/x/services/types/models.go @@ -8,6 +8,8 @@ import ( sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + + "github.com/milkyway-labs/milkyway/utils" ) // GetServiceAddress generates a service address from its id @@ -77,7 +79,7 @@ func (s Service) Validate() error { // GetSharesDenom returns the shares denom for a service and token denom func (s Service) GetSharesDenom(tokenDenom string) string { - return fmt.Sprintf("service/%d/%s", s.ID, tokenDenom) + return utils.GetSharesDenomFromTokenDenom("service", s.ID, tokenDenom) } // IsActive returns whether the service is active. @@ -89,12 +91,12 @@ func (s Service) IsActive() bool { // This can happen e.g. if Service loses all tokens due to slashing. In this case, // make all future delegations invalid. func (s Service) InvalidExRate() bool { - for _, token := range s.Tokens { - if token.IsZero() && s.DelegatorShares.AmountOf(token.Denom).IsPositive() { - return true - } - } - return false + return utils.IsInvalidExRate(s.Tokens, s.DelegatorShares) +} + +// TokensFromShares calculates the token worth of provided shares +func (s Service) TokensFromShares(shares sdk.DecCoins) sdk.DecCoins { + return utils.ComputeTokensFromShares(shares, s.Tokens, s.DelegatorShares) } // SharesFromTokens returns the shares of a delegation given a bond amount. It @@ -103,38 +105,14 @@ func (s Service) SharesFromTokens(tokens sdk.Coin) (sdkmath.LegacyDec, error) { if s.Tokens.IsZero() { return sdkmath.LegacyZeroDec(), ErrInsufficientShares } - - sharesDenom := s.GetSharesDenom(tokens.Denom) - delegatorTokenShares := s.DelegatorShares.AmountOf(sharesDenom) - operatorTokenAmount := s.Tokens.AmountOf(tokens.Denom) - - return delegatorTokenShares.MulInt(tokens.Amount).QuoInt(operatorTokenAmount), nil + return utils.SharesFromTokens(tokens, s.GetSharesDenom, s.Tokens, s.DelegatorShares) } // AddTokensFromDelegation adds the given amount of tokens to the service's total tokens, // also updating the service's delegator shares. // It returns the updated service and the shares issued. func (s Service) AddTokensFromDelegation(amount sdk.Coins) (Service, sdk.DecCoins) { - // calculate the shares to issue - issuedShares := sdk.NewDecCoins() - for _, token := range amount { - var tokenShares sdk.DecCoin - sharesDenom := s.GetSharesDenom(token.Denom) - - delegatorShares := s.DelegatorShares.AmountOf(sharesDenom) - if delegatorShares.IsZero() { - // The first delegation to an operator sets the exchange rate to one - tokenShares = sdk.NewDecCoin(sharesDenom, token.Amount) - } else { - shares, err := s.SharesFromTokens(token) - if err != nil { - panic(err) - } - tokenShares = sdk.NewDecCoinFromDec(sharesDenom, shares) - } - - issuedShares = issuedShares.Add(tokenShares) - } + issuedShares := utils.IssueShares(amount, s.GetSharesDenom, s.Tokens, s.DelegatorShares) s.Tokens = s.Tokens.Add(amount...) s.DelegatorShares = s.DelegatorShares.Add(issuedShares...) diff --git a/x/services/types/models_test.go b/x/services/types/models_test.go index 462f011e..d038a0b2 100644 --- a/x/services/types/models_test.go +++ b/x/services/types/models_test.go @@ -3,6 +3,8 @@ package types_test import ( "testing" + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "github.com/milkyway-labs/milkyway/x/services/types" @@ -285,3 +287,91 @@ func TestService_Update(t *testing.T) { }) } } + +func TestService_SharesFromTokens(t *testing.T) { + testCases := []struct { + name string + service types.Service + tokens sdk.Coin + shouldErr bool + expShares sdkmath.LegacyDec + }{ + { + name: "service with no delegation shares returns error", + service: types.Service{ + ID: 1, + Address: types.GetServiceAddress(1).String(), + DelegatorShares: sdk.NewDecCoins(), + Tokens: sdk.NewCoins(), + }, + tokens: sdk.NewCoin("umilk", sdkmath.NewInt(100)), + shouldErr: true, + }, + { + name: "shares are computed properly for non empty operator", + service: types.Service{ + ID: 1, + Address: types.GetServiceAddress(1).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(50)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("service/1/umilk", sdkmath.LegacyNewDec(100)), + ), + }, + tokens: sdk.NewCoin("umilk", sdkmath.NewInt(20)), + shouldErr: false, + expShares: sdkmath.LegacyNewDec(40), + }, + } + + for _, tc := range testCases { + tc := tc + t.Run(tc.name, func(t *testing.T) { + shares, err := tc.service.SharesFromTokens(tc.tokens) + if tc.shouldErr { + require.Error(t, err) + } else { + require.NoError(t, err) + require.Equal(t, tc.expShares, shares) + } + }) + } +} + +func TestService_TokensFromShares(t *testing.T) { + testCases := []struct { + name string + service types.Service + shares sdk.DecCoins + expTokens sdk.DecCoins + }{ + { + name: "service with shares returns correct amount", + service: types.Service{ + ID: 1, + Address: types.GetServiceAddress(1).String(), + Tokens: sdk.NewCoins( + sdk.NewCoin("umilk", sdkmath.NewInt(70)), + ), + DelegatorShares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("service/1/umilk", sdkmath.LegacyNewDec(140)), + ), + }, + shares: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("service/1/umilk", sdkmath.LegacyNewDec(40)), + ), + expTokens: sdk.NewDecCoins( + sdk.NewDecCoinFromDec("umilk", sdkmath.LegacyNewDec(20)), + ), + }, + } + + for _, tc := range testCases { + tc := tc + t.Run(tc.name, func(t *testing.T) { + tokens := tc.service.TokensFromShares(tc.shares) + require.Equal(t, tc.expTokens, tokens) + }) + } +}