diff --git a/.golangci.yml b/.golangci.yml index 607ff165a3..a6744083d4 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -5,28 +5,32 @@ run: linters: enable: - bodyclose - - deadcode - - depguard + # WARN [runner] The linter 'deadcode' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused. + # - deadcode + # x/tokenregistry/client/cli/query.go:9:2: import 'github.com/cosmos/cosmos-sdk/client' is not allowed from list 'Main' (depguard) + # - depguard - dogsled - goconst -# - gocritic -# - gofmt -# - goimports -# - golint - - revive + # - gocritic + # - gofmt + # - goimports + # - golint + # x/clp/client/cli/query.go:49:17: unused-parameter: parameter 'queryRoute' seems to be unused, consider removing or renaming it as _ (revive) + # - revive - gosec - govet - ineffassign -# - interfacer -# this is deprecated/obsolete -# - maligned + # - interfacer + # this is deprecated/obsolete + # - maligned - misspell - nakedret - prealloc -# - scopelint + # - scopelint - exportloopref - staticcheck - - structcheck + # WARN [runner] The linter 'structcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused. + # - structcheck - stylecheck - typecheck - unconvert @@ -63,7 +67,7 @@ issues: - ineffassign - prealloc - staticcheck -# Not a real issue here, so ignore + # Not a real issue here, so ignore - path: x/clp/keeper/pureCalculation_test.go text: "G113:" linters: diff --git a/integrationtest/integration_test.go b/integrationtest/integration_test.go index 1c325cf20a..415ba8953c 100644 --- a/integrationtest/integration_test.go +++ b/integrationtest/integration_test.go @@ -390,10 +390,10 @@ func TestIntegration(t *testing.T) { return genesisState }) - app.ClpKeeper.SetRewardParams(ctx, &tc.Setup.RewardsParams) - app.ClpKeeper.SetLiquidityProtectionParams(ctx, &tc.Setup.ProtectionParams) - app.ClpKeeper.SetPmtpParams(ctx, &tc.Setup.ShiftingParams) - app.ClpKeeper.SetProviderDistributionParams(ctx, &tc.Setup.ProviderParams) + app.ClpKeeper.SetRewardParams(ctx, &tc.Setup.RewardsParams) //nolint + app.ClpKeeper.SetLiquidityProtectionParams(ctx, &tc.Setup.ProtectionParams) //nolint + app.ClpKeeper.SetPmtpParams(ctx, &tc.Setup.ShiftingParams) //nolint + app.ClpKeeper.SetProviderDistributionParams(ctx, &tc.Setup.ProviderParams) //nolint clpSrv := clpkeeper.NewMsgServerImpl(app.ClpKeeper) marginSrv := marginkeeper.NewMsgServerImpl(app.MarginKeeper) diff --git a/proto/sifnode/clp/v1/genesis.proto b/proto/sifnode/clp/v1/genesis.proto index 57fea2a460..e06d5b6b4f 100644 --- a/proto/sifnode/clp/v1/genesis.proto +++ b/proto/sifnode/clp/v1/genesis.proto @@ -7,6 +7,7 @@ option go_package = "github.com/Sifchain/sifnode/x/clp/types"; import "sifnode/clp/v1/params.proto"; import "sifnode/clp/v1/types.proto"; +import "sifnode/clp/v1/rewards_bucket.proto"; // GenesisState - all clp state that must be provided at genesis // TODO: Add parameters to Genesis state ,such as minimum liquidity required to @@ -16,4 +17,5 @@ message GenesisState { repeated string address_whitelist = 2; repeated sifnode.clp.v1.Pool pool_list = 3; repeated sifnode.clp.v1.LiquidityProvider liquidity_providers = 4; + repeated RewardsBucket rewards_bucket_list = 5 [(gogoproto.nullable) = false]; } diff --git a/proto/sifnode/clp/v1/querier.proto b/proto/sifnode/clp/v1/querier.proto index c15539dcbb..dce3ae87b2 100644 --- a/proto/sifnode/clp/v1/querier.proto +++ b/proto/sifnode/clp/v1/querier.proto @@ -6,6 +6,7 @@ import "sifnode/clp/v1/types.proto"; import "sifnode/clp/v1/params.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "google/api/annotations.proto"; +import "sifnode/clp/v1/rewards_bucket.proto"; option go_package = "github.com/Sifchain/sifnode/x/clp/types"; @@ -59,6 +60,15 @@ service Query { rpc GetPoolShareEstimate(PoolShareEstimateReq) returns (PoolShareEstimateRes) { option (google.api.http).get = "/sifchain/clp/v1/pool_share_estimate"; }; + // Queries a list of RewardsBucket items. + rpc GetRewardsBucket (RewardsBucketReq) returns (RewardsBucketRes) { + option (google.api.http).get = "/sifchain/clp/v1/rewards_bucket/{denom}"; + + } + rpc GetRewardsBucketAll (AllRewardsBucketReq) returns (AllRewardsBucketRes) { + option (google.api.http).get = "/sifchain/clp/v1/clp/rewards_bucket"; + + } } message PoolReq { @@ -262,4 +272,22 @@ message SwapInfo { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint", (gogoproto.nullable) = false ]; -} \ No newline at end of file +} + +message RewardsBucketReq { + string denom = 1; +} + +message RewardsBucketRes { + RewardsBucket rewards_bucket = 1 [(gogoproto.nullable) = false]; +} + +message AllRewardsBucketReq { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message AllRewardsBucketRes { + repeated RewardsBucket rewards_bucket = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + diff --git a/proto/sifnode/clp/v1/rewards_bucket.proto b/proto/sifnode/clp/v1/rewards_bucket.proto new file mode 100644 index 0000000000..a40857577d --- /dev/null +++ b/proto/sifnode/clp/v1/rewards_bucket.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package sifnode.clp.v1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/Sifchain/sifnode/x/clp/types"; + +message RewardsBucket { + string denom = 1; + string amount = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"amount\"" + ]; + +} + diff --git a/testutil/keeper/clp.go b/testutil/keeper/clp.go new file mode 100644 index 0000000000..1dbe64e52f --- /dev/null +++ b/testutil/keeper/clp.go @@ -0,0 +1,59 @@ +package keeper + +import ( + "testing" + + "github.com/Sifchain/sifnode/x/clp/keeper" + "github.com/Sifchain/sifnode/x/clp/types" + + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/store" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" + typesparams "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/libs/log" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + tmdb "github.com/tendermint/tm-db" +) + +func ClpKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { + storeKey := sdk.NewKVStoreKey(types.StoreKey) + memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) + + db := tmdb.NewMemDB() + stateStore := store.NewCommitMultiStore(db) + stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) + stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) + require.NoError(t, stateStore.LoadLatestVersion()) + + registry := codectypes.NewInterfaceRegistry() + cdc := codec.NewProtoCodec(registry) + + paramsSubspace := typesparams.NewSubspace(cdc, + types.Amino, + storeKey, + memStoreKey, + "ClpParams", + ) + k := keeper.NewKeeper( + cdc, + storeKey, + nil, + nil, + nil, + nil, + mintkeeper.Keeper{}, + nil, + paramsSubspace, + ) + + ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) + + // Initialize params + k.SetParams(ctx, types.DefaultParams()) + + return &k, ctx +} diff --git a/testutil/network/network.go b/testutil/network/network.go new file mode 100644 index 0000000000..5178536e73 --- /dev/null +++ b/testutil/network/network.go @@ -0,0 +1,90 @@ +package network + +import ( + "fmt" + "testing" + "time" + + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/crypto/hd" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + servertypes "github.com/cosmos/cosmos-sdk/server/types" + tmdb "github.com/tendermint/tm-db" + + storetypes "github.com/cosmos/cosmos-sdk/store/types" + "github.com/cosmos/cosmos-sdk/testutil/network" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/stretchr/testify/require" + tmrand "github.com/tendermint/tendermint/libs/rand" + + "github.com/Sifchain/sifnode/app" +) + +type ( + Network = network.Network + Config = network.Config +) + +// New creates instance with fully configured cosmos network. +// Accepts optional config, that will be used in place of the DefaultConfig() if provided. +func New(t *testing.T, configs ...Config) *Network { + if len(configs) > 1 { + panic("at most one config should be provided") + } + var cfg network.Config + if len(configs) == 0 { + cfg = DefaultConfig() + } else { + cfg = configs[0] + } + net := network.New(t, cfg) + _, err := net.WaitForHeight(1) + require.NoError(t, err) + t.Cleanup(net.Cleanup) + return net +} + +// DefaultConfig will initialize config for the network with custom application, +// genesis and single validator. All other parameters are inherited from cosmos-sdk/testutil/network.DefaultConfig +func DefaultConfig() network.Config { + var ( + encoding = app.MakeTestEncodingConfig() + chainID = "chain-" + tmrand.NewRand().Str(6) + ) + return network.Config{ + Codec: encoding.Marshaler, + TxConfig: encoding.TxConfig, + LegacyAmino: encoding.Amino, + InterfaceRegistry: encoding.InterfaceRegistry, + AccountRetriever: authtypes.AccountRetriever{}, + AppConstructor: func(val network.Validator) servertypes.Application { + return app.NewSifApp( + val.Ctx.Logger, + tmdb.NewMemDB(), + nil, + true, + map[int64]bool{}, + val.Ctx.Config.RootDir, + 0, + encoding, + app.EmptyAppOptions{}, + baseapp.SetPruning(storetypes.NewPruningOptionsFromString(val.AppConfig.Pruning)), + baseapp.SetMinGasPrices(val.AppConfig.MinGasPrices), + ) + }, + GenesisState: app.ModuleBasics.DefaultGenesis(encoding.Marshaler), + TimeoutCommit: 2 * time.Second, + ChainID: chainID, + NumValidators: 1, + BondDenom: sdk.DefaultBondDenom, + MinGasPrices: fmt.Sprintf("0.000006%s", sdk.DefaultBondDenom), + AccountTokens: sdk.TokensFromConsensusPower(1000, sdk.DefaultPowerReduction), + StakingTokens: sdk.TokensFromConsensusPower(500, sdk.DefaultPowerReduction), + BondedTokens: sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction), + PruningStrategy: storetypes.PruningOptionNothing, + CleanupDir: true, + SigningAlgo: string(hd.Secp256k1Type), + KeyringOptions: []keyring.Option{}, + } +} diff --git a/testutil/nullify/nullify.go b/testutil/nullify/nullify.go new file mode 100644 index 0000000000..3b968c09c1 --- /dev/null +++ b/testutil/nullify/nullify.go @@ -0,0 +1,57 @@ +// Package nullify provides methods to init nil values structs for test assertion. +package nullify + +import ( + "reflect" + "unsafe" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var ( + coinType = reflect.TypeOf(sdk.Coin{}) + coinsType = reflect.TypeOf(sdk.Coins{}) +) + +// Fill analyze all struct fields and slices with +// reflection and initialize the nil and empty slices, +// structs, and pointers. +func Fill(x interface{}) interface{} { + v := reflect.Indirect(reflect.ValueOf(x)) + switch v.Kind() { + case reflect.Slice: + for i := 0; i < v.Len(); i++ { + obj := v.Index(i) + objPt := reflect.NewAt(obj.Type(), unsafe.Pointer(obj.UnsafeAddr())).Interface() + objPt = Fill(objPt) + obj.Set(reflect.ValueOf(objPt)) + } + case reflect.Struct: + for i := 0; i < v.NumField(); i++ { + f := reflect.Indirect(v.Field(i)) + if !f.CanSet() { + continue + } + switch f.Kind() { + case reflect.Slice: + f.Set(reflect.MakeSlice(f.Type(), 0, 0)) + case reflect.Struct: + switch f.Type() { + case coinType: + coin := reflect.New(coinType).Interface() + s := reflect.ValueOf(coin).Elem() + f.Set(s) + case coinsType: + coins := reflect.New(coinsType).Interface() + s := reflect.ValueOf(coins).Elem() + f.Set(s) + default: + objPt := reflect.NewAt(f.Type(), unsafe.Pointer(f.UnsafeAddr())).Interface() + s := Fill(objPt) + f.Set(reflect.ValueOf(s)) + } + } + } + } + return reflect.Indirect(v).Interface() +} diff --git a/x/clp/client/cli/query.go b/x/clp/client/cli/query.go index 36a5c4ced3..6236c24dba 100644 --- a/x/clp/client/cli/query.go +++ b/x/clp/client/cli/query.go @@ -40,6 +40,8 @@ func GetQueryCmd(queryRoute string) *cobra.Command { GetCmdProviderDistributionParams(queryRoute), GetCmdSwapFeeParams(queryRoute), GetCmdPoolShareEstimate(queryRoute), + GetCmdListRewardsBucket(), + GetCmdShowRewardsBucket(), ) return clpQueryCmd } diff --git a/x/clp/client/cli/query_rewards_bucket.go b/x/clp/client/cli/query_rewards_bucket.go new file mode 100644 index 0000000000..e06ab89213 --- /dev/null +++ b/x/clp/client/cli/query_rewards_bucket.go @@ -0,0 +1,78 @@ +package cli + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "github.com/Sifchain/sifnode/x/clp/types" +) + +func GetCmdListRewardsBucket() *cobra.Command { + cmd := &cobra.Command{ + Use: "list-rewards-bucket", + Short: "list all rewards-bucket", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.AllRewardsBucketReq{ + Pagination: pageReq, + } + + res, err := queryClient.GetRewardsBucketAll(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, cmd.Use) + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func GetCmdShowRewardsBucket() *cobra.Command { + cmd := &cobra.Command{ + Use: "show-rewards-bucket [denom]", + Short: "shows a rewards-bucket", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + argDenom := args[0] + + params := &types.RewardsBucketReq{ + Denom: argDenom, + } + + res, err := queryClient.GetRewardsBucket(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/clp/client/cli/query_rewards_bucket_test.go b/x/clp/client/cli/query_rewards_bucket_test.go new file mode 100644 index 0000000000..70c8cec034 --- /dev/null +++ b/x/clp/client/cli/query_rewards_bucket_test.go @@ -0,0 +1,167 @@ +package cli_test + +import ( + "fmt" + "strconv" + "testing" + + "github.com/cosmos/cosmos-sdk/client/flags" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + tmcli "github.com/tendermint/tendermint/libs/cli" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/Sifchain/sifnode/testutil/network" + "github.com/Sifchain/sifnode/testutil/nullify" + "github.com/Sifchain/sifnode/x/clp/client/cli" + "github.com/Sifchain/sifnode/x/clp/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func networkWithRewardsBucketObjects(t *testing.T, n int) (*network.Network, []types.RewardsBucket) { + t.Helper() + cfg := network.DefaultConfig() + + state := types.DefaultGenesisState() + for i := 0; i < n; i++ { + rewardsBucket := types.RewardsBucket{ + Denom: strconv.Itoa(i), + Amount: sdk.NewInt(int64(i)), + } + nullify.Fill(&rewardsBucket) + state.RewardsBucketList = append(state.RewardsBucketList, rewardsBucket) + } + buf, err := cfg.Codec.MarshalJSON(state) + require.NoError(t, err) + cfg.GenesisState[types.ModuleName] = buf + return network.New(t, cfg), state.RewardsBucketList +} + +func TestShowRewardsBucket(t *testing.T) { + net, objs := networkWithRewardsBucketObjects(t, 2) + + ctx := net.Validators[0].ClientCtx + common := []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + tests := []struct { + desc string + idDenom string + + args []string + err error + obj types.RewardsBucket + }{ + { + desc: "found", + idDenom: objs[0].Denom, + + args: common, + obj: objs[0], + }, + { + desc: "not found", + idDenom: strconv.Itoa(100000), + + args: common, + err: status.Error(codes.NotFound, "not found"), + }, + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + args := []string{ + tc.idDenom, + } + args = append(args, tc.args...) + out, err := clitestutil.ExecTestCLICmd(ctx, cli.GetCmdShowRewardsBucket(), args) + if tc.err != nil { + stat, ok := status.FromError(tc.err) + require.True(t, ok) + require.ErrorIs(t, stat.Err(), tc.err) + } else { + require.NoError(t, err) + var resp types.RewardsBucketRes + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.NotNil(t, resp.RewardsBucket) + require.Equal(t, + nullify.Fill(&tc.obj), //nolint + nullify.Fill(&resp.RewardsBucket), + ) + } + }) + } +} + +func TestListRewardsBucket(t *testing.T) { + net, objs := networkWithRewardsBucketObjects(t, 5) + + ctx := net.Validators[0].ClientCtx + request := func(next []byte, offset, limit uint64, total bool) []string { + args := []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + if next == nil { + args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset)) + } else { + args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next)) + } + args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit)) + if total { + args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal)) + } + return args + } + t.Run("ByOffset", func(t *testing.T) { + step := 2 + for i := 0; i < len(objs); i += step { + args := request(nil, uint64(i), uint64(step), false) + // print args + fmt.Println(args) + out, err := clitestutil.ExecTestCLICmd(ctx, cli.GetCmdListRewardsBucket(), args) + require.NoError(t, err) + var resp types.AllRewardsBucketRes + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.LessOrEqual(t, len(resp.RewardsBucket), step) + require.Subset(t, + nullify.Fill(objs), + nullify.Fill(resp.RewardsBucket), + ) + } + }) + t.Run("ByKey", func(t *testing.T) { + step := 2 + var next []byte + for i := 0; i < len(objs); i += step { + args := request(next, 0, uint64(step), false) + // print args + fmt.Println(args) + out, err := clitestutil.ExecTestCLICmd(ctx, cli.GetCmdListRewardsBucket(), args) + require.NoError(t, err) + var resp types.AllRewardsBucketRes + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.LessOrEqual(t, len(resp.RewardsBucket), step) + require.Subset(t, + nullify.Fill(objs), + nullify.Fill(resp.RewardsBucket), + ) + next = resp.Pagination.NextKey + } + }) + t.Run("Total", func(t *testing.T) { + args := request(nil, 0, uint64(len(objs)), true) + out, err := clitestutil.ExecTestCLICmd(ctx, cli.GetCmdListRewardsBucket(), args) + require.NoError(t, err) + var resp types.AllRewardsBucketRes + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.NoError(t, err) + require.Equal(t, len(objs), int(resp.Pagination.Total)) + require.ElementsMatch(t, + nullify.Fill(objs), + nullify.Fill(resp.RewardsBucket), + ) + }) +} diff --git a/x/clp/client/rest/query.go b/x/clp/client/rest/query.go index 833f1b1dab..359c440f98 100644 --- a/x/clp/client/rest/query.go +++ b/x/clp/client/rest/query.go @@ -48,6 +48,14 @@ func registerQueryRoutes(cliCtx client.Context, r *mux.Router) { "/clp/params", getParamsHandler(cliCtx), ).Methods("GET") + r.HandleFunc( + "/clp/getRewardsBucket", + getRewardsBucketHandler(cliCtx), + ).Methods("GET") + r.HandleFunc( + "/clp/getRewardsBuckets", + getRewardsBucketsHandler(cliCtx), + ).Methods("GET") } func getPoolHandler(cliCtx client.Context) http.HandlerFunc { @@ -221,7 +229,7 @@ func getAssetsHandler(cliCtx client.Context) http.HandlerFunc { } } -//http://localhost:1317/clp/getLpList?symbol=catk +// http://localhost:1317/clp/getLpList?symbol=catk func getLpListHandler(cliCtx client.Context) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) @@ -334,3 +342,83 @@ func getParamsHandler(cliCtx client.Context) http.HandlerFunc { rest.PostProcessResponse(w, cliCtx, res) } } + +func getRewardsBucketHandler(cliCtx client.Context) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) + if !ok { + return + } + //Generate Router + route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryRewardsBucket) + //Generate Params + var params types.RewardsBucketReq + params.Denom = r.URL.Query().Get("denom") + + bz, err := cliCtx.LegacyAmino.MarshalJSON(params) + if err != nil { + rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) + return + } + res, height, err := cliCtx.QueryWithData(route, bz) + if err != nil { + rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) + return + } + + cliCtx = cliCtx.WithHeight(height) + rest.PostProcessResponse(w, cliCtx, res) + } +} + +func getRewardsBucketsHandler(cliCtx client.Context) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) + if !ok { + return + } + + route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryRewardsBuckets) + + var err error + var limit, offset uint64 + + if r.URL.Query().Get("limit") != "" { + limit, err = strconv.ParseUint(r.URL.Query().Get("limit"), 10, 64) + if err != nil { + rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) + return + } + } + + if r.URL.Query().Get("offset") != "" { + offset, err = strconv.ParseUint(r.URL.Query().Get("offset"), 10, 64) + if err != nil { + rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error()) + return + } + } + + params := types.AllRewardsBucketReq{ + Pagination: &query.PageRequest{ + Limit: limit, + Offset: offset, + }, + } + + bz, err := cliCtx.LegacyAmino.MarshalJSON(params) + if err != nil { + rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) + return + } + + res, height, err := cliCtx.QueryWithData(route, bz) + if err != nil { + rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) + return + } + + cliCtx = cliCtx.WithHeight(height) + rest.PostProcessResponse(w, cliCtx, res) + } +} diff --git a/x/clp/genesis.go b/x/clp/genesis.go index 5f762e39de..3a1dbd0d43 100644 --- a/x/clp/genesis.go +++ b/x/clp/genesis.go @@ -60,6 +60,10 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, data types.GenesisState) (res for _, lp := range data.LiquidityProviders { k.SetLiquidityProvider(ctx, lp) } + // Set all the rewardsBucket + for _, elem := range data.RewardsBucketList { + k.SetRewardsBucket(ctx, elem) + } return []abci.ValidatorUpdate{} } @@ -77,11 +81,13 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) types.GenesisState { for i, entry := range whiteList { wl[i] = entry.String() } + rewardsBucketList := keeper.GetAllRewardsBucket(ctx) return types.GenesisState{ Params: params, AddressWhitelist: wl, PoolList: poolList, LiquidityProviders: liquidityProviders, + RewardsBucketList: rewardsBucketList, } } diff --git a/x/clp/genesis_test.go b/x/clp/genesis_test.go index 74cf2e5675..54bbddffbc 100644 --- a/x/clp/genesis_test.go +++ b/x/clp/genesis_test.go @@ -7,7 +7,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + keepertest "github.com/Sifchain/sifnode/testutil/keeper" + "github.com/Sifchain/sifnode/testutil/nullify" "github.com/Sifchain/sifnode/x/clp" "github.com/Sifchain/sifnode/x/clp/keeper" "github.com/Sifchain/sifnode/x/clp/test" @@ -91,3 +94,33 @@ func CreateState(ctx sdk.Context, keeper keeper.Keeper, t *testing.T) (int, int) lpCount := len(assetList) return poolsCount, lpCount } + +func TestGenesis(t *testing.T) { + admin := types.GetDefaultCLPAdmin() + + genesisState := types.GenesisState{ + Params: types.DefaultParams(), + + AddressWhitelist: []string{admin.String()}, + + RewardsBucketList: []types.RewardsBucket{ + { + Denom: "0", + Amount: sdk.NewInt(1), + }, + { + Denom: "1", + Amount: sdk.NewInt(2), + }, + }, + } + + k, ctx := keepertest.ClpKeeper(t) + clp.InitGenesis(ctx, *k, genesisState) + got := clp.ExportGenesis(ctx, *k) + require.NotNil(t, got) + + nullify.Fill(got) + + require.ElementsMatch(t, genesisState.RewardsBucketList, got.RewardsBucketList) +} diff --git a/x/clp/keeper/grpc_query.go b/x/clp/keeper/grpc_query.go index f2152f2bc7..712ce2b455 100755 --- a/x/clp/keeper/grpc_query.go +++ b/x/clp/keeper/grpc_query.go @@ -6,6 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/query" + "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -344,3 +345,48 @@ func calculateSwapInfo(swapStatus int, swapAmount, nativeAssetDepth, externalAss panic("expect not to reach here!") } } + +func (k Querier) GetRewardsBucketAll(goCtx context.Context, req *types.AllRewardsBucketReq) (*types.AllRewardsBucketRes, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + var rewardsBuckets []types.RewardsBucket + ctx := sdk.UnwrapSDKContext(goCtx) + + store := ctx.KVStore(k.Keeper.storeKey) + rewardsBucketStore := prefix.NewStore(store, types.KeyPrefix(types.RewardsBucketKeyPrefix)) + + pageRes, err := query.Paginate(rewardsBucketStore, req.Pagination, func(key []byte, value []byte) error { + var rewardsBucket types.RewardsBucket + if err := k.Keeper.cdc.Unmarshal(value, &rewardsBucket); err != nil { + return err + } + + rewardsBuckets = append(rewardsBuckets, rewardsBucket) + return nil + }) + + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.AllRewardsBucketRes{RewardsBucket: rewardsBuckets, Pagination: pageRes}, nil +} + +func (k Querier) GetRewardsBucket(goCtx context.Context, req *types.RewardsBucketReq) (*types.RewardsBucketRes, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + + val, found := k.Keeper.GetRewardsBucket( + ctx, + req.Denom, + ) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + return &types.RewardsBucketRes{RewardsBucket: val}, nil +} diff --git a/x/clp/keeper/grpc_query_test.go b/x/clp/keeper/grpc_query_test.go index a3a8322e88..059de7839f 100644 --- a/x/clp/keeper/grpc_query_test.go +++ b/x/clp/keeper/grpc_query_test.go @@ -3,9 +3,12 @@ package keeper_test import ( "context" "errors" + "strconv" "testing" sifapp "github.com/Sifchain/sifnode/app" + keepertest "github.com/Sifchain/sifnode/testutil/keeper" + "github.com/Sifchain/sifnode/testutil/nullify" clpkeeper "github.com/Sifchain/sifnode/x/clp/keeper" "github.com/Sifchain/sifnode/x/clp/test" "github.com/Sifchain/sifnode/x/clp/types" @@ -13,8 +16,13 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) +// Prevent strconv unused error +var _ = strconv.IntSize + func TestQuerier_GetPool(t *testing.T) { var ctx context.Context querier := clpkeeper.Querier{} @@ -259,3 +267,113 @@ func TestQuerier_GetPoolShareEstimate(t *testing.T) { }) } } + +func TestRewardsBucketQuerySingle(t *testing.T) { + keeper, ctx := keepertest.ClpKeeper(t) + wctx := sdk.WrapSDKContext(ctx) + querier := clpkeeper.Querier{Keeper: *keeper} + msgs := createNRewardsBucket(keeper, ctx, 2) + tests := []struct { + desc string + request *types.RewardsBucketReq + response *types.RewardsBucketRes + err error + }{ + { + desc: "First", + request: &types.RewardsBucketReq{ + Denom: msgs[0].Denom, + }, + response: &types.RewardsBucketRes{RewardsBucket: msgs[0]}, + }, + { + desc: "Second", + request: &types.RewardsBucketReq{ + Denom: msgs[1].Denom, + }, + response: &types.RewardsBucketRes{RewardsBucket: msgs[1]}, + }, + { + desc: "KeyNotFound", + request: &types.RewardsBucketReq{ + Denom: strconv.Itoa(100000), + }, + err: status.Error(codes.NotFound, "not found"), + }, + { + desc: "InvalidRequest", + err: status.Error(codes.InvalidArgument, "invalid request"), + }, + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + response, err := querier.GetRewardsBucket(wctx, tc.request) + if tc.err != nil { + require.ErrorIs(t, err, tc.err) + } else { + require.NoError(t, err) + require.Equal(t, + nullify.Fill(tc.response), + nullify.Fill(response), + ) + } + }) + } +} + +func TestRewardsBucketQueryPaginated(t *testing.T) { + keeper, ctx := keepertest.ClpKeeper(t) + wctx := sdk.WrapSDKContext(ctx) + querier := clpkeeper.Querier{Keeper: *keeper} + msgs := createNRewardsBucket(keeper, ctx, 5) + + request := func(next []byte, offset, limit uint64, total bool) *types.AllRewardsBucketReq { + return &types.AllRewardsBucketReq{ + Pagination: &query.PageRequest{ + Key: next, + Offset: offset, + Limit: limit, + CountTotal: total, + }, + } + } + t.Run("ByOffset", func(t *testing.T) { + step := 2 + for i := 0; i < len(msgs); i += step { + resp, err := querier.GetRewardsBucketAll(wctx, request(nil, uint64(i), uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.RewardsBucket), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.RewardsBucket), + ) + } + }) + t.Run("ByKey", func(t *testing.T) { + step := 2 + var next []byte + for i := 0; i < len(msgs); i += step { + resp, err := querier.GetRewardsBucketAll(wctx, request(next, 0, uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.RewardsBucket), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.RewardsBucket), + ) + next = resp.Pagination.NextKey + } + }) + t.Run("Total", func(t *testing.T) { + resp, err := querier.GetRewardsBucketAll(wctx, request(nil, 0, 0, true)) + require.NoError(t, err) + require.Equal(t, len(msgs), int(resp.Pagination.Total)) + require.ElementsMatch(t, + nullify.Fill(msgs), + nullify.Fill(resp.RewardsBucket), + ) + }) + t.Run("InvalidRequest", func(t *testing.T) { + _, err := querier.GetRewardsBucketAll(wctx, nil) + require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) + }) +} diff --git a/x/clp/keeper/migrations.go b/x/clp/keeper/migrations.go index 082a28db02..904dcf73b4 100644 --- a/x/clp/keeper/migrations.go +++ b/x/clp/keeper/migrations.go @@ -86,3 +86,9 @@ func (m Migrator) MigrateToVer4(ctx sdk.Context) error { return nil } + +func (m Migrator) MigrateToVer5(ctx sdk.Context) error { + m.keeper.SetRewardsBucket(ctx, types.RewardsBucket{}) + + return nil +} diff --git a/x/clp/keeper/rewards_bucket.go b/x/clp/keeper/rewards_bucket.go new file mode 100644 index 0000000000..325862666f --- /dev/null +++ b/x/clp/keeper/rewards_bucket.go @@ -0,0 +1,63 @@ +package keeper + +import ( + "github.com/Sifchain/sifnode/x/clp/types" + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// SetRewardsBucket set a specific rewardsBucket in the store from its index +func (k Keeper) SetRewardsBucket(ctx sdk.Context, rewardsBucket types.RewardsBucket) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.RewardsBucketKeyPrefix)) + b := k.cdc.MustMarshal(&rewardsBucket) + store.Set(types.RewardsBucketKey( + rewardsBucket.Denom, + ), b) +} + +// GetRewardsBucket returns a rewardsBucket from its index +func (k Keeper) GetRewardsBucket( + ctx sdk.Context, + denom string, + +) (val types.RewardsBucket, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.RewardsBucketKeyPrefix)) + + b := store.Get(types.RewardsBucketKey( + denom, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +// RemoveRewardsBucket removes a rewardsBucket from the store +func (k Keeper) RemoveRewardsBucket( + ctx sdk.Context, + denom string, + +) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.RewardsBucketKeyPrefix)) + store.Delete(types.RewardsBucketKey( + denom, + )) +} + +// GetAllRewardsBucket returns all rewardsBucket +func (k Keeper) GetAllRewardsBucket(ctx sdk.Context) (list []types.RewardsBucket) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.RewardsBucketKeyPrefix)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.RewardsBucket + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/x/clp/keeper/rewards_bucket_test.go b/x/clp/keeper/rewards_bucket_test.go new file mode 100644 index 0000000000..3d0c55e867 --- /dev/null +++ b/x/clp/keeper/rewards_bucket_test.go @@ -0,0 +1,64 @@ +package keeper_test + +import ( + "strconv" + "testing" + + keepertest "github.com/Sifchain/sifnode/testutil/keeper" + "github.com/Sifchain/sifnode/testutil/nullify" + "github.com/Sifchain/sifnode/x/clp/keeper" + "github.com/Sifchain/sifnode/x/clp/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func createNRewardsBucket(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.RewardsBucket { + items := make([]types.RewardsBucket, n) + for i := range items { + items[i].Denom = strconv.Itoa(i) + items[i].Amount = sdk.NewInt(int64(i)) + + keeper.SetRewardsBucket(ctx, items[i]) + } + return items +} + +func TestRewardsBucketGet(t *testing.T) { + keeper, ctx := keepertest.ClpKeeper(t) + items := createNRewardsBucket(keeper, ctx, 10) + for _, item := range items { + rst, found := keeper.GetRewardsBucket(ctx, + item.Denom, + ) + require.True(t, found) + require.Equal(t, + nullify.Fill(&item), //nolint + nullify.Fill(&rst), + ) + } +} +func TestRewardsBucketRemove(t *testing.T) { + keeper, ctx := keepertest.ClpKeeper(t) + items := createNRewardsBucket(keeper, ctx, 10) + for _, item := range items { + keeper.RemoveRewardsBucket(ctx, + item.Denom, + ) + _, found := keeper.GetRewardsBucket(ctx, + item.Denom, + ) + require.False(t, found) + } +} + +func TestRewardsBucketGetAll(t *testing.T) { + keeper, ctx := keepertest.ClpKeeper(t) + items := createNRewardsBucket(keeper, ctx, 10) + require.ElementsMatch(t, + nullify.Fill(items), + nullify.Fill(keeper.GetAllRewardsBucket(ctx)), + ) +} diff --git a/x/clp/module.go b/x/clp/module.go index cd58a84a28..7af7c65cfa 100644 --- a/x/clp/module.go +++ b/x/clp/module.go @@ -146,6 +146,10 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { if err != nil { panic(err) } + err = cfg.RegisterMigration(types.ModuleName, 4, m.MigrateToVer5) + if err != nil { + panic(err) + } } // InitGenesis performs genesis initialization for the clp module. It returns @@ -175,4 +179,4 @@ func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Val return EndBlocker(ctx, am.keeper) } -func (AppModule) ConsensusVersion() uint64 { return 4 } +func (AppModule) ConsensusVersion() uint64 { return 5 } diff --git a/x/clp/types/codec.go b/x/clp/types/codec.go index e849974915..4b394dbf43 100644 --- a/x/clp/types/codec.go +++ b/x/clp/types/codec.go @@ -21,6 +21,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { //nolint var ( amino = codec.NewLegacyAmino() + Amino = amino ModuleCdc = codec.NewAminoCodec(amino) ) diff --git a/x/clp/types/genesis.go b/x/clp/types/genesis.go index 0a6607ef21..6784ba1c9d 100644 --- a/x/clp/types/genesis.go +++ b/x/clp/types/genesis.go @@ -7,19 +7,13 @@ import ( "github.com/cosmos/cosmos-sdk/codec" ) -// NewGenesisState creates a new GenesisState instance -func NewGenesisState(params Params) GenesisState { - return GenesisState{ - Params: params, - } -} - // DefaultGenesisState gets the raw genesis raw message for testing func DefaultGenesisState() *GenesisState { admin := GetDefaultCLPAdmin() return &GenesisState{ - Params: DefaultParams(), - AddressWhitelist: []string{admin.String()}, + Params: DefaultParams(), + AddressWhitelist: []string{admin.String()}, + RewardsBucketList: []RewardsBucket{}, } } @@ -33,3 +27,20 @@ func GetGenesisStateFromAppState(marshaler codec.JSONCodec, appState map[string] } return genesisState } + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + // Check for duplicated index in rewardsBucket + rewardsBucketIndexMap := make(map[string]struct{}) + + for _, elem := range gs.RewardsBucketList { + index := string(RewardsBucketKey(elem.Denom)) + if _, ok := rewardsBucketIndexMap[index]; ok { + return fmt.Errorf("duplicated index for rewardsBucket") + } + rewardsBucketIndexMap[index] = struct{}{} + } + + return gs.Params.Validate() +} diff --git a/x/clp/types/genesis.pb.go b/x/clp/types/genesis.pb.go index b9e8d74e5c..e7b44ebebd 100644 --- a/x/clp/types/genesis.pb.go +++ b/x/clp/types/genesis.pb.go @@ -31,6 +31,7 @@ type GenesisState struct { AddressWhitelist []string `protobuf:"bytes,2,rep,name=address_whitelist,json=addressWhitelist,proto3" json:"address_whitelist,omitempty"` PoolList []*Pool `protobuf:"bytes,3,rep,name=pool_list,json=poolList,proto3" json:"pool_list,omitempty"` LiquidityProviders []*LiquidityProvider `protobuf:"bytes,4,rep,name=liquidity_providers,json=liquidityProviders,proto3" json:"liquidity_providers,omitempty"` + RewardsBucketList []RewardsBucket `protobuf:"bytes,5,rep,name=rewards_bucket_list,json=rewardsBucketList,proto3" json:"rewards_bucket_list"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -94,6 +95,13 @@ func (m *GenesisState) GetLiquidityProviders() []*LiquidityProvider { return nil } +func (m *GenesisState) GetRewardsBucketList() []RewardsBucket { + if m != nil { + return m.RewardsBucketList + } + return nil +} + func init() { proto.RegisterType((*GenesisState)(nil), "sifnode.clp.v1.GenesisState") } @@ -101,27 +109,29 @@ func init() { func init() { proto.RegisterFile("sifnode/clp/v1/genesis.proto", fileDescriptor_cd711ee3eda6f54c) } var fileDescriptor_cd711ee3eda6f54c = []byte{ - // 309 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0xc1, 0x4e, 0xc2, 0x30, - 0x18, 0xc7, 0x57, 0x21, 0x44, 0x8a, 0x31, 0x3a, 0x89, 0x21, 0xd3, 0x54, 0xf4, 0x22, 0x89, 0x49, - 0x1b, 0xd0, 0x17, 0x90, 0x8b, 0x17, 0x0e, 0x64, 0x1c, 0x4c, 0xbc, 0x90, 0xb1, 0x95, 0xd1, 0xa4, - 0xd0, 0xba, 0x16, 0x94, 0xb7, 0xf0, 0xb1, 0x38, 0x72, 0xf4, 0x64, 0xcc, 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 0xbb, 0xbc, 0x3a, 0x52, 0xc3, 0xc7, 0x5d, 0x8a, 0xc0, 0x3e, 0x45, 0xe0, 0x3b, - 0x45, 0xe0, 0x23, 0x43, 0xce, 0x3e, 0x43, 0xce, 0x67, 0x86, 0x9c, 0x97, 0xdb, 0x98, 0xe9, 0xc5, - 0x7a, 0x86, 0x43, 0xb1, 0x24, 0x13, 0x36, 0x0f, 0x17, 0x01, 0x5b, 0x91, 0xb2, 0xc4, 0x77, 0x53, - 0xa3, 0xe9, 0x70, 0xd6, 0x30, 0x25, 0xde, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xd6, 0x99, 0xea, - 0x9f, 0xc3, 0x01, 0x00, 0x00, + // 352 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0xc1, 0x4e, 0xc2, 0x30, + 0x1c, 0xc6, 0x37, 0x40, 0x22, 0xc5, 0x18, 0x19, 0xc4, 0x90, 0xa9, 0x13, 0xf5, 0x20, 0x89, 0xc9, + 0x16, 0xd0, 0x17, 0x90, 0x8b, 0x17, 0x0e, 0x64, 0x1c, 0x4c, 0xbc, 0x2c, 0x63, 0x2b, 0xa3, 0xb1, + 0xd0, 0xda, 0x16, 0x90, 0xb7, 0xf0, 0xb1, 0xb8, 0x98, 0x70, 0xf4, 0x64, 0x0c, 0xbc, 0x88, 0x59, + 0xd7, 0x25, 0x52, 0x6f, 0xcb, 0xff, 0xfb, 0xfd, 0xbf, 0xff, 0xb7, 0x7e, 0xe0, 0x9c, 0xa3, 0xf1, + 0x8c, 0xc4, 0xd0, 0x8b, 0x30, 0xf5, 0x16, 0x1d, 0x2f, 0x81, 0x33, 0xc8, 0x11, 0x77, 0x29, 0x23, + 0x82, 0x58, 0xc7, 0x4a, 0x75, 0x23, 0x4c, 0xdd, 0x45, 0xc7, 0x6e, 0x24, 0x24, 0x21, 0x52, 0xf2, + 0xd2, 0xaf, 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0xe6, 0xcf, 0xd6, 0x31, 0x3f, 0x76, 0x8e, 0xb1, 0xd9, + 0x39, 0xc6, 0xd7, 0xce, 0x31, 0x5e, 0x6e, 0x13, 0x24, 0x26, 0xf3, 0x91, 0x1b, 0x91, 0xa9, 0x37, + 0x44, 0xe3, 0x68, 0x12, 0xa2, 0x99, 0x97, 0x57, 0xf4, 0x2e, 0x4b, 0x92, 0xed, 0x8d, 0xca, 0xb2, + 0x99, 0xfb, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7f, 0x8b, 0xb2, 0x95, 0x3d, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -144,6 +154,20 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.RewardsBucketList) > 0 { + for iNdEx := len(m.RewardsBucketList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RewardsBucketList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } if len(m.LiquidityProviders) > 0 { for iNdEx := len(m.LiquidityProviders) - 1; iNdEx >= 0; iNdEx-- { { @@ -231,6 +255,12 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + if len(m.RewardsBucketList) > 0 { + for _, e := range m.RewardsBucketList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } return n } @@ -402,6 +432,40 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RewardsBucketList", 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.RewardsBucketList = append(m.RewardsBucketList, RewardsBucket{}) + if err := m.RewardsBucketList[len(m.RewardsBucketList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/clp/types/genesis_test.go b/x/clp/types/genesis_test.go index 17f6b9acc3..909f5869ee 100644 --- a/x/clp/types/genesis_test.go +++ b/x/clp/types/genesis_test.go @@ -4,10 +4,11 @@ import ( "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func Test_NewGenesisState(t *testing.T) { - genesisState := NewGenesisState(DefaultParams()) + genesisState := DefaultGenesisState() assert.Equal(t, genesisState.Params.MinCreatePoolThreshold, uint64(100)) } @@ -16,3 +17,61 @@ func Test_DefaultGenesisState(t *testing.T) { assert.Equal(t, genesisState.Params.MinCreatePoolThreshold, uint64(100)) assert.Equal(t, genesisState.AddressWhitelist, []string{"cosmos1ny48eeuk4dm9f63dy0lwfgjhnvud9yvt8tcaat"}) } + +func TestGenesisState_Validate(t *testing.T) { + admin := GetDefaultCLPAdmin() + + tests := []struct { + desc string + genState *GenesisState + valid bool + }{ + { + desc: "default is valid", + genState: DefaultGenesisState(), + valid: true, + }, + { + desc: "valid genesis state", + genState: &GenesisState{ + Params: DefaultParams(), + AddressWhitelist: []string{admin.String()}, + RewardsBucketList: []RewardsBucket{ + { + Denom: "0", + }, + { + Denom: "1", + }, + }, + }, + valid: true, + }, + { + desc: "duplicated rewardsBucket", + genState: &GenesisState{ + Params: DefaultParams(), + AddressWhitelist: []string{admin.String()}, + RewardsBucketList: []RewardsBucket{ + { + Denom: "0", + }, + { + Denom: "0", + }, + }, + }, + valid: false, + }, + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + err := tc.genState.Validate() + if tc.valid { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) + } +} diff --git a/x/clp/types/key_rewards_bucket.go b/x/clp/types/key_rewards_bucket.go new file mode 100644 index 0000000000..5a9e539400 --- /dev/null +++ b/x/clp/types/key_rewards_bucket.go @@ -0,0 +1,23 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // RewardsBucketKeyPrefix is the prefix to retrieve all RewardsBucket + RewardsBucketKeyPrefix = "RewardsBucket/value/" +) + +// RewardsBucketKey returns the store key to retrieve a RewardsBucket from the index fields +func RewardsBucketKey( + denom string, +) []byte { + var key []byte + + denomBytes := []byte(denom) + key = append(key, denomBytes...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/clp/types/keys.go b/x/clp/types/keys.go index 46991800a6..454f7e96f2 100644 --- a/x/clp/types/keys.go +++ b/x/clp/types/keys.go @@ -16,6 +16,9 @@ const ( // RouterKey to be used for routing msgs RouterKey = ModuleName + // MemStoreKey defines the in-memory store key + MemStoreKey = "mem_clp" + // QuerierRoute to be used for querier msgs QuerierRoute = ModuleName @@ -45,6 +48,10 @@ var ( RemovalQueuePrefix = []byte{0x0e} ) +func KeyPrefix(p string) []byte { + return []byte(p) +} + // Generates a key for storing a specific pool // The key is of the format externalticker_nativeticker // Example : eth_rwn and converted into bytes after adding a prefix diff --git a/x/clp/types/querier.go b/x/clp/types/querier.go index 9f30ff8a47..bc35fa3a47 100755 --- a/x/clp/types/querier.go +++ b/x/clp/types/querier.go @@ -11,6 +11,8 @@ const ( QueryParams = "params" QueryRewardParams = "rewardParams" QueryPmtpParams = "pmtpParams" + QueryRewardsBucket = "rewardsBucket" + QueryRewardsBuckets = "allRewardsBuckets" ) func NewQueryReqGetPool(symbol string) PoolReq { diff --git a/x/clp/types/querier.pb.go b/x/clp/types/querier.pb.go index 8ec17886fa..f9930cc5cf 100644 --- a/x/clp/types/querier.pb.go +++ b/x/clp/types/querier.pb.go @@ -1434,6 +1434,190 @@ func (m *SwapInfo) GetStatus() SwapStatus { return SwapStatus_UNSPECIFIED } +type RewardsBucketReq struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` +} + +func (m *RewardsBucketReq) Reset() { *m = RewardsBucketReq{} } +func (m *RewardsBucketReq) String() string { return proto.CompactTextString(m) } +func (*RewardsBucketReq) ProtoMessage() {} +func (*RewardsBucketReq) Descriptor() ([]byte, []int) { + return fileDescriptor_5f4edede314ca3fd, []int{29} +} +func (m *RewardsBucketReq) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RewardsBucketReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RewardsBucketReq.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 *RewardsBucketReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_RewardsBucketReq.Merge(m, src) +} +func (m *RewardsBucketReq) XXX_Size() int { + return m.Size() +} +func (m *RewardsBucketReq) XXX_DiscardUnknown() { + xxx_messageInfo_RewardsBucketReq.DiscardUnknown(m) +} + +var xxx_messageInfo_RewardsBucketReq proto.InternalMessageInfo + +func (m *RewardsBucketReq) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +type RewardsBucketRes struct { + RewardsBucket RewardsBucket `protobuf:"bytes,1,opt,name=rewards_bucket,json=rewardsBucket,proto3" json:"rewards_bucket"` +} + +func (m *RewardsBucketRes) Reset() { *m = RewardsBucketRes{} } +func (m *RewardsBucketRes) String() string { return proto.CompactTextString(m) } +func (*RewardsBucketRes) ProtoMessage() {} +func (*RewardsBucketRes) Descriptor() ([]byte, []int) { + return fileDescriptor_5f4edede314ca3fd, []int{30} +} +func (m *RewardsBucketRes) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RewardsBucketRes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RewardsBucketRes.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 *RewardsBucketRes) XXX_Merge(src proto.Message) { + xxx_messageInfo_RewardsBucketRes.Merge(m, src) +} +func (m *RewardsBucketRes) XXX_Size() int { + return m.Size() +} +func (m *RewardsBucketRes) XXX_DiscardUnknown() { + xxx_messageInfo_RewardsBucketRes.DiscardUnknown(m) +} + +var xxx_messageInfo_RewardsBucketRes proto.InternalMessageInfo + +func (m *RewardsBucketRes) GetRewardsBucket() RewardsBucket { + if m != nil { + return m.RewardsBucket + } + return RewardsBucket{} +} + +type AllRewardsBucketReq struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *AllRewardsBucketReq) Reset() { *m = AllRewardsBucketReq{} } +func (m *AllRewardsBucketReq) String() string { return proto.CompactTextString(m) } +func (*AllRewardsBucketReq) ProtoMessage() {} +func (*AllRewardsBucketReq) Descriptor() ([]byte, []int) { + return fileDescriptor_5f4edede314ca3fd, []int{31} +} +func (m *AllRewardsBucketReq) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AllRewardsBucketReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AllRewardsBucketReq.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 *AllRewardsBucketReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_AllRewardsBucketReq.Merge(m, src) +} +func (m *AllRewardsBucketReq) XXX_Size() int { + return m.Size() +} +func (m *AllRewardsBucketReq) XXX_DiscardUnknown() { + xxx_messageInfo_AllRewardsBucketReq.DiscardUnknown(m) +} + +var xxx_messageInfo_AllRewardsBucketReq proto.InternalMessageInfo + +func (m *AllRewardsBucketReq) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +type AllRewardsBucketRes struct { + RewardsBucket []RewardsBucket `protobuf:"bytes,1,rep,name=rewards_bucket,json=rewardsBucket,proto3" json:"rewards_bucket"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *AllRewardsBucketRes) Reset() { *m = AllRewardsBucketRes{} } +func (m *AllRewardsBucketRes) String() string { return proto.CompactTextString(m) } +func (*AllRewardsBucketRes) ProtoMessage() {} +func (*AllRewardsBucketRes) Descriptor() ([]byte, []int) { + return fileDescriptor_5f4edede314ca3fd, []int{32} +} +func (m *AllRewardsBucketRes) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AllRewardsBucketRes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AllRewardsBucketRes.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 *AllRewardsBucketRes) XXX_Merge(src proto.Message) { + xxx_messageInfo_AllRewardsBucketRes.Merge(m, src) +} +func (m *AllRewardsBucketRes) XXX_Size() int { + return m.Size() +} +func (m *AllRewardsBucketRes) XXX_DiscardUnknown() { + xxx_messageInfo_AllRewardsBucketRes.DiscardUnknown(m) +} + +var xxx_messageInfo_AllRewardsBucketRes proto.InternalMessageInfo + +func (m *AllRewardsBucketRes) GetRewardsBucket() []RewardsBucket { + if m != nil { + return m.RewardsBucket + } + return nil +} + +func (m *AllRewardsBucketRes) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + func init() { proto.RegisterEnum("sifnode.clp.v1.SwapStatus", SwapStatus_name, SwapStatus_value) proto.RegisterType((*PoolReq)(nil), "sifnode.clp.v1.PoolReq") @@ -1465,120 +1649,134 @@ func init() { proto.RegisterType((*PoolShareEstimateReq)(nil), "sifnode.clp.v1.PoolShareEstimateReq") proto.RegisterType((*PoolShareEstimateRes)(nil), "sifnode.clp.v1.PoolShareEstimateRes") proto.RegisterType((*SwapInfo)(nil), "sifnode.clp.v1.SwapInfo") + proto.RegisterType((*RewardsBucketReq)(nil), "sifnode.clp.v1.RewardsBucketReq") + proto.RegisterType((*RewardsBucketRes)(nil), "sifnode.clp.v1.RewardsBucketRes") + proto.RegisterType((*AllRewardsBucketReq)(nil), "sifnode.clp.v1.AllRewardsBucketReq") + proto.RegisterType((*AllRewardsBucketRes)(nil), "sifnode.clp.v1.AllRewardsBucketRes") } func init() { proto.RegisterFile("sifnode/clp/v1/querier.proto", fileDescriptor_5f4edede314ca3fd) } var fileDescriptor_5f4edede314ca3fd = []byte{ - // 1726 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x59, 0xcd, 0x6f, 0x1b, 0x5b, - 0x15, 0xcf, 0xd8, 0x69, 0x3e, 0x4e, 0xda, 0x7c, 0x9c, 0x26, 0xa9, 0x6b, 0x12, 0x27, 0x8c, 0x4a, - 0x5e, 0x08, 0x89, 0xfd, 0xd2, 0xd7, 0x27, 0x78, 0x3c, 0x58, 0x38, 0x34, 0x31, 0x11, 0x21, 0x98, - 0x49, 0x4b, 0x05, 0x52, 0xb1, 0xc6, 0xf6, 0xb5, 0x3d, 0xea, 0xd8, 0x33, 0x9e, 0x7b, 0x9d, 0x36, - 0x2a, 0x05, 0x09, 0x75, 0x81, 0xc4, 0xa6, 0x52, 0x77, 0x2c, 0x50, 0x37, 0x2c, 0x58, 0x20, 0xb1, - 0x40, 0x62, 0xc3, 0x16, 0xa9, 0x48, 0x48, 0x54, 0x62, 0x03, 0x2c, 0x0a, 0x6a, 0x59, 0x94, 0xff, - 0x02, 0xdd, 0x3b, 0x77, 0x6c, 0xcf, 0x97, 0xe3, 0x58, 0x15, 0x08, 0x56, 0xc9, 0xcc, 0xf9, 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 0x3c, 0x37, 0xed, 0xb9, - 0x16, 0xbc, 0x05, 0xcb, 0xe4, 0x11, 0x23, 0x4e, 0x4b, 0x37, 0x03, 0x3e, 0x49, 0xe1, 0xb3, 0xe8, - 0x59, 0x7d, 0x5e, 0xbd, 0x8f, 0x31, 0xee, 0x9b, 0xaf, 0x1f, 0xc1, 0x65, 0x81, 0x3b, 0x32, 0x28, - 0xe3, 0xdc, 0xf9, 0x39, 0x52, 0x02, 0x1c, 0x05, 0x46, 0x30, 0x31, 0xea, 0x08, 0xf6, 0x71, 0xfd, - 0x73, 0xc5, 0x57, 0x01, 0xc5, 0x1d, 0x98, 0x10, 0x6d, 0x79, 0x13, 0xb9, 0x14, 0xe4, 0x55, 0xa0, - 0x35, 0x09, 0xea, 0x6b, 0x2c, 0x31, 0x60, 0xca, 0x92, 0xa3, 0x4f, 0xd9, 0x4f, 0x15, 0x48, 0x85, - 0x3e, 0xe5, 0x6d, 0x9d, 0xe9, 0xff, 0x15, 0xba, 0xfe, 0x1a, 0x5f, 0x0d, 0xc5, 0xfb, 0x70, 0x2d, - 0x3c, 0x9e, 0xa5, 0xaa, 0xce, 0x74, 0xc9, 0xe5, 0xe7, 0xce, 0x9d, 0x51, 0x11, 0x6a, 0xc9, 0x8c, - 0x7a, 0x1d, 0x4b, 0xf5, 0x41, 0x04, 0xd5, 0xa3, 0xec, 0x4b, 0x4f, 0xa3, 0x7a, 0xf3, 0x06, 0x33, - 0x6e, 0x51, 0xbf, 0x7f, 0x8a, 0xff, 0x14, 0x5f, 0x06, 0x45, 0x0d, 0xae, 0x86, 0x29, 0xf6, 0x46, - 0x75, 0x88, 0x2d, 0x00, 0x43, 0xd4, 0xfe, 0x07, 0x46, 0xd8, 0x80, 0xa5, 0x50, 0x25, 0x11, 0x27, - 0xca, 0xfb, 0x20, 0xef, 0x8f, 0x4a, 0x74, 0xae, 0xff, 0x51, 0xe6, 0x66, 0x60, 0xba, 0x28, 0x04, - 0x88, 0x46, 0xda, 0xea, 0x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0x44, 0x89, 0x59, 0xdc, 0x1e, 0x3c, 0x0d, 0xd2, 0xcf, 0x2b, 0xf9, - 0x37, 0x0a, 0xac, 0x72, 0xa2, 0x62, 0x35, 0x32, 0xee, 0x5c, 0x40, 0x4f, 0x93, 0x76, 0xfa, 0x42, - 0x70, 0xaa, 0x7e, 0x2c, 0xaa, 0xce, 0xe1, 0x4e, 0x98, 0xd8, 0xee, 0xee, 0xd3, 0xe7, 0xe8, 0x95, - 0xfd, 0x43, 0x98, 0x2f, 0x10, 0xe6, 0x93, 0xe7, 0xb8, 0x1e, 0x23, 0x91, 0x7b, 0xb5, 0x9d, 0x87, - 0x18, 0x34, 0x5e, 0x3e, 0xb9, 0x8f, 0xcf, 0xdc, 0x73, 0x25, 0xa4, 0x21, 0xc3, 0xe7, 0x4a, 0x94, - 0x06, 0x4f, 0x0f, 0x83, 0x1a, 0xb4, 0xfd, 0xf0, 0xc3, 0xad, 0x44, 0x39, 0xbe, 0x44, 0xa4, 0xc3, - 0x5e, 0xfe, 0xe5, 0x9b, 0x8c, 0xf2, 0xea, 0x4d, 0x46, 0xf9, 0xc7, 0x9b, 0x8c, 0xf2, 0xec, 0x6d, - 0x66, 0xec, 0xd5, 0xdb, 0xcc, 0xd8, 0x5f, 0xde, 0x66, 0xc6, 0xbe, 0xd7, 0xaf, 0x28, 0x4e, 0xbc, - 0x48, 0xde, 0x3f, 0x55, 0x1e, 0x89, 0x98, 0x42, 0x56, 0x94, 0x27, 0xc4, 0x7f, 0x42, 0x3e, 0xfa, - 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0xef, 0xab, 0xf9, 0x6e, 0xd2, 0x19, 0x00, 0x00, + // 1887 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x59, 0xcf, 0x6f, 0x1c, 0x49, + 0x15, 0x76, 0xcf, 0x38, 0x8e, 0xfd, 0x9c, 0x38, 0xf6, 0xf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0x74, 0x69, 0x41, 0xd9, 0xc8, 0x67, 0x46, 0x14, 0x40, 0x5e, + 0x4d, 0x48, 0xb8, 0x17, 0x09, 0x63, 0x52, 0x84, 0x71, 0x65, 0x68, 0x18, 0xd4, 0x73, 0x1d, 0x4a, + 0x22, 0x71, 0xbc, 0x07, 0x4b, 0xb7, 0xad, 0x76, 0xc7, 0xaa, 0x5b, 0xec, 0xe4, 0xc0, 0x77, 0x8f, + 0xad, 0x3a, 0xf1, 0x07, 0x2c, 0x28, 0xae, 0x01, 0xd8, 0x5e, 0x8c, 0xf6, 0x8c, 0xed, 0x49, 0xbe, + 0x7d, 0xeb, 0xfd, 0x42, 0x49, 0xb5, 0x4c, 0xf1, 0x00, 0xd0, 0x0e, 0xdf, 0x57, 0x3d, 0x39, 0x20, + 0x57, 0xe2, 0xf3, 0x71, 0xe5, 0x92, 0x16, 0x16, 0xec, 0xf8, 0x2b, 0x7c, 0x13, 0x96, 0x78, 0x34, + 0xc7, 0xa4, 0x6a, 0x50, 0x4a, 0x58, 0xb5, 0x66, 0xd8, 0x86, 0x63, 0x12, 0xc9, 0x0e, 0x83, 0xb1, + 0x0a, 0x1f, 0xda, 0x09, 0x46, 0xf0, 0x06, 0xac, 0x90, 0x0f, 0x18, 0xf1, 0x1d, 0xc3, 0x8e, 0xcd, + 0xc9, 0x8b, 0x39, 0x4b, 0xe1, 0x68, 0x64, 0x56, 0x6f, 0x31, 0x26, 0x23, 0xf9, 0xf5, 0x43, 0x38, + 0x23, 0x70, 0xb7, 0x2d, 0xca, 0xb8, 0x76, 0x51, 0x8d, 0x94, 0x98, 0x46, 0xb1, 0x14, 0xcc, 0x8d, + 0x9b, 0x82, 0x7d, 0x5a, 0xff, 0x42, 0x89, 0x30, 0xa0, 0xb8, 0x0d, 0x53, 0x22, 0xac, 0x30, 0x23, + 0x97, 0xe3, 0xba, 0x0a, 0xb4, 0x2e, 0x41, 0x7d, 0x81, 0xe5, 0x06, 0x64, 0x59, 0x7e, 0xfc, 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, 0xc5, 0x89, 0xef, 0xf5, 0x17, 0xc0, + 0x87, 0xa1, 0xa1, 0xf0, 0x17, 0xbc, 0x0f, 0x84, 0x2d, 0x51, 0x05, 0xd7, 0xa6, 0xc4, 0x0f, 0x77, + 0x6f, 0xfd, 0x27, 0x00, 0x00, 0xff, 0xff, 0x4a, 0x51, 0x7d, 0xae, 0xa6, 0x1c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1607,6 +1805,9 @@ type QueryClient interface { GetProviderDistributionParams(ctx context.Context, in *ProviderDistributionParamsReq, opts ...grpc.CallOption) (*ProviderDistributionParamsRes, error) GetSwapFeeParams(ctx context.Context, in *SwapFeeParamsReq, opts ...grpc.CallOption) (*SwapFeeParamsRes, error) GetPoolShareEstimate(ctx context.Context, in *PoolShareEstimateReq, opts ...grpc.CallOption) (*PoolShareEstimateRes, error) + // Queries a list of RewardsBucket items. + GetRewardsBucket(ctx context.Context, in *RewardsBucketReq, opts ...grpc.CallOption) (*RewardsBucketRes, error) + GetRewardsBucketAll(ctx context.Context, in *AllRewardsBucketReq, opts ...grpc.CallOption) (*AllRewardsBucketRes, error) } type queryClient struct { @@ -1743,6 +1944,24 @@ func (c *queryClient) GetPoolShareEstimate(ctx context.Context, in *PoolShareEst return out, nil } +func (c *queryClient) GetRewardsBucket(ctx context.Context, in *RewardsBucketReq, opts ...grpc.CallOption) (*RewardsBucketRes, error) { + out := new(RewardsBucketRes) + err := c.cc.Invoke(ctx, "/sifnode.clp.v1.Query/GetRewardsBucket", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetRewardsBucketAll(ctx context.Context, in *AllRewardsBucketReq, opts ...grpc.CallOption) (*AllRewardsBucketRes, error) { + out := new(AllRewardsBucketRes) + err := c.cc.Invoke(ctx, "/sifnode.clp.v1.Query/GetRewardsBucketAll", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { GetPool(context.Context, *PoolReq) (*PoolRes, error) @@ -1759,6 +1978,9 @@ type QueryServer interface { GetProviderDistributionParams(context.Context, *ProviderDistributionParamsReq) (*ProviderDistributionParamsRes, error) GetSwapFeeParams(context.Context, *SwapFeeParamsReq) (*SwapFeeParamsRes, error) GetPoolShareEstimate(context.Context, *PoolShareEstimateReq) (*PoolShareEstimateRes, error) + // Queries a list of RewardsBucket items. + GetRewardsBucket(context.Context, *RewardsBucketReq) (*RewardsBucketRes, error) + GetRewardsBucketAll(context.Context, *AllRewardsBucketReq) (*AllRewardsBucketRes, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -1807,6 +2029,12 @@ func (*UnimplementedQueryServer) GetSwapFeeParams(ctx context.Context, req *Swap func (*UnimplementedQueryServer) GetPoolShareEstimate(ctx context.Context, req *PoolShareEstimateReq) (*PoolShareEstimateRes, error) { return nil, status.Errorf(codes.Unimplemented, "method GetPoolShareEstimate not implemented") } +func (*UnimplementedQueryServer) GetRewardsBucket(ctx context.Context, req *RewardsBucketReq) (*RewardsBucketRes, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetRewardsBucket not implemented") +} +func (*UnimplementedQueryServer) GetRewardsBucketAll(ctx context.Context, req *AllRewardsBucketReq) (*AllRewardsBucketRes, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetRewardsBucketAll not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -2064,6 +2292,42 @@ func _Query_GetPoolShareEstimate_Handler(srv interface{}, ctx context.Context, d return interceptor(ctx, in, info, handler) } +func _Query_GetRewardsBucket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RewardsBucketReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetRewardsBucket(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/sifnode.clp.v1.Query/GetRewardsBucket", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetRewardsBucket(ctx, req.(*RewardsBucketReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetRewardsBucketAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AllRewardsBucketReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetRewardsBucketAll(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/sifnode.clp.v1.Query/GetRewardsBucketAll", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetRewardsBucketAll(ctx, req.(*AllRewardsBucketReq)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "sifnode.clp.v1.Query", HandlerType: (*QueryServer)(nil), @@ -2124,6 +2388,14 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "GetPoolShareEstimate", Handler: _Query_GetPoolShareEstimate_Handler, }, + { + MethodName: "GetRewardsBucket", + Handler: _Query_GetRewardsBucket_Handler, + }, + { + MethodName: "GetRewardsBucketAll", + Handler: _Query_GetRewardsBucketAll_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "sifnode/clp/v1/querier.proto", @@ -3382,61 +3654,208 @@ func (m *SwapInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func encodeVarintQuerier(dAtA []byte, offset int, v uint64) int { - offset -= sovQuerier(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *RewardsBucketReq) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *PoolReq) Size() (n int) { - if m == nil { - return 0 - } + +func (m *RewardsBucketReq) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RewardsBucketReq) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Symbol) - if l > 0 { - n += 1 + l + sovQuerier(uint64(l)) + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuerier(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *PoolRes) Size() (n int) { - if m == nil { - return 0 +func (m *RewardsBucketRes) 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 *RewardsBucketRes) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RewardsBucketRes) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.Pool != nil { - l = m.Pool.Size() - n += 1 + l + sovQuerier(uint64(l)) - } - l = len(m.ClpModuleAddress) - if l > 0 { - n += 1 + l + sovQuerier(uint64(l)) - } - if m.Height != 0 { - n += 1 + sovQuerier(uint64(m.Height)) + { + size, err := m.RewardsBucket.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuerier(dAtA, i, uint64(size)) } - return n + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m *PoolsReq) Size() (n int) { - if m == nil { - return 0 +func (m *AllRewardsBucketReq) 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 *AllRewardsBucketReq) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AllRewardsBucketReq) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuerier(uint64(l)) + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuerier(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil +} + +func (m *AllRewardsBucketRes) 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 *AllRewardsBucketRes) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AllRewardsBucketRes) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuerier(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.RewardsBucket) > 0 { + for iNdEx := len(m.RewardsBucket) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RewardsBucket[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuerier(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintQuerier(dAtA []byte, offset int, v uint64) int { + offset -= sovQuerier(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *PoolReq) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Symbol) + if l > 0 { + n += 1 + l + sovQuerier(uint64(l)) + } + return n +} + +func (m *PoolRes) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pool != nil { + l = m.Pool.Size() + n += 1 + l + sovQuerier(uint64(l)) + } + l = len(m.ClpModuleAddress) + if l > 0 { + n += 1 + l + sovQuerier(uint64(l)) + } + if m.Height != 0 { + n += 1 + sovQuerier(uint64(m.Height)) + } + return n +} + +func (m *PoolsReq) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuerier(uint64(l)) + } + return n } func (m *PoolsRes) Size() (n int) { @@ -3870,6 +4289,62 @@ func (m *SwapInfo) Size() (n int) { return n } +func (m *RewardsBucketReq) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovQuerier(uint64(l)) + } + return n +} + +func (m *RewardsBucketRes) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.RewardsBucket.Size() + n += 1 + l + sovQuerier(uint64(l)) + return n +} + +func (m *AllRewardsBucketReq) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuerier(uint64(l)) + } + return n +} + +func (m *AllRewardsBucketRes) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.RewardsBucket) > 0 { + for _, e := range m.RewardsBucket { + l = e.Size() + n += 1 + l + sovQuerier(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuerier(uint64(l)) + } + return n +} + func sovQuerier(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -7237,6 +7712,377 @@ func (m *SwapInfo) Unmarshal(dAtA []byte) error { } return nil } +func (m *RewardsBucketReq) 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 ErrIntOverflowQuerier + } + 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: RewardsBucketReq: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RewardsBucketReq: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuerier + } + 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 ErrInvalidLengthQuerier + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuerier + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuerier(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuerier + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RewardsBucketRes) 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 ErrIntOverflowQuerier + } + 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: RewardsBucketRes: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RewardsBucketRes: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RewardsBucket", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuerier + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuerier + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuerier + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RewardsBucket.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuerier(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuerier + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AllRewardsBucketReq) 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 ErrIntOverflowQuerier + } + 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: AllRewardsBucketReq: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AllRewardsBucketReq: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuerier + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuerier + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuerier + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuerier(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuerier + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AllRewardsBucketRes) 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 ErrIntOverflowQuerier + } + 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: AllRewardsBucketRes: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AllRewardsBucketRes: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RewardsBucket", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuerier + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuerier + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuerier + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RewardsBucket = append(m.RewardsBucket, RewardsBucket{}) + if err := m.RewardsBucket[len(m.RewardsBucket)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuerier + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuerier + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuerier + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuerier(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuerier + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuerier(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/clp/types/querier.pb.gw.go b/x/clp/types/querier.pb.gw.go index 57fd4bb03c..5c08845568 100644 --- a/x/clp/types/querier.pb.gw.go +++ b/x/clp/types/querier.pb.gw.go @@ -593,6 +593,96 @@ func local_request_Query_GetPoolShareEstimate_0(ctx context.Context, marshaler r } +func request_Query_GetRewardsBucket_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq RewardsBucketReq + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + } + + msg, err := client.GetRewardsBucket(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetRewardsBucket_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq RewardsBucketReq + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + } + + msg, err := server.GetRewardsBucket(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_GetRewardsBucketAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_GetRewardsBucketAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AllRewardsBucketReq + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetRewardsBucketAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GetRewardsBucketAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetRewardsBucketAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AllRewardsBucketReq + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetRewardsBucketAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GetRewardsBucketAll(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. @@ -879,6 +969,46 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_GetRewardsBucket_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GetRewardsBucket_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetRewardsBucket_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetRewardsBucketAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GetRewardsBucketAll_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetRewardsBucketAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1200,6 +1330,46 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_GetRewardsBucket_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_GetRewardsBucket_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_GetRewardsBucket_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetRewardsBucketAll_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_GetRewardsBucketAll_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_GetRewardsBucketAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1231,6 +1401,10 @@ var ( pattern_Query_GetSwapFeeParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"sifchain", "clp", "v1", "swap_fee_rate"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_GetPoolShareEstimate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"sifchain", "clp", "v1", "pool_share_estimate"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_GetRewardsBucket_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"sifchain", "clp", "v1", "rewards_bucket", "denom"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_GetRewardsBucketAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 1, 2, 3}, []string{"sifchain", "clp", "v1", "rewards_bucket"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( @@ -1261,4 +1435,8 @@ var ( forward_Query_GetSwapFeeParams_0 = runtime.ForwardResponseMessage forward_Query_GetPoolShareEstimate_0 = runtime.ForwardResponseMessage + + forward_Query_GetRewardsBucket_0 = runtime.ForwardResponseMessage + + forward_Query_GetRewardsBucketAll_0 = runtime.ForwardResponseMessage ) diff --git a/x/clp/types/rewards_bucket.pb.go b/x/clp/types/rewards_bucket.pb.go new file mode 100644 index 0000000000..d9ca55969a --- /dev/null +++ b/x/clp/types/rewards_bucket.pb.go @@ -0,0 +1,370 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: sifnode/clp/v1/rewards_bucket.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" + 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 + +type RewardsBucket struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount" yaml:"amount"` +} + +func (m *RewardsBucket) Reset() { *m = RewardsBucket{} } +func (m *RewardsBucket) String() string { return proto.CompactTextString(m) } +func (*RewardsBucket) ProtoMessage() {} +func (*RewardsBucket) Descriptor() ([]byte, []int) { + return fileDescriptor_ff038fbaa5779c08, []int{0} +} +func (m *RewardsBucket) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RewardsBucket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RewardsBucket.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 *RewardsBucket) XXX_Merge(src proto.Message) { + xxx_messageInfo_RewardsBucket.Merge(m, src) +} +func (m *RewardsBucket) XXX_Size() int { + return m.Size() +} +func (m *RewardsBucket) XXX_DiscardUnknown() { + xxx_messageInfo_RewardsBucket.DiscardUnknown(m) +} + +var xxx_messageInfo_RewardsBucket proto.InternalMessageInfo + +func (m *RewardsBucket) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func init() { + proto.RegisterType((*RewardsBucket)(nil), "sifnode.clp.v1.RewardsBucket") +} + +func init() { + proto.RegisterFile("sifnode/clp/v1/rewards_bucket.proto", fileDescriptor_ff038fbaa5779c08) +} + +var fileDescriptor_ff038fbaa5779c08 = []byte{ + // 240 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2e, 0xce, 0x4c, 0xcb, + 0xcb, 0x4f, 0x49, 0xd5, 0x4f, 0xce, 0x29, 0xd0, 0x2f, 0x33, 0xd4, 0x2f, 0x4a, 0x2d, 0x4f, 0x2c, + 0x4a, 0x29, 0x8e, 0x4f, 0x2a, 0x4d, 0xce, 0x4e, 0x2d, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, + 0xe2, 0x83, 0x2a, 0xd2, 0x4b, 0xce, 0x29, 0xd0, 0x2b, 0x33, 0x94, 0x12, 0x49, 0xcf, 0x4f, 0xcf, + 0x07, 0x4b, 0xe9, 0x83, 0x58, 0x10, 0x55, 0x4a, 0x75, 0x5c, 0xbc, 0x41, 0x10, 0xdd, 0x4e, 0x60, + 0xcd, 0x42, 0x22, 0x5c, 0xac, 0x29, 0xa9, 0x79, 0xf9, 0xb9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, + 0x41, 0x10, 0x8e, 0x50, 0x38, 0x17, 0x5b, 0x62, 0x6e, 0x7e, 0x69, 0x5e, 0x89, 0x04, 0x13, 0x48, + 0xd8, 0xc9, 0xfe, 0xc4, 0x3d, 0x79, 0x86, 0x5b, 0xf7, 0xe4, 0xd5, 0xd2, 0x33, 0x4b, 0x32, 0x4a, + 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x93, 0xf3, 0x8b, 0x73, 0xf3, 0x8b, 0xa1, 0x94, 0x6e, 0x71, + 0x4a, 0xb6, 0x7e, 0x49, 0x65, 0x41, 0x6a, 0xb1, 0x9e, 0x67, 0x5e, 0xc9, 0xa7, 0x7b, 0xf2, 0xbc, + 0x95, 0x89, 0xb9, 0x39, 0x56, 0x4a, 0x10, 0x53, 0x94, 0x82, 0xa0, 0xc6, 0x39, 0x39, 0x9e, 0x78, + 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, + 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x3a, 0x92, 0xd1, 0xc1, 0x99, 0x69, 0xc9, + 0x19, 0x89, 0x99, 0x79, 0xfa, 0x30, 0x8f, 0x57, 0x80, 0xbd, 0x0e, 0x36, 0x3f, 0x89, 0x0d, 0xec, + 0x13, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf2, 0x84, 0x5f, 0x1d, 0x16, 0x01, 0x00, 0x00, +} + +func (m *RewardsBucket) 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 *RewardsBucket) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RewardsBucket) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintRewardsBucket(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintRewardsBucket(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintRewardsBucket(dAtA []byte, offset int, v uint64) int { + offset -= sovRewardsBucket(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *RewardsBucket) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovRewardsBucket(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovRewardsBucket(uint64(l)) + return n +} + +func sovRewardsBucket(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozRewardsBucket(x uint64) (n int) { + return sovRewardsBucket(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *RewardsBucket) 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 ErrIntOverflowRewardsBucket + } + 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: RewardsBucket: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RewardsBucket: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRewardsBucket + } + 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 ErrInvalidLengthRewardsBucket + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRewardsBucket + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRewardsBucket + } + 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 ErrInvalidLengthRewardsBucket + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRewardsBucket + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRewardsBucket(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRewardsBucket + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipRewardsBucket(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, ErrIntOverflowRewardsBucket + } + 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, ErrIntOverflowRewardsBucket + } + 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, ErrIntOverflowRewardsBucket + } + 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, ErrInvalidLengthRewardsBucket + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupRewardsBucket + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthRewardsBucket + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthRewardsBucket = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRewardsBucket = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupRewardsBucket = fmt.Errorf("proto: unexpected end of group") +)