diff --git a/proto/osmosis/pool-incentives/v1beta1/genesis.proto b/proto/osmosis/pool-incentives/v1beta1/genesis.proto deleted file mode 100644 index 42cc6a98446..00000000000 --- a/proto/osmosis/pool-incentives/v1beta1/genesis.proto +++ /dev/null @@ -1,27 +0,0 @@ -syntax = "proto3"; -package osmosis.poolincentives.v1beta1; - -import "gogoproto/gogo.proto"; -import "google/protobuf/duration.proto"; -import "osmosis/pool-incentives/v1beta1/incentives.proto"; - -option go_package = "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/types"; - -// GenesisState defines the pool incentives module's genesis state. -message GenesisState { - // params defines all the paramaters of the module. - Params params = 1 [ (gogoproto.nullable) = false ]; - repeated google.protobuf.Duration lockable_durations = 2 [ - (gogoproto.nullable) = false, - (gogoproto.stdduration) = true, - (gogoproto.moretags) = "yaml:\"lockable_durations\"" - ]; - DistrInfo distr_info = 3 [ - (gogoproto.nullable) = true, - (gogoproto.moretags) = "yaml:\"distr_info\"" - ]; - PoolToGauges pool_to_gauges = 4 [ - (gogoproto.nullable) = true, - (gogoproto.moretags) = "yaml:\"pool_to_gauges\"" - ]; -} diff --git a/proto/osmosis/pool-incentives/v1beta1/gov.proto b/proto/osmosis/pool-incentives/v1beta1/gov.proto deleted file mode 100644 index 748c56159de..00000000000 --- a/proto/osmosis/pool-incentives/v1beta1/gov.proto +++ /dev/null @@ -1,49 +0,0 @@ -syntax = "proto3"; -package osmosis.poolincentives.v1beta1; - -import "gogoproto/gogo.proto"; -import "osmosis/pool-incentives/v1beta1/incentives.proto"; - -option go_package = "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/types"; - -// ReplacePoolIncentivesProposal is a gov Content type for updating the pool -// incentives. If a ReplacePoolIncentivesProposal passes, the proposal’s records -// override the existing DistrRecords set in the module. Each record has a -// specified gauge id and weight, and the incentives are distributed to each -// gauge according to weight/total_weight. The incentives are put in the fee -// pool and it is allocated to gauges and community pool by the DistrRecords -// configuration. Note that gaugeId=0 represents the community pool. -message ReplacePoolIncentivesProposal { - option (gogoproto.equal) = true; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - - string title = 1; - string description = 2; - repeated DistrRecord records = 3 [ (gogoproto.nullable) = false ]; -} - -// UpdatePoolIncentivesProposal is a gov Content type for updating the pool -// incentives. If a UpdatePoolIncentivesProposal passes, all the DistrRecords -// in the proposals are edited. An existing DistrRecord is not overriden unless -// explicitly included in the proposal. -// This differs from an ReplacePoolIncentivesProposal because it only does an -// in place update of the DistrRecords for gauges explicitly mentioned in the -// proposal. - -// For example: if the existing DistrRecords were: -// [(Gauge 0, 5), (Gauge 1, 6), (Gauge 2, 6)] -// An UpdatePoolIncentivesProposal includes -// [(Gauge 1, 0), (Gauge 2, 4), (Gauge 3, 10)] -// This would delete Gauge 1, Edit Gauge 2, and Add Gauge 3 -// The result DistrRecords in state would be: -// [(Gauge 0, 5), (Gauge 2, 4), (Gauge 3, 10)] -message UpdatePoolIncentivesProposal { - option (gogoproto.equal) = true; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - - string title = 1; - string description = 2; - repeated DistrRecord records = 3 [ (gogoproto.nullable) = false ]; -} diff --git a/proto/osmosis/pool-incentives/v1beta1/incentives.proto b/proto/osmosis/pool-incentives/v1beta1/incentives.proto deleted file mode 100644 index 6398bda4a3f..00000000000 --- a/proto/osmosis/pool-incentives/v1beta1/incentives.proto +++ /dev/null @@ -1,55 +0,0 @@ -syntax = "proto3"; -package osmosis.poolincentives.v1beta1; - -import "gogoproto/gogo.proto"; -import "google/protobuf/duration.proto"; - -option go_package = "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/types"; - -message Params { - option (gogoproto.goproto_stringer) = false; - - // minted_denom is the denomination of the coin expected to be used for incentives - string minted_denom = 1 [ (gogoproto.moretags) = "yaml:\"minted_denom\"" ]; -} - -message LockableDurationsInfo { - repeated google.protobuf.Duration lockable_durations = 1 [ - (gogoproto.nullable) = false, - (gogoproto.stdduration) = true, - (gogoproto.moretags) = "yaml:\"lockable_durations\"" - ]; -} - -message DistrInfo { - string total_weight = 1 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.moretags) = "yaml:\"total_weight\"", - (gogoproto.nullable) = false - ]; - repeated DistrRecord records = 2 [ (gogoproto.nullable) = false ]; -} - -message DistrRecord { - option (gogoproto.equal) = true; - - uint64 gauge_id = 1 [ (gogoproto.moretags) = "yaml:\"gauge_id\"" ]; - string weight = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; -} - -message PoolToGauge { - uint64 pool_id = 1 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ]; - uint64 gauge_id = 2 [ (gogoproto.moretags) = "yaml:\"gauge\"" ]; - google.protobuf.Duration duration = 3 [ - (gogoproto.nullable) = false, - (gogoproto.stdduration) = true, - (gogoproto.moretags) = "yaml:\"duration\"" - ]; -} - -message PoolToGauges { - repeated PoolToGauge pool_to_gauge = 2 [ (gogoproto.nullable) = false ]; -} \ No newline at end of file diff --git a/proto/osmosis/pool-incentives/v1beta1/query.proto b/proto/osmosis/pool-incentives/v1beta1/query.proto deleted file mode 100644 index ce6537749df..00000000000 --- a/proto/osmosis/pool-incentives/v1beta1/query.proto +++ /dev/null @@ -1,108 +0,0 @@ -syntax = "proto3"; -package osmosis.poolincentives.v1beta1; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "google/protobuf/duration.proto"; -import "osmosis/incentives/gauge.proto"; -import "osmosis/pool-incentives/v1beta1/incentives.proto"; - -option go_package = "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/types"; - -service Query { - // GaugeIds takes the pool id and returns the matching gauge ids and durations - rpc GaugeIds(QueryGaugeIdsRequest) returns (QueryGaugeIdsResponse) { - option (google.api.http).get = - "/osmosis/pool-incentives/v1beta1/gauge-ids/{pool_id}"; - } - // DistrInfo returns the pool's matching gauge ids and weights. - rpc DistrInfo(QueryDistrInfoRequest) returns (QueryDistrInfoResponse) { - option (google.api.http).get = - "/osmosis/pool-incentives/v1beta1/distr_info"; - } - - // Params returns pool incentives params. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/osmosis/pool-incentives/v1beta1/params"; - } - - // LockableDurations returns lock durations for pools. - rpc LockableDurations(QueryLockableDurationsRequest) - returns (QueryLockableDurationsResponse) { - option (google.api.http).get = - "/osmosis/pool-incentives/v1beta1/lockable_durations"; - } - - // IncentivizedPools returns currently incentivized pools - rpc IncentivizedPools(QueryIncentivizedPoolsRequest) - returns (QueryIncentivizedPoolsResponse) { - option (google.api.http).get = - "/osmosis/pool-incentives/v1beta1/incentivized_pools"; - } - - // ExternalIncentiveGauges returns external incentive gauges. - rpc ExternalIncentiveGauges(QueryExternalIncentiveGaugesRequest) - returns (QueryExternalIncentiveGaugesResponse) { - option (google.api.http).get = - "/osmosis/pool-incentives/v1beta1/external_incentive_gauges"; - } -} - -message QueryGaugeIdsRequest { - uint64 pool_id = 1 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ]; -} -message QueryGaugeIdsResponse { - message GaugeIdWithDuration { - uint64 gauge_id = 1 [ (gogoproto.moretags) = "yaml:\"gauge_id\"" ]; - google.protobuf.Duration duration = 2 - [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ]; - string gauge_incentive_percentage = 3; - } - - repeated GaugeIdWithDuration gauge_ids_with_duration = 1 - [ (gogoproto.moretags) = "yaml:\"gauge_ids_with_duration\"" ]; -} - -message QueryDistrInfoRequest {} -message QueryDistrInfoResponse { - DistrInfo distr_info = 1 [ - (gogoproto.nullable) = false, - (gogoproto.moretags) = "yaml:\"distr_info\"" - ]; -} - -message QueryParamsRequest {} -message QueryParamsResponse { - Params params = 1 [ (gogoproto.nullable) = false ]; -} - -message QueryLockableDurationsRequest {} -message QueryLockableDurationsResponse { - repeated google.protobuf.Duration lockable_durations = 1 [ - (gogoproto.nullable) = false, - (gogoproto.stdduration) = true, - (gogoproto.moretags) = "yaml:\"lockable_durations\"" - ]; -} - -message QueryIncentivizedPoolsRequest {} -message IncentivizedPool { - uint64 pool_id = 1 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ]; - google.protobuf.Duration lockable_duration = 2 [ - (gogoproto.nullable) = false, - (gogoproto.stdduration) = true, - (gogoproto.moretags) = "yaml:\"lockable_duration\"" - ]; - uint64 gauge_id = 3 [ (gogoproto.moretags) = "yaml:\"gauge_id\"" ]; -} -message QueryIncentivizedPoolsResponse { - repeated IncentivizedPool incentivized_pools = 1 [ - (gogoproto.nullable) = false, - (gogoproto.moretags) = "yaml:\"incentivized_pools\"" - ]; -} - -message QueryExternalIncentiveGaugesRequest {} -message QueryExternalIncentiveGaugesResponse { - repeated osmosis.incentives.Gauge data = 1 [ (gogoproto.nullable) = false ]; -} diff --git a/x/pool-incentives/README.md b/x/pool-incentives/README.md deleted file mode 100644 index 4d190e14f7d..00000000000 --- a/x/pool-incentives/README.md +++ /dev/null @@ -1,389 +0,0 @@ -# Pool Incentives - -## Abstract - -The `pool-incentives` module is separate but related to the `incentives` module. When a pool is created using the `GAMM` module, the `pool-incentives` module automatically creates individual gauges in the `incentives` module for every lock duration that exists in that pool. -The `pool-incentives` module also takes the `pool_incentives` distributed from the `gov` module and distributes it to the various incentivized gauges. - -## Contents - -1. **[Concept](#concepts)** -2. **[State](#state)** -3. **[Governance](#gov)** -4. **[Transactions](#transactions)** -5. **[Queries](#queries)** - -## Concepts - -The purpose of the `pool incentives` module is to distribute incentives -to a pool's LPs. This assumes that pool's follow the interface from the -`x/gamm` module - -`Pool incentives` module doesn't directly distribute the rewards to the -LPs. When a pool is created, the `pool incentives` module creates a -`gauge` in the `incentives` module for every lock duration that exists. -Also, the `pool incentives` module takes a part of the minted inflation -from the mint module, and automatically distributes it to the various -selected gauges. - -## State - -### Genesis states - -```go -type GenesisState struct { - // params defines all the paramaters of the module. - Params Params - LockableDurations []time.Duration - DistrInfo *DistrInfo -} - -type Params struct { - // minted_denom is the denomination of the coin expected to be minted - // by the minting module. - // Pool-incentives module doesn’t actually mint the coin itself, - // but rather manages the distribution of coins that matches the defined minted_denom. - MintedDenom string - // allocation_ratio defines the proportion of the minted minted_denom - // that is to be allocated as pool incentives. - AllocationRatio github_com_cosmos_cosmos_sdk_types.Dec -} -``` - -Lockable durations can be set to the pool incentives module at genesis. -Every time a pool is created, the `pool incentives` module creates the -same amount of 'gauge' as there are lockable durations for the pool. - -Also in regards to the `Params`, when the mint module mints new tokens -to the fee collector at Begin Block, the `pool incentives` module takes -the token which matches the 'minted denom' from the fee collector. -Tokens are taken according to the 'allocationRatio', and are distributed -to each `DistrRecord` of the DistrInfo. For example, if the fee -collector holds 1000uatom and 2000 uosmo at Begin Block, and Params' -mintedDenom is set to uosmo, and AllocationRatio is set to 0.1, 200uosmo -will be taken from the fee collector and distributed to the -`DistrRecord`s. - -## Gov - -`Pool Incentives` module uses the values set at genesis or values added -by chain governance to distribute part of the inflation minted by the -mint module to specified gauges. - -```go -type DistrInfo struct { - TotalWeight github_com_cosmos_cosmos_sdk_types.Int - Records []DistrRecord -} - -type DistrRecord struct { - GaugeId uint64 - Weight github_com_cosmos_cosmos_sdk_types.Int -} -``` - -`DistrInfo` internally manages the `DistrRecord` and total weight of all -`DistrRecord`. Governance can modify DistrInfo via -`UpdatePoolIncentivesProposal` proposal. - -### UpdatePoolIncentivesProposal - -```go -type UpdatePoolIncentivesProposal struct { - Title string - Description string - Records []DistrRecord -} -``` - -`UpdatePoolIncentivesProposal` can be used by governance to update -`DistrRecord`s. - -```shell -osmosisd tx gov submit-proposal update-pool-incentives [gaugeIds] [weights] -``` - -Proposals can be proposed in using the CLI command format above.\ -For example, to designate 100 weight to gauge id 2 and 200 weight to -gauge id 3, the following command can be used. - -```shell -osmosisd tx gov submit-proposal update-pool-incentives 2,3 100,200 -``` - -## Transactions - -### replace-pool-incentives - -```sh -osmosisd tx poolincentives replace-pool-incentives [gaugeIds] [weights] [flags] -``` - -::: details Example - -Fully replace records for pool incentives: - -```bash -osmosisd tx poolincentives replace-pool-incentives proposal.json --from --chain-id -``` - -The proposal.json would look as follows: - -```json -{ - "title": "Pool Incentive Adjustment", - "description": "Adjust pool incentives", - "records": [ - { - "gauge_id": "0", - "weight": "100000" - }, - { - "gauge_id": "1", - "weight": "1766249" - }, - { - "gauge_id": "XXX", - "weight": "XXXXXXXX" - }, - ... - ] -} -``` - -::: - -### update-pool-incentives - -Update the weight of specified pool gauges in regards to their share of incentives (by creating a proposal) - -```sh -osmosisd tx poolincentives update-pool-incentives [gaugeIds] [weights] [flags] --from --chain-id -``` - -::: details Example - -Update the pool incentives for `gauge_id` 0 and 1: - -```bash -osmosisd tx gov submit-proposal update-pool-incentives proposal.json --from WALLET_NAME --chain-id CHAIN_ID -``` - -The proposal.json would look as follows: - -```json -{ - "title": "Pool Incentive Adjustment", - "description": "Adjust pool incentives", - "records": [ - { - "gauge_id": "0", - "weight": "100000" - }, - { - "gauge_id": "1", - "weight": "1766249" - }, - ] -} -``` - -::: - -## Queries - -### distr-info - -Query distribution info for all pool gauges - -```sh -osmosisd query poolincentives distr-info -``` - -::: details Example - -```bash -osmosisd query poolincentives distr-info -``` - -An example output: - -```bash - - gauge_id: "1877" - weight: "60707" - - gauge_id: "1878" - weight: "40471" - - gauge_id: "1897" - weight: "1448" - - gauge_id: "1898" - weight: "869" - - gauge_id: "1899" - weight: "579" -... -``` - -::: - -### external-incentivized-gauges - -Query externally incentivized gauges (gauges distributing rewards on top of the normal OSMO rewards) - -```sh -osmosisd query pool-incentives external-incentivized-gauges -``` - -::: details Example - -```bash -osmosisd query pool-incentives external-incentivized-gauges -``` - -An example output: - -```bash -- coins: - - amount: "596400000" - denom: ibc/0EF15DF2F02480ADE0BB6E85D9EBB5DAEA2836D3860E9F97F9AADE4F57A31AA0 - distribute_to: - denom: gamm/pool/562 - duration: 604800s - lock_query_type: ByDuration - timestamp: "1970-01-01T00:00:00Z" - distributed_coins: - - amount: "596398318" - denom: ibc/0EF15DF2F02480ADE0BB6E85D9EBB5DAEA2836D3860E9F97F9AADE4F57A31AA0 - filled_epochs: "28" - id: "1791" - is_perpetual: false - num_epochs_paid_over: "28" - start_time: "1970-01-01T00:00:00Z" -- coins: - - amount: "1000000" - denom: ibc/46B44899322F3CD854D2D46DEEF881958467CDD4B3B10086DA49296BBED94BED - distribute_to: - denom: gamm/pool/498 - duration: 86400s - lock_query_type: ByDuration - timestamp: "1970-01-01T00:00:00Z" - distributed_coins: - - amount: "999210" - denom: ibc/46B44899322F3CD854D2D46DEEF881958467CDD4B3B10086DA49296BBED94BED - filled_epochs: "2" - id: "1660" - is_perpetual: false - num_epochs_paid_over: "2" - start_time: "2021-10-14T16:00:00Z" -... -``` - -::: - -### gauge-ids - -Query the gauge ids (by duration) by pool id - -```sh -osmosisd query poolincentives gauge-ids [pool-id] [flags] -``` - -::: details Example - -Find out what the gauge IDs are for pool 1: - -```bash -osmosisd query poolincentives gauge-ids 1 -``` - -An example output: - -```bash -gauge_ids_with_duration: -- duration: 86400s - gauge_id: "1" -- duration: 604800s - gauge_id: "2" -- duration: 1209600s - gauge_id: "3" -``` - -In this example, we see that gauge IDs 1,2, and 3 are for the one day, one week, and two week lockup periods respectively for the OSMO/ATOM pool. -::: - -### incentivized-pools - -Query all incentivized pools with their respective gauge IDs and lockup durations - -```sh -osmosisd query poolincentives incentivized-pools [flags] -``` - -::: details Example - -```bash -osmosisd query poolincentives incentivized-pools -``` - -An example output: - -```bash -- gauge_id: "1897" - lockable_duration: 86400s - pool_id: "602" -- gauge_id: "1898" - lockable_duration: 604800s - pool_id: "602" -- gauge_id: "1899" - lockable_duration: 1209600s - pool_id: "602" -... -``` - -::: - -### lockable-durations - -Query incentivized lockup durations - -```sh -osmosisd query poolincentives lockable-durations [flags] -``` - -::: details Example - -```bash -osmosisd query poolincentives lockable-durations -``` - -An example output: - -```bash -lockable_durations: -- 86400s -- 604800s -- 1209600s -``` - -::: - -### params - -Query pool-incentives module parameters - -```sh -osmosisd query poolincentives params [flags] -``` - -::: details Example - -```bash -osmosisd query poolincentives params -``` - -An example output: - -```bash -params: - minted_denom: uosmo -``` - -::: diff --git a/x/pool-incentives/client/cli/query.go b/x/pool-incentives/client/cli/query.go deleted file mode 100644 index 67ab7f9fb6a..00000000000 --- a/x/pool-incentives/client/cli/query.go +++ /dev/null @@ -1,77 +0,0 @@ -package cli - -import ( - "github.com/spf13/cobra" - - "github.com/osmosis-labs/osmosis/v15/osmoutils/osmocli" - "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/types" -) - -// GetQueryCmd returns the cli query commands for this module. -func GetQueryCmd() *cobra.Command { - cmd := osmocli.QueryIndexCmd(types.ModuleName) - - cmd.AddCommand( - GetCmdGaugeIds(), - GetCmdDistrInfo(), - osmocli.GetParams[*types.QueryParamsRequest]( - types.ModuleName, types.NewQueryClient), - GetCmdLockableDurations(), - GetCmdIncentivizedPools(), - GetCmdExternalIncentiveGauges(), - ) - - return cmd -} - -// GetCmdGaugeIds takes the pool id and returns the matching gauge ids and durations. -func GetCmdGaugeIds() *cobra.Command { - return osmocli.SimpleQueryCmd[*types.QueryGaugeIdsRequest]( - "gauge-ids [pool-id]", - "Query the matching gauge ids and durations by pool id", - `{{.Short}}{{.ExampleHeader}} -{{.CommandPrefix}} gauge-ids 1 -`, types.ModuleName, types.NewQueryClient) -} - -// GetCmdDistrInfo takes the pool id and returns the matching gauge ids and weights. -func GetCmdDistrInfo() *cobra.Command { - return osmocli.SimpleQueryCmd[*types.QueryDistrInfoRequest]( - "distr-info", - "Query distribution info", - `{{.Short}}{{.ExampleHeader}} -{{.CommandPrefix}} distr-info -`, types.ModuleName, types.NewQueryClient) -} - -// GetCmdLockableDurations returns lockable durations. -func GetCmdLockableDurations() *cobra.Command { - return osmocli.SimpleQueryCmd[*types.QueryLockableDurationsRequest]( - "lockable-durations", - "Query lockable durations", - `Query distribution info. - -Example: -{{.CommandPrefix}} lockable-durations -`, types.ModuleName, types.NewQueryClient) -} - -func GetCmdIncentivizedPools() *cobra.Command { - return osmocli.SimpleQueryCmd[*types.QueryIncentivizedPoolsRequest]( - "incentivized-pools", - "Query incentivized pools", - `Query incentivized pools. - -Example: -{{.CommandPrefix}} incentivized-pools -`, types.ModuleName, types.NewQueryClient) -} - -func GetCmdExternalIncentiveGauges() *cobra.Command { - return osmocli.SimpleQueryCmd[*types.QueryExternalIncentiveGaugesRequest]( - "external-incentivized-gauges", - "Query external incentivized gauges", - `{{.Short}}{{.ExampleHeader}} -{{.CommandPrefix}} external-incentivized-gauges -`, types.ModuleName, types.NewQueryClient) -} diff --git a/x/pool-incentives/client/cli/query_test.go b/x/pool-incentives/client/cli/query_test.go deleted file mode 100644 index 6d483820ad9..00000000000 --- a/x/pool-incentives/client/cli/query_test.go +++ /dev/null @@ -1,86 +0,0 @@ -package cli_test - -import ( - gocontext "context" - "testing" - - "github.com/stretchr/testify/suite" - - "github.com/osmosis-labs/osmosis/v15/app/apptesting" - "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/types" -) - -type QueryTestSuite struct { - apptesting.KeeperTestHelper - queryClient types.QueryClient -} - -func (s *QueryTestSuite) SetupSuite() { - s.Setup() - s.queryClient = types.NewQueryClient(s.QueryHelper) - - // set up pool - s.PrepareBalancerPool() - s.Commit() -} - -func (s *QueryTestSuite) TestQueriesNeverAlterState() { - testCases := []struct { - name string - query string - input interface{} - output interface{} - }{ - { - "Query distribution info", - "/osmosis.poolincentives.v1beta1.Query/DistrInfo", - &types.QueryDistrInfoRequest{}, - &types.QueryDistrInfoResponse{}, - }, - { - "Query external incentive gauges", - "/osmosis.poolincentives.v1beta1.Query/ExternalIncentiveGauges", - &types.QueryExternalIncentiveGaugesRequest{}, - &types.QueryExternalIncentiveGaugesResponse{}, - }, - { - "Query all gauge ids", - "/osmosis.poolincentives.v1beta1.Query/GaugeIds", - &types.QueryGaugeIdsRequest{PoolId: 1}, - &types.QueryGaugeIdsResponse{}, - }, - { - "Query all incentivized pools", - "/osmosis.poolincentives.v1beta1.Query/IncentivizedPools", - &types.QueryIncentivizedPoolsRequest{}, - &types.QueryIncentivizedPoolsResponse{}, - }, - { - "Query lockable durations", - "/osmosis.poolincentives.v1beta1.Query/LockableDurations", - &types.QueryLockableDurationsRequest{}, - &types.QueryLockableDurationsResponse{}, - }, - { - "Query params", - "/osmosis.poolincentives.v1beta1.Query/Params", - &types.QueryParamsRequest{}, - &types.QueryParamsResponse{}, - }, - } - - for _, tc := range testCases { - tc := tc - - s.Run(tc.name, func() { - s.SetupSuite() - err := s.QueryHelper.Invoke(gocontext.Background(), tc.query, tc.input, tc.output) - s.Require().NoError(err) - s.StateNotAltered() - }) - } -} - -func TestQueryTestSuite(t *testing.T) { - suite.Run(t, new(QueryTestSuite)) -} diff --git a/x/pool-incentives/client/cli/tx.go b/x/pool-incentives/client/cli/tx.go deleted file mode 100644 index 903e1df9077..00000000000 --- a/x/pool-incentives/client/cli/tx.go +++ /dev/null @@ -1,161 +0,0 @@ -package cli - -import ( - "fmt" - - "github.com/cosmos/cosmos-sdk/client/tx" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - sdk "github.com/cosmos/cosmos-sdk/types" - govcli "github.com/cosmos/cosmos-sdk/x/gov/client/cli" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - - "github.com/osmosis-labs/osmosis/v15/osmoutils" - "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/types" -) - -func NewCmdSubmitUpdatePoolIncentivesProposal() *cobra.Command { - cmd := &cobra.Command{ - Use: "update-pool-incentives [gaugeIds] [weights]", - Args: cobra.ExactArgs(2), - Short: "Submit an update to the records for pool incentives", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - gaugeIds, err := osmoutils.ParseUint64SliceFromString(args[0], ",") - if err != nil { - return err - } - - weights, err := osmoutils.ParseSdkIntFromString(args[1], ",") - if err != nil { - return err - } - - if len(gaugeIds) != len(weights) { - return fmt.Errorf("the length of gauge ids and weights not matched") - } - - if len(gaugeIds) == 0 { - return fmt.Errorf("records is empty") - } - - var records []types.DistrRecord - for i, gaugeId := range gaugeIds { - records = append(records, types.DistrRecord{ - GaugeId: gaugeId, - Weight: weights[i], - }) - } - - from := clientCtx.GetFromAddress() - - proposal, err := osmoutils.ParseProposalFlags(cmd.Flags()) - if err != nil { - return fmt.Errorf("failed to parse proposal: %w", err) - } - - deposit, err := sdk.ParseCoinsNormalized(proposal.Deposit) - if err != nil { - return err - } - - content := types.NewUpdatePoolIncentivesProposal(proposal.Title, proposal.Description, records) - - msg, err := govtypes.NewMsgSubmitProposal(content, deposit, from) - if err != nil { - return err - } - - if err = msg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - cmd.Flags().String(govcli.FlagTitle, "", "The proposal title") - cmd.Flags().String(govcli.FlagDescription, "", "The proposal description") - cmd.Flags().String(govcli.FlagDeposit, "", "The proposal deposit") - cmd.Flags().String(govcli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)") - - return cmd -} - -func NewCmdSubmitReplacePoolIncentivesProposal() *cobra.Command { - cmd := &cobra.Command{ - Use: "replace-pool-incentives [gaugeIds] [weights]", - Args: cobra.ExactArgs(2), - Short: "Submit a full replacement to the records for pool incentives", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - gaugeIds, err := osmoutils.ParseUint64SliceFromString(args[0], ",") - if err != nil { - return err - } - - weights, err := osmoutils.ParseSdkIntFromString(args[1], ",") - if err != nil { - return err - } - - if len(gaugeIds) != len(weights) { - return fmt.Errorf("the length of gauge ids and weights not matched") - } - - if len(gaugeIds) == 0 { - return fmt.Errorf("records is empty") - } - - var records []types.DistrRecord - for i, gaugeId := range gaugeIds { - records = append(records, types.DistrRecord{ - GaugeId: gaugeId, - Weight: weights[i], - }) - } - - from := clientCtx.GetFromAddress() - - proposal, err := osmoutils.ParseProposalFlags(cmd.Flags()) - if err != nil { - return fmt.Errorf("failed to parse proposal: %w", err) - } - - deposit, err := sdk.ParseCoinsNormalized(proposal.Deposit) - if err != nil { - return err - } - - content := types.NewReplacePoolIncentivesProposal(proposal.Title, proposal.Description, records) - - msg, err := govtypes.NewMsgSubmitProposal(content, deposit, from) - if err != nil { - return err - } - - if err = msg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - cmd.Flags().String(govcli.FlagTitle, "", "The proposal title") - cmd.Flags().String(govcli.FlagDescription, "", "The proposal description") - cmd.Flags().String(govcli.FlagDeposit, "", "The proposal deposit") - cmd.Flags().String(govcli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)") - - return cmd -} diff --git a/x/pool-incentives/client/proposal_handler.go b/x/pool-incentives/client/proposal_handler.go deleted file mode 100644 index 2df0d07a6d8..00000000000 --- a/x/pool-incentives/client/proposal_handler.go +++ /dev/null @@ -1,12 +0,0 @@ -package client - -import ( - "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/client/cli" - - govclient "github.com/cosmos/cosmos-sdk/x/gov/client" -) - -var ( - UpdatePoolIncentivesHandler = govclient.NewProposalHandler(cli.NewCmdSubmitUpdatePoolIncentivesProposal) - ReplacePoolIncentivesHandler = govclient.NewProposalHandler(cli.NewCmdSubmitReplacePoolIncentivesProposal) -) diff --git a/x/pool-incentives/handler.go b/x/pool-incentives/handler.go deleted file mode 100644 index 087ab0c4ddc..00000000000 --- a/x/pool-incentives/handler.go +++ /dev/null @@ -1,35 +0,0 @@ -package pool_incentives - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - - "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/keeper" - "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/types" -) - -// NewPoolIncentivesProposalHandler is a handler for governance proposals on new pool incentives. -func NewPoolIncentivesProposalHandler(k keeper.Keeper) govtypes.Handler { - return func(ctx sdk.Context, content govtypes.Content) error { - switch c := content.(type) { - case *types.UpdatePoolIncentivesProposal: - return handleUpdatePoolIncentivesProposal(ctx, k, c) - case *types.ReplacePoolIncentivesProposal: - return handleReplacePoolIncentivesProposal(ctx, k, c) - - default: - return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized pool incentives proposal content type: %T", c) - } - } -} - -// handleReplacePoolIncentivesProposal is a handler for replacing pool incentives governance proposals -func handleReplacePoolIncentivesProposal(ctx sdk.Context, k keeper.Keeper, p *types.ReplacePoolIncentivesProposal) error { - return k.HandleReplacePoolIncentivesProposal(ctx, p) -} - -// handleUpdatePoolIncentivesProposal is a handler for updating pool incentives governance proposals -func handleUpdatePoolIncentivesProposal(ctx sdk.Context, k keeper.Keeper, p *types.UpdatePoolIncentivesProposal) error { - return k.HandleUpdatePoolIncentivesProposal(ctx, p) -} diff --git a/x/pool-incentives/keeper/distr.go b/x/pool-incentives/keeper/distr.go deleted file mode 100644 index ba9d03640a7..00000000000 --- a/x/pool-incentives/keeper/distr.go +++ /dev/null @@ -1,194 +0,0 @@ -package keeper - -import ( - "fmt" - "sort" - - "github.com/osmosis-labs/osmosis/v15/osmoutils" - "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/types" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -// FundCommunityPoolFromModule allows the pool-incentives module to directly fund the community fund pool. -func (k Keeper) FundCommunityPoolFromModule(ctx sdk.Context, asset sdk.Coin) error { - moduleAddr := k.accountKeeper.GetModuleAddress(types.ModuleName) - if moduleAddr == nil { - panic("Could not get distribution module from SDK") - } - - return k.distrKeeper.FundCommunityPool(ctx, sdk.Coins{asset}, moduleAddr) -} - -// AllocateAsset allocates and distributes coin according a gauge’s proportional weight that is recorded in the record. -func (k Keeper) AllocateAsset(ctx sdk.Context) error { - logger := k.Logger(ctx) - params := k.GetParams(ctx) - moduleAddr := k.accountKeeper.GetModuleAddress(types.ModuleName) - - //TODO(#5): we should support distribution of all assets, not only specific denom - asset := k.bankKeeper.GetBalance(ctx, moduleAddr, params.MintedDenom) - if asset.Amount.IsZero() { - // when allocating asset is zero, skip execution - return nil - } - - distrInfo := k.GetDistrInfo(ctx) - - if distrInfo.TotalWeight.IsZero() { - // If there are no records, put the asset to the community pool - return k.FundCommunityPoolFromModule(ctx, asset) - } - - assetAmountDec := sdk.NewDecFromInt(asset.Amount) - totalWeightDec := sdk.NewDecFromInt(distrInfo.TotalWeight) - for _, record := range distrInfo.Records { - allocatingAmount := assetAmountDec.Mul(sdk.NewDecFromInt(record.Weight).Quo(totalWeightDec)).TruncateInt() - - // when weight is too small and no amount is allocated, just skip this to avoid zero coin send issues - if !allocatingAmount.IsPositive() { - logger.Info(fmt.Sprintf("allocating amount for (%d, %s) record is not positive", record.GaugeId, record.Weight.String())) - continue - } - - if record.GaugeId == 0 { // fund community pool if gaugeId is zero - if err := k.FundCommunityPoolFromModule(ctx, sdk.NewCoin(asset.Denom, allocatingAmount)); err != nil { - return err - } - continue - } - - coins := sdk.NewCoins(sdk.NewCoin(asset.Denom, allocatingAmount)) - err := k.incentivesKeeper.AddToGaugeRewards(ctx, k.accountKeeper.GetModuleAddress(types.ModuleName), coins, record.GaugeId) - if err != nil { - return err - } - } - - return nil -} - -func (k Keeper) GetDistrInfo(ctx sdk.Context) types.DistrInfo { - store := ctx.KVStore(k.storeKey) - distrInfo := types.DistrInfo{} - osmoutils.MustGet(store, types.DistrInfoKey, &distrInfo) - return distrInfo -} - -func (k Keeper) SetDistrInfo(ctx sdk.Context, distrInfo types.DistrInfo) { - store := ctx.KVStore(k.storeKey) - osmoutils.MustSet(store, types.DistrInfoKey, &distrInfo) -} - -// validateRecords validates a list of records to ensure that: -// 1) there are no duplicates, -// 2) the records are in sorted order. -// 3) the records only pay to gauges that exist. -func (k Keeper) validateRecords(ctx sdk.Context, records ...types.DistrRecord) error { - lastGaugeID := uint64(0) - gaugeIdFlags := make(map[uint64]bool) - - for _, record := range records { - if gaugeIdFlags[record.GaugeId] { - return sdkerrors.Wrapf( - types.ErrDistrRecordRegisteredGauge, - "Gauge ID #%d has duplications.", - record.GaugeId, - ) - } - - // Ensure records are sorted because ~AESTHETIC~ - if record.GaugeId < lastGaugeID { - return sdkerrors.Wrapf( - types.ErrDistrRecordNotSorted, - "Gauge ID #%d came after Gauge ID #%d.", - record.GaugeId, lastGaugeID, - ) - } - lastGaugeID = record.GaugeId - - // unless GaugeID is 0 for the community pool, don't allow distribution records for gauges that don't exist - if record.GaugeId != 0 { - gauge, err := k.incentivesKeeper.GetGaugeByID(ctx, record.GaugeId) - if err != nil { - return err - } - if !gauge.IsPerpetual { - return sdkerrors.Wrapf(types.ErrDistrRecordRegisteredGauge, - "Gauge ID #%d is not perpetual.", - record.GaugeId) - } - } - - gaugeIdFlags[record.GaugeId] = true - } - return nil -} - -// This is checked for no err when a proposal is made, and executed when a proposal passes. -func (k Keeper) ReplaceDistrRecords(ctx sdk.Context, records ...types.DistrRecord) error { - distrInfo := k.GetDistrInfo(ctx) - - err := k.validateRecords(ctx, records...) - if err != nil { - return err - } - - totalWeight := sdk.NewInt(0) - - for _, record := range records { - totalWeight = totalWeight.Add(record.Weight) - } - - distrInfo.Records = records - distrInfo.TotalWeight = totalWeight - - k.SetDistrInfo(ctx, distrInfo) - return nil -} - -// UpdateDistrRecords is checked for no err when a proposal is made, and executed when a proposal passes. -func (k Keeper) UpdateDistrRecords(ctx sdk.Context, records ...types.DistrRecord) error { - recordsMap := make(map[uint64]types.DistrRecord) - totalWeight := sdk.NewInt(0) - - for _, existingRecord := range k.GetDistrInfo(ctx).Records { - recordsMap[existingRecord.GaugeId] = existingRecord - totalWeight = totalWeight.Add(existingRecord.Weight) - } - - err := k.validateRecords(ctx, records...) - if err != nil { - return err - } - - for _, record := range records { - if val, ok := recordsMap[record.GaugeId]; ok { - totalWeight = totalWeight.Sub(val.Weight) - recordsMap[record.GaugeId] = record - totalWeight = totalWeight.Add(record.Weight) - } else { - recordsMap[record.GaugeId] = record - totalWeight = totalWeight.Add(record.Weight) - } - } - - newRecords := []types.DistrRecord{} - - for _, val := range recordsMap { - if !val.Weight.Equal(sdk.ZeroInt()) { - newRecords = append(newRecords, val) - } - } - - sort.SliceStable(newRecords, func(i, j int) bool { - return newRecords[i].GaugeId < newRecords[j].GaugeId - }) - - k.SetDistrInfo(ctx, types.DistrInfo{ - Records: newRecords, - TotalWeight: totalWeight, - }) - return nil -} diff --git a/x/pool-incentives/keeper/distr_test.go b/x/pool-incentives/keeper/distr_test.go deleted file mode 100644 index c1820c383f4..00000000000 --- a/x/pool-incentives/keeper/distr_test.go +++ /dev/null @@ -1,339 +0,0 @@ -package keeper_test - -import ( - "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/types" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func (suite *KeeperTestSuite) TestAllocateAsset() { - tests := []struct { - name string - testingDistrRecord []types.DistrRecord - mintedCoins sdk.Coin - expectedGaugesBalances []sdk.Coins - expectedCommunityPool sdk.DecCoin - }{ - // With minting 15000 stake to module, after AllocateAsset we get: - // expectedCommunityPool = 0 (All reward will be transferred to the gauges) - // expectedGaugesBalances in order: - // gaue1_balance = 15000 * 100/(100+200+300) = 2500 - // gaue2_balance = 15000 * 200/(100+200+300) = 5000 (using the formula in the function gives the exact result 4999,9999999999995000. But TruncateInt return 4999. Is this the issue?) - // gaue3_balance = 15000 * 300/(100+200+300) = 7500 - { - name: "Allocated to the gauges proportionally", - testingDistrRecord: []types.DistrRecord{ - { - GaugeId: 1, - Weight: sdk.NewInt(100), - }, - { - GaugeId: 2, - Weight: sdk.NewInt(200), - }, - { - GaugeId: 3, - Weight: sdk.NewInt(300), - }, - }, - mintedCoins: sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(15000)), - expectedGaugesBalances: []sdk.Coins{ - sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(2500))), - sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(4999))), - sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(7500))), - }, - expectedCommunityPool: sdk.NewDecCoin(sdk.DefaultBondDenom, sdk.NewInt(0)), - }, - - // With minting 30000 stake to module, after AllocateAsset we get: - // expectedCommunityPool = 30000 * 700/(700+200+100) = 21000 stake (Cause gaugeId=0 the reward will be transferred to the community pool) - // expectedGaugesBalances in order: - // gaue1_balance = 30000 * 100/(700+200+100) = 3000 - // gaue2_balance = 30000 * 200/(700+200+100) = 6000 - { - name: "Community pool distribution when gaugeId is zero", - testingDistrRecord: []types.DistrRecord{ - { - GaugeId: 0, - Weight: sdk.NewInt(700), - }, - { - GaugeId: 1, - Weight: sdk.NewInt(100), - }, - { - GaugeId: 2, - Weight: sdk.NewInt(200), - }, - }, - mintedCoins: sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(30000)), - expectedGaugesBalances: []sdk.Coins{ - sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(0))), - sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(3000))), - sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(6000))), - }, - expectedCommunityPool: sdk.NewDecCoin(sdk.DefaultBondDenom, sdk.NewInt(21000)), - }, - // With minting 30000 stake to module, after AllocateAsset we get: - // expectedCommunityPool = 30000 (Cause there are no gauges, all rewards are transferred to the community pool) - { - name: "community pool distribution when no distribution records are set", - testingDistrRecord: []types.DistrRecord{}, - mintedCoins: sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(30000)), - expectedGaugesBalances: []sdk.Coins{}, - expectedCommunityPool: sdk.NewDecCoin(sdk.DefaultBondDenom, sdk.NewInt(30000)), - }, - } - - for _, test := range tests { - suite.Run(test.name, func() { - suite.Setup() - keeper := suite.App.PoolIncentivesKeeper - suite.FundModuleAcc(types.ModuleName, sdk.NewCoins(test.mintedCoins)) - suite.PrepareBalancerPool() - - // LockableDurations should be 1, 3, 7 hours from the default genesis state. - lockableDurations := keeper.GetLockableDurations(suite.Ctx) - suite.Equal(3, len(lockableDurations)) - - for i, duration := range lockableDurations { - suite.Equal(duration, types.DefaultGenesisState().GetLockableDurations()[i]) - } - - feePoolOrigin := suite.App.DistrKeeper.GetFeePool(suite.Ctx) - - // Create record - err := keeper.ReplaceDistrRecords(suite.Ctx, test.testingDistrRecord...) - suite.Require().NoError(err) - - err = keeper.AllocateAsset(suite.Ctx) - suite.Require().NoError(err) - - for i := 0; i < len(test.testingDistrRecord); i++ { - if test.testingDistrRecord[i].GaugeId == 0 { - continue - } - gauge, err := suite.App.IncentivesKeeper.GetGaugeByID(suite.Ctx, test.testingDistrRecord[i].GaugeId) - suite.Require().NoError(err) - suite.Require().Equal(test.expectedGaugesBalances[i], gauge.Coins) - } - - feePoolNew := suite.App.DistrKeeper.GetFeePool(suite.Ctx) - suite.Require().Equal(feePoolOrigin.CommunityPool.Add(test.expectedCommunityPool), feePoolNew.CommunityPool) - }) - } -} - -func (suite *KeeperTestSuite) TestReplaceDistrRecords() { - tests := []struct { - name string - testingDistrRecord []types.DistrRecord - isPoolPrepared bool - expectErr bool - expectTotalWeight sdk.Int - }{ - { - name: "Not existent gauge.", - testingDistrRecord: []types.DistrRecord{{ - GaugeId: 1, - Weight: sdk.NewInt(100), - }}, - isPoolPrepared: false, - expectErr: true, - }, - { - name: "Adding two of the same gauge id at once should error", - testingDistrRecord: []types.DistrRecord{ - { - GaugeId: 1, - Weight: sdk.NewInt(100), - }, - { - GaugeId: 1, - Weight: sdk.NewInt(200), - }, - }, - isPoolPrepared: true, - expectErr: true, - }, - { - name: "Adding unsort gauges at once should error", - testingDistrRecord: []types.DistrRecord{ - { - GaugeId: 2, - Weight: sdk.NewInt(200), - }, - { - GaugeId: 1, - Weight: sdk.NewInt(250), - }, - }, - isPoolPrepared: true, - expectErr: true, - }, - { - name: "Normal case with same weights", - testingDistrRecord: []types.DistrRecord{ - { - GaugeId: 0, - Weight: sdk.NewInt(100), - }, - { - GaugeId: 1, - Weight: sdk.NewInt(100), - }, - }, - isPoolPrepared: true, - expectErr: false, - expectTotalWeight: sdk.NewInt(200), - }, - { - name: "With different weights", - testingDistrRecord: []types.DistrRecord{ - { - GaugeId: 0, - Weight: sdk.NewInt(100), - }, - { - GaugeId: 1, - Weight: sdk.NewInt(200), - }, - }, - isPoolPrepared: true, - expectErr: false, - expectTotalWeight: sdk.NewInt(300), - }, - } - - for _, test := range tests { - suite.Run(test.name, func() { - suite.SetupTest() - keeper := suite.App.PoolIncentivesKeeper - - if test.isPoolPrepared { - suite.PrepareBalancerPool() - } - - err := keeper.ReplaceDistrRecords(suite.Ctx, test.testingDistrRecord...) - if test.expectErr { - suite.Require().Error(err) - } else { - suite.Require().NoError(err) - - distrInfo := keeper.GetDistrInfo(suite.Ctx) - suite.Require().Equal(len(test.testingDistrRecord), len(distrInfo.Records)) - for i, record := range test.testingDistrRecord { - suite.Require().Equal(record.Weight, distrInfo.Records[i].Weight) - } - suite.Require().Equal(test.expectTotalWeight, distrInfo.TotalWeight) - } - }) - } -} - -func (suite *KeeperTestSuite) TestUpdateDistrRecords() { - tests := []struct { - name string - testingDistrRecord []types.DistrRecord - isPoolPrepared bool - expectErr bool - expectTotalWeight sdk.Int - }{ - { - name: "Not existent gauge.", - testingDistrRecord: []types.DistrRecord{{ - GaugeId: 1, - Weight: sdk.NewInt(100), - }}, - isPoolPrepared: false, - expectErr: true, - }, - { - name: "Adding two of the same gauge id at once should error", - testingDistrRecord: []types.DistrRecord{ - { - GaugeId: 1, - Weight: sdk.NewInt(100), - }, - { - GaugeId: 1, - Weight: sdk.NewInt(100), - }, - }, - isPoolPrepared: true, - expectErr: true, - }, - { - name: "Adding unsort gauges at once should error", - testingDistrRecord: []types.DistrRecord{ - { - GaugeId: 2, - Weight: sdk.NewInt(100), - }, - { - GaugeId: 1, - Weight: sdk.NewInt(200), - }, - }, - isPoolPrepared: true, - expectErr: true, - }, - { - name: "Normal case with same weights", - testingDistrRecord: []types.DistrRecord{ - { - GaugeId: 0, - Weight: sdk.NewInt(100), - }, - { - GaugeId: 1, - Weight: sdk.NewInt(100), - }, - }, - isPoolPrepared: true, - expectErr: false, - expectTotalWeight: sdk.NewInt(200), - }, - { - name: "With different weights", - testingDistrRecord: []types.DistrRecord{ - { - GaugeId: 0, - Weight: sdk.NewInt(100), - }, - { - GaugeId: 1, - Weight: sdk.NewInt(200), - }, - }, - isPoolPrepared: true, - expectErr: false, - expectTotalWeight: sdk.NewInt(300), - }, - } - - for _, test := range tests { - suite.Run(test.name, func() { - suite.SetupTest() - keeper := suite.App.PoolIncentivesKeeper - - if test.isPoolPrepared { - suite.PrepareBalancerPool() - } - - err := keeper.UpdateDistrRecords(suite.Ctx, test.testingDistrRecord...) - if test.expectErr { - suite.Require().Error(err) - } else { - suite.Require().NoError(err) - - distrInfo := keeper.GetDistrInfo(suite.Ctx) - suite.Require().Equal(len(test.testingDistrRecord), len(distrInfo.Records)) - for i, record := range test.testingDistrRecord { - suite.Require().Equal(record.Weight, distrInfo.Records[i].Weight) - } - suite.Require().Equal(test.expectTotalWeight, distrInfo.TotalWeight) - } - }) - } -} diff --git a/x/pool-incentives/keeper/genesis.go b/x/pool-incentives/keeper/genesis.go deleted file mode 100644 index 438262309a6..00000000000 --- a/x/pool-incentives/keeper/genesis.go +++ /dev/null @@ -1,59 +0,0 @@ -package keeper - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/types" -) - -func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) { - recipientAcc := k.accountKeeper.GetModuleAccount(ctx, types.ModuleName) - if recipientAcc == nil { - panic(fmt.Sprintf("module account %s does not exist", types.ModuleName)) - } - - k.SetParams(ctx, genState.Params) - k.SetLockableDurations(ctx, genState.LockableDurations) - if genState.DistrInfo == nil { - k.SetDistrInfo(ctx, types.DistrInfo{ - TotalWeight: sdk.NewInt(0), - Records: nil, - }) - } else { - k.SetDistrInfo(ctx, *genState.DistrInfo) - } - if genState.PoolToGauges != nil { - for _, record := range genState.PoolToGauges.PoolToGauge { - k.SetPoolGaugeId(ctx, record.PoolId, record.Duration, record.GaugeId) - } - } -} - -func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { - distrInfo := k.GetDistrInfo(ctx) - lastPoolId := k.poolmanagerKeeper.GetNextPoolId(ctx) - lockableDurations := k.GetLockableDurations(ctx) - var poolToGauges types.PoolToGauges - for i := 1; i < int(lastPoolId); i++ { - for _, duration := range lockableDurations { - gaugeID, err := k.GetPoolGaugeId(ctx, uint64(i), duration) - if err != nil { - panic(err) - } - var poolToGauge types.PoolToGauge - poolToGauge.Duration = duration - poolToGauge.GaugeId = gaugeID - poolToGauge.PoolId = uint64(i) - poolToGauges.PoolToGauge = append(poolToGauges.PoolToGauge, poolToGauge) - } - } - - return &types.GenesisState{ - Params: k.GetParams(ctx), - LockableDurations: k.GetLockableDurations(ctx), - DistrInfo: &distrInfo, - PoolToGauges: &poolToGauges, - } -} diff --git a/x/pool-incentives/keeper/genesis_test.go b/x/pool-incentives/keeper/genesis_test.go deleted file mode 100644 index bc5c9ffbd1a..00000000000 --- a/x/pool-incentives/keeper/genesis_test.go +++ /dev/null @@ -1,116 +0,0 @@ -package keeper_test - -import ( - "testing" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - - pool_incentives "github.com/osmosis-labs/osmosis/v15/x/pool-incentives" - - simapp "github.com/dymensionxyz/dymension/app" - - "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/types" -) - -var ( - now = time.Now().UTC() - testGenesis = types.GenesisState{ - Params: types.Params{ - MintedDenom: "uosmo", - }, - LockableDurations: []time.Duration{ - time.Second, - time.Minute, - time.Hour, - }, - DistrInfo: &types.DistrInfo{ - TotalWeight: sdk.NewInt(1), - Records: []types.DistrRecord{ - { - GaugeId: 1, - Weight: sdk.NewInt(1), - }, - }, - }, - } -) - -func TestMarshalUnmarshalGenesis(t *testing.T) { - app := simapp.Setup(t, false) - ctx := app.BaseApp.NewContext(false, tmproto.Header{}) - ctx = ctx.WithBlockTime(now.Add(time.Second)) - - encodingConfig := simapp.MakeEncodingConfig() - appCodec := encodingConfig.Codec - am := pool_incentives.NewAppModule(*app.PoolIncentivesKeeper) - - genesis := testGenesis - app.PoolIncentivesKeeper.InitGenesis(ctx, &genesis) - assert.Equal(t, app.PoolIncentivesKeeper.GetDistrInfo(ctx), *testGenesis.DistrInfo) - - genesisExported := am.ExportGenesis(ctx, appCodec) - assert.NotPanics(t, func() { - app := simapp.Setup(t, false) - ctx := app.BaseApp.NewContext(false, tmproto.Header{}) - ctx = ctx.WithBlockTime(now.Add(time.Second)) - am := pool_incentives.NewAppModule(*app.PoolIncentivesKeeper) - am.InitGenesis(ctx, appCodec, genesisExported) - }) -} - -func TestInitGenesis(t *testing.T) { - app := simapp.Setup(t, false) - ctx := app.BaseApp.NewContext(false, tmproto.Header{}) - ctx = ctx.WithBlockTime(now.Add(time.Second)) - genesis := testGenesis - app.PoolIncentivesKeeper.InitGenesis(ctx, &genesis) - - params := app.PoolIncentivesKeeper.GetParams(ctx) - require.Equal(t, params, genesis.Params) - - durations := app.PoolIncentivesKeeper.GetLockableDurations(ctx) - require.Equal(t, durations, genesis.LockableDurations) - - distrInfo := app.PoolIncentivesKeeper.GetDistrInfo(ctx) - require.Equal(t, distrInfo, *genesis.DistrInfo) -} - -func (suite *KeeperTestSuite) TestExportGenesis() { - ctx := suite.App.BaseApp.NewContext(false, tmproto.Header{}) - ctx = ctx.WithBlockTime(now.Add(time.Second)) - genesis := testGenesis - suite.App.PoolIncentivesKeeper.InitGenesis(ctx, &genesis) - - lockableDurations := suite.App.PoolIncentivesKeeper.GetLockableDurations(ctx) - suite.App.IncentivesKeeper.SetLockableDurations(ctx, lockableDurations) - poolId := suite.PrepareBalancerPool() - - durations := []time.Duration{ - time.Second, - time.Minute, - time.Hour, - } - suite.App.PoolIncentivesKeeper.SetLockableDurations(ctx, durations) - savedDurations := suite.App.PoolIncentivesKeeper.GetLockableDurations(ctx) - suite.Equal(savedDurations, durations) - var expectedPoolToGauges types.PoolToGauges - var gauge uint64 - for _, duration := range durations { - gauge++ - var poolToGauge types.PoolToGauge - poolToGauge.Duration = duration - poolToGauge.PoolId = poolId - poolToGauge.GaugeId = gauge - expectedPoolToGauges.PoolToGauge = append(expectedPoolToGauges.PoolToGauge, poolToGauge) - } - - genesisExported := suite.App.PoolIncentivesKeeper.ExportGenesis(ctx) - suite.Equal(genesisExported.Params, genesis.Params) - suite.Equal(genesisExported.LockableDurations, durations) - suite.Equal(genesisExported.DistrInfo, genesis.DistrInfo) - suite.Equal(genesisExported.PoolToGauges, &expectedPoolToGauges) -} diff --git a/x/pool-incentives/keeper/gov.go b/x/pool-incentives/keeper/gov.go deleted file mode 100644 index 4136b41e920..00000000000 --- a/x/pool-incentives/keeper/gov.go +++ /dev/null @@ -1,15 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/types" -) - -func (k Keeper) HandleReplacePoolIncentivesProposal(ctx sdk.Context, p *types.ReplacePoolIncentivesProposal) error { - return k.ReplaceDistrRecords(ctx, p.Records...) -} - -func (k Keeper) HandleUpdatePoolIncentivesProposal(ctx sdk.Context, p *types.UpdatePoolIncentivesProposal) error { - return k.UpdateDistrRecords(ctx, p.Records...) -} diff --git a/x/pool-incentives/keeper/grpc_query.go b/x/pool-incentives/keeper/grpc_query.go deleted file mode 100644 index 8ca4988c640..00000000000 --- a/x/pool-incentives/keeper/grpc_query.go +++ /dev/null @@ -1,144 +0,0 @@ -package keeper - -import ( - "context" - - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - - incentivetypes "github.com/osmosis-labs/osmosis/v15/x/incentives/types" - "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/types" -) - -var _ types.QueryServer = Querier{} - -// Querier defines a wrapper around the x/pool-incentives keeper providing gRPC -// method handlers. -type Querier struct { - Keeper -} - -func NewQuerier(k Keeper) Querier { - return Querier{Keeper: k} -} - -// GaugeIds takes provided gauge request and returns the respective gaugeIDs. -func (q Querier) GaugeIds(ctx context.Context, req *types.QueryGaugeIdsRequest) (*types.QueryGaugeIdsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") - } - - sdkCtx := sdk.UnwrapSDKContext(ctx) - lockableDurations := q.Keeper.GetLockableDurations(sdkCtx) - distrInfo := q.Keeper.GetDistrInfo(sdkCtx) - gaugeIdsWithDuration := make([]*types.QueryGaugeIdsResponse_GaugeIdWithDuration, len(lockableDurations)) - - totalWeightDec := sdk.NewDecFromInt(distrInfo.TotalWeight) - incentivePercentage := sdk.NewDec(0) - percentMultiplier := sdk.NewInt(100) - - for i, duration := range lockableDurations { - gaugeId, err := q.Keeper.GetPoolGaugeId(sdkCtx, req.PoolId, duration) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - for _, record := range distrInfo.Records { - if record.GaugeId == gaugeId { - // Pool incentive % = (gauge_id_weight / sum_of_all_pool_gauge_weight) * 100 - incentivePercentage = sdk.NewDecFromInt(record.Weight).Quo(totalWeightDec).MulInt(percentMultiplier) - } - } - - gaugeIdsWithDuration[i] = &types.QueryGaugeIdsResponse_GaugeIdWithDuration{ - GaugeId: gaugeId, - Duration: duration, - GaugeIncentivePercentage: incentivePercentage.String(), - } - } - return &types.QueryGaugeIdsResponse{GaugeIdsWithDuration: gaugeIdsWithDuration}, nil -} - -// DistrInfo returns gauges receiving pool rewards and their respective weights. -func (q Querier) DistrInfo(ctx context.Context, _ *types.QueryDistrInfoRequest) (*types.QueryDistrInfoResponse, error) { - sdkCtx := sdk.UnwrapSDKContext(ctx) - return &types.QueryDistrInfoResponse{DistrInfo: q.Keeper.GetDistrInfo(sdkCtx)}, nil -} - -// Params return pool-incentives module params. -func (q Querier) Params(ctx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - sdkCtx := sdk.UnwrapSDKContext(ctx) - return &types.QueryParamsResponse{Params: q.Keeper.GetParams(sdkCtx)}, nil -} - -// LockableDurations returns the lock durations that are incentivized through pool-incentives. -func (q Querier) LockableDurations(ctx context.Context, _ *types.QueryLockableDurationsRequest) (*types.QueryLockableDurationsResponse, error) { - sdkCtx := sdk.UnwrapSDKContext(ctx) - return &types.QueryLockableDurationsResponse{LockableDurations: q.Keeper.GetLockableDurations(sdkCtx)}, nil -} - -// IncentivizedPools iterates over all gauges, returns default gauges created with pool. -func (q Querier) IncentivizedPools(ctx context.Context, _ *types.QueryIncentivizedPoolsRequest) (*types.QueryIncentivizedPoolsResponse, error) { - sdkCtx := sdk.UnwrapSDKContext(ctx) - - lockableDurations := q.Keeper.GetLockableDurations(sdkCtx) - distrInfo := q.Keeper.GetDistrInfo(sdkCtx) - - // While there are exceptions, typically the number of incentivizedPools - // equals to the number of incentivized gauges / number of lockable durations. - incentivizedPools := make([]types.IncentivizedPool, 0, len(distrInfo.Records)/len(lockableDurations)) - - for _, record := range distrInfo.Records { - for _, lockableDuration := range lockableDurations { - poolId, err := q.Keeper.GetPoolIdFromGaugeId(sdkCtx, record.GaugeId, lockableDuration) - if err == nil { - incentivizedPool := types.IncentivizedPool{ - PoolId: poolId, - LockableDuration: lockableDuration, - GaugeId: record.GaugeId, - } - - incentivizedPools = append(incentivizedPools, incentivizedPool) - } - } - } - - return &types.QueryIncentivizedPoolsResponse{ - IncentivizedPools: incentivizedPools, - }, nil -} - -// ExternalIncentiveGauges iterates over all gauges, returns gauges externally -// incentivized, excluding default gauges created with pool. -func (q Querier) ExternalIncentiveGauges(ctx context.Context, req *types.QueryExternalIncentiveGaugesRequest) (*types.QueryExternalIncentiveGaugesResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") - } - - sdkCtx := sdk.UnwrapSDKContext(ctx) - store := sdkCtx.KVStore(q.Keeper.storeKey) - prefixStore := prefix.NewStore(store, []byte("pool-incentives")) - - iterator := prefixStore.Iterator(nil, nil) - defer iterator.Close() // nolint: errcheck - - // map true to default gauges created with pool - poolGaugeIds := make(map[uint64]bool) - for ; iterator.Valid(); iterator.Next() { - poolGaugeIds[sdk.BigEndianToUint64(iterator.Value())] = true - } - - // iterate over all gauges, exclude default created gauges, leaving externally incentivized gauges - allGauges := q.Keeper.GetAllGauges(sdkCtx) - gauges := []incentivetypes.Gauge{} - for _, gauge := range allGauges { - if _, ok := poolGaugeIds[gauge.Id]; !ok { - gauges = append(gauges, gauge) - } - } - - return &types.QueryExternalIncentiveGaugesResponse{Data: gauges}, nil -} diff --git a/x/pool-incentives/keeper/grpc_query_test.go b/x/pool-incentives/keeper/grpc_query_test.go deleted file mode 100644 index 8a95ead0df0..00000000000 --- a/x/pool-incentives/keeper/grpc_query_test.go +++ /dev/null @@ -1,292 +0,0 @@ -package keeper_test - -import ( - "context" - "sort" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - - lockuptypes "github.com/osmosis-labs/osmosis/v15/x/lockup/types" - "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/types" -) - -var ( - isPerpetual = true - notPerpetual = false -) - -func (suite *KeeperTestSuite) TestGaugeIds() { - for _, tc := range []struct { - desc string - request *types.QueryGaugeIdsRequest - err bool - }{ - { - desc: "Empty request", - request: &types.QueryGaugeIdsRequest{}, - err: true, - }, - { - desc: "Nonexistent pool", - request: &types.QueryGaugeIdsRequest{ - PoolId: 2, - }, - err: true, - }, - { - desc: "Happy case", - request: &types.QueryGaugeIdsRequest{ - PoolId: 1, - }, - err: false, - }, - } { - tc := tc - suite.Run(tc.desc, func() { - suite.SetupTest() - queryClient := suite.queryClient - // Prepare a balancer pool - suite.PrepareBalancerPool() - // LockableDurations should be 1, 3, 7 hours from the default genesis state. - lockableDurations := suite.App.PoolIncentivesKeeper.GetLockableDurations(suite.Ctx) - suite.Require().Equal(3, len(lockableDurations)) - - res, err := queryClient.GaugeIds(context.Background(), tc.request) - if tc.err { - suite.Require().Error(err) - } else { - suite.Require().NoError(err) - suite.Require().Equal(3, len(res.GaugeIdsWithDuration)) - - for i := 0; i < len(res.GaugeIdsWithDuration); i++ { - suite.Require().Equal(lockableDurations[i], res.GaugeIdsWithDuration[i].Duration) - } - } - }) - } -} - -func (suite *KeeperTestSuite) TestDistrInfo() { - for _, tc := range []struct { - desc string - poolCreated bool - weights []sdk.Int - expectedTotalWeight sdk.Int - expectedRecordLength int - }{ - { - desc: "No pool exists", - poolCreated: false, - weights: []sdk.Int{}, - expectedTotalWeight: sdk.NewInt(0), - expectedRecordLength: 0, - }, - { - desc: "Happy case", - poolCreated: true, - weights: []sdk.Int{sdk.NewInt(100), sdk.NewInt(200), sdk.NewInt(300)}, - expectedTotalWeight: sdk.NewInt(600), - expectedRecordLength: 3, - }, - } { - tc := tc - suite.Run(tc.desc, func() { - suite.SetupTest() - keeper := suite.App.PoolIncentivesKeeper - queryClient := suite.queryClient - - if tc.poolCreated { - poolId := suite.PrepareBalancerPool() - - // LockableDurations should be 1, 3, 7 hours from the default genesis state. - lockableDurations := keeper.GetLockableDurations(suite.Ctx) - suite.Require().Equal(3, len(lockableDurations)) - - var distRecord []types.DistrRecord - for i := 0; i < len(lockableDurations); i++ { - gaugeId, err := keeper.GetPoolGaugeId(suite.Ctx, poolId, lockableDurations[i]) - suite.Require().NoError(err) - distRecord = append(distRecord, types.DistrRecord{ - GaugeId: gaugeId, - Weight: tc.weights[i], - }) - } - - // Create 3 records - err := keeper.UpdateDistrRecords(suite.Ctx, distRecord...) - suite.Require().NoError(err) - } - - res, err := queryClient.DistrInfo(context.Background(), &types.QueryDistrInfoRequest{}) - suite.Require().NoError(err) - - suite.Require().Equal(tc.expectedTotalWeight, res.DistrInfo.TotalWeight) - suite.Require().Equal(tc.expectedRecordLength, len(res.DistrInfo.Records)) - }) - } -} - -func (suite *KeeperTestSuite) TestParams() { - suite.SetupTest() - - queryClient := suite.queryClient - - res, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{}) - suite.Require().NoError(err) - - // Minted denom set as "stake" from the default genesis state - suite.Require().Equal("stake", res.Params.MintedDenom) -} - -func (suite *KeeperTestSuite) TestLockableDurations() { - suite.SetupTest() - - queryClient := suite.queryClient - - res, err := queryClient.LockableDurations(context.Background(), &types.QueryLockableDurationsRequest{}) - suite.Require().NoError(err) - - // LockableDurations should be 1, 3, 7 hours from the default genesis state. - suite.Require().Equal(3, len(res.LockableDurations)) - suite.Require().Equal(time.Hour, res.LockableDurations[0]) - suite.Require().Equal(time.Hour*3, res.LockableDurations[1]) - suite.Require().Equal(time.Hour*7, res.LockableDurations[2]) -} - -func (suite *KeeperTestSuite) TestIncentivizedPools() { - for _, tc := range []struct { - desc string - poolCreated bool - weights []sdk.Int - perpetual bool - nonPerpetual bool - expectedRecordLength int - }{ - { - desc: "No pool exist", - poolCreated: false, - weights: []sdk.Int{}, - expectedRecordLength: 0, - }, - { - desc: "Normal case", - poolCreated: true, - weights: []sdk.Int{sdk.NewInt(100), sdk.NewInt(200), sdk.NewInt(300)}, - expectedRecordLength: 3, - }, - { - desc: "Perpetual", - poolCreated: true, - weights: []sdk.Int{sdk.NewInt(100), sdk.NewInt(200), sdk.NewInt(300)}, - perpetual: true, - expectedRecordLength: 3, - }, - { - desc: "Non Perpetual", - poolCreated: true, - weights: []sdk.Int{sdk.NewInt(100), sdk.NewInt(200), sdk.NewInt(300)}, - nonPerpetual: true, - expectedRecordLength: 0, - }, - } { - tc := tc - suite.Run(tc.desc, func() { - suite.SetupTest() - keeper := suite.App.PoolIncentivesKeeper - queryClient := suite.queryClient - var poolId uint64 - - var lockableDurations []time.Duration - if tc.poolCreated { - // prepare a balancer pool - poolId = suite.PrepareBalancerPool() - // LockableDurations should be 1, 3, 7 hours from the default genesis state. - lockableDurations = keeper.GetLockableDurations(suite.Ctx) - suite.Require().Equal(3, len(lockableDurations)) - - var distRecords []types.DistrRecord - for i := 0; i < len(lockableDurations); i++ { - gaugeId, err := keeper.GetPoolGaugeId(suite.Ctx, poolId, lockableDurations[i]) - suite.Require().NoError(err) - distRecords = append(distRecords, types.DistrRecord{GaugeId: gaugeId, Weight: tc.weights[i]}) - - if tc.perpetual { - gaugePerpetualId, err := suite.App.IncentivesKeeper.CreateGauge( - suite.Ctx, isPerpetual, sdk.AccAddress{}, sdk.Coins{}, lockuptypes.QueryCondition{ - LockQueryType: lockuptypes.ByDuration, - Denom: "stake", - Duration: time.Hour, - }, time.Now(), 1) - suite.Require().NoError(err) - distRecords = append(distRecords, types.DistrRecord{GaugeId: gaugePerpetualId, Weight: sdk.NewInt(300)}) - } - if tc.nonPerpetual { - gaugeNonPerpetualId, err := suite.App.IncentivesKeeper.CreateGauge( - suite.Ctx, notPerpetual, sdk.AccAddress{}, sdk.Coins{}, lockuptypes.QueryCondition{ - LockQueryType: lockuptypes.ByDuration, - Denom: "stake", - Duration: time.Hour, - }, time.Now(), 1) - suite.Require().NoError(err) - distRecords = append(distRecords, types.DistrRecord{GaugeId: gaugeNonPerpetualId, Weight: sdk.NewInt(100)}) - } - - // Sort in ascending order of gaugeId - sort.Slice(distRecords[:], func(i, j int) bool { - return distRecords[i].GaugeId < distRecords[j].GaugeId - }) - - // update records and ensure that non-perpetuals pot cannot get rewards. - keeper.UpdateDistrRecords(suite.Ctx, distRecords...) - } - res, err := queryClient.IncentivizedPools(context.Background(), &types.QueryIncentivizedPoolsRequest{}) - suite.Require().NoError(err) - suite.Require().Equal(tc.expectedRecordLength, len(res.IncentivizedPools)) - } - }) - } -} - -func (suite *KeeperTestSuite) TestGaugeIncentivePercentage() { - suite.SetupTest() - - keeper := suite.App.PoolIncentivesKeeper - queryClient := suite.queryClient - - poolId := suite.PrepareBalancerPool() - // LockableDurations should be 1, 3, 7 hours from the default genesis state. - lockableDurations := keeper.GetLockableDurations(suite.Ctx) - suite.Require().Equal(3, len(lockableDurations)) - - gauge1Id, err := keeper.GetPoolGaugeId(suite.Ctx, poolId, lockableDurations[0]) - suite.Require().NoError(err) - - gauge2Id, err := keeper.GetPoolGaugeId(suite.Ctx, poolId, lockableDurations[1]) - suite.Require().NoError(err) - - gauge3Id, err := keeper.GetPoolGaugeId(suite.Ctx, poolId, lockableDurations[2]) - suite.Require().NoError(err) - - // Create 3 records - err = keeper.UpdateDistrRecords(suite.Ctx, types.DistrRecord{ - GaugeId: gauge1Id, - Weight: sdk.NewInt(100), - }, types.DistrRecord{ - GaugeId: gauge2Id, - Weight: sdk.NewInt(200), - }, types.DistrRecord{ - GaugeId: gauge3Id, - Weight: sdk.NewInt(300), - }) - suite.Require().NoError(err) - - res, err := queryClient.GaugeIds(context.Background(), &types.QueryGaugeIdsRequest{ - PoolId: poolId, - }) - - suite.Require().NoError(err) - suite.Require().Equal("16.666666666666666700", res.GaugeIdsWithDuration[0].GaugeIncentivePercentage) - suite.Require().Equal("33.333333333333333300", res.GaugeIdsWithDuration[1].GaugeIncentivePercentage) - suite.Require().Equal("50.000000000000000000", res.GaugeIdsWithDuration[2].GaugeIncentivePercentage) -} diff --git a/x/pool-incentives/keeper/hooks.go b/x/pool-incentives/keeper/hooks.go deleted file mode 100644 index 6d9f7d774e3..00000000000 --- a/x/pool-incentives/keeper/hooks.go +++ /dev/null @@ -1,38 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - gammtypes "github.com/osmosis-labs/osmosis/v15/x/gamm/types" -) - -type Hooks struct { - k Keeper -} - -var ( - _ gammtypes.GammHooks = Hooks{} -) - -// Create new pool incentives hooks. -func (k Keeper) Hooks() Hooks { return Hooks{k} } - -// AfterPoolCreated creates a gauge for each pool’s lockable duration. -func (h Hooks) AfterPoolCreated(ctx sdk.Context, sender sdk.AccAddress, poolId uint64) { - err := h.k.CreatePoolGauges(ctx, poolId) - if err != nil { - panic(err) - } -} - -// AfterJoinPool hook is a noop. -func (h Hooks) AfterJoinPool(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, enterCoins sdk.Coins, shareOutAmount sdk.Int) { -} - -// AfterExitPool hook is a noop. -func (h Hooks) AfterExitPool(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, shareInAmount sdk.Int, exitCoins sdk.Coins) { -} - -// AfterSwap hook is a noop. -func (h Hooks) AfterSwap(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, input sdk.Coins, output sdk.Coins) { -} diff --git a/x/pool-incentives/keeper/keeper.go b/x/pool-incentives/keeper/keeper.go deleted file mode 100644 index 44629edf451..00000000000 --- a/x/pool-incentives/keeper/keeper.go +++ /dev/null @@ -1,161 +0,0 @@ -package keeper - -import ( - "fmt" - "time" - - "github.com/tendermint/tendermint/libs/log" - - "github.com/osmosis-labs/osmosis/v15/osmoutils" - gammtypes "github.com/osmosis-labs/osmosis/v15/x/gamm/types" - incentivestypes "github.com/osmosis-labs/osmosis/v15/x/incentives/types" - lockuptypes "github.com/osmosis-labs/osmosis/v15/x/lockup/types" - "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/types" - - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" -) - -type Keeper struct { - storeKey storetypes.StoreKey - - paramSpace paramtypes.Subspace - - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper - incentivesKeeper types.IncentivesKeeper - distrKeeper types.DistrKeeper - poolmanagerKeeper types.PoolManagerKeeper -} - -func NewKeeper(storeKey storetypes.StoreKey, paramSpace paramtypes.Subspace, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, incentivesKeeper types.IncentivesKeeper, distrKeeper types.DistrKeeper, poolmanagerKeeper types.PoolManagerKeeper) Keeper { - // ensure pool-incentives module account is set - if addr := accountKeeper.GetModuleAddress(types.ModuleName); addr == nil { - panic(fmt.Sprintf("%s module account has not been set", types.ModuleName)) - } - - // set KeyTable if it has not already been set - if !paramSpace.HasKeyTable() { - paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) - } - - return Keeper{ - storeKey: storeKey, - - paramSpace: paramSpace, - - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - incentivesKeeper: incentivesKeeper, - distrKeeper: distrKeeper, - poolmanagerKeeper: poolmanagerKeeper, - } -} - -// Logger returns a module-specific logger. -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", "x/"+types.ModuleName) -} - -func (k Keeper) CreatePoolGauges(ctx sdk.Context, poolId uint64) error { - // Create the same number of gaugeges as there are LockableDurations - for _, lockableDuration := range k.GetLockableDurations(ctx) { - gaugeId, err := k.incentivesKeeper.CreateGauge( - ctx, - true, - k.accountKeeper.GetModuleAddress(types.ModuleName), - sdk.Coins{}, - lockuptypes.QueryCondition{ - LockQueryType: lockuptypes.ByDuration, - Denom: gammtypes.GetPoolShareDenom(poolId), - Duration: lockableDuration, - Timestamp: time.Time{}, - }, - // QUESTION: Should we set the startTime as the epoch start time that the modules share or the current block time? - ctx.BlockTime(), - 1, - ) - if err != nil { - return err - } - - k.SetPoolGaugeId(ctx, poolId, lockableDuration, gaugeId) - } - - return nil -} - -func (k Keeper) SetPoolGaugeId(ctx sdk.Context, poolId uint64, lockableDuration time.Duration, gaugeId uint64) { - key := types.GetPoolGaugeIdStoreKey(poolId, lockableDuration) - store := ctx.KVStore(k.storeKey) - store.Set(key, sdk.Uint64ToBigEndian(gaugeId)) - - key = types.GetPoolIdFromGaugeIdStoreKey(gaugeId, lockableDuration) - store.Set(key, sdk.Uint64ToBigEndian(poolId)) -} - -func (k Keeper) GetPoolGaugeId(ctx sdk.Context, poolId uint64, lockableDuration time.Duration) (uint64, error) { - key := types.GetPoolGaugeIdStoreKey(poolId, lockableDuration) - store := ctx.KVStore(k.storeKey) - bz := store.Get(key) - - if len(bz) == 0 { - return 0, sdkerrors.Wrapf(types.ErrNoGaugeIdExist, "gauge id for pool (%d) with duration (%s) not exist", poolId, lockableDuration.String()) - } - - return sdk.BigEndianToUint64(bz), nil -} - -func (k Keeper) GetPoolIdFromGaugeId(ctx sdk.Context, gaugeId uint64, lockableDuration time.Duration) (uint64, error) { - key := types.GetPoolIdFromGaugeIdStoreKey(gaugeId, lockableDuration) - store := ctx.KVStore(k.storeKey) - bz := store.Get(key) - - if len(bz) == 0 { - return 0, sdkerrors.Wrapf(types.ErrNoGaugeIdExist, "pool for gauge id (%d) with duration (%s) not exist", gaugeId, lockableDuration.String()) - } - - return sdk.BigEndianToUint64(bz), nil -} - -func (k Keeper) SetLockableDurations(ctx sdk.Context, lockableDurations []time.Duration) { - store := ctx.KVStore(k.storeKey) - info := types.LockableDurationsInfo{LockableDurations: lockableDurations} - osmoutils.MustSet(store, types.LockableDurationsKey, &info) -} - -func (k Keeper) GetLockableDurations(ctx sdk.Context) []time.Duration { - store := ctx.KVStore(k.storeKey) - info := types.LockableDurationsInfo{} - osmoutils.MustGet(store, types.LockableDurationsKey, &info) - return info.LockableDurations -} - -func (k Keeper) GetAllGauges(ctx sdk.Context) []incentivestypes.Gauge { - gauges := k.incentivesKeeper.GetGauges(ctx) - return gauges -} - -func (k Keeper) IsPoolIncentivized(ctx sdk.Context, poolId uint64) bool { - lockableDurations := k.GetLockableDurations(ctx) - distrInfo := k.GetDistrInfo(ctx) - - candidateGaugeIds := []uint64{} - for _, lockableDuration := range lockableDurations { - gaugeId, err := k.GetPoolGaugeId(ctx, poolId, lockableDuration) - if err == nil { - candidateGaugeIds = append(candidateGaugeIds, gaugeId) - } - } - - for _, record := range distrInfo.Records { - for _, gaugeId := range candidateGaugeIds { - if record.GaugeId == gaugeId { - return true - } - } - } - return false -} diff --git a/x/pool-incentives/keeper/keeper_test.go b/x/pool-incentives/keeper/keeper_test.go deleted file mode 100644 index 51d5636f5fa..00000000000 --- a/x/pool-incentives/keeper/keeper_test.go +++ /dev/null @@ -1,73 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/stretchr/testify/suite" - - "github.com/osmosis-labs/osmosis/v15/app/apptesting" - gammtypes "github.com/osmosis-labs/osmosis/v15/x/gamm/types" - "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/types" -) - -type KeeperTestSuite struct { - apptesting.KeeperTestHelper - - queryClient types.QueryClient -} - -func (suite *KeeperTestSuite) SetupTest() { - suite.Setup() - - suite.queryClient = types.NewQueryClient(suite.QueryHelper) -} - -func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) -} - -func (suite *KeeperTestSuite) TestCreateBalancerPoolGauges() { - suite.SetupTest() - - keeper := suite.App.PoolIncentivesKeeper - - // LockableDurations should be 1, 3, 7 hours from the default genesis state. - lockableDurations := keeper.GetLockableDurations(suite.Ctx) - suite.Equal(3, len(lockableDurations)) - - for i := 0; i < 3; i++ { - poolId := suite.PrepareBalancerPool() - pool, err := suite.App.GAMMKeeper.GetPoolAndPoke(suite.Ctx, poolId) - suite.NoError(err) - - poolLpDenom := gammtypes.GetPoolShareDenom(pool.GetId()) - - // Same amount of gauges as lockableDurations must be created for every pool created. - gaugeId, err := keeper.GetPoolGaugeId(suite.Ctx, poolId, lockableDurations[0]) - suite.NoError(err) - gauge, err := suite.App.IncentivesKeeper.GetGaugeByID(suite.Ctx, gaugeId) - suite.NoError(err) - suite.Equal(0, len(gauge.Coins)) - suite.Equal(true, gauge.IsPerpetual) - suite.Equal(poolLpDenom, gauge.DistributeTo.Denom) - suite.Equal(lockableDurations[0], gauge.DistributeTo.Duration) - - gaugeId, err = keeper.GetPoolGaugeId(suite.Ctx, poolId, lockableDurations[1]) - suite.NoError(err) - gauge, err = suite.App.IncentivesKeeper.GetGaugeByID(suite.Ctx, gaugeId) - suite.NoError(err) - suite.Equal(0, len(gauge.Coins)) - suite.Equal(true, gauge.IsPerpetual) - suite.Equal(poolLpDenom, gauge.DistributeTo.Denom) - suite.Equal(lockableDurations[1], gauge.DistributeTo.Duration) - - gaugeId, err = keeper.GetPoolGaugeId(suite.Ctx, poolId, lockableDurations[2]) - suite.NoError(err) - gauge, err = suite.App.IncentivesKeeper.GetGaugeByID(suite.Ctx, gaugeId) - suite.NoError(err) - suite.Equal(0, len(gauge.Coins)) - suite.Equal(true, gauge.IsPerpetual) - suite.Equal(poolLpDenom, gauge.DistributeTo.Denom) - suite.Equal(lockableDurations[2], gauge.DistributeTo.Duration) - } -} diff --git a/x/pool-incentives/keeper/params.go b/x/pool-incentives/keeper/params.go deleted file mode 100644 index b61d724b652..00000000000 --- a/x/pool-incentives/keeper/params.go +++ /dev/null @@ -1,16 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/types" -) - -func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { - k.paramSpace.GetParamSet(ctx, ¶ms) - return params -} - -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramSpace.SetParamSet(ctx, ¶ms) -} diff --git a/x/pool-incentives/module.go b/x/pool-incentives/module.go deleted file mode 100644 index 5b47d47582c..00000000000 --- a/x/pool-incentives/module.go +++ /dev/null @@ -1,190 +0,0 @@ -/* -The `pool-incentives` module automatically creates individual gauges -in the `incentives` module for every lock duration -that exists in that pool. The `pool-incentives` module also takes -the `pool_incentives` distributed from the `gov` module -and distributes it to the various incentivized gauges. - - Handles governance proposals impacting pool incentives. - - Pool distribution and lockup infos queries. - - Distributes incentives to LPs. -*/ -package pool_incentives - -import ( - "context" - "encoding/json" - "fmt" - "math/rand" - - "github.com/gorilla/mux" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/cosmos/cosmos-sdk/x/gov/simulation" - - "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/client/cli" - "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/keeper" - "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/types" -) - -var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} - _ module.AppModuleSimulation = AppModule{} -) - -type AppModuleBasic struct{} - -// Name returns the pool-incentives module's name. -func (AppModuleBasic) Name() string { return types.ModuleName } - -// RegisterLegacyAminoCodec registers the pool-incentives module's types on the LegacyAmino codec. -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterLegacyAminoCodec(cdc) -} - -// DefaultGenesis returns default genesis state as raw bytes for the pool-incentives -// module. -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesisState()) -} - -// ValidateGenesis performs genesis state validation for the pool-incentives module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - var data types.GenesisState - if err := cdc.UnmarshalJSON(bz, &data); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - - return types.ValidateGenesis(&data) -} - -// --------------------------------------- -// Interfaces. -func (b AppModuleBasic) RegisterRESTRoutes(ctx client.Context, r *mux.Router) { - // noop -} - -func (b AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { - return - } -} - -func (b AppModuleBasic) GetTxCmd() *cobra.Command { - return nil -} - -func (b AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd() -} - -// RegisterInterfaces registers interfaces and implementations of the pool-incentives module. -func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) { - types.RegisterInterfaces(registry) -} - -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper -} - -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQuerier(am.keeper)) -} - -func NewAppModule(keeper keeper.Keeper) AppModule { - return AppModule{ - AppModuleBasic: AppModuleBasic{}, - keeper: keeper, - } -} - -// RegisterInvariants registers the pool-incentives module invariants. -func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { -} - -// Route returns the message routing key for the pool-incentives module. -func (am AppModule) Route() sdk.Route { - return sdk.NewRoute(types.RouterKey, nil) -} - -// QuerierRoute returns the pool-incentives module's querier route name. -func (AppModule) QuerierRoute() string { return types.RouterKey } - -// LegacyQuerierHandler returns the x/pool-incentives's module sdk.Querier. -func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { - return func(sdk.Context, []string, abci.RequestQuery) ([]byte, error) { - return nil, fmt.Errorf("legacy querier not supported for the x/%s module", types.ModuleName) - } -} - -// InitGenesis performs genesis initialization for the pool-incentives module. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { - var genesisState types.GenesisState - - cdc.MustUnmarshalJSON(data, &genesisState) - - am.keeper.InitGenesis(ctx, &genesisState) - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the exported genesis state as raw bytes for the mint -// module. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - gs := am.keeper.ExportGenesis(ctx) - return cdc.MustMarshalJSON(gs) -} - -// BeginBlock performs a no-op. -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {} - -// EndBlock returns the end blocker for the pool-incentives module. It returns no validator -// updates. -func (m AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - err := m.keeper.AllocateAsset(ctx) - if err != nil { - ctx.Logger().Error("failed to allocate asset", "error", err) - } - - return []abci.ValidatorUpdate{} -} - -// ___________________________________________________________________________ - -// AppModuleSimulation functions - -// GenerateGenesisState creates a randomized GenState of the pool-incentives module. -func (AppModule) GenerateGenesisState(simState *module.SimulationState) { - simulation.RandomizedGenState(simState) -} - -// ProposalContents doesn't return any content functions for governance proposals. -func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { - return nil -} - -// RandomizedParams creates randomized pool-incentives param changes for the simulator. -func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { - return simulation.ParamChanges(r) -} - -// RegisterStoreDecoder registers a decoder for supply module's types. -func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { -} - -// WeightedOperations returns the all the gov module operations with their respective weights. -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - return nil // TODO -} - -// ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } diff --git a/x/pool-incentives/types/codec.go b/x/pool-incentives/types/codec.go deleted file mode 100644 index 2ac9cee7970..00000000000 --- a/x/pool-incentives/types/codec.go +++ /dev/null @@ -1,18 +0,0 @@ -package types - -import ( - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" -) - -func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&UpdatePoolIncentivesProposal{}, "osmosis/UpdatePoolIncentivesProposal", nil) -} - -func RegisterInterfaces(registry types.InterfaceRegistry) { - registry.RegisterImplementations( - (*govtypes.Content)(nil), - &UpdatePoolIncentivesProposal{}, - ) -} diff --git a/x/pool-incentives/types/errors.go b/x/pool-incentives/types/errors.go deleted file mode 100644 index 0244aa8391c..00000000000 --- a/x/pool-incentives/types/errors.go +++ /dev/null @@ -1,17 +0,0 @@ -package types - -import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -// The following regiisters various pool-incentives errors. -var ( - ErrNoGaugeIdExist = sdkerrors.Register(ModuleName, 1, "no gauge id exist") - ErrDistrRecordNotPositiveWeight = sdkerrors.Register(ModuleName, 2, "weight in record should be positive") - ErrDistrRecordNotRegisteredGauge = sdkerrors.Register(ModuleName, 3, "gauge was not registered") - ErrDistrRecordRegisteredGauge = sdkerrors.Register(ModuleName, 4, "gauge was already registered") - ErrDistrRecordNotSorted = sdkerrors.Register(ModuleName, 5, "gauges are not sorted") - - ErrEmptyProposalRecords = sdkerrors.Register(ModuleName, 10, "records are empty") - ErrEmptyProposalGaugeIds = sdkerrors.Register(ModuleName, 11, "gauge ids are empty") -) diff --git a/x/pool-incentives/types/expected_keepers.go b/x/pool-incentives/types/expected_keepers.go deleted file mode 100644 index d9376a9814c..00000000000 --- a/x/pool-incentives/types/expected_keepers.go +++ /dev/null @@ -1,43 +0,0 @@ -package types - -import ( - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - - incentivestypes "github.com/osmosis-labs/osmosis/v15/x/incentives/types" - lockuptypes "github.com/osmosis-labs/osmosis/v15/x/lockup/types" -) - -// AccountKeeper interface contains functions for getting accounts and the module address -type AccountKeeper interface { - GetModuleAddress(name string) sdk.AccAddress - GetModuleAccount(ctx sdk.Context, name string) authtypes.ModuleAccountI -} - -// BankKeeper sends tokens across modules and is able to get account balances. -type BankKeeper interface { - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin -} - -// PoolManagerKeeper gets the pool interface from poolID. -type PoolManagerKeeper interface { - GetNextPoolId(ctx sdk.Context) uint64 -} - -// IncentivesKeeper creates and gets gauges, and also allows additions to gauge rewards. -type IncentivesKeeper interface { - CreateGauge(ctx sdk.Context, isPerpetual bool, owner sdk.AccAddress, coins sdk.Coins, distrTo lockuptypes.QueryCondition, startTime time.Time, numEpochsPaidOver uint64) (uint64, error) - GetGaugeByID(ctx sdk.Context, gaugeID uint64) (*incentivestypes.Gauge, error) - GetGauges(ctx sdk.Context) []incentivestypes.Gauge - - AddToGaugeRewards(ctx sdk.Context, owner sdk.AccAddress, coins sdk.Coins, gaugeID uint64) error -} - -// DistrKeeper handles pool-fees functionality - setting / getting fees and funding the community pool. -type DistrKeeper interface { - SetFeePool(ctx sdk.Context, feePool distrtypes.FeePool) - FundCommunityPool(ctx sdk.Context, amount sdk.Coins, sender sdk.AccAddress) error -} diff --git a/x/pool-incentives/types/genesis.go b/x/pool-incentives/types/genesis.go deleted file mode 100644 index 05f6259fe90..00000000000 --- a/x/pool-incentives/types/genesis.go +++ /dev/null @@ -1,71 +0,0 @@ -package types - -import ( - "encoding/json" - "errors" - "fmt" - time "time" - - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func NewGenesisState(params Params, lockableDurations []time.Duration, distrInfo *DistrInfo) *GenesisState { - return &GenesisState{ - Params: params, - LockableDurations: lockableDurations, - DistrInfo: distrInfo, - } -} - -// DefaultGenesisState gets the raw genesis raw message for testing. -func DefaultGenesisState() *GenesisState { - return &GenesisState{ - Params: DefaultParams(), - LockableDurations: []time.Duration{ - time.Hour, - time.Hour * 3, - time.Hour * 7, - }, - DistrInfo: &DistrInfo{ - TotalWeight: sdk.ZeroInt(), - Records: nil, - }, - } -} - -// GetGenesisStateFromAppState returns x/pool-yield GenesisState given raw application -// genesis state. -func GetGenesisStateFromAppState(cdc codec.JSONCodec, appState map[string]json.RawMessage) *GenesisState { - var genesisState GenesisState - - if appState[ModuleName] != nil { - cdc.MustUnmarshalJSON(appState[ModuleName], &genesisState) - } - - return &genesisState -} - -// ValidateGenesis validates the provided pool-yield genesis state to ensure the -// expected invariants holds. (i.e. params in correct bounds). -func ValidateGenesis(data *GenesisState) error { - if err := data.Params.Validate(); err != nil { - return err - } - - if data.DistrInfo.TotalWeight.LT(sdk.NewInt(0)) { - return errors.New("distrinfo weight should not be negative") - } - - return validateLockableDurations(data.LockableDurations) -} - -// validateLockableDurations ensures the provided lockable duration is a valid parameter. -func validateLockableDurations(i interface{}) error { - _, ok := i.([]time.Duration) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} diff --git a/x/pool-incentives/types/genesis.pb.go b/x/pool-incentives/types/genesis.pb.go deleted file mode 100644 index 05b76a02a9e..00000000000 --- a/x/pool-incentives/types/genesis.pb.go +++ /dev/null @@ -1,520 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: osmosis/pool-incentives/v1beta1/genesis.proto - -package types - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - _ "github.com/gogo/protobuf/types" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - io "io" - math "math" - math_bits "math/bits" - time "time" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// 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 - -// GenesisState defines the pool incentives module's genesis state. -type GenesisState struct { - // params defines all the paramaters of the module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - LockableDurations []time.Duration `protobuf:"bytes,2,rep,name=lockable_durations,json=lockableDurations,proto3,stdduration" json:"lockable_durations" yaml:"lockable_durations"` - DistrInfo *DistrInfo `protobuf:"bytes,3,opt,name=distr_info,json=distrInfo,proto3" json:"distr_info,omitempty" yaml:"distr_info"` - PoolToGauges *PoolToGauges `protobuf:"bytes,4,opt,name=pool_to_gauges,json=poolToGauges,proto3" json:"pool_to_gauges,omitempty" yaml:"pool_to_gauges"` -} - -func (m *GenesisState) Reset() { *m = GenesisState{} } -func (m *GenesisState) String() string { return proto.CompactTextString(m) } -func (*GenesisState) ProtoMessage() {} -func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_cc1f078212600632, []int{0} -} -func (m *GenesisState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisState.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 *GenesisState) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisState.Merge(m, src) -} -func (m *GenesisState) XXX_Size() int { - return m.Size() -} -func (m *GenesisState) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisState.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisState proto.InternalMessageInfo - -func (m *GenesisState) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -func (m *GenesisState) GetLockableDurations() []time.Duration { - if m != nil { - return m.LockableDurations - } - return nil -} - -func (m *GenesisState) GetDistrInfo() *DistrInfo { - if m != nil { - return m.DistrInfo - } - return nil -} - -func (m *GenesisState) GetPoolToGauges() *PoolToGauges { - if m != nil { - return m.PoolToGauges - } - return nil -} - -func init() { - proto.RegisterType((*GenesisState)(nil), "osmosis.poolincentives.v1beta1.GenesisState") -} - -func init() { - proto.RegisterFile("osmosis/pool-incentives/v1beta1/genesis.proto", fileDescriptor_cc1f078212600632) -} - -var fileDescriptor_cc1f078212600632 = []byte{ - // 393 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xcd, 0xaa, 0xd3, 0x40, - 0x14, 0xc7, 0x13, 0x7b, 0xb9, 0x60, 0xee, 0x45, 0xb8, 0x41, 0x21, 0x2d, 0x38, 0x29, 0x01, 0xa5, - 0x82, 0x9d, 0xb1, 0x15, 0x37, 0xba, 0x0b, 0x85, 0xe2, 0x4e, 0xa2, 0x6e, 0xdc, 0x84, 0x49, 0x3a, - 0x1d, 0x07, 0x93, 0x9c, 0x98, 0x99, 0x14, 0xfb, 0x16, 0x2e, 0xdd, 0xf8, 0x3e, 0x5d, 0x76, 0xe9, - 0x2a, 0x4a, 0xfb, 0x06, 0x7d, 0x02, 0xc9, 0x24, 0xa1, 0x95, 0x82, 0xdd, 0x65, 0x38, 0xbf, 0xff, - 0xc7, 0x39, 0xc4, 0x1a, 0x83, 0x4c, 0x41, 0x0a, 0x49, 0x72, 0x80, 0x64, 0x2c, 0xb2, 0x98, 0x65, - 0x4a, 0xac, 0x98, 0x24, 0xab, 0x49, 0xc4, 0x14, 0x9d, 0x10, 0xce, 0x32, 0x26, 0x85, 0xc4, 0x79, - 0x01, 0x0a, 0x6c, 0xd4, 0xe2, 0xb8, 0xc6, 0x8f, 0x34, 0x6e, 0xe9, 0xc1, 0x43, 0x0e, 0x1c, 0x34, - 0x4a, 0xea, 0xaf, 0x46, 0x35, 0x40, 0x1c, 0x80, 0x27, 0x8c, 0xe8, 0x57, 0x54, 0x2e, 0xc9, 0xa2, - 0x2c, 0xa8, 0x12, 0x90, 0xb5, 0xf3, 0x17, 0x97, 0x4a, 0x9c, 0x24, 0x69, 0x85, 0xf7, 0xb3, 0x67, - 0xdd, 0xce, 0x9b, 0x66, 0xef, 0x15, 0x55, 0xcc, 0x9e, 0x59, 0xd7, 0x39, 0x2d, 0x68, 0x2a, 0x1d, - 0x73, 0x68, 0x8e, 0x6e, 0xa6, 0x4f, 0xf1, 0xff, 0x9b, 0xe2, 0x77, 0x9a, 0xf6, 0xaf, 0x36, 0x95, - 0x6b, 0x04, 0xad, 0xd6, 0x06, 0xcb, 0x4e, 0x20, 0xfe, 0x42, 0xa3, 0x84, 0x85, 0x5d, 0x47, 0xe9, - 0xdc, 0x1b, 0xf6, 0x46, 0x37, 0xd3, 0x3e, 0x6e, 0xb6, 0xc0, 0xdd, 0x16, 0x78, 0xd6, 0x12, 0xfe, - 0x93, 0xda, 0xe4, 0x50, 0xb9, 0xfd, 0x35, 0x4d, 0x93, 0xd7, 0xde, 0xb9, 0x85, 0xf7, 0xe3, 0xb7, - 0x6b, 0x06, 0x77, 0xdd, 0xa0, 0x13, 0x4a, 0x3b, 0xb6, 0xac, 0x85, 0x90, 0xaa, 0x08, 0x45, 0xb6, - 0x04, 0xa7, 0xa7, 0xab, 0x3f, 0xbb, 0x54, 0x7d, 0x56, 0x2b, 0xde, 0x66, 0x4b, 0xf0, 0xfb, 0x9b, - 0xca, 0x35, 0x0f, 0x95, 0x7b, 0xd7, 0x04, 0x1f, 0xad, 0xbc, 0xe0, 0xfe, 0xa2, 0xa3, 0xec, 0xaf, - 0xd6, 0x83, 0xda, 0x29, 0x54, 0x10, 0x72, 0x5a, 0x72, 0x26, 0x9d, 0x2b, 0x1d, 0xf4, 0xfc, 0xe2, - 0x8d, 0x00, 0x92, 0x0f, 0x30, 0xd7, 0x1a, 0xff, 0x71, 0x9b, 0xf5, 0xa8, 0xc9, 0xfa, 0xd7, 0xd1, - 0x0b, 0x6e, 0xf3, 0x53, 0xf8, 0xe3, 0x66, 0x87, 0xcc, 0xed, 0x0e, 0x99, 0x7f, 0x76, 0xc8, 0xfc, - 0xbe, 0x47, 0xc6, 0x76, 0x8f, 0x8c, 0x5f, 0x7b, 0x64, 0x7c, 0x7a, 0xc3, 0x85, 0xfa, 0x5c, 0x46, - 0x38, 0x86, 0x94, 0xb4, 0xf1, 0xe3, 0x84, 0x46, 0xb2, 0x7b, 0x90, 0xd5, 0xe4, 0x15, 0xf9, 0x76, - 0xf6, 0x27, 0xa8, 0x75, 0xce, 0x64, 0x74, 0xad, 0x6f, 0xff, 0xf2, 0x6f, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xaf, 0x6b, 0x14, 0x4b, 0xb6, 0x02, 0x00, 0x00, -} - -func (m *GenesisState) 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 *GenesisState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.PoolToGauges != nil { - { - size, err := m.PoolToGauges.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.DistrInfo != nil { - { - size, err := m.DistrInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if len(m.LockableDurations) > 0 { - for iNdEx := len(m.LockableDurations) - 1; iNdEx >= 0; iNdEx-- { - n, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.LockableDurations[iNdEx], dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.LockableDurations[iNdEx]):]) - if err != nil { - return 0, err - } - i -= n - i = encodeVarintGenesis(dAtA, i, uint64(n)) - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { - offset -= sovGenesis(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GenesisState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) - if len(m.LockableDurations) > 0 { - for _, e := range m.LockableDurations { - l = github_com_gogo_protobuf_types.SizeOfStdDuration(e) - n += 1 + l + sovGenesis(uint64(l)) - } - } - if m.DistrInfo != nil { - l = m.DistrInfo.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - if m.PoolToGauges != nil { - l = m.PoolToGauges.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - return n -} - -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenesis(x uint64) (n int) { - return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GenesisState) 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 ErrIntOverflowGenesis - } - 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: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisState: 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 ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LockableDurations", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LockableDurations = append(m.LockableDurations, time.Duration(0)) - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&(m.LockableDurations[len(m.LockableDurations)-1]), dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DistrInfo", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.DistrInfo == nil { - m.DistrInfo = &DistrInfo{} - } - if err := m.DistrInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PoolToGauges", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PoolToGauges == nil { - m.PoolToGauges = &PoolToGauges{} - } - if err := m.PoolToGauges.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenesis(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, ErrIntOverflowGenesis - } - 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, ErrIntOverflowGenesis - } - 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, ErrIntOverflowGenesis - } - 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, ErrInvalidLengthGenesis - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenesis - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenesis - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/pool-incentives/types/genesis_test.go b/x/pool-incentives/types/genesis_test.go deleted file mode 100644 index bb702406aa9..00000000000 --- a/x/pool-incentives/types/genesis_test.go +++ /dev/null @@ -1,77 +0,0 @@ -package types_test - -import ( - "testing" - "time" - - proto "github.com/gogo/protobuf/proto" - "github.com/stretchr/testify/require" - - "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/types" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func TestGenesisStateMarshalUnmarshal(t *testing.T) { - tests := []struct { - state *types.GenesisState - }{ - { // default genesis state - state: types.DefaultGenesisState(), - }, - { // empty lock durations - state: &types.GenesisState{ - Params: types.DefaultParams(), - LockableDurations: []time.Duration(nil), - DistrInfo: &types.DistrInfo{ - TotalWeight: sdk.ZeroInt(), - Records: nil, - }, - }, - }, - { // empty array distribution info - state: &types.GenesisState{ - Params: types.DefaultParams(), - LockableDurations: []time.Duration(nil), - DistrInfo: &types.DistrInfo{ - TotalWeight: sdk.ZeroInt(), - Records: nil, - }, - }, - }, - { // one record distribution info - state: &types.GenesisState{ - Params: types.DefaultParams(), - LockableDurations: []time.Duration(nil), - DistrInfo: &types.DistrInfo{ - TotalWeight: sdk.NewInt(1), - Records: []types.DistrRecord{ - { - GaugeId: 1, - Weight: sdk.NewInt(1), - }, - }, - }, - }, - }, - { // empty params - state: &types.GenesisState{ - Params: types.Params{}, - LockableDurations: []time.Duration(nil), - DistrInfo: &types.DistrInfo{ - TotalWeight: sdk.ZeroInt(), - Records: nil, - }, - }, - }, - } - - for _, test := range tests { - bz, err := proto.Marshal(test.state) - require.NoError(t, err) - decoded := types.GenesisState{} - err = proto.Unmarshal(bz, &decoded) - require.NoError(t, err) - require.Equal(t, *test.state, decoded) - } -} diff --git a/x/pool-incentives/types/gov.go b/x/pool-incentives/types/gov.go deleted file mode 100644 index 9036423d2d7..00000000000 --- a/x/pool-incentives/types/gov.go +++ /dev/null @@ -1,140 +0,0 @@ -package types - -import ( - "fmt" - "strings" - - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" -) - -const ( - ProposalTypeUpdatePoolIncentives = "UpdatePoolIncentives" - ProposalTypeReplacePoolIncentives = "ReplacePoolIncentives" -) - -// Init registers proposals to update and replace pool incentives. -func init() { - govtypes.RegisterProposalType(ProposalTypeUpdatePoolIncentives) - govtypes.RegisterProposalType(ProposalTypeReplacePoolIncentives) -} - -var ( - _ govtypes.Content = &UpdatePoolIncentivesProposal{} - _ govtypes.Content = &ReplacePoolIncentivesProposal{} -) - -// NewReplacePoolIncentivesProposal returns a new instance of a replace pool incentives proposal struct. -func NewReplacePoolIncentivesProposal(title, description string, records []DistrRecord) govtypes.Content { - return &ReplacePoolIncentivesProposal{ - Title: title, - Description: description, - Records: records, - } -} - -// GetTitle gets the title of the proposal -func (p *ReplacePoolIncentivesProposal) GetTitle() string { return p.Title } - -// GetDescription gets the description of the proposal -func (p *ReplacePoolIncentivesProposal) GetDescription() string { return p.Description } - -// ProposalRoute returns the router key for the proposal -func (p *ReplacePoolIncentivesProposal) ProposalRoute() string { return RouterKey } - -// ProposalType returns the type of the proposal -func (p *ReplacePoolIncentivesProposal) ProposalType() string { - return ProposalTypeReplacePoolIncentives -} - -// ValidateBasic validates a governance proposal's abstract and basic contents -func (p *ReplacePoolIncentivesProposal) ValidateBasic() error { - err := govtypes.ValidateAbstract(p) - if err != nil { - return err - } - if len(p.Records) == 0 { - return ErrEmptyProposalRecords - } - - for _, record := range p.Records { - if err := record.ValidateBasic(); err != nil { - return err - } - } - - return nil -} - -// String returns a string containing the pool incentives proposal. -func (p ReplacePoolIncentivesProposal) String() string { - // TODO: Make this prettier - recordsStr := "" - for _, record := range p.Records { - recordsStr = recordsStr + fmt.Sprintf("(GaugeId: %d, Weight: %s) ", record.GaugeId, record.Weight.String()) - } - - var b strings.Builder - b.WriteString(fmt.Sprintf(`Replace Pool Incentives Proposal: - Title: %s - Description: %s - Records: %s -`, p.Title, p.Description, recordsStr)) - return b.String() -} - -// NewReplacePoolIncentivesProposal returns a new instance of a replace pool incentives proposal struct. -func NewUpdatePoolIncentivesProposal(title, description string, records []DistrRecord) govtypes.Content { - return &UpdatePoolIncentivesProposal{ - Title: title, - Description: description, - Records: records, - } -} - -// GetTitle gets the title of the proposal -func (p *UpdatePoolIncentivesProposal) GetTitle() string { return p.Title } - -// GetDescription gets the description of the proposal -func (p *UpdatePoolIncentivesProposal) GetDescription() string { return p.Description } - -// ProposalRoute returns the router key for the proposal -func (p *UpdatePoolIncentivesProposal) ProposalRoute() string { return RouterKey } - -// ProposalType returns the type of the proposal -func (p *UpdatePoolIncentivesProposal) ProposalType() string { return ProposalTypeUpdatePoolIncentives } - -// ValidateBasic validates a governance proposal's abstract and basic contents. -func (p *UpdatePoolIncentivesProposal) ValidateBasic() error { - err := govtypes.ValidateAbstract(p) - if err != nil { - return err - } - if len(p.Records) == 0 { - return ErrEmptyProposalRecords - } - - for _, record := range p.Records { - if err := record.ValidateBasic(); err != nil { - return err - } - } - - return nil -} - -// String returns a string containing the pool incentives proposal. -func (p UpdatePoolIncentivesProposal) String() string { - // TODO: Make this prettier - recordsStr := "" - for _, record := range p.Records { - recordsStr = recordsStr + fmt.Sprintf("(GaugeId: %d, Weight: %s) ", record.GaugeId, record.Weight.String()) - } - - var b strings.Builder - b.WriteString(fmt.Sprintf(`Update Pool Incentives Proposal: - Title: %s - Description: %s - Records: %s -`, p.Title, p.Description, recordsStr)) - return b.String() -} diff --git a/x/pool-incentives/types/gov.pb.go b/x/pool-incentives/types/gov.pb.go deleted file mode 100644 index 5485e1350dd..00000000000 --- a/x/pool-incentives/types/gov.pb.go +++ /dev/null @@ -1,762 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: osmosis/pool-incentives/v1beta1/gov.proto - -package types - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - 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 - -// ReplacePoolIncentivesProposal is a gov Content type for updating the pool -// incentives. If a ReplacePoolIncentivesProposal passes, the proposal’s records -// override the existing DistrRecords set in the module. Each record has a -// specified gauge id and weight, and the incentives are distributed to each -// gauge according to weight/total_weight. The incentives are put in the fee -// pool and it is allocated to gauges and community pool by the DistrRecords -// configuration. Note that gaugeId=0 represents the community pool. -type ReplacePoolIncentivesProposal struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Records []DistrRecord `protobuf:"bytes,3,rep,name=records,proto3" json:"records"` -} - -func (m *ReplacePoolIncentivesProposal) Reset() { *m = ReplacePoolIncentivesProposal{} } -func (*ReplacePoolIncentivesProposal) ProtoMessage() {} -func (*ReplacePoolIncentivesProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_96caede426ba9516, []int{0} -} -func (m *ReplacePoolIncentivesProposal) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ReplacePoolIncentivesProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ReplacePoolIncentivesProposal.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 *ReplacePoolIncentivesProposal) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReplacePoolIncentivesProposal.Merge(m, src) -} -func (m *ReplacePoolIncentivesProposal) XXX_Size() int { - return m.Size() -} -func (m *ReplacePoolIncentivesProposal) XXX_DiscardUnknown() { - xxx_messageInfo_ReplacePoolIncentivesProposal.DiscardUnknown(m) -} - -var xxx_messageInfo_ReplacePoolIncentivesProposal proto.InternalMessageInfo - -// For example: if the existing DistrRecords were: -// [(Gauge 0, 5), (Gauge 1, 6), (Gauge 2, 6)] -// An UpdatePoolIncentivesProposal includes -// [(Gauge 1, 0), (Gauge 2, 4), (Gauge 3, 10)] -// This would delete Gauge 1, Edit Gauge 2, and Add Gauge 3 -// The result DistrRecords in state would be: -// [(Gauge 0, 5), (Gauge 2, 4), (Gauge 3, 10)] -type UpdatePoolIncentivesProposal struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Records []DistrRecord `protobuf:"bytes,3,rep,name=records,proto3" json:"records"` -} - -func (m *UpdatePoolIncentivesProposal) Reset() { *m = UpdatePoolIncentivesProposal{} } -func (*UpdatePoolIncentivesProposal) ProtoMessage() {} -func (*UpdatePoolIncentivesProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_96caede426ba9516, []int{1} -} -func (m *UpdatePoolIncentivesProposal) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *UpdatePoolIncentivesProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_UpdatePoolIncentivesProposal.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 *UpdatePoolIncentivesProposal) XXX_Merge(src proto.Message) { - xxx_messageInfo_UpdatePoolIncentivesProposal.Merge(m, src) -} -func (m *UpdatePoolIncentivesProposal) XXX_Size() int { - return m.Size() -} -func (m *UpdatePoolIncentivesProposal) XXX_DiscardUnknown() { - xxx_messageInfo_UpdatePoolIncentivesProposal.DiscardUnknown(m) -} - -var xxx_messageInfo_UpdatePoolIncentivesProposal proto.InternalMessageInfo - -func init() { - proto.RegisterType((*ReplacePoolIncentivesProposal)(nil), "osmosis.poolincentives.v1beta1.ReplacePoolIncentivesProposal") - proto.RegisterType((*UpdatePoolIncentivesProposal)(nil), "osmosis.poolincentives.v1beta1.UpdatePoolIncentivesProposal") -} - -func init() { - proto.RegisterFile("osmosis/pool-incentives/v1beta1/gov.proto", fileDescriptor_96caede426ba9516) -} - -var fileDescriptor_96caede426ba9516 = []byte{ - // 303 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xcc, 0x2f, 0xce, 0xcd, - 0x2f, 0xce, 0x2c, 0xd6, 0x2f, 0xc8, 0xcf, 0xcf, 0xd1, 0xcd, 0xcc, 0x4b, 0x4e, 0xcd, 0x2b, 0xc9, - 0x2c, 0x4b, 0x2d, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x4f, 0xcf, 0x2f, 0xd3, - 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x83, 0x2a, 0xd5, 0x03, 0x29, 0x45, 0xa8, 0xd4, 0x83, - 0xaa, 0x94, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x2b, 0xd5, 0x07, 0xb1, 0x20, 0xba, 0xa4, 0x0c, - 0x08, 0x59, 0x80, 0x64, 0x12, 0x58, 0x87, 0xd2, 0x26, 0x46, 0x2e, 0xd9, 0xa0, 0xd4, 0x82, 0x9c, - 0xc4, 0xe4, 0xd4, 0x80, 0xfc, 0xfc, 0x1c, 0x4f, 0xb8, 0x7c, 0x40, 0x51, 0x7e, 0x41, 0x7e, 0x71, - 0x62, 0x8e, 0x90, 0x08, 0x17, 0x6b, 0x49, 0x66, 0x49, 0x4e, 0xaa, 0x04, 0xa3, 0x02, 0xa3, 0x06, - 0x67, 0x10, 0x84, 0x23, 0xa4, 0xc0, 0xc5, 0x9d, 0x92, 0x5a, 0x9c, 0x5c, 0x94, 0x59, 0x50, 0x92, - 0x99, 0x9f, 0x27, 0xc1, 0x04, 0x96, 0x43, 0x16, 0x12, 0xf2, 0xe6, 0x62, 0x2f, 0x4a, 0x4d, 0xce, - 0x2f, 0x4a, 0x29, 0x96, 0x60, 0x56, 0x60, 0xd6, 0xe0, 0x36, 0xd2, 0xd6, 0xc3, 0xef, 0x27, 0x3d, - 0x97, 0xcc, 0xe2, 0x92, 0xa2, 0x20, 0xb0, 0x1e, 0x27, 0x96, 0x13, 0xf7, 0xe4, 0x19, 0x82, 0x60, - 0x26, 0x58, 0xf1, 0x74, 0x2c, 0x90, 0x67, 0x98, 0xb1, 0x40, 0x9e, 0xe1, 0xc5, 0x02, 0x79, 0x46, - 0xa5, 0x8d, 0x8c, 0x5c, 0x32, 0xa1, 0x05, 0x29, 0x89, 0x25, 0x43, 0xc7, 0xcd, 0x4e, 0xa1, 0x27, - 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, - 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0x65, 0x9d, 0x9e, 0x59, 0x92, 0x51, 0x9a, - 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x0f, 0xb5, 0x4d, 0x37, 0x27, 0x31, 0xa9, 0x18, 0xc6, 0xd1, 0x2f, - 0x33, 0x34, 0xd5, 0xaf, 0xc0, 0x88, 0xd2, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0x70, 0x34, - 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x53, 0xd4, 0x8e, 0x01, 0x5b, 0x02, 0x00, 0x00, -} - -func (this *ReplacePoolIncentivesProposal) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*ReplacePoolIncentivesProposal) - if !ok { - that2, ok := that.(ReplacePoolIncentivesProposal) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Title != that1.Title { - return false - } - if this.Description != that1.Description { - return false - } - if len(this.Records) != len(that1.Records) { - return false - } - for i := range this.Records { - if !this.Records[i].Equal(&that1.Records[i]) { - return false - } - } - return true -} -func (this *UpdatePoolIncentivesProposal) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*UpdatePoolIncentivesProposal) - if !ok { - that2, ok := that.(UpdatePoolIncentivesProposal) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Title != that1.Title { - return false - } - if this.Description != that1.Description { - return false - } - if len(this.Records) != len(that1.Records) { - return false - } - for i := range this.Records { - if !this.Records[i].Equal(&that1.Records[i]) { - return false - } - } - return true -} -func (m *ReplacePoolIncentivesProposal) 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 *ReplacePoolIncentivesProposal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ReplacePoolIncentivesProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Records) > 0 { - for iNdEx := len(m.Records) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Records[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintGov(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x12 - } - if len(m.Title) > 0 { - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintGov(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *UpdatePoolIncentivesProposal) 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 *UpdatePoolIncentivesProposal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *UpdatePoolIncentivesProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Records) > 0 { - for iNdEx := len(m.Records) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Records[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintGov(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x12 - } - if len(m.Title) > 0 { - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintGov(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintGov(dAtA []byte, offset int, v uint64) int { - offset -= sovGov(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ReplacePoolIncentivesProposal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Title) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - if len(m.Records) > 0 { - for _, e := range m.Records { - l = e.Size() - n += 1 + l + sovGov(uint64(l)) - } - } - return n -} - -func (m *UpdatePoolIncentivesProposal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Title) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - if len(m.Records) > 0 { - for _, e := range m.Records { - l = e.Size() - n += 1 + l + sovGov(uint64(l)) - } - } - return n -} - -func sovGov(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGov(x uint64) (n int) { - return sovGov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *ReplacePoolIncentivesProposal) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ReplacePoolIncentivesProposal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ReplacePoolIncentivesProposal: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Title = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Records", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Records = append(m.Records, DistrRecord{}) - if err := m.Records[len(m.Records)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGov(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGov - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *UpdatePoolIncentivesProposal) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: UpdatePoolIncentivesProposal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UpdatePoolIncentivesProposal: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Title = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Records", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Records = append(m.Records, DistrRecord{}) - if err := m.Records[len(m.Records)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGov(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGov - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGov(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, ErrIntOverflowGov - } - 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, ErrIntOverflowGov - } - 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, ErrIntOverflowGov - } - 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, ErrInvalidLengthGov - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGov - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGov - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGov = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGov = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGov = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/pool-incentives/types/gov_test.go b/x/pool-incentives/types/gov_test.go deleted file mode 100644 index 2cbc9d22899..00000000000 --- a/x/pool-incentives/types/gov_test.go +++ /dev/null @@ -1,89 +0,0 @@ -package types_test - -import ( - "testing" - - proto "github.com/gogo/protobuf/proto" - "github.com/stretchr/testify/require" - - "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/types" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func TestUpdatePoolIncentivesProposalMarshalUnmarshal(t *testing.T) { - tests := []struct { - proposal *types.UpdatePoolIncentivesProposal - }{ - { // empty title - proposal: &types.UpdatePoolIncentivesProposal{ - Title: "", - Description: "proposal to update pool incentives", - Records: []types.DistrRecord(nil), - }, - }, - { // empty description - proposal: &types.UpdatePoolIncentivesProposal{ - Title: "title", - Description: "", - Records: []types.DistrRecord(nil), - }, - }, - { // empty records - proposal: &types.UpdatePoolIncentivesProposal{ - Title: "title", - Description: "proposal to update pool incentives", - Records: []types.DistrRecord(nil), - }, - }, - { // one record - proposal: &types.UpdatePoolIncentivesProposal{ - Title: "title", - Description: "proposal to update pool incentives", - Records: []types.DistrRecord{ - { - GaugeId: 1, - Weight: sdk.NewInt(1), - }, - }, - }, - }, - { // zero-weight record - proposal: &types.UpdatePoolIncentivesProposal{ - Title: "title", - Description: "proposal to update pool incentives", - Records: []types.DistrRecord{ - { - GaugeId: 1, - Weight: sdk.NewInt(0), - }, - }, - }, - }, - { // two records - proposal: &types.UpdatePoolIncentivesProposal{ - Title: "title", - Description: "proposal to update pool incentives", - Records: []types.DistrRecord{ - { - GaugeId: 1, - Weight: sdk.NewInt(1), - }, - { - GaugeId: 2, - Weight: sdk.NewInt(1), - }, - }, - }, - }, - } - - for _, test := range tests { - bz, err := proto.Marshal(test.proposal) - require.NoError(t, err) - decoded := types.UpdatePoolIncentivesProposal{} - err = proto.Unmarshal(bz, &decoded) - require.NoError(t, err) - require.Equal(t, *test.proposal, decoded) - } -} diff --git a/x/pool-incentives/types/incentives.pb.go b/x/pool-incentives/types/incentives.pb.go deleted file mode 100644 index 65a096cfa66..00000000000 --- a/x/pool-incentives/types/incentives.pb.go +++ /dev/null @@ -1,1404 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: osmosis/pool-incentives/v1beta1/incentives.proto - -package types - -import ( - fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - _ "github.com/gogo/protobuf/types" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - io "io" - math "math" - math_bits "math/bits" - time "time" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// 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 - -type Params struct { - // minted_denom is the denomination of the coin expected to be used for incentives - MintedDenom string `protobuf:"bytes,1,opt,name=minted_denom,json=mintedDenom,proto3" json:"minted_denom,omitempty" yaml:"minted_denom"` -} - -func (m *Params) Reset() { *m = Params{} } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_a8153bad03e553d1, []int{0} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func (m *Params) GetMintedDenom() string { - if m != nil { - return m.MintedDenom - } - return "" -} - -type LockableDurationsInfo struct { - LockableDurations []time.Duration `protobuf:"bytes,1,rep,name=lockable_durations,json=lockableDurations,proto3,stdduration" json:"lockable_durations" yaml:"lockable_durations"` -} - -func (m *LockableDurationsInfo) Reset() { *m = LockableDurationsInfo{} } -func (m *LockableDurationsInfo) String() string { return proto.CompactTextString(m) } -func (*LockableDurationsInfo) ProtoMessage() {} -func (*LockableDurationsInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_a8153bad03e553d1, []int{1} -} -func (m *LockableDurationsInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LockableDurationsInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LockableDurationsInfo.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 *LockableDurationsInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_LockableDurationsInfo.Merge(m, src) -} -func (m *LockableDurationsInfo) XXX_Size() int { - return m.Size() -} -func (m *LockableDurationsInfo) XXX_DiscardUnknown() { - xxx_messageInfo_LockableDurationsInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_LockableDurationsInfo proto.InternalMessageInfo - -func (m *LockableDurationsInfo) GetLockableDurations() []time.Duration { - if m != nil { - return m.LockableDurations - } - return nil -} - -type DistrInfo struct { - TotalWeight github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=total_weight,json=totalWeight,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_weight" yaml:"total_weight"` - Records []DistrRecord `protobuf:"bytes,2,rep,name=records,proto3" json:"records"` -} - -func (m *DistrInfo) Reset() { *m = DistrInfo{} } -func (m *DistrInfo) String() string { return proto.CompactTextString(m) } -func (*DistrInfo) ProtoMessage() {} -func (*DistrInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_a8153bad03e553d1, []int{2} -} -func (m *DistrInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DistrInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DistrInfo.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 *DistrInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_DistrInfo.Merge(m, src) -} -func (m *DistrInfo) XXX_Size() int { - return m.Size() -} -func (m *DistrInfo) XXX_DiscardUnknown() { - xxx_messageInfo_DistrInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_DistrInfo proto.InternalMessageInfo - -func (m *DistrInfo) GetRecords() []DistrRecord { - if m != nil { - return m.Records - } - return nil -} - -type DistrRecord struct { - GaugeId uint64 `protobuf:"varint,1,opt,name=gauge_id,json=gaugeId,proto3" json:"gauge_id,omitempty" yaml:"gauge_id"` - Weight github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=weight,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"weight"` -} - -func (m *DistrRecord) Reset() { *m = DistrRecord{} } -func (m *DistrRecord) String() string { return proto.CompactTextString(m) } -func (*DistrRecord) ProtoMessage() {} -func (*DistrRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_a8153bad03e553d1, []int{3} -} -func (m *DistrRecord) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DistrRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DistrRecord.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 *DistrRecord) XXX_Merge(src proto.Message) { - xxx_messageInfo_DistrRecord.Merge(m, src) -} -func (m *DistrRecord) XXX_Size() int { - return m.Size() -} -func (m *DistrRecord) XXX_DiscardUnknown() { - xxx_messageInfo_DistrRecord.DiscardUnknown(m) -} - -var xxx_messageInfo_DistrRecord proto.InternalMessageInfo - -func (m *DistrRecord) GetGaugeId() uint64 { - if m != nil { - return m.GaugeId - } - return 0 -} - -type PoolToGauge struct { - PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty" yaml:"pool_id"` - GaugeId uint64 `protobuf:"varint,2,opt,name=gauge_id,json=gaugeId,proto3" json:"gauge_id,omitempty" yaml:"gauge"` - Duration time.Duration `protobuf:"bytes,3,opt,name=duration,proto3,stdduration" json:"duration" yaml:"duration"` -} - -func (m *PoolToGauge) Reset() { *m = PoolToGauge{} } -func (m *PoolToGauge) String() string { return proto.CompactTextString(m) } -func (*PoolToGauge) ProtoMessage() {} -func (*PoolToGauge) Descriptor() ([]byte, []int) { - return fileDescriptor_a8153bad03e553d1, []int{4} -} -func (m *PoolToGauge) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PoolToGauge) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PoolToGauge.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 *PoolToGauge) XXX_Merge(src proto.Message) { - xxx_messageInfo_PoolToGauge.Merge(m, src) -} -func (m *PoolToGauge) XXX_Size() int { - return m.Size() -} -func (m *PoolToGauge) XXX_DiscardUnknown() { - xxx_messageInfo_PoolToGauge.DiscardUnknown(m) -} - -var xxx_messageInfo_PoolToGauge proto.InternalMessageInfo - -func (m *PoolToGauge) GetPoolId() uint64 { - if m != nil { - return m.PoolId - } - return 0 -} - -func (m *PoolToGauge) GetGaugeId() uint64 { - if m != nil { - return m.GaugeId - } - return 0 -} - -func (m *PoolToGauge) GetDuration() time.Duration { - if m != nil { - return m.Duration - } - return 0 -} - -type PoolToGauges struct { - PoolToGauge []PoolToGauge `protobuf:"bytes,2,rep,name=pool_to_gauge,json=poolToGauge,proto3" json:"pool_to_gauge"` -} - -func (m *PoolToGauges) Reset() { *m = PoolToGauges{} } -func (m *PoolToGauges) String() string { return proto.CompactTextString(m) } -func (*PoolToGauges) ProtoMessage() {} -func (*PoolToGauges) Descriptor() ([]byte, []int) { - return fileDescriptor_a8153bad03e553d1, []int{5} -} -func (m *PoolToGauges) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PoolToGauges) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PoolToGauges.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 *PoolToGauges) XXX_Merge(src proto.Message) { - xxx_messageInfo_PoolToGauges.Merge(m, src) -} -func (m *PoolToGauges) XXX_Size() int { - return m.Size() -} -func (m *PoolToGauges) XXX_DiscardUnknown() { - xxx_messageInfo_PoolToGauges.DiscardUnknown(m) -} - -var xxx_messageInfo_PoolToGauges proto.InternalMessageInfo - -func (m *PoolToGauges) GetPoolToGauge() []PoolToGauge { - if m != nil { - return m.PoolToGauge - } - return nil -} - -func init() { - proto.RegisterType((*Params)(nil), "osmosis.poolincentives.v1beta1.Params") - proto.RegisterType((*LockableDurationsInfo)(nil), "osmosis.poolincentives.v1beta1.LockableDurationsInfo") - proto.RegisterType((*DistrInfo)(nil), "osmosis.poolincentives.v1beta1.DistrInfo") - proto.RegisterType((*DistrRecord)(nil), "osmosis.poolincentives.v1beta1.DistrRecord") - proto.RegisterType((*PoolToGauge)(nil), "osmosis.poolincentives.v1beta1.PoolToGauge") - proto.RegisterType((*PoolToGauges)(nil), "osmosis.poolincentives.v1beta1.PoolToGauges") -} - -func init() { - proto.RegisterFile("osmosis/pool-incentives/v1beta1/incentives.proto", fileDescriptor_a8153bad03e553d1) -} - -var fileDescriptor_a8153bad03e553d1 = []byte{ - // 565 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xbf, 0x6f, 0xd3, 0x40, - 0x14, 0xc7, 0x73, 0x6d, 0x94, 0xb4, 0xe7, 0xf0, 0xcb, 0x05, 0x91, 0x16, 0xc9, 0x8e, 0x4e, 0x02, - 0x55, 0x8a, 0x62, 0x13, 0x10, 0x4b, 0xd8, 0xa2, 0x00, 0x0a, 0x30, 0x54, 0x16, 0x15, 0x12, 0x4b, - 0x64, 0xc7, 0x57, 0xc7, 0xaa, 0xed, 0x17, 0xf9, 0x2e, 0x81, 0xfe, 0x07, 0x48, 0x2c, 0x8c, 0x1d, - 0xfb, 0x7f, 0xb0, 0x31, 0x75, 0xec, 0x88, 0x18, 0x0c, 0x4a, 0x16, 0xe6, 0xfc, 0x05, 0xc8, 0xe7, - 0x33, 0x39, 0x51, 0xa9, 0x82, 0x29, 0xf7, 0xfc, 0xee, 0xfb, 0xde, 0xe7, 0xfb, 0xde, 0x29, 0xf8, - 0x21, 0xb0, 0x18, 0x58, 0xc8, 0xec, 0x29, 0x40, 0xd4, 0x09, 0x93, 0x31, 0x4d, 0x78, 0x38, 0xa7, - 0xcc, 0x9e, 0x77, 0x3d, 0xca, 0xdd, 0xae, 0xbd, 0xfe, 0x64, 0x4d, 0x53, 0xe0, 0xa0, 0x1b, 0x52, - 0x61, 0xe5, 0x0a, 0x25, 0x2b, 0x05, 0x7b, 0xb7, 0x03, 0x08, 0x40, 0x5c, 0xb5, 0xf3, 0x53, 0xa1, - 0xda, 0x33, 0x02, 0x80, 0x20, 0xa2, 0xb6, 0x88, 0xbc, 0xd9, 0x91, 0xed, 0xcf, 0x52, 0x97, 0x87, - 0x90, 0x14, 0x79, 0xf2, 0x12, 0xd7, 0x0e, 0xdc, 0xd4, 0x8d, 0x99, 0xde, 0xc3, 0x8d, 0x38, 0x4c, - 0x38, 0xf5, 0x47, 0x3e, 0x4d, 0x20, 0x6e, 0xa2, 0x16, 0xda, 0xdf, 0xee, 0xdf, 0x5d, 0x65, 0xe6, - 0xce, 0x89, 0x1b, 0x47, 0x3d, 0xa2, 0x66, 0x89, 0xa3, 0x15, 0xe1, 0x20, 0x8f, 0x7a, 0xd5, 0xd3, - 0x33, 0xb3, 0x42, 0x3e, 0x22, 0x7c, 0xe7, 0x35, 0x8c, 0x8f, 0x5d, 0x2f, 0xa2, 0x03, 0xd9, 0x86, - 0x0d, 0x93, 0x23, 0xd0, 0x01, 0xeb, 0x91, 0x4c, 0x8c, 0x4a, 0x00, 0xd6, 0x44, 0xad, 0xcd, 0x7d, - 0xed, 0xd1, 0xae, 0x55, 0x20, 0x5a, 0x25, 0xa2, 0x55, 0x6a, 0xfb, 0xf7, 0xcf, 0x33, 0xb3, 0xb2, - 0xca, 0xcc, 0xdd, 0x02, 0xe0, 0x72, 0x09, 0x72, 0xfa, 0xc3, 0x44, 0xce, 0xad, 0xe8, 0xef, 0xa6, - 0xe4, 0x2b, 0xc2, 0xdb, 0x83, 0x90, 0xf1, 0x54, 0xb4, 0x9f, 0xe0, 0x06, 0x07, 0xee, 0x46, 0xa3, - 0xf7, 0x34, 0x0c, 0x26, 0x5c, 0x5a, 0x7b, 0x96, 0x57, 0xff, 0x9e, 0x99, 0x0f, 0x82, 0x90, 0x4f, - 0x66, 0x9e, 0x35, 0x86, 0xd8, 0x1e, 0x8b, 0x21, 0xcb, 0x9f, 0x0e, 0xf3, 0x8f, 0x6d, 0x7e, 0x32, - 0xa5, 0xcc, 0x1a, 0x26, 0x7c, 0x3d, 0x08, 0xb5, 0x16, 0x71, 0x34, 0x11, 0xbe, 0x15, 0x91, 0xfe, - 0x0a, 0xd7, 0x53, 0x3a, 0x86, 0xd4, 0x67, 0xcd, 0x0d, 0xe1, 0xae, 0x6d, 0x5d, 0xbd, 0x36, 0x4b, - 0x50, 0x3a, 0x42, 0xd3, 0xaf, 0xe6, 0x44, 0x4e, 0x59, 0x81, 0x7c, 0x42, 0x58, 0x53, 0xd2, 0xba, - 0x85, 0xb7, 0x02, 0x77, 0x16, 0xd0, 0x51, 0xe8, 0x0b, 0x0b, 0xd5, 0xfe, 0xce, 0x2a, 0x33, 0x6f, - 0x14, 0x50, 0x65, 0x86, 0x38, 0x75, 0x71, 0x1c, 0xfa, 0xfa, 0x73, 0x5c, 0x93, 0x86, 0x37, 0x84, - 0x61, 0xeb, 0xff, 0x0c, 0x3b, 0x52, 0xdd, 0xab, 0xfe, 0x3a, 0x33, 0x11, 0xf9, 0x82, 0xb0, 0x76, - 0x00, 0x10, 0xbd, 0x81, 0x17, 0x79, 0x7d, 0xbd, 0x8d, 0xeb, 0xb9, 0xa5, 0x35, 0x8c, 0xbe, 0xca, - 0xcc, 0xeb, 0x05, 0x8c, 0x4c, 0x10, 0xa7, 0x96, 0x9f, 0x86, 0xbe, 0xde, 0x56, 0xd0, 0x37, 0xc4, - 0xed, 0x9b, 0xab, 0xcc, 0x6c, 0x28, 0xe8, 0x0a, 0xb7, 0x83, 0xb7, 0xca, 0x0d, 0x37, 0x37, 0x5b, - 0xe8, 0xea, 0x37, 0x72, 0x4f, 0xbe, 0x11, 0x39, 0x86, 0x52, 0x58, 0xbc, 0x8c, 0x3f, 0x75, 0x08, - 0xc5, 0x0d, 0x05, 0x9e, 0xe9, 0x87, 0xf8, 0x9a, 0x80, 0xe4, 0x30, 0x12, 0x6d, 0xff, 0x75, 0x5d, - 0x4a, 0x11, 0xb9, 0x2e, 0x6d, 0xaa, 0x7c, 0x3a, 0x3c, 0x5f, 0x18, 0xe8, 0x62, 0x61, 0xa0, 0x9f, - 0x0b, 0x03, 0x7d, 0x5e, 0x1a, 0x95, 0x8b, 0xa5, 0x51, 0xf9, 0xb6, 0x34, 0x2a, 0xef, 0x9e, 0x2a, - 0x43, 0x97, 0x3d, 0x3a, 0x91, 0xeb, 0xb1, 0x32, 0xb0, 0xe7, 0xdd, 0x27, 0xf6, 0x87, 0x4b, 0x7f, - 0x07, 0x62, 0x1b, 0x5e, 0x4d, 0xf8, 0x7e, 0xfc, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xfa, 0x5a, 0x9e, - 0x3b, 0x36, 0x04, 0x00, 0x00, -} - -func (this *DistrRecord) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*DistrRecord) - if !ok { - that2, ok := that.(DistrRecord) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.GaugeId != that1.GaugeId { - return false - } - if !this.Weight.Equal(that1.Weight) { - return false - } - return true -} -func (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.MintedDenom) > 0 { - i -= len(m.MintedDenom) - copy(dAtA[i:], m.MintedDenom) - i = encodeVarintIncentives(dAtA, i, uint64(len(m.MintedDenom))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *LockableDurationsInfo) 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 *LockableDurationsInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LockableDurationsInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.LockableDurations) > 0 { - for iNdEx := len(m.LockableDurations) - 1; iNdEx >= 0; iNdEx-- { - n, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.LockableDurations[iNdEx], dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.LockableDurations[iNdEx]):]) - if err != nil { - return 0, err - } - i -= n - i = encodeVarintIncentives(dAtA, i, uint64(n)) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *DistrInfo) 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 *DistrInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DistrInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Records) > 0 { - for iNdEx := len(m.Records) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Records[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintIncentives(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size := m.TotalWeight.Size() - i -= size - if _, err := m.TotalWeight.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintIncentives(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *DistrRecord) 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 *DistrRecord) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DistrRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Weight.Size() - i -= size - if _, err := m.Weight.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintIncentives(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if m.GaugeId != 0 { - i = encodeVarintIncentives(dAtA, i, uint64(m.GaugeId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *PoolToGauge) 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 *PoolToGauge) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PoolToGauge) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.Duration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.Duration):]) - if err1 != nil { - return 0, err1 - } - i -= n1 - i = encodeVarintIncentives(dAtA, i, uint64(n1)) - i-- - dAtA[i] = 0x1a - if m.GaugeId != 0 { - i = encodeVarintIncentives(dAtA, i, uint64(m.GaugeId)) - i-- - dAtA[i] = 0x10 - } - if m.PoolId != 0 { - i = encodeVarintIncentives(dAtA, i, uint64(m.PoolId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *PoolToGauges) 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 *PoolToGauges) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PoolToGauges) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.PoolToGauge) > 0 { - for iNdEx := len(m.PoolToGauge) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.PoolToGauge[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintIncentives(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - return len(dAtA) - i, nil -} - -func encodeVarintIncentives(dAtA []byte, offset int, v uint64) int { - offset -= sovIncentives(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.MintedDenom) - if l > 0 { - n += 1 + l + sovIncentives(uint64(l)) - } - return n -} - -func (m *LockableDurationsInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.LockableDurations) > 0 { - for _, e := range m.LockableDurations { - l = github_com_gogo_protobuf_types.SizeOfStdDuration(e) - n += 1 + l + sovIncentives(uint64(l)) - } - } - return n -} - -func (m *DistrInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.TotalWeight.Size() - n += 1 + l + sovIncentives(uint64(l)) - if len(m.Records) > 0 { - for _, e := range m.Records { - l = e.Size() - n += 1 + l + sovIncentives(uint64(l)) - } - } - return n -} - -func (m *DistrRecord) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.GaugeId != 0 { - n += 1 + sovIncentives(uint64(m.GaugeId)) - } - l = m.Weight.Size() - n += 1 + l + sovIncentives(uint64(l)) - return n -} - -func (m *PoolToGauge) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.PoolId != 0 { - n += 1 + sovIncentives(uint64(m.PoolId)) - } - if m.GaugeId != 0 { - n += 1 + sovIncentives(uint64(m.GaugeId)) - } - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.Duration) - n += 1 + l + sovIncentives(uint64(l)) - return n -} - -func (m *PoolToGauges) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.PoolToGauge) > 0 { - for _, e := range m.PoolToGauge { - l = e.Size() - n += 1 + l + sovIncentives(uint64(l)) - } - } - return n -} - -func sovIncentives(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozIncentives(x uint64) (n int) { - return sovIncentives(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Params) 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 ErrIntOverflowIncentives - } - 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: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MintedDenom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentives - } - 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 ErrInvalidLengthIncentives - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthIncentives - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MintedDenom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipIncentives(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthIncentives - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LockableDurationsInfo) 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 ErrIntOverflowIncentives - } - 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: LockableDurationsInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LockableDurationsInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LockableDurations", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentives - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthIncentives - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthIncentives - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LockableDurations = append(m.LockableDurations, time.Duration(0)) - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&(m.LockableDurations[len(m.LockableDurations)-1]), dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipIncentives(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthIncentives - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DistrInfo) 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 ErrIntOverflowIncentives - } - 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: DistrInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DistrInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalWeight", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentives - } - 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 ErrInvalidLengthIncentives - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthIncentives - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.TotalWeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Records", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentives - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthIncentives - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthIncentives - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Records = append(m.Records, DistrRecord{}) - if err := m.Records[len(m.Records)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipIncentives(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthIncentives - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DistrRecord) 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 ErrIntOverflowIncentives - } - 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: DistrRecord: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DistrRecord: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GaugeId", wireType) - } - m.GaugeId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentives - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GaugeId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Weight", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentives - } - 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 ErrInvalidLengthIncentives - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthIncentives - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Weight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipIncentives(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthIncentives - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PoolToGauge) 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 ErrIntOverflowIncentives - } - 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: PoolToGauge: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PoolToGauge: 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 ErrIntOverflowIncentives - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PoolId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GaugeId", wireType) - } - m.GaugeId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentives - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GaugeId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Duration", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentives - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthIncentives - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthIncentives - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.Duration, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipIncentives(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthIncentives - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PoolToGauges) 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 ErrIntOverflowIncentives - } - 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: PoolToGauges: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PoolToGauges: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PoolToGauge", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowIncentives - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthIncentives - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthIncentives - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PoolToGauge = append(m.PoolToGauge, PoolToGauge{}) - if err := m.PoolToGauge[len(m.PoolToGauge)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipIncentives(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthIncentives - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipIncentives(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, ErrIntOverflowIncentives - } - 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, ErrIntOverflowIncentives - } - 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, ErrIntOverflowIncentives - } - 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, ErrInvalidLengthIncentives - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupIncentives - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthIncentives - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthIncentives = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowIncentives = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupIncentives = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/pool-incentives/types/incentives_test.go b/x/pool-incentives/types/incentives_test.go deleted file mode 100644 index 232c53e7151..00000000000 --- a/x/pool-incentives/types/incentives_test.go +++ /dev/null @@ -1,141 +0,0 @@ -package types_test - -import ( - "testing" - "time" - - proto "github.com/gogo/protobuf/proto" - "github.com/stretchr/testify/require" - - "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/types" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func TestParamsMarshalUnmarshal(t *testing.T) { - tests := []struct { - params *types.Params - }{ - { // empty denom - params: &types.Params{ - MintedDenom: "", - }, - }, - { // filled - params: &types.Params{ - MintedDenom: "stake", - }, - }, - } - - for _, test := range tests { - bz, err := proto.Marshal(test.params) - require.NoError(t, err) - decoded := types.Params{} - err = proto.Unmarshal(bz, &decoded) - require.NoError(t, err) - require.Equal(t, *test.params, decoded) - } -} - -func TestLockableDurationsInfoMarshalUnmarshal(t *testing.T) { - tests := []struct { - durations *types.LockableDurationsInfo - }{ - { // empty struct - durations: &types.LockableDurationsInfo{}, - }, - { // empty lockable durations - durations: &types.LockableDurationsInfo{ - LockableDurations: []time.Duration(nil), - }, - }, - { // filled - durations: &types.LockableDurationsInfo{ - LockableDurations: []time.Duration{time.Second, time.Hour}, - }, - }, - } - - for _, test := range tests { - bz, err := proto.Marshal(test.durations) - require.NoError(t, err) - decoded := types.LockableDurationsInfo{} - err = proto.Unmarshal(bz, &decoded) - require.NoError(t, err) - require.Equal(t, *test.durations, decoded) - } -} - -func TestDistrInfoMarshalUnmarshal(t *testing.T) { - tests := []struct { - info *types.DistrInfo - }{ - { // empty records - info: &types.DistrInfo{ - TotalWeight: sdk.NewInt(0), - Records: []types.DistrRecord(nil), - }, - }, - { // one record - info: &types.DistrInfo{ - TotalWeight: sdk.NewInt(1), - Records: []types.DistrRecord{ - { - GaugeId: 1, - Weight: sdk.NewInt(1), - }, - }, - }, - }, - { // two records - info: &types.DistrInfo{ - TotalWeight: sdk.NewInt(2), - Records: []types.DistrRecord{ - { - GaugeId: 1, - Weight: sdk.NewInt(1), - }, - { - GaugeId: 2, - Weight: sdk.NewInt(1), - }, - }, - }, - }, - } - - for _, test := range tests { - bz, err := proto.Marshal(test.info) - require.NoError(t, err) - decoded := types.DistrInfo{} - err = proto.Unmarshal(bz, &decoded) - require.NoError(t, err) - require.Equal(t, *test.info, decoded) - } -} - -func TestDistrRecordMarshalUnmarshal(t *testing.T) { - tests := []struct { - info *types.DistrRecord - }{ - { // empty struct - info: &types.DistrRecord{}, - }, - { // filled struct - info: &types.DistrRecord{ - GaugeId: 1, - Weight: sdk.NewInt(1), - }, - }, - } - - for _, test := range tests { - bz, err := proto.Marshal(test.info) - require.NoError(t, err) - decoded := types.DistrRecord{} - err = proto.Unmarshal(bz, &decoded) - require.NoError(t, err) - require.Equal(t, *test.info, decoded) - } -} diff --git a/x/pool-incentives/types/key.go b/x/pool-incentives/types/key.go deleted file mode 100644 index 7ab6a5d83c7..00000000000 --- a/x/pool-incentives/types/key.go +++ /dev/null @@ -1,31 +0,0 @@ -package types - -import ( - "fmt" - "time" -) - -const ( - ModuleName = "poolincentives" - - StoreKey = ModuleName - - RouterKey = ModuleName - - QuerierRoute = ModuleName -) - -var ( - LockableDurationsKey = []byte("lockable_durations") - DistrInfoKey = []byte("distr_info") -) - -// GetPoolGaugeIdStoreKey returns a StoreKey with pool ID and its duration as inputs -func GetPoolGaugeIdStoreKey(poolId uint64, duration time.Duration) []byte { - return []byte(fmt.Sprintf("pool-incentives/%d/%s", poolId, duration.String())) -} - -// GetPoolIdFromGaugeIdStoreKey returns a StoreKey from the given gaugeID and duration. -func GetPoolIdFromGaugeIdStoreKey(gaugeId uint64, duration time.Duration) []byte { - return []byte(fmt.Sprintf("pool-incentives-pool-id/%d/%s", gaugeId, duration.String())) -} diff --git a/x/pool-incentives/types/params.go b/x/pool-incentives/types/params.go deleted file mode 100644 index 5d53ddb6dd2..00000000000 --- a/x/pool-incentives/types/params.go +++ /dev/null @@ -1,65 +0,0 @@ -package types - -import ( - "errors" - "fmt" - "strings" - - "gopkg.in/yaml.v2" - - sdk "github.com/cosmos/cosmos-sdk/types" - - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" -) - -var KeyMintedDenom = []byte("MintedDenom") - -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -func NewParams(mintedDenom string) Params { - return Params{ - MintedDenom: mintedDenom, - } -} - -// DefaultParams is the default parameter configuration for the pool-incentives module. -func DefaultParams() Params { - return NewParams(sdk.DefaultBondDenom) -} - -func (p Params) Validate() error { - if err := validateMintedDenom(p.MintedDenom); err != nil { - return err - } - return nil -} - -// String implements the Stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} - -func validateMintedDenom(i interface{}) error { - v, ok := i.(string) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if strings.TrimSpace(v) == "" { - return errors.New("mint denom cannot be blank") - } - if err := sdk.ValidateDenom(v); err != nil { - return err - } - - return nil -} - -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeyMintedDenom, &p.MintedDenom, validateMintedDenom), - } -} diff --git a/x/pool-incentives/types/query.pb.go b/x/pool-incentives/types/query.pb.go deleted file mode 100644 index 13b1c4bbf32..00000000000 --- a/x/pool-incentives/types/query.pb.go +++ /dev/null @@ -1,2793 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: osmosis/pool-incentives/v1beta1/query.proto - -package types - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - _ "github.com/gogo/protobuf/types" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - types1 "github.com/osmosis-labs/osmosis/v15/x/incentives/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" - time "time" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// 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 - -type QueryGaugeIdsRequest struct { - PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty" yaml:"pool_id"` -} - -func (m *QueryGaugeIdsRequest) Reset() { *m = QueryGaugeIdsRequest{} } -func (m *QueryGaugeIdsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGaugeIdsRequest) ProtoMessage() {} -func (*QueryGaugeIdsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_302873ecccbc7636, []int{0} -} -func (m *QueryGaugeIdsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGaugeIdsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGaugeIdsRequest.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 *QueryGaugeIdsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGaugeIdsRequest.Merge(m, src) -} -func (m *QueryGaugeIdsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryGaugeIdsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGaugeIdsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGaugeIdsRequest proto.InternalMessageInfo - -func (m *QueryGaugeIdsRequest) GetPoolId() uint64 { - if m != nil { - return m.PoolId - } - return 0 -} - -type QueryGaugeIdsResponse struct { - GaugeIdsWithDuration []*QueryGaugeIdsResponse_GaugeIdWithDuration `protobuf:"bytes,1,rep,name=gauge_ids_with_duration,json=gaugeIdsWithDuration,proto3" json:"gauge_ids_with_duration,omitempty" yaml:"gauge_ids_with_duration"` -} - -func (m *QueryGaugeIdsResponse) Reset() { *m = QueryGaugeIdsResponse{} } -func (m *QueryGaugeIdsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGaugeIdsResponse) ProtoMessage() {} -func (*QueryGaugeIdsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_302873ecccbc7636, []int{1} -} -func (m *QueryGaugeIdsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGaugeIdsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGaugeIdsResponse.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 *QueryGaugeIdsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGaugeIdsResponse.Merge(m, src) -} -func (m *QueryGaugeIdsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryGaugeIdsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGaugeIdsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGaugeIdsResponse proto.InternalMessageInfo - -func (m *QueryGaugeIdsResponse) GetGaugeIdsWithDuration() []*QueryGaugeIdsResponse_GaugeIdWithDuration { - if m != nil { - return m.GaugeIdsWithDuration - } - return nil -} - -type QueryGaugeIdsResponse_GaugeIdWithDuration struct { - GaugeId uint64 `protobuf:"varint,1,opt,name=gauge_id,json=gaugeId,proto3" json:"gauge_id,omitempty" yaml:"gauge_id"` - Duration time.Duration `protobuf:"bytes,2,opt,name=duration,proto3,stdduration" json:"duration"` - GaugeIncentivePercentage string `protobuf:"bytes,3,opt,name=gauge_incentive_percentage,json=gaugeIncentivePercentage,proto3" json:"gauge_incentive_percentage,omitempty"` -} - -func (m *QueryGaugeIdsResponse_GaugeIdWithDuration) Reset() { - *m = QueryGaugeIdsResponse_GaugeIdWithDuration{} -} -func (m *QueryGaugeIdsResponse_GaugeIdWithDuration) String() string { - return proto.CompactTextString(m) -} -func (*QueryGaugeIdsResponse_GaugeIdWithDuration) ProtoMessage() {} -func (*QueryGaugeIdsResponse_GaugeIdWithDuration) Descriptor() ([]byte, []int) { - return fileDescriptor_302873ecccbc7636, []int{1, 0} -} -func (m *QueryGaugeIdsResponse_GaugeIdWithDuration) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGaugeIdsResponse_GaugeIdWithDuration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGaugeIdsResponse_GaugeIdWithDuration.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 *QueryGaugeIdsResponse_GaugeIdWithDuration) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGaugeIdsResponse_GaugeIdWithDuration.Merge(m, src) -} -func (m *QueryGaugeIdsResponse_GaugeIdWithDuration) XXX_Size() int { - return m.Size() -} -func (m *QueryGaugeIdsResponse_GaugeIdWithDuration) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGaugeIdsResponse_GaugeIdWithDuration.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGaugeIdsResponse_GaugeIdWithDuration proto.InternalMessageInfo - -func (m *QueryGaugeIdsResponse_GaugeIdWithDuration) GetGaugeId() uint64 { - if m != nil { - return m.GaugeId - } - return 0 -} - -func (m *QueryGaugeIdsResponse_GaugeIdWithDuration) GetDuration() time.Duration { - if m != nil { - return m.Duration - } - return 0 -} - -func (m *QueryGaugeIdsResponse_GaugeIdWithDuration) GetGaugeIncentivePercentage() string { - if m != nil { - return m.GaugeIncentivePercentage - } - return "" -} - -type QueryDistrInfoRequest struct { -} - -func (m *QueryDistrInfoRequest) Reset() { *m = QueryDistrInfoRequest{} } -func (m *QueryDistrInfoRequest) String() string { return proto.CompactTextString(m) } -func (*QueryDistrInfoRequest) ProtoMessage() {} -func (*QueryDistrInfoRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_302873ecccbc7636, []int{2} -} -func (m *QueryDistrInfoRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDistrInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDistrInfoRequest.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 *QueryDistrInfoRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDistrInfoRequest.Merge(m, src) -} -func (m *QueryDistrInfoRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryDistrInfoRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDistrInfoRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDistrInfoRequest proto.InternalMessageInfo - -type QueryDistrInfoResponse struct { - DistrInfo DistrInfo `protobuf:"bytes,1,opt,name=distr_info,json=distrInfo,proto3" json:"distr_info" yaml:"distr_info"` -} - -func (m *QueryDistrInfoResponse) Reset() { *m = QueryDistrInfoResponse{} } -func (m *QueryDistrInfoResponse) String() string { return proto.CompactTextString(m) } -func (*QueryDistrInfoResponse) ProtoMessage() {} -func (*QueryDistrInfoResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_302873ecccbc7636, []int{3} -} -func (m *QueryDistrInfoResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDistrInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDistrInfoResponse.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 *QueryDistrInfoResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDistrInfoResponse.Merge(m, src) -} -func (m *QueryDistrInfoResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryDistrInfoResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDistrInfoResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDistrInfoResponse proto.InternalMessageInfo - -func (m *QueryDistrInfoResponse) GetDistrInfo() DistrInfo { - if m != nil { - return m.DistrInfo - } - return DistrInfo{} -} - -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_302873ecccbc7636, []int{4} -} -func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsRequest.Merge(m, src) -} -func (m *QueryParamsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo - -type QueryParamsResponse struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` -} - -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_302873ecccbc7636, []int{5} -} -func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsResponse.Merge(m, src) -} -func (m *QueryParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo - -func (m *QueryParamsResponse) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -type QueryLockableDurationsRequest struct { -} - -func (m *QueryLockableDurationsRequest) Reset() { *m = QueryLockableDurationsRequest{} } -func (m *QueryLockableDurationsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryLockableDurationsRequest) ProtoMessage() {} -func (*QueryLockableDurationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_302873ecccbc7636, []int{6} -} -func (m *QueryLockableDurationsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryLockableDurationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryLockableDurationsRequest.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 *QueryLockableDurationsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryLockableDurationsRequest.Merge(m, src) -} -func (m *QueryLockableDurationsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryLockableDurationsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryLockableDurationsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryLockableDurationsRequest proto.InternalMessageInfo - -type QueryLockableDurationsResponse struct { - LockableDurations []time.Duration `protobuf:"bytes,1,rep,name=lockable_durations,json=lockableDurations,proto3,stdduration" json:"lockable_durations" yaml:"lockable_durations"` -} - -func (m *QueryLockableDurationsResponse) Reset() { *m = QueryLockableDurationsResponse{} } -func (m *QueryLockableDurationsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryLockableDurationsResponse) ProtoMessage() {} -func (*QueryLockableDurationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_302873ecccbc7636, []int{7} -} -func (m *QueryLockableDurationsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryLockableDurationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryLockableDurationsResponse.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 *QueryLockableDurationsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryLockableDurationsResponse.Merge(m, src) -} -func (m *QueryLockableDurationsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryLockableDurationsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryLockableDurationsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryLockableDurationsResponse proto.InternalMessageInfo - -func (m *QueryLockableDurationsResponse) GetLockableDurations() []time.Duration { - if m != nil { - return m.LockableDurations - } - return nil -} - -type QueryIncentivizedPoolsRequest struct { -} - -func (m *QueryIncentivizedPoolsRequest) Reset() { *m = QueryIncentivizedPoolsRequest{} } -func (m *QueryIncentivizedPoolsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryIncentivizedPoolsRequest) ProtoMessage() {} -func (*QueryIncentivizedPoolsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_302873ecccbc7636, []int{8} -} -func (m *QueryIncentivizedPoolsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryIncentivizedPoolsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryIncentivizedPoolsRequest.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 *QueryIncentivizedPoolsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryIncentivizedPoolsRequest.Merge(m, src) -} -func (m *QueryIncentivizedPoolsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryIncentivizedPoolsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryIncentivizedPoolsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryIncentivizedPoolsRequest proto.InternalMessageInfo - -type IncentivizedPool struct { - PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty" yaml:"pool_id"` - LockableDuration time.Duration `protobuf:"bytes,2,opt,name=lockable_duration,json=lockableDuration,proto3,stdduration" json:"lockable_duration" yaml:"lockable_duration"` - GaugeId uint64 `protobuf:"varint,3,opt,name=gauge_id,json=gaugeId,proto3" json:"gauge_id,omitempty" yaml:"gauge_id"` -} - -func (m *IncentivizedPool) Reset() { *m = IncentivizedPool{} } -func (m *IncentivizedPool) String() string { return proto.CompactTextString(m) } -func (*IncentivizedPool) ProtoMessage() {} -func (*IncentivizedPool) Descriptor() ([]byte, []int) { - return fileDescriptor_302873ecccbc7636, []int{9} -} -func (m *IncentivizedPool) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *IncentivizedPool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_IncentivizedPool.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 *IncentivizedPool) XXX_Merge(src proto.Message) { - xxx_messageInfo_IncentivizedPool.Merge(m, src) -} -func (m *IncentivizedPool) XXX_Size() int { - return m.Size() -} -func (m *IncentivizedPool) XXX_DiscardUnknown() { - xxx_messageInfo_IncentivizedPool.DiscardUnknown(m) -} - -var xxx_messageInfo_IncentivizedPool proto.InternalMessageInfo - -func (m *IncentivizedPool) GetPoolId() uint64 { - if m != nil { - return m.PoolId - } - return 0 -} - -func (m *IncentivizedPool) GetLockableDuration() time.Duration { - if m != nil { - return m.LockableDuration - } - return 0 -} - -func (m *IncentivizedPool) GetGaugeId() uint64 { - if m != nil { - return m.GaugeId - } - return 0 -} - -type QueryIncentivizedPoolsResponse struct { - IncentivizedPools []IncentivizedPool `protobuf:"bytes,1,rep,name=incentivized_pools,json=incentivizedPools,proto3" json:"incentivized_pools" yaml:"incentivized_pools"` -} - -func (m *QueryIncentivizedPoolsResponse) Reset() { *m = QueryIncentivizedPoolsResponse{} } -func (m *QueryIncentivizedPoolsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryIncentivizedPoolsResponse) ProtoMessage() {} -func (*QueryIncentivizedPoolsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_302873ecccbc7636, []int{10} -} -func (m *QueryIncentivizedPoolsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryIncentivizedPoolsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryIncentivizedPoolsResponse.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 *QueryIncentivizedPoolsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryIncentivizedPoolsResponse.Merge(m, src) -} -func (m *QueryIncentivizedPoolsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryIncentivizedPoolsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryIncentivizedPoolsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryIncentivizedPoolsResponse proto.InternalMessageInfo - -func (m *QueryIncentivizedPoolsResponse) GetIncentivizedPools() []IncentivizedPool { - if m != nil { - return m.IncentivizedPools - } - return nil -} - -type QueryExternalIncentiveGaugesRequest struct { -} - -func (m *QueryExternalIncentiveGaugesRequest) Reset() { *m = QueryExternalIncentiveGaugesRequest{} } -func (m *QueryExternalIncentiveGaugesRequest) String() string { return proto.CompactTextString(m) } -func (*QueryExternalIncentiveGaugesRequest) ProtoMessage() {} -func (*QueryExternalIncentiveGaugesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_302873ecccbc7636, []int{11} -} -func (m *QueryExternalIncentiveGaugesRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryExternalIncentiveGaugesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryExternalIncentiveGaugesRequest.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 *QueryExternalIncentiveGaugesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryExternalIncentiveGaugesRequest.Merge(m, src) -} -func (m *QueryExternalIncentiveGaugesRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryExternalIncentiveGaugesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryExternalIncentiveGaugesRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryExternalIncentiveGaugesRequest proto.InternalMessageInfo - -type QueryExternalIncentiveGaugesResponse struct { - Data []types1.Gauge `protobuf:"bytes,1,rep,name=data,proto3" json:"data"` -} - -func (m *QueryExternalIncentiveGaugesResponse) Reset() { *m = QueryExternalIncentiveGaugesResponse{} } -func (m *QueryExternalIncentiveGaugesResponse) String() string { return proto.CompactTextString(m) } -func (*QueryExternalIncentiveGaugesResponse) ProtoMessage() {} -func (*QueryExternalIncentiveGaugesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_302873ecccbc7636, []int{12} -} -func (m *QueryExternalIncentiveGaugesResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryExternalIncentiveGaugesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryExternalIncentiveGaugesResponse.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 *QueryExternalIncentiveGaugesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryExternalIncentiveGaugesResponse.Merge(m, src) -} -func (m *QueryExternalIncentiveGaugesResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryExternalIncentiveGaugesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryExternalIncentiveGaugesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryExternalIncentiveGaugesResponse proto.InternalMessageInfo - -func (m *QueryExternalIncentiveGaugesResponse) GetData() []types1.Gauge { - if m != nil { - return m.Data - } - return nil -} - -func init() { - proto.RegisterType((*QueryGaugeIdsRequest)(nil), "osmosis.poolincentives.v1beta1.QueryGaugeIdsRequest") - proto.RegisterType((*QueryGaugeIdsResponse)(nil), "osmosis.poolincentives.v1beta1.QueryGaugeIdsResponse") - proto.RegisterType((*QueryGaugeIdsResponse_GaugeIdWithDuration)(nil), "osmosis.poolincentives.v1beta1.QueryGaugeIdsResponse.GaugeIdWithDuration") - proto.RegisterType((*QueryDistrInfoRequest)(nil), "osmosis.poolincentives.v1beta1.QueryDistrInfoRequest") - proto.RegisterType((*QueryDistrInfoResponse)(nil), "osmosis.poolincentives.v1beta1.QueryDistrInfoResponse") - proto.RegisterType((*QueryParamsRequest)(nil), "osmosis.poolincentives.v1beta1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "osmosis.poolincentives.v1beta1.QueryParamsResponse") - proto.RegisterType((*QueryLockableDurationsRequest)(nil), "osmosis.poolincentives.v1beta1.QueryLockableDurationsRequest") - proto.RegisterType((*QueryLockableDurationsResponse)(nil), "osmosis.poolincentives.v1beta1.QueryLockableDurationsResponse") - proto.RegisterType((*QueryIncentivizedPoolsRequest)(nil), "osmosis.poolincentives.v1beta1.QueryIncentivizedPoolsRequest") - proto.RegisterType((*IncentivizedPool)(nil), "osmosis.poolincentives.v1beta1.IncentivizedPool") - proto.RegisterType((*QueryIncentivizedPoolsResponse)(nil), "osmosis.poolincentives.v1beta1.QueryIncentivizedPoolsResponse") - proto.RegisterType((*QueryExternalIncentiveGaugesRequest)(nil), "osmosis.poolincentives.v1beta1.QueryExternalIncentiveGaugesRequest") - proto.RegisterType((*QueryExternalIncentiveGaugesResponse)(nil), "osmosis.poolincentives.v1beta1.QueryExternalIncentiveGaugesResponse") -} - -func init() { - proto.RegisterFile("osmosis/pool-incentives/v1beta1/query.proto", fileDescriptor_302873ecccbc7636) -} - -var fileDescriptor_302873ecccbc7636 = []byte{ - // 923 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x41, 0x6f, 0x1b, 0x45, - 0x14, 0xce, 0x34, 0x21, 0x4d, 0x26, 0x12, 0xd4, 0x93, 0x40, 0x9c, 0x15, 0xac, 0xc3, 0xd0, 0x42, - 0xaa, 0x28, 0xbb, 0x8d, 0xdd, 0xf4, 0xd0, 0x06, 0x90, 0xdc, 0x20, 0x14, 0x89, 0x43, 0x58, 0x09, - 0x21, 0xc1, 0xc1, 0x5a, 0x67, 0x27, 0x9b, 0x11, 0xeb, 0x1d, 0xd7, 0xb3, 0x0e, 0x0d, 0xa8, 0x97, - 0x4a, 0xdc, 0x41, 0x5c, 0x38, 0x23, 0x7a, 0xe6, 0xc4, 0x3f, 0xe0, 0xd0, 0x1b, 0x95, 0xb8, 0x70, - 0xc1, 0xa0, 0x84, 0x03, 0x67, 0xff, 0x02, 0xb4, 0xb3, 0x6f, 0x36, 0xf6, 0x6e, 0xec, 0xb5, 0xc3, - 0x6d, 0x33, 0xef, 0xbd, 0xef, 0x7d, 0xdf, 0xbc, 0x37, 0x9f, 0x83, 0x37, 0x85, 0x6c, 0x09, 0xc9, - 0xa5, 0xdd, 0x16, 0x22, 0xd8, 0xe2, 0xe1, 0x21, 0x0b, 0x23, 0x7e, 0xc2, 0xa4, 0x7d, 0xb2, 0xdd, - 0x64, 0x91, 0xbb, 0x6d, 0x3f, 0xea, 0xb2, 0xce, 0xa9, 0xd5, 0xee, 0x88, 0x48, 0x10, 0x13, 0x92, - 0xad, 0x38, 0xf9, 0x22, 0xd7, 0x82, 0x5c, 0x63, 0xc5, 0x17, 0xbe, 0x50, 0xa9, 0x76, 0xfc, 0x95, - 0x54, 0x19, 0xaf, 0xfb, 0x42, 0xf8, 0x01, 0xb3, 0xdd, 0x36, 0xb7, 0xdd, 0x30, 0x14, 0x91, 0x1b, - 0x71, 0x11, 0x4a, 0x88, 0x9a, 0x10, 0x55, 0x7f, 0x35, 0xbb, 0x47, 0xb6, 0xd7, 0xed, 0xa8, 0x04, - 0x1d, 0xd7, 0x04, 0x07, 0xb8, 0xf9, 0x6e, 0xd7, 0x67, 0x10, 0xbf, 0x53, 0x24, 0x60, 0x80, 0xa7, - 0xaa, 0xa0, 0x0f, 0xf1, 0xca, 0xc7, 0xb1, 0xa8, 0x0f, 0x63, 0x94, 0x7d, 0x4f, 0x3a, 0xec, 0x51, - 0x97, 0xc9, 0x88, 0x6c, 0xe2, 0xeb, 0x31, 0x46, 0x83, 0x7b, 0x65, 0xb4, 0x8e, 0x36, 0xe6, 0xea, - 0xa4, 0xdf, 0xab, 0xbc, 0x7c, 0xea, 0xb6, 0x82, 0xfb, 0x14, 0x02, 0xd4, 0x99, 0x8f, 0xbf, 0xf6, - 0x3d, 0xfa, 0xcd, 0x2c, 0x7e, 0x35, 0x83, 0x22, 0xdb, 0x22, 0x94, 0x8c, 0xfc, 0x84, 0xf0, 0xaa, - 0x22, 0xd8, 0xe0, 0x9e, 0x6c, 0x7c, 0xc9, 0xa3, 0xe3, 0x86, 0x96, 0x54, 0x46, 0xeb, 0xb3, 0x1b, - 0x4b, 0xd5, 0x7d, 0x6b, 0xfc, 0x3d, 0x5a, 0x97, 0x02, 0x5b, 0x70, 0xf0, 0x29, 0x8f, 0x8e, 0xf7, - 0x00, 0xb0, 0x4e, 0xfb, 0xbd, 0x8a, 0x99, 0x50, 0x1c, 0xd1, 0x93, 0x3a, 0x2b, 0x3e, 0x20, 0x0d, - 0x56, 0x1a, 0xbf, 0x22, 0xbc, 0x7c, 0x09, 0x22, 0xb1, 0xf0, 0x82, 0x46, 0x82, 0x6b, 0x58, 0xee, - 0xf7, 0x2a, 0xaf, 0x0c, 0xf7, 0xa0, 0xce, 0x75, 0x00, 0x25, 0xef, 0xe3, 0x85, 0x54, 0xde, 0xb5, - 0x75, 0xb4, 0xb1, 0x54, 0x5d, 0xb3, 0x92, 0x91, 0x5a, 0x7a, 0xa4, 0x56, 0x4a, 0x77, 0xe1, 0x79, - 0xaf, 0x32, 0xf3, 0xc3, 0x5f, 0x15, 0xe4, 0xa4, 0x45, 0x64, 0x17, 0x1b, 0x00, 0xab, 0x2f, 0xa2, - 0xd1, 0x66, 0x9d, 0xf8, 0xd3, 0xf5, 0x59, 0x79, 0x76, 0x1d, 0x6d, 0x2c, 0x3a, 0xe5, 0xa4, 0x9b, - 0x4e, 0x38, 0x48, 0xe3, 0x74, 0x15, 0xc6, 0xb0, 0xc7, 0x65, 0xd4, 0xd9, 0x0f, 0x8f, 0x04, 0x4c, - 0x93, 0x3e, 0xc1, 0xaf, 0x65, 0x03, 0x30, 0xa0, 0x43, 0x8c, 0xbd, 0xf8, 0xb0, 0xc1, 0xc3, 0x23, - 0xa1, 0x34, 0x2e, 0x55, 0x6f, 0x17, 0x8d, 0x24, 0x85, 0xa9, 0xaf, 0xc5, 0x1a, 0xfa, 0xbd, 0x4a, - 0x29, 0xb9, 0x92, 0x0b, 0x28, 0xea, 0x2c, 0x7a, 0x3a, 0x8b, 0xae, 0x60, 0xa2, 0xda, 0x1f, 0xb8, - 0x1d, 0xb7, 0xa5, 0x57, 0x8c, 0x7e, 0x8e, 0x97, 0x87, 0x4e, 0x81, 0xd1, 0x1e, 0x9e, 0x6f, 0xab, - 0x13, 0x60, 0xf3, 0x76, 0x11, 0x9b, 0xa4, 0xbe, 0x3e, 0x17, 0x53, 0x71, 0xa0, 0x96, 0x56, 0xf0, - 0x1b, 0x0a, 0xfc, 0x23, 0x71, 0xf8, 0x85, 0xdb, 0x0c, 0x98, 0xbe, 0xf5, 0xb4, 0xfb, 0x77, 0x08, - 0x9b, 0xa3, 0x32, 0x80, 0x89, 0xc0, 0x24, 0x80, 0x60, 0xba, 0x41, 0x12, 0xd6, 0x76, 0xcc, 0x5c, - 0x6f, 0xc1, 0x9d, 0xac, 0x25, 0x77, 0x92, 0x87, 0xa0, 0x6a, 0xe8, 0xa5, 0x20, 0xdb, 0x38, 0x25, - 0xad, 0x67, 0xcb, 0xbf, 0x62, 0xde, 0x81, 0x10, 0x41, 0x4a, 0xfa, 0x4f, 0x84, 0x6f, 0x64, 0x83, - 0x53, 0x3d, 0x55, 0x12, 0xe0, 0x52, 0x8e, 0x50, 0xf1, 0xaa, 0xde, 0x04, 0x49, 0xe5, 0x11, 0x92, - 0x12, 0x45, 0x37, 0xb2, 0x8a, 0x86, 0xde, 0xcf, 0x6c, 0xf1, 0xfb, 0xa1, 0xcf, 0xf4, 0x50, 0x2e, - 0xb9, 0x01, 0x18, 0xca, 0x53, 0x84, 0x09, 0x1f, 0x88, 0x36, 0x62, 0x61, 0x7a, 0x2a, 0x77, 0x8a, - 0x76, 0x25, 0x8b, 0x5b, 0x7f, 0x73, 0x78, 0x58, 0x79, 0x64, 0xea, 0x94, 0x78, 0x96, 0x0c, 0xbd, - 0x85, 0xdf, 0x52, 0x34, 0x3f, 0x78, 0x1c, 0xb1, 0x4e, 0xe8, 0x06, 0xe9, 0x63, 0x54, 0x26, 0x32, - 0xb0, 0xe1, 0x37, 0xc7, 0xa7, 0x81, 0xa6, 0x1a, 0x9e, 0xf3, 0xdc, 0xc8, 0x4d, 0x57, 0x4b, 0x8b, - 0x18, 0x10, 0xa0, 0x2a, 0x60, 0xc7, 0x55, 0x72, 0xf5, 0xd9, 0x22, 0x7e, 0x49, 0xa1, 0x93, 0x5f, - 0x10, 0x5e, 0xd0, 0x06, 0x49, 0xee, 0x4e, 0xe9, 0xa7, 0x8a, 0xa9, 0xb1, 0x73, 0x25, 0x17, 0xa6, - 0xbb, 0x4f, 0x7f, 0xff, 0xe7, 0xfb, 0x6b, 0xf7, 0xc8, 0x5d, 0xbb, 0xe8, 0x87, 0x47, 0x4d, 0x78, - 0x8b, 0x7b, 0xd2, 0xfe, 0x1a, 0x76, 0xf2, 0x09, 0xf9, 0x19, 0xe1, 0xc5, 0xd4, 0x4a, 0xc8, 0x64, - 0x14, 0xb2, 0xd6, 0x66, 0xdc, 0x9b, 0xb6, 0x0c, 0xa8, 0xd7, 0x14, 0xf5, 0x2d, 0xb2, 0x59, 0x48, - 0xfd, 0xc2, 0xd4, 0xc8, 0x8f, 0x08, 0xcf, 0x27, 0x76, 0x43, 0xaa, 0x13, 0xf5, 0x1d, 0x72, 0x3c, - 0xa3, 0x36, 0x55, 0x0d, 0x10, 0xb5, 0x15, 0xd1, 0xdb, 0xe4, 0x9d, 0x42, 0xa2, 0x89, 0xf5, 0x91, - 0xdf, 0x10, 0x2e, 0xe5, 0x4c, 0x8d, 0xbc, 0x3b, 0x51, 0xef, 0x51, 0x76, 0x69, 0xbc, 0x77, 0xd5, - 0x72, 0x50, 0xf1, 0x40, 0xa9, 0xd8, 0x21, 0xb5, 0x42, 0x15, 0x79, 0xbf, 0x54, 0x8a, 0x72, 0x8e, - 0x30, 0xa1, 0xa2, 0x51, 0x5e, 0x3a, 0xa1, 0xa2, 0x91, 0x46, 0x34, 0x85, 0xa2, 0xbc, 0xa9, 0x90, - 0x7f, 0x11, 0x5e, 0x1d, 0xe1, 0x0a, 0xe4, 0xe1, 0x44, 0xc4, 0xc6, 0x5b, 0x8f, 0xb1, 0xf7, 0xff, - 0x40, 0x40, 0x63, 0x5d, 0x69, 0xdc, 0x25, 0xf7, 0x0b, 0x35, 0x32, 0x40, 0x1a, 0xf8, 0xc7, 0x45, - 0x3d, 0x79, 0x59, 0xff, 0xe4, 0xf9, 0x99, 0x89, 0x5e, 0x9c, 0x99, 0xe8, 0xef, 0x33, 0x13, 0x7d, - 0x7b, 0x6e, 0xce, 0xbc, 0x38, 0x37, 0x67, 0xfe, 0x38, 0x37, 0x67, 0x3e, 0x7b, 0xe0, 0xf3, 0xe8, - 0xb8, 0xdb, 0xb4, 0x0e, 0x45, 0x4b, 0xe3, 0x6f, 0x05, 0x6e, 0x53, 0xa6, 0xcd, 0x4e, 0xb6, 0x77, - 0xec, 0xc7, 0xb9, 0x96, 0xd1, 0x69, 0x9b, 0xc9, 0xe6, 0xbc, 0xfa, 0x95, 0xaa, 0xfd, 0x17, 0x00, - 0x00, 0xff, 0xff, 0xef, 0x47, 0x06, 0xfd, 0xb4, 0x0b, 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 { - // GaugeIds takes the pool id and returns the matching gauge ids and durations - GaugeIds(ctx context.Context, in *QueryGaugeIdsRequest, opts ...grpc.CallOption) (*QueryGaugeIdsResponse, error) - // DistrInfo returns the pool's matching gauge ids and weights. - DistrInfo(ctx context.Context, in *QueryDistrInfoRequest, opts ...grpc.CallOption) (*QueryDistrInfoResponse, error) - // Params returns pool incentives params. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // LockableDurations returns lock durations for pools. - LockableDurations(ctx context.Context, in *QueryLockableDurationsRequest, opts ...grpc.CallOption) (*QueryLockableDurationsResponse, error) - // IncentivizedPools returns currently incentivized pools - IncentivizedPools(ctx context.Context, in *QueryIncentivizedPoolsRequest, opts ...grpc.CallOption) (*QueryIncentivizedPoolsResponse, error) - // ExternalIncentiveGauges returns external incentive gauges. - ExternalIncentiveGauges(ctx context.Context, in *QueryExternalIncentiveGaugesRequest, opts ...grpc.CallOption) (*QueryExternalIncentiveGaugesResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) GaugeIds(ctx context.Context, in *QueryGaugeIdsRequest, opts ...grpc.CallOption) (*QueryGaugeIdsResponse, error) { - out := new(QueryGaugeIdsResponse) - err := c.cc.Invoke(ctx, "/osmosis.poolincentives.v1beta1.Query/GaugeIds", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) DistrInfo(ctx context.Context, in *QueryDistrInfoRequest, opts ...grpc.CallOption) (*QueryDistrInfoResponse, error) { - out := new(QueryDistrInfoResponse) - err := c.cc.Invoke(ctx, "/osmosis.poolincentives.v1beta1.Query/DistrInfo", 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, "/osmosis.poolincentives.v1beta1.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) LockableDurations(ctx context.Context, in *QueryLockableDurationsRequest, opts ...grpc.CallOption) (*QueryLockableDurationsResponse, error) { - out := new(QueryLockableDurationsResponse) - err := c.cc.Invoke(ctx, "/osmosis.poolincentives.v1beta1.Query/LockableDurations", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) IncentivizedPools(ctx context.Context, in *QueryIncentivizedPoolsRequest, opts ...grpc.CallOption) (*QueryIncentivizedPoolsResponse, error) { - out := new(QueryIncentivizedPoolsResponse) - err := c.cc.Invoke(ctx, "/osmosis.poolincentives.v1beta1.Query/IncentivizedPools", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) ExternalIncentiveGauges(ctx context.Context, in *QueryExternalIncentiveGaugesRequest, opts ...grpc.CallOption) (*QueryExternalIncentiveGaugesResponse, error) { - out := new(QueryExternalIncentiveGaugesResponse) - err := c.cc.Invoke(ctx, "/osmosis.poolincentives.v1beta1.Query/ExternalIncentiveGauges", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // GaugeIds takes the pool id and returns the matching gauge ids and durations - GaugeIds(context.Context, *QueryGaugeIdsRequest) (*QueryGaugeIdsResponse, error) - // DistrInfo returns the pool's matching gauge ids and weights. - DistrInfo(context.Context, *QueryDistrInfoRequest) (*QueryDistrInfoResponse, error) - // Params returns pool incentives params. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // LockableDurations returns lock durations for pools. - LockableDurations(context.Context, *QueryLockableDurationsRequest) (*QueryLockableDurationsResponse, error) - // IncentivizedPools returns currently incentivized pools - IncentivizedPools(context.Context, *QueryIncentivizedPoolsRequest) (*QueryIncentivizedPoolsResponse, error) - // ExternalIncentiveGauges returns external incentive gauges. - ExternalIncentiveGauges(context.Context, *QueryExternalIncentiveGaugesRequest) (*QueryExternalIncentiveGaugesResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) GaugeIds(ctx context.Context, req *QueryGaugeIdsRequest) (*QueryGaugeIdsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GaugeIds not implemented") -} -func (*UnimplementedQueryServer) DistrInfo(ctx context.Context, req *QueryDistrInfoRequest) (*QueryDistrInfoResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DistrInfo not implemented") -} -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} -func (*UnimplementedQueryServer) LockableDurations(ctx context.Context, req *QueryLockableDurationsRequest) (*QueryLockableDurationsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method LockableDurations not implemented") -} -func (*UnimplementedQueryServer) IncentivizedPools(ctx context.Context, req *QueryIncentivizedPoolsRequest) (*QueryIncentivizedPoolsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method IncentivizedPools not implemented") -} -func (*UnimplementedQueryServer) ExternalIncentiveGauges(ctx context.Context, req *QueryExternalIncentiveGaugesRequest) (*QueryExternalIncentiveGaugesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ExternalIncentiveGauges not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_GaugeIds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGaugeIdsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GaugeIds(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/osmosis.poolincentives.v1beta1.Query/GaugeIds", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GaugeIds(ctx, req.(*QueryGaugeIdsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_DistrInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDistrInfoRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).DistrInfo(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/osmosis.poolincentives.v1beta1.Query/DistrInfo", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).DistrInfo(ctx, req.(*QueryDistrInfoRequest)) - } - 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: "/osmosis.poolincentives.v1beta1.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_LockableDurations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryLockableDurationsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).LockableDurations(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/osmosis.poolincentives.v1beta1.Query/LockableDurations", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).LockableDurations(ctx, req.(*QueryLockableDurationsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_IncentivizedPools_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryIncentivizedPoolsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).IncentivizedPools(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/osmosis.poolincentives.v1beta1.Query/IncentivizedPools", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).IncentivizedPools(ctx, req.(*QueryIncentivizedPoolsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_ExternalIncentiveGauges_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryExternalIncentiveGaugesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ExternalIncentiveGauges(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/osmosis.poolincentives.v1beta1.Query/ExternalIncentiveGauges", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ExternalIncentiveGauges(ctx, req.(*QueryExternalIncentiveGaugesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "osmosis.poolincentives.v1beta1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GaugeIds", - Handler: _Query_GaugeIds_Handler, - }, - { - MethodName: "DistrInfo", - Handler: _Query_DistrInfo_Handler, - }, - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - { - MethodName: "LockableDurations", - Handler: _Query_LockableDurations_Handler, - }, - { - MethodName: "IncentivizedPools", - Handler: _Query_IncentivizedPools_Handler, - }, - { - MethodName: "ExternalIncentiveGauges", - Handler: _Query_ExternalIncentiveGauges_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "osmosis/pool-incentives/v1beta1/query.proto", -} - -func (m *QueryGaugeIdsRequest) 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 *QueryGaugeIdsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGaugeIdsRequest) 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] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryGaugeIdsResponse) 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 *QueryGaugeIdsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGaugeIdsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.GaugeIdsWithDuration) > 0 { - for iNdEx := len(m.GaugeIdsWithDuration) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.GaugeIdsWithDuration[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 *QueryGaugeIdsResponse_GaugeIdWithDuration) 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 *QueryGaugeIdsResponse_GaugeIdWithDuration) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGaugeIdsResponse_GaugeIdWithDuration) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.GaugeIncentivePercentage) > 0 { - i -= len(m.GaugeIncentivePercentage) - copy(dAtA[i:], m.GaugeIncentivePercentage) - i = encodeVarintQuery(dAtA, i, uint64(len(m.GaugeIncentivePercentage))) - i-- - dAtA[i] = 0x1a - } - n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.Duration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.Duration):]) - if err1 != nil { - return 0, err1 - } - i -= n1 - i = encodeVarintQuery(dAtA, i, uint64(n1)) - i-- - dAtA[i] = 0x12 - if m.GaugeId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.GaugeId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryDistrInfoRequest) 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 *QueryDistrInfoRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDistrInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryDistrInfoResponse) 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 *QueryDistrInfoResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDistrInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.DistrInfo.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 (m *QueryLockableDurationsRequest) 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 *QueryLockableDurationsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryLockableDurationsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryLockableDurationsResponse) 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 *QueryLockableDurationsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryLockableDurationsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.LockableDurations) > 0 { - for iNdEx := len(m.LockableDurations) - 1; iNdEx >= 0; iNdEx-- { - n, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.LockableDurations[iNdEx], dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.LockableDurations[iNdEx]):]) - if err != nil { - return 0, err - } - i -= n - i = encodeVarintQuery(dAtA, i, uint64(n)) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *QueryIncentivizedPoolsRequest) 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 *QueryIncentivizedPoolsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryIncentivizedPoolsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *IncentivizedPool) 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 *IncentivizedPool) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *IncentivizedPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.GaugeId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.GaugeId)) - i-- - dAtA[i] = 0x18 - } - n4, err4 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.LockableDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.LockableDuration):]) - if err4 != nil { - return 0, err4 - } - i -= n4 - i = encodeVarintQuery(dAtA, i, uint64(n4)) - 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 *QueryIncentivizedPoolsResponse) 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 *QueryIncentivizedPoolsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryIncentivizedPoolsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.IncentivizedPools) > 0 { - for iNdEx := len(m.IncentivizedPools) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.IncentivizedPools[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 *QueryExternalIncentiveGaugesRequest) 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 *QueryExternalIncentiveGaugesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryExternalIncentiveGaugesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryExternalIncentiveGaugesResponse) 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 *QueryExternalIncentiveGaugesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryExternalIncentiveGaugesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Data) > 0 { - for iNdEx := len(m.Data) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Data[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *QueryGaugeIdsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.PoolId != 0 { - n += 1 + sovQuery(uint64(m.PoolId)) - } - return n -} - -func (m *QueryGaugeIdsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.GaugeIdsWithDuration) > 0 { - for _, e := range m.GaugeIdsWithDuration { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryGaugeIdsResponse_GaugeIdWithDuration) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.GaugeId != 0 { - n += 1 + sovQuery(uint64(m.GaugeId)) - } - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.Duration) - n += 1 + l + sovQuery(uint64(l)) - l = len(m.GaugeIncentivePercentage) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryDistrInfoRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryDistrInfoResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.DistrInfo.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 (m *QueryLockableDurationsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryLockableDurationsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.LockableDurations) > 0 { - for _, e := range m.LockableDurations { - l = github_com_gogo_protobuf_types.SizeOfStdDuration(e) - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryIncentivizedPoolsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *IncentivizedPool) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.PoolId != 0 { - n += 1 + sovQuery(uint64(m.PoolId)) - } - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.LockableDuration) - n += 1 + l + sovQuery(uint64(l)) - if m.GaugeId != 0 { - n += 1 + sovQuery(uint64(m.GaugeId)) - } - return n -} - -func (m *QueryIncentivizedPoolsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.IncentivizedPools) > 0 { - for _, e := range m.IncentivizedPools { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryExternalIncentiveGaugesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryExternalIncentiveGaugesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Data) > 0 { - for _, e := range m.Data { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *QueryGaugeIdsRequest) 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: QueryGaugeIdsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGaugeIdsRequest: 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 |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGaugeIdsResponse) 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: QueryGaugeIdsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGaugeIdsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GaugeIdsWithDuration", 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.GaugeIdsWithDuration = append(m.GaugeIdsWithDuration, &QueryGaugeIdsResponse_GaugeIdWithDuration{}) - if err := m.GaugeIdsWithDuration[len(m.GaugeIdsWithDuration)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGaugeIdsResponse_GaugeIdWithDuration) 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: GaugeIdWithDuration: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GaugeIdWithDuration: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GaugeId", wireType) - } - m.GaugeId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GaugeId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Duration", 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 := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.Duration, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GaugeIncentivePercentage", 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.GaugeIncentivePercentage = 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 *QueryDistrInfoRequest) 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: QueryDistrInfoRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDistrInfoRequest: 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 *QueryDistrInfoResponse) 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: QueryDistrInfoResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDistrInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DistrInfo", 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.DistrInfo.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 (m *QueryLockableDurationsRequest) 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: QueryLockableDurationsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryLockableDurationsRequest: 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 *QueryLockableDurationsResponse) 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: QueryLockableDurationsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryLockableDurationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LockableDurations", 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.LockableDurations = append(m.LockableDurations, time.Duration(0)) - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&(m.LockableDurations[len(m.LockableDurations)-1]), 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 *QueryIncentivizedPoolsRequest) 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: QueryIncentivizedPoolsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryIncentivizedPoolsRequest: 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 *IncentivizedPool) 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: IncentivizedPool: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IncentivizedPool: 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 |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LockableDuration", 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 := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.LockableDuration, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GaugeId", wireType) - } - m.GaugeId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GaugeId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryIncentivizedPoolsResponse) 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: QueryIncentivizedPoolsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryIncentivizedPoolsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IncentivizedPools", 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.IncentivizedPools = append(m.IncentivizedPools, IncentivizedPool{}) - if err := m.IncentivizedPools[len(m.IncentivizedPools)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryExternalIncentiveGaugesRequest) 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: QueryExternalIncentiveGaugesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryExternalIncentiveGaugesRequest: 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 *QueryExternalIncentiveGaugesResponse) 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: QueryExternalIncentiveGaugesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryExternalIncentiveGaugesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", 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.Data = append(m.Data, types1.Gauge{}) - if err := m.Data[len(m.Data)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipQuery(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthQuery - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupQuery - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthQuery - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/pool-incentives/types/query.pb.gw.go b/x/pool-incentives/types/query.pb.gw.go deleted file mode 100644 index 45710f96449..00000000000 --- a/x/pool-incentives/types/query.pb.gw.go +++ /dev/null @@ -1,514 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: osmosis/pool-incentives/v1beta1/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 - -func request_Query_GaugeIds_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGaugeIdsRequest - 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.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "pool_id", err) - } - - msg, err := client.GaugeIds(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_GaugeIds_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGaugeIdsRequest - 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.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "pool_id", err) - } - - msg, err := server.GaugeIds(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_DistrInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryDistrInfoRequest - var metadata runtime.ServerMetadata - - msg, err := client.DistrInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_DistrInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryDistrInfoRequest - var metadata runtime.ServerMetadata - - msg, err := server.DistrInfo(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := server.Params(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_LockableDurations_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryLockableDurationsRequest - var metadata runtime.ServerMetadata - - msg, err := client.LockableDurations(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_LockableDurations_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryLockableDurationsRequest - var metadata runtime.ServerMetadata - - msg, err := server.LockableDurations(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_IncentivizedPools_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryIncentivizedPoolsRequest - var metadata runtime.ServerMetadata - - msg, err := client.IncentivizedPools(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_IncentivizedPools_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryIncentivizedPoolsRequest - var metadata runtime.ServerMetadata - - msg, err := server.IncentivizedPools(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_ExternalIncentiveGauges_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryExternalIncentiveGaugesRequest - var metadata runtime.ServerMetadata - - msg, err := client.ExternalIncentiveGauges(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_ExternalIncentiveGauges_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryExternalIncentiveGaugesRequest - var metadata runtime.ServerMetadata - - msg, err := server.ExternalIncentiveGauges(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_GaugeIds_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_GaugeIds_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_GaugeIds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_DistrInfo_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_DistrInfo_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_DistrInfo_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()...) - - }) - - mux.Handle("GET", pattern_Query_LockableDurations_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_LockableDurations_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_LockableDurations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_IncentivizedPools_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_IncentivizedPools_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_IncentivizedPools_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ExternalIncentiveGauges_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_ExternalIncentiveGauges_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_ExternalIncentiveGauges_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_GaugeIds_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_GaugeIds_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_GaugeIds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_DistrInfo_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_DistrInfo_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_DistrInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_LockableDurations_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_LockableDurations_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_LockableDurations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_IncentivizedPools_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_IncentivizedPools_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_IncentivizedPools_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ExternalIncentiveGauges_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_ExternalIncentiveGauges_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_ExternalIncentiveGauges_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_Query_GaugeIds_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"osmosis", "pool-incentives", "v1beta1", "gauge-ids", "pool_id"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_DistrInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"osmosis", "pool-incentives", "v1beta1", "distr_info"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"osmosis", "pool-incentives", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_LockableDurations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"osmosis", "pool-incentives", "v1beta1", "lockable_durations"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_IncentivizedPools_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"osmosis", "pool-incentives", "v1beta1", "incentivized_pools"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_ExternalIncentiveGauges_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"osmosis", "pool-incentives", "v1beta1", "external_incentive_gauges"}, "", runtime.AssumeColonVerbOpt(false))) -) - -var ( - forward_Query_GaugeIds_0 = runtime.ForwardResponseMessage - - forward_Query_DistrInfo_0 = runtime.ForwardResponseMessage - - forward_Query_Params_0 = runtime.ForwardResponseMessage - - forward_Query_LockableDurations_0 = runtime.ForwardResponseMessage - - forward_Query_IncentivizedPools_0 = runtime.ForwardResponseMessage - - forward_Query_ExternalIncentiveGauges_0 = runtime.ForwardResponseMessage -) diff --git a/x/pool-incentives/types/query_test.go b/x/pool-incentives/types/query_test.go deleted file mode 100644 index 22347f74108..00000000000 --- a/x/pool-incentives/types/query_test.go +++ /dev/null @@ -1,70 +0,0 @@ -package types_test - -import ( - "testing" - "time" - - proto "github.com/gogo/protobuf/proto" - "github.com/stretchr/testify/require" - - "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/types" -) - -func TestQueryGaugeIdsResponseMarshalUnmarshal(t *testing.T) { - tests := []struct { - response *types.QueryGaugeIdsResponse - }{ - { // empty struct - response: &types.QueryGaugeIdsResponse{}, - }, - { // length one value - response: &types.QueryGaugeIdsResponse{ - GaugeIdsWithDuration: []*types.QueryGaugeIdsResponse_GaugeIdWithDuration{ - { - GaugeId: 1, - Duration: time.Second, - }, - }, - }, - }, - } - - for _, test := range tests { - bz, err := proto.Marshal(test.response) - require.NoError(t, err) - decoded := types.QueryGaugeIdsResponse{} - err = proto.Unmarshal(bz, &decoded) - require.NoError(t, err) - require.Equal(t, *test.response, decoded) - } -} - -func TestQueryIncentivizedPoolsResponseMarshalUnmarshal(t *testing.T) { - tests := []struct { - response *types.QueryIncentivizedPoolsResponse - }{ - { // empty struct - response: &types.QueryIncentivizedPoolsResponse{}, - }, - { // length one value - response: &types.QueryIncentivizedPoolsResponse{ - IncentivizedPools: []types.IncentivizedPool{ - { - PoolId: 1, - LockableDuration: time.Second, - GaugeId: 1, - }, - }, - }, - }, - } - - for _, test := range tests { - bz, err := proto.Marshal(test.response) - require.NoError(t, err) - decoded := types.QueryIncentivizedPoolsResponse{} - err = proto.Unmarshal(bz, &decoded) - require.NoError(t, err) - require.Equal(t, *test.response, decoded) - } -} diff --git a/x/pool-incentives/types/record.go b/x/pool-incentives/types/record.go deleted file mode 100644 index 9dc7e6df4da..00000000000 --- a/x/pool-incentives/types/record.go +++ /dev/null @@ -1,9 +0,0 @@ -package types - -// ValidateBasic is a basic validation test on recordd distribution gauges' weights. -func (r DistrRecord) ValidateBasic() error { - if r.Weight.IsNegative() { - return ErrDistrRecordNotPositiveWeight - } - return nil -} diff --git a/x/pool-incentives/types/record_test.go b/x/pool-incentives/types/record_test.go deleted file mode 100644 index 6844ed5e775..00000000000 --- a/x/pool-incentives/types/record_test.go +++ /dev/null @@ -1,35 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/osmosis-labs/osmosis/v15/x/pool-incentives/types" -) - -// TestDistrRecord is a test on the weights of distribution gauges. -func TestDistrRecord(t *testing.T) { - zeroWeight := types.DistrRecord{ - GaugeId: 1, - Weight: sdk.NewInt(0), - } - - require.NoError(t, zeroWeight.ValidateBasic()) - - negativeWeight := types.DistrRecord{ - GaugeId: 1, - Weight: sdk.NewInt(-1), - } - - require.Error(t, negativeWeight.ValidateBasic()) - - positiveWeight := types.DistrRecord{ - GaugeId: 1, - Weight: sdk.NewInt(1), - } - - require.NoError(t, positiveWeight.ValidateBasic()) -}