mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-24 15:25:18 +00:00
Savings module scaffold (#1188)
* module files * proto types * types and generated proto types * keeper * client scaffold * add savings module to app * remove placeholder types file * implement rest and add to module * update comments * remove unused imports from proto files * remove abci * remove refs to other modules * remove endblocker call * genesis init test for module account
This commit is contained in:
parent
214a07b788
commit
8540a5c06f
18
app/app.go
18
app/app.go
@ -111,6 +111,9 @@ import (
|
||||
pricefeed "github.com/kava-labs/kava/x/pricefeed"
|
||||
pricefeedkeeper "github.com/kava-labs/kava/x/pricefeed/keeper"
|
||||
pricefeedtypes "github.com/kava-labs/kava/x/pricefeed/types"
|
||||
savings "github.com/kava-labs/kava/x/savings"
|
||||
savingskeeper "github.com/kava-labs/kava/x/savings/keeper"
|
||||
savingstypes "github.com/kava-labs/kava/x/savings/types"
|
||||
"github.com/kava-labs/kava/x/swap"
|
||||
swapkeeper "github.com/kava-labs/kava/x/swap/keeper"
|
||||
swaptypes "github.com/kava-labs/kava/x/swap/types"
|
||||
@ -164,6 +167,7 @@ var (
|
||||
hard.AppModuleBasic{},
|
||||
committee.AppModuleBasic{},
|
||||
incentive.AppModuleBasic{},
|
||||
savings.AppModuleBasic{},
|
||||
validatorvesting.AppModuleBasic{},
|
||||
)
|
||||
|
||||
@ -186,6 +190,7 @@ var (
|
||||
cdptypes.ModuleName: {authtypes.Minter, authtypes.Burner},
|
||||
cdptypes.LiquidatorMacc: {authtypes.Minter, authtypes.Burner},
|
||||
hardtypes.ModuleAccountName: {authtypes.Minter},
|
||||
savingstypes.ModuleAccountName: nil,
|
||||
}
|
||||
)
|
||||
|
||||
@ -243,6 +248,7 @@ type App struct {
|
||||
hardKeeper hardkeeper.Keeper
|
||||
committeeKeeper committeekeeper.Keeper
|
||||
incentiveKeeper incentivekeeper.Keeper
|
||||
savingsKeeper savingskeeper.Keeper
|
||||
|
||||
// make scoped keepers public for test purposes
|
||||
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
|
||||
@ -295,7 +301,7 @@ func NewApp(
|
||||
capabilitytypes.StoreKey, kavadisttypes.StoreKey, auctiontypes.StoreKey,
|
||||
issuancetypes.StoreKey, bep3types.StoreKey, pricefeedtypes.StoreKey,
|
||||
swaptypes.StoreKey, cdptypes.StoreKey, hardtypes.StoreKey,
|
||||
committeetypes.StoreKey, incentivetypes.StoreKey,
|
||||
committeetypes.StoreKey, incentivetypes.StoreKey, savingstypes.StoreKey,
|
||||
)
|
||||
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
|
||||
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
|
||||
@ -334,6 +340,7 @@ func NewApp(
|
||||
cdpSubspace := app.paramsKeeper.Subspace(cdptypes.ModuleName)
|
||||
hardSubspace := app.paramsKeeper.Subspace(hardtypes.ModuleName)
|
||||
incentiveSubspace := app.paramsKeeper.Subspace(incentivetypes.ModuleName)
|
||||
savingsSubspace := app.paramsKeeper.Subspace(savingstypes.ModuleName)
|
||||
ibcSubspace := app.paramsKeeper.Subspace(ibchost.ModuleName)
|
||||
ibctransferSubspace := app.paramsKeeper.Subspace(ibctransfertypes.ModuleName)
|
||||
|
||||
@ -519,7 +526,6 @@ func NewApp(
|
||||
app.pricefeedKeeper,
|
||||
app.auctionKeeper,
|
||||
)
|
||||
|
||||
app.incentiveKeeper = incentivekeeper.NewKeeper(
|
||||
appCodec,
|
||||
keys[incentivetypes.StoreKey],
|
||||
@ -531,7 +537,11 @@ func NewApp(
|
||||
app.stakingKeeper,
|
||||
&swapKeeper,
|
||||
)
|
||||
|
||||
app.savingsKeeper = savingskeeper.NewKeeper(
|
||||
appCodec,
|
||||
keys[savingstypes.StoreKey],
|
||||
savingsSubspace,
|
||||
)
|
||||
// create committee keeper with router
|
||||
committeeGovRouter := govtypes.NewRouter()
|
||||
committeeGovRouter.
|
||||
@ -590,6 +600,7 @@ func NewApp(
|
||||
hard.NewAppModule(app.hardKeeper, app.accountKeeper, app.bankKeeper, app.pricefeedKeeper),
|
||||
committee.NewAppModule(app.committeeKeeper, app.accountKeeper),
|
||||
incentive.NewAppModule(app.incentiveKeeper, app.accountKeeper, app.bankKeeper, app.cdpKeeper),
|
||||
savings.NewAppModule(app.savingsKeeper, app.accountKeeper),
|
||||
)
|
||||
|
||||
// Warning: Some begin blockers must run before others. Ensure the dependencies are understood before modifying this list.
|
||||
@ -645,6 +656,7 @@ func NewApp(
|
||||
kavadisttypes.ModuleName,
|
||||
auctiontypes.ModuleName,
|
||||
issuancetypes.ModuleName,
|
||||
savingstypes.ModuleName,
|
||||
bep3types.ModuleName,
|
||||
pricefeedtypes.ModuleName,
|
||||
swaptypes.ModuleName,
|
||||
|
@ -37,6 +37,7 @@ import (
|
||||
issuancekeeper "github.com/kava-labs/kava/x/issuance/keeper"
|
||||
kavadistkeeper "github.com/kava-labs/kava/x/kavadist/keeper"
|
||||
pricefeedkeeper "github.com/kava-labs/kava/x/pricefeed/keeper"
|
||||
savingskeeper "github.com/kava-labs/kava/x/savings/keeper"
|
||||
swapkeeper "github.com/kava-labs/kava/x/swap/keeper"
|
||||
)
|
||||
|
||||
@ -99,6 +100,7 @@ func (tApp TestApp) GetCDPKeeper() cdpkeeper.Keeper { return tApp.cd
|
||||
func (tApp TestApp) GetHardKeeper() hardkeeper.Keeper { return tApp.hardKeeper }
|
||||
func (tApp TestApp) GetCommitteeKeeper() committeekeeper.Keeper { return tApp.committeeKeeper }
|
||||
func (tApp TestApp) GetIncentiveKeeper() incentivekeeper.Keeper { return tApp.incentiveKeeper }
|
||||
func (tApp TestApp) GetSavingsKeeper() savingskeeper.Keeper { return tApp.savingsKeeper }
|
||||
|
||||
// LegacyAmino returns the app's amino codec.
|
||||
func (app *App) LegacyAmino() *codec.LegacyAmino {
|
||||
|
15
proto/kava/savings/v1beta1/genesis.proto
Normal file
15
proto/kava/savings/v1beta1/genesis.proto
Normal file
@ -0,0 +1,15 @@
|
||||
syntax = "proto3";
|
||||
package kava.savings.v1beta1;
|
||||
|
||||
import "kava/savings/v1beta1/store.proto";
|
||||
import "gogoproto/gogo.proto";
|
||||
|
||||
option go_package = "github.com/kava-labs/kava/x/savings/types";
|
||||
option (gogoproto.equal_all) = true;
|
||||
option (gogoproto.verbose_equal_all) = true;
|
||||
|
||||
// GenesisState defines the savings module's genesis state.
|
||||
message GenesisState {
|
||||
// params defines all the paramaters of the module.
|
||||
Params params = 1 [(gogoproto.nullable) = false];
|
||||
}
|
30
proto/kava/savings/v1beta1/query.proto
Normal file
30
proto/kava/savings/v1beta1/query.proto
Normal file
@ -0,0 +1,30 @@
|
||||
syntax = "proto3";
|
||||
package kava.savings.v1beta1;
|
||||
|
||||
import "kava/savings/v1beta1/store.proto";
|
||||
import "gogoproto/gogo.proto";
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
option go_package = "github.com/kava-labs/kava/x/savings/types";
|
||||
option (gogoproto.equal_all) = true;
|
||||
option (gogoproto.verbose_equal_all) = true;
|
||||
|
||||
// Query defines the gRPC querier service for savings module
|
||||
service Query {
|
||||
// Params queries all parameters of the savings module.
|
||||
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
|
||||
option (google.api.http).get = "/kava/savings/v1beta1/params";
|
||||
}
|
||||
}
|
||||
|
||||
// QueryParamsRequest defines the request type for querying x/savings
|
||||
// parameters.
|
||||
message QueryParamsRequest {}
|
||||
|
||||
// QueryParamsResponse defines the response type for querying x/savings
|
||||
// parameters.
|
||||
message QueryParamsResponse {
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
Params params = 1 [(gogoproto.nullable) = false];
|
||||
}
|
11
proto/kava/savings/v1beta1/store.proto
Normal file
11
proto/kava/savings/v1beta1/store.proto
Normal file
@ -0,0 +1,11 @@
|
||||
syntax = "proto3";
|
||||
package kava.savings.v1beta1;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
|
||||
option go_package = "github.com/kava-labs/kava/x/savings/types";
|
||||
option (gogoproto.equal_all) = true;
|
||||
option (gogoproto.verbose_equal_all) = true;
|
||||
|
||||
// Params defines the parameters for the savings module.
|
||||
message Params {}
|
11
proto/kava/savings/v1beta1/tx.proto
Normal file
11
proto/kava/savings/v1beta1/tx.proto
Normal file
@ -0,0 +1,11 @@
|
||||
syntax = "proto3";
|
||||
package kava.savings.v1beta1;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
|
||||
option go_package = "github.com/kava-labs/kava/x/savings/types";
|
||||
option (gogoproto.equal_all) = true;
|
||||
option (gogoproto.verbose_equal_all) = true;
|
||||
|
||||
// Msg defines the savings Msg service.
|
||||
service Msg {}
|
60
x/savings/client/cli/query.go
Normal file
60
x/savings/client/cli/query.go
Normal file
@ -0,0 +1,60 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
|
||||
"github.com/kava-labs/kava/x/savings/types"
|
||||
)
|
||||
|
||||
// GetQueryCmd returns the cli query commands for this module
|
||||
func GetQueryCmd() *cobra.Command {
|
||||
savingsQueryCmd := &cobra.Command{
|
||||
Use: types.ModuleName,
|
||||
Short: "Querying commands for the savings module",
|
||||
DisableFlagParsing: true,
|
||||
SuggestionsMinimumDistance: 2,
|
||||
RunE: client.ValidateCmd,
|
||||
}
|
||||
|
||||
cmds := []*cobra.Command{
|
||||
GetCmdQueryParams(),
|
||||
}
|
||||
|
||||
for _, cmd := range cmds {
|
||||
flags.AddQueryFlagsToCmd(cmd)
|
||||
}
|
||||
|
||||
savingsQueryCmd.AddCommand(cmds...)
|
||||
|
||||
return savingsQueryCmd
|
||||
}
|
||||
|
||||
// GetCmdQueryParams queries the savings module parameters
|
||||
func GetCmdQueryParams() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "params",
|
||||
Short: "get the savings module parameters",
|
||||
Long: "Get the current global savings module parameters.",
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
clientCtx, err := client.GetClientQueryContext(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
queryClient := types.NewQueryClient(clientCtx)
|
||||
|
||||
res, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return clientCtx.PrintProto(&res.Params)
|
||||
},
|
||||
}
|
||||
}
|
31
x/savings/client/cli/tx.go
Normal file
31
x/savings/client/cli/tx.go
Normal file
@ -0,0 +1,31 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
|
||||
"github.com/kava-labs/kava/x/savings/types"
|
||||
)
|
||||
|
||||
// GetTxCmd returns the transaction commands for this module
|
||||
func GetTxCmd() *cobra.Command {
|
||||
savingsTxCmd := &cobra.Command{
|
||||
Use: types.ModuleName,
|
||||
Short: "savings transactions subcommands",
|
||||
DisableFlagParsing: true,
|
||||
SuggestionsMinimumDistance: 2,
|
||||
RunE: client.ValidateCmd,
|
||||
}
|
||||
|
||||
cmds := []*cobra.Command{}
|
||||
|
||||
for _, cmd := range cmds {
|
||||
flags.AddTxFlagsToCmd(cmd)
|
||||
}
|
||||
|
||||
savingsTxCmd.AddCommand(cmds...)
|
||||
|
||||
return savingsTxCmd
|
||||
}
|
36
x/savings/client/rest/query.go
Normal file
36
x/savings/client/rest/query.go
Normal file
@ -0,0 +1,36 @@
|
||||
package rest
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/types/rest"
|
||||
|
||||
"github.com/kava-labs/kava/x/savings/types"
|
||||
)
|
||||
|
||||
// define routes that get registered by the main application
|
||||
func registerQueryRoutes(cliCtx client.Context, r *mux.Router) {
|
||||
r.HandleFunc(fmt.Sprintf("/%s/parameters", types.ModuleName), queryParamsHandlerFn(cliCtx)).Methods("GET")
|
||||
}
|
||||
|
||||
func queryParamsHandlerFn(cliCtx client.Context) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
// Parse the query height
|
||||
cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
res, height, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", types.ModuleName, types.QueryGetParams), nil)
|
||||
if err != nil {
|
||||
rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
cliCtx = cliCtx.WithHeight(height)
|
||||
rest.PostProcessResponse(w, cliCtx, res)
|
||||
}
|
||||
}
|
13
x/savings/client/rest/rest.go
Normal file
13
x/savings/client/rest/rest.go
Normal file
@ -0,0 +1,13 @@
|
||||
package rest
|
||||
|
||||
import (
|
||||
"github.com/gorilla/mux"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
)
|
||||
|
||||
// RegisterRoutes - Central function to define routes that get registered by the main application
|
||||
func RegisterRoutes(cliCtx client.Context, r *mux.Router) {
|
||||
registerQueryRoutes(cliCtx, r)
|
||||
registerTxRoutes(cliCtx, r)
|
||||
}
|
9
x/savings/client/rest/tx.go
Normal file
9
x/savings/client/rest/tx.go
Normal file
@ -0,0 +1,9 @@
|
||||
package rest
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
func registerTxRoutes(cliCtx client.Context, r *mux.Router) {
|
||||
}
|
27
x/savings/genesis.go
Normal file
27
x/savings/genesis.go
Normal file
@ -0,0 +1,27 @@
|
||||
package savings
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
"github.com/kava-labs/kava/x/savings/keeper"
|
||||
"github.com/kava-labs/kava/x/savings/types"
|
||||
)
|
||||
|
||||
// InitGenesis initializes genesis state
|
||||
func InitGenesis(ctx sdk.Context, k keeper.Keeper, ak types.AccountKeeper, gs types.GenesisState) {
|
||||
k.SetParams(ctx, gs.Params)
|
||||
|
||||
// check if the module account exists
|
||||
SavingsModuleAccount := ak.GetModuleAccount(ctx, types.ModuleAccountName)
|
||||
if SavingsModuleAccount == nil {
|
||||
panic(fmt.Sprintf("%s module account has not been set", SavingsModuleAccount))
|
||||
}
|
||||
}
|
||||
|
||||
// ExportGenesis returns a GenesisState for a given context and keeper
|
||||
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState {
|
||||
params := k.GetParams(ctx)
|
||||
return types.NewGenesisState(params)
|
||||
}
|
55
x/savings/genesis_test.go
Normal file
55
x/savings/genesis_test.go
Normal file
@ -0,0 +1,55 @@
|
||||
package savings_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
|
||||
tmtime "github.com/tendermint/tendermint/types/time"
|
||||
|
||||
"github.com/kava-labs/kava/app"
|
||||
"github.com/kava-labs/kava/x/savings/keeper"
|
||||
"github.com/kava-labs/kava/x/savings/types"
|
||||
)
|
||||
|
||||
type GenesisTestSuite struct {
|
||||
suite.Suite
|
||||
|
||||
app app.TestApp
|
||||
genTime time.Time
|
||||
ctx sdk.Context
|
||||
keeper keeper.Keeper
|
||||
addrs []sdk.AccAddress
|
||||
}
|
||||
|
||||
func (suite *GenesisTestSuite) SetupTest() {
|
||||
tApp := app.NewTestApp()
|
||||
suite.genTime = tmtime.Canonical(time.Date(2022, 1, 1, 1, 1, 1, 1, time.UTC))
|
||||
suite.ctx = tApp.NewContext(true, tmproto.Header{Height: 1, Time: suite.genTime})
|
||||
suite.keeper = tApp.GetSavingsKeeper()
|
||||
suite.app = tApp
|
||||
|
||||
_, addrs := app.GeneratePrivKeyAddressPairs(3)
|
||||
suite.addrs = addrs
|
||||
}
|
||||
|
||||
func (suite *GenesisTestSuite) TestInitGenesis() {
|
||||
params := types.NewParams()
|
||||
savingsGenesis := types.NewGenesisState(params)
|
||||
|
||||
suite.NotPanics(
|
||||
func() {
|
||||
suite.app.InitializeFromGenesisStatesWithTime(
|
||||
suite.genTime,
|
||||
app.GenesisState{types.ModuleName: suite.app.AppCodec().MustMarshalJSON(&savingsGenesis)},
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
func TestGenesisTestSuite(t *testing.T) {
|
||||
suite.Run(t, new(GenesisTestSuite))
|
||||
}
|
35
x/savings/keeper/grpc_query.go
Normal file
35
x/savings/keeper/grpc_query.go
Normal file
@ -0,0 +1,35 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
"github.com/kava-labs/kava/x/savings/types"
|
||||
)
|
||||
|
||||
type queryServer struct {
|
||||
keeper Keeper
|
||||
}
|
||||
|
||||
// NewQueryServerImpl creates a new server for handling gRPC queries.
|
||||
func NewQueryServerImpl(k Keeper) types.QueryServer {
|
||||
return &queryServer{keeper: k}
|
||||
}
|
||||
|
||||
var _ types.QueryServer = queryServer{}
|
||||
|
||||
// Params implements the gRPC service handler for querying x/savings parameters.
|
||||
func (s queryServer) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
|
||||
if req == nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "empty request")
|
||||
}
|
||||
|
||||
sdkCtx := sdk.UnwrapSDKContext(c)
|
||||
params := s.keeper.GetParams(sdkCtx)
|
||||
|
||||
return &types.QueryParamsResponse{Params: params}, nil
|
||||
}
|
42
x/savings/keeper/keeper.go
Normal file
42
x/savings/keeper/keeper.go
Normal file
@ -0,0 +1,42 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
|
||||
"github.com/kava-labs/kava/x/savings/types"
|
||||
)
|
||||
|
||||
// Keeper struct for savings module
|
||||
type Keeper struct {
|
||||
// key used to access the stores from Context
|
||||
key sdk.StoreKey
|
||||
// Codec for binary encoding/decoding
|
||||
cdc codec.Codec
|
||||
// The reference to the Paramstore to get and set savings specific params
|
||||
paramSubspace paramtypes.Subspace
|
||||
}
|
||||
|
||||
// NewKeeper returns a new keeper for the savings module.
|
||||
func NewKeeper(
|
||||
cdc codec.Codec, key sdk.StoreKey, paramstore paramtypes.Subspace,
|
||||
) Keeper {
|
||||
if !paramstore.HasKeyTable() {
|
||||
paramstore = paramstore.WithKeyTable(types.ParamKeyTable())
|
||||
}
|
||||
|
||||
return Keeper{
|
||||
cdc: cdc,
|
||||
key: key,
|
||||
paramSubspace: paramstore,
|
||||
}
|
||||
}
|
||||
|
||||
// Logger returns a module-specific logger.
|
||||
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
|
||||
return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName))
|
||||
}
|
19
x/savings/keeper/params.go
Normal file
19
x/savings/keeper/params.go
Normal file
@ -0,0 +1,19 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
"github.com/kava-labs/kava/x/savings/types"
|
||||
)
|
||||
|
||||
// GetParams returns the params from the store
|
||||
func (k Keeper) GetParams(ctx sdk.Context) types.Params {
|
||||
var p types.Params
|
||||
k.paramSubspace.GetParamSet(ctx, &p)
|
||||
return p
|
||||
}
|
||||
|
||||
// SetParams sets params on the store
|
||||
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
|
||||
k.paramSubspace.SetParamSet(ctx, ¶ms)
|
||||
}
|
36
x/savings/keeper/querier.go
Normal file
36
x/savings/keeper/querier.go
Normal file
@ -0,0 +1,36 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
|
||||
"github.com/kava-labs/kava/x/savings/types"
|
||||
)
|
||||
|
||||
// NewQuerier is the module level router for state queries
|
||||
func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier {
|
||||
return func(ctx sdk.Context, path []string, req abci.RequestQuery) (res []byte, err error) {
|
||||
switch path[0] {
|
||||
case types.QueryGetParams:
|
||||
return queryGetParams(ctx, req, keeper, legacyQuerierCdc)
|
||||
default:
|
||||
return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unknown %s query endpoint", types.ModuleName)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// query params in the pricefeed store
|
||||
func queryGetParams(ctx sdk.Context, req abci.RequestQuery, keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) {
|
||||
params := keeper.GetParams(ctx)
|
||||
|
||||
// Encode results
|
||||
bz, err := codec.MarshalJSONIndent(legacyQuerierCdc, params)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error())
|
||||
}
|
||||
return bz, nil
|
||||
}
|
195
x/savings/module.go
Normal file
195
x/savings/module.go
Normal file
@ -0,0 +1,195 @@
|
||||
package savings
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
|
||||
"github.com/kava-labs/kava/x/savings/client/cli"
|
||||
"github.com/kava-labs/kava/x/savings/client/rest"
|
||||
"github.com/kava-labs/kava/x/savings/keeper"
|
||||
"github.com/kava-labs/kava/x/savings/types"
|
||||
)
|
||||
|
||||
var (
|
||||
_ module.AppModule = AppModule{}
|
||||
_ module.AppModuleBasic = AppModuleBasic{}
|
||||
// _ module.AppModuleSimulation = AppModule{} // TODO simulation
|
||||
)
|
||||
|
||||
// AppModuleBasic app module basics object
|
||||
type AppModuleBasic struct{}
|
||||
|
||||
// Name get module name
|
||||
func (AppModuleBasic) Name() string {
|
||||
return types.ModuleName
|
||||
}
|
||||
|
||||
// RegisterLegacyAminoCodec register module codec
|
||||
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
|
||||
types.RegisterLegacyAminoCodec(cdc)
|
||||
}
|
||||
|
||||
// DefaultGenesis default genesis state
|
||||
func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
|
||||
gs := types.DefaultGenesisState()
|
||||
return cdc.MustMarshalJSON(&gs)
|
||||
}
|
||||
|
||||
// ValidateGenesis module validate genesis
|
||||
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error {
|
||||
var gs types.GenesisState
|
||||
err := cdc.UnmarshalJSON(bz, &gs)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return gs.Validate()
|
||||
}
|
||||
|
||||
// RegisterInterfaces implements InterfaceModule.RegisterInterfaces
|
||||
func (a AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) {
|
||||
types.RegisterInterfaces(registry)
|
||||
}
|
||||
|
||||
// RegisterRESTRoutes registers REST routes for the module.
|
||||
func (a AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) {
|
||||
rest.RegisterRoutes(clientCtx, rtr)
|
||||
}
|
||||
|
||||
// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the gov module.
|
||||
func (a AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
|
||||
if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// GetTxCmd returns the root tx command for the module.
|
||||
func (AppModuleBasic) GetTxCmd() *cobra.Command {
|
||||
return cli.GetTxCmd()
|
||||
}
|
||||
|
||||
// GetQueryCmd returns no root query command for the module.
|
||||
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
|
||||
return cli.GetQueryCmd()
|
||||
}
|
||||
|
||||
//____________________________________________________________________________
|
||||
|
||||
// AppModule app module type
|
||||
type AppModule struct {
|
||||
AppModuleBasic
|
||||
|
||||
keeper keeper.Keeper
|
||||
accountKeeper authkeeper.AccountKeeper
|
||||
}
|
||||
|
||||
// NewAppModule creates a new AppModule object
|
||||
func NewAppModule(keeper keeper.Keeper, accountKeeper authkeeper.AccountKeeper) AppModule {
|
||||
return AppModule{
|
||||
AppModuleBasic: AppModuleBasic{},
|
||||
keeper: keeper,
|
||||
accountKeeper: accountKeeper,
|
||||
}
|
||||
}
|
||||
|
||||
// Name module name
|
||||
func (am AppModule) Name() string {
|
||||
return am.AppModuleBasic.Name()
|
||||
}
|
||||
|
||||
// RegisterInvariants register module invariants
|
||||
func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {}
|
||||
|
||||
// Route module message route name
|
||||
func (am AppModule) Route() sdk.Route {
|
||||
return sdk.Route{}
|
||||
}
|
||||
|
||||
// QuerierRoute module querier route name
|
||||
func (AppModule) QuerierRoute() string {
|
||||
return types.QuerierRoute
|
||||
}
|
||||
|
||||
// LegacyQuerierHandler returns no sdk.Querier.
|
||||
func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier {
|
||||
return keeper.NewQuerier(am.keeper, legacyQuerierCdc)
|
||||
}
|
||||
|
||||
// ConsensusVersion implements AppModule/ConsensusVersion.
|
||||
func (AppModule) ConsensusVersion() uint64 {
|
||||
return 1
|
||||
}
|
||||
|
||||
// RegisterServices registers module services.
|
||||
func (am AppModule) RegisterServices(cfg module.Configurator) {
|
||||
// TODO:
|
||||
// types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
|
||||
// types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServerImpl(am.keeper))
|
||||
}
|
||||
|
||||
// InitGenesis module init-genesis
|
||||
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate {
|
||||
var genState types.GenesisState
|
||||
// Initialize global index to index in genesis state
|
||||
cdc.MustUnmarshalJSON(gs, &genState)
|
||||
|
||||
InitGenesis(ctx, am.keeper, am.accountKeeper, genState)
|
||||
|
||||
return []abci.ValidatorUpdate{}
|
||||
}
|
||||
|
||||
// ExportGenesis module export genesis
|
||||
func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage {
|
||||
gs := ExportGenesis(ctx, am.keeper)
|
||||
return cdc.MustMarshalJSON(&gs)
|
||||
}
|
||||
|
||||
// BeginBlock module begin-block
|
||||
func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {
|
||||
}
|
||||
|
||||
// EndBlock module end-block
|
||||
func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate {
|
||||
return []abci.ValidatorUpdate{}
|
||||
}
|
||||
|
||||
//____________________________________________________________________________
|
||||
|
||||
// AppModuleSimulation functions
|
||||
|
||||
// GenerateGenesisState creates a randomized GenState of the price feed module
|
||||
// func (AppModuleBasic) GenerateGenesisState(simState *module.SimulationState) {
|
||||
// simulation.RandomizedGenState(simState)
|
||||
// }
|
||||
|
||||
// // ProposalContents doesn't return any content functions for governance proposals.
|
||||
// func (AppModuleBasic) ProposalContents(_ module.SimulationState) []sim.WeightedProposalContent {
|
||||
// return nil
|
||||
// }
|
||||
|
||||
// // RandomizedParams returns nil because price feed has no params.
|
||||
// func (AppModuleBasic) RandomizedParams(r *rand.Rand) []sim.ParamChange {
|
||||
// return simulation.ParamChanges(r)
|
||||
// }
|
||||
|
||||
// // RegisterStoreDecoder registers a decoder for price feed module's types
|
||||
// func (AppModuleBasic) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) {
|
||||
// sdr[StoreKey] = simulation.DecodeStore
|
||||
// }
|
||||
|
||||
// // WeightedOperations returns the all the price feed module operations with their respective weights.
|
||||
// func (am AppModule) WeightedOperations(simState module.SimulationState) []sim.WeightedOperation {
|
||||
// return simulation.WeightedOperations(simState.AppParams, simState.Cdc, am.accountKeeper, am.keeper)
|
||||
// }
|
29
x/savings/types/codec.go
Normal file
29
x/savings/types/codec.go
Normal file
@ -0,0 +1,29 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/codec/types"
|
||||
|
||||
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
// RegisterLegacyAminoCodec registers all the necessary types and interfaces for the
|
||||
// savings module.
|
||||
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
|
||||
}
|
||||
|
||||
func RegisterInterfaces(registry types.InterfaceRegistry) {
|
||||
registry.RegisterImplementations((*sdk.Msg)(nil))
|
||||
}
|
||||
|
||||
var (
|
||||
amino = codec.NewLegacyAmino()
|
||||
ModuleCdc = codec.NewAminoCodec(amino)
|
||||
)
|
||||
|
||||
func init() {
|
||||
RegisterLegacyAminoCodec(amino)
|
||||
cryptocodec.RegisterCrypto(amino)
|
||||
}
|
12
x/savings/types/errors.go
Normal file
12
x/savings/types/errors.go
Normal file
@ -0,0 +1,12 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
)
|
||||
|
||||
// DONTCOVER
|
||||
|
||||
var (
|
||||
// ErrEmptyInput error for empty input
|
||||
ErrEmptyInput = sdkerrors.Register(ModuleName, 2, "input must not be empty")
|
||||
)
|
8
x/savings/types/events.go
Normal file
8
x/savings/types/events.go
Normal file
@ -0,0 +1,8 @@
|
||||
package types
|
||||
|
||||
const (
|
||||
EventTypePlaceholder = "placeholder"
|
||||
|
||||
AttributeValueCategory = ModuleName
|
||||
AttributePlaceholderID = "placeholder_id"
|
||||
)
|
15
x/savings/types/expected_keepers.go
Normal file
15
x/savings/types/expected_keepers.go
Normal file
@ -0,0 +1,15 @@
|
||||
package types // noalias
|
||||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
)
|
||||
|
||||
// AccountKeeper defines the expected keeper interface for interacting with account
|
||||
type AccountKeeper interface {
|
||||
GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI
|
||||
SetAccount(ctx sdk.Context, acc authtypes.AccountI)
|
||||
|
||||
GetModuleAddress(name string) sdk.AccAddress
|
||||
GetModuleAccount(ctx sdk.Context, name string) authtypes.ModuleAccountI
|
||||
}
|
21
x/savings/types/genesis.go
Normal file
21
x/savings/types/genesis.go
Normal file
@ -0,0 +1,21 @@
|
||||
package types
|
||||
|
||||
// NewGenesisState creates a new genesis state for the savings module
|
||||
func NewGenesisState(p Params) GenesisState {
|
||||
return GenesisState{
|
||||
Params: p,
|
||||
}
|
||||
}
|
||||
|
||||
// DefaultGenesisState defines default GenesisState for savings
|
||||
func DefaultGenesisState() GenesisState {
|
||||
return NewGenesisState(
|
||||
DefaultParams(),
|
||||
)
|
||||
}
|
||||
|
||||
// Validate performs basic validation of genesis data returning an
|
||||
// error for any failed validation criteria.
|
||||
func (gs GenesisState) Validate() error {
|
||||
return gs.Params.Validate()
|
||||
}
|
379
x/savings/types/genesis.pb.go
Normal file
379
x/savings/types/genesis.pb.go
Normal file
@ -0,0 +1,379 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: kava/savings/v1beta1/genesis.proto
|
||||
|
||||
package types
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
_ "github.com/gogo/protobuf/gogoproto"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
io "io"
|
||||
math "math"
|
||||
math_bits "math/bits"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
// GenesisState defines the savings module's genesis state.
|
||||
type GenesisState struct {
|
||||
// params defines all the paramaters of the module.
|
||||
Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
|
||||
}
|
||||
|
||||
func (m *GenesisState) Reset() { *m = GenesisState{} }
|
||||
func (m *GenesisState) String() string { return proto.CompactTextString(m) }
|
||||
func (*GenesisState) ProtoMessage() {}
|
||||
func (*GenesisState) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_f5dcde4d417fcec8, []int{0}
|
||||
}
|
||||
func (m *GenesisState) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *GenesisState) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GenesisState.Merge(m, src)
|
||||
}
|
||||
func (m *GenesisState) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *GenesisState) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GenesisState.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GenesisState proto.InternalMessageInfo
|
||||
|
||||
func (m *GenesisState) GetParams() Params {
|
||||
if m != nil {
|
||||
return m.Params
|
||||
}
|
||||
return Params{}
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*GenesisState)(nil), "kava.savings.v1beta1.GenesisState")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("kava/savings/v1beta1/genesis.proto", fileDescriptor_f5dcde4d417fcec8)
|
||||
}
|
||||
|
||||
var fileDescriptor_f5dcde4d417fcec8 = []byte{
|
||||
// 213 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xca, 0x4e, 0x2c, 0x4b,
|
||||
0xd4, 0x2f, 0x4e, 0x2c, 0xcb, 0xcc, 0x4b, 0x2f, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34,
|
||||
0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12,
|
||||
0x01, 0xa9, 0xd1, 0x83, 0xaa, 0xd1, 0x83, 0xaa, 0x91, 0x52, 0xc0, 0xaa, 0xb3, 0xb8, 0x24, 0xbf,
|
||||
0x28, 0x15, 0xa2, 0x4f, 0x4a, 0x24, 0x3d, 0x3f, 0x3d, 0x1f, 0xcc, 0xd4, 0x07, 0xb1, 0x20, 0xa2,
|
||||
0x4a, 0x5e, 0x5c, 0x3c, 0xee, 0x10, 0xe3, 0x83, 0x4b, 0x12, 0x4b, 0x52, 0x85, 0xac, 0xb8, 0xd8,
|
||||
0x0a, 0x12, 0x8b, 0x12, 0x73, 0x8b, 0x25, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0x64, 0xf4, 0xb0,
|
||||
0x59, 0xa7, 0x17, 0x00, 0x56, 0xe3, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x54, 0x87, 0x93,
|
||||
0xf7, 0x83, 0x87, 0x72, 0x8c, 0x2b, 0x1e, 0xc9, 0x31, 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, 0x66, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e,
|
||||
0xc8, 0x5c, 0xdd, 0x9c, 0xc4, 0xa4, 0x62, 0x30, 0x4b, 0xbf, 0x02, 0xee, 0xf8, 0x92, 0xca, 0x82,
|
||||
0xd4, 0xe2, 0x24, 0x36, 0xb0, 0xfb, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x34, 0x4a, 0x83,
|
||||
0x71, 0x13, 0x01, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (this *GenesisState) VerboseEqual(that interface{}) error {
|
||||
if that == nil {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("that == nil && this != nil")
|
||||
}
|
||||
|
||||
that1, ok := that.(*GenesisState)
|
||||
if !ok {
|
||||
that2, ok := that.(GenesisState)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return fmt.Errorf("that is not of type *GenesisState")
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("that is type *GenesisState but is nil && this != nil")
|
||||
} else if this == nil {
|
||||
return fmt.Errorf("that is type *GenesisState but is not nil && this == nil")
|
||||
}
|
||||
if !this.Params.Equal(&that1.Params) {
|
||||
return fmt.Errorf("Params this(%v) Not Equal that(%v)", this.Params, that1.Params)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *GenesisState) Equal(that interface{}) bool {
|
||||
if that == nil {
|
||||
return this == nil
|
||||
}
|
||||
|
||||
that1, ok := that.(*GenesisState)
|
||||
if !ok {
|
||||
that2, ok := that.(GenesisState)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
return this == nil
|
||||
} else if this == nil {
|
||||
return false
|
||||
}
|
||||
if !this.Params.Equal(&that1.Params) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
{
|
||||
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintGenesis(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovGenesis(v)
|
||||
base := offset
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return base
|
||||
}
|
||||
func (m *GenesisState) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = m.Params.Size()
|
||||
n += 1 + l + sovGenesis(uint64(l))
|
||||
return n
|
||||
}
|
||||
|
||||
func sovGenesis(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
func sozGenesis(x uint64) (n int) {
|
||||
return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *GenesisState) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: GenesisState: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipGenesis(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipGenesis(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
depth := 0
|
||||
for iNdEx < l {
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
wireType := int(wire & 0x7)
|
||||
switch wireType {
|
||||
case 0:
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx++
|
||||
if dAtA[iNdEx-1] < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 1:
|
||||
iNdEx += 8
|
||||
case 2:
|
||||
var length int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
length |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthGenesis
|
||||
}
|
||||
iNdEx += length
|
||||
case 3:
|
||||
depth++
|
||||
case 4:
|
||||
if depth == 0 {
|
||||
return 0, ErrUnexpectedEndOfGroupGenesis
|
||||
}
|
||||
depth--
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
if iNdEx < 0 {
|
||||
return 0, ErrInvalidLengthGenesis
|
||||
}
|
||||
if depth == 0 {
|
||||
return iNdEx, nil
|
||||
}
|
||||
}
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow")
|
||||
ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
|
||||
)
|
26
x/savings/types/key.go
Normal file
26
x/savings/types/key.go
Normal file
@ -0,0 +1,26 @@
|
||||
package types
|
||||
|
||||
const (
|
||||
// ModuleName The name that will be used throughout the module
|
||||
ModuleName = "savings"
|
||||
|
||||
// StoreKey Top level store key where all module items will be stored
|
||||
StoreKey = ModuleName
|
||||
|
||||
// RouterKey Top level router key
|
||||
RouterKey = ModuleName
|
||||
|
||||
// QuerierRoute is the querier route for gov
|
||||
QuerierRoute = ModuleName
|
||||
|
||||
// DefaultParamspace default namestore
|
||||
DefaultParamspace = ModuleName
|
||||
|
||||
// ModuleAccountName is the module account's name
|
||||
ModuleAccountName = ModuleName
|
||||
)
|
||||
|
||||
var (
|
||||
// Add store prefixes here
|
||||
// IndexPrefix = []byte{0x00}
|
||||
)
|
34
x/savings/types/params.go
Normal file
34
x/savings/types/params.go
Normal file
@ -0,0 +1,34 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||
)
|
||||
|
||||
// Parameter keys
|
||||
var ()
|
||||
|
||||
// NewParams creates a new Params object
|
||||
func NewParams() Params {
|
||||
return Params{}
|
||||
}
|
||||
|
||||
// DefaultParams default params for savings
|
||||
func DefaultParams() Params {
|
||||
return NewParams()
|
||||
}
|
||||
|
||||
// ParamKeyTable Key declaration for parameters
|
||||
func ParamKeyTable() paramtypes.KeyTable {
|
||||
return paramtypes.NewKeyTable().RegisterParamSet(&Params{})
|
||||
}
|
||||
|
||||
// ParamSetPairs implements the ParamSet interface and returns all the key/value pairs
|
||||
// pairs of savings module's parameters.
|
||||
func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
|
||||
return paramtypes.ParamSetPairs{}
|
||||
}
|
||||
|
||||
// Validate ensure that params have valid values
|
||||
func (p Params) Validate() error {
|
||||
return nil
|
||||
}
|
6
x/savings/types/querier.go
Normal file
6
x/savings/types/querier.go
Normal file
@ -0,0 +1,6 @@
|
||||
package types
|
||||
|
||||
const (
|
||||
// QueryGetParams command for params query
|
||||
QueryGetParams = "parameters"
|
||||
)
|
635
x/savings/types/query.pb.go
Normal file
635
x/savings/types/query.pb.go
Normal file
@ -0,0 +1,635 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: kava/savings/v1beta1/query.proto
|
||||
|
||||
package types
|
||||
|
||||
import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
_ "github.com/gogo/protobuf/gogoproto"
|
||||
grpc1 "github.com/gogo/protobuf/grpc"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
_ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
_ "google.golang.org/protobuf/types/known/timestamppb"
|
||||
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
|
||||
|
||||
// QueryParamsRequest defines the request type for querying x/savings
|
||||
// parameters.
|
||||
type QueryParamsRequest struct {
|
||||
}
|
||||
|
||||
func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} }
|
||||
func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryParamsRequest) ProtoMessage() {}
|
||||
func (*QueryParamsRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_f78c91efc5db144f, []int{0}
|
||||
}
|
||||
func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *QueryParamsRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_QueryParamsRequest.Merge(m, src)
|
||||
}
|
||||
func (m *QueryParamsRequest) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *QueryParamsRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo
|
||||
|
||||
// QueryParamsResponse defines the response type for querying x/savings
|
||||
// parameters.
|
||||
type QueryParamsResponse struct {
|
||||
Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
|
||||
}
|
||||
|
||||
func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} }
|
||||
func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryParamsResponse) ProtoMessage() {}
|
||||
func (*QueryParamsResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_f78c91efc5db144f, []int{1}
|
||||
}
|
||||
func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *QueryParamsResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_QueryParamsResponse.Merge(m, src)
|
||||
}
|
||||
func (m *QueryParamsResponse) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *QueryParamsResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*QueryParamsRequest)(nil), "kava.savings.v1beta1.QueryParamsRequest")
|
||||
proto.RegisterType((*QueryParamsResponse)(nil), "kava.savings.v1beta1.QueryParamsResponse")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("kava/savings/v1beta1/query.proto", fileDescriptor_f78c91efc5db144f) }
|
||||
|
||||
var fileDescriptor_f78c91efc5db144f = []byte{
|
||||
// 316 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x90, 0x31, 0x4b, 0x03, 0x31,
|
||||
0x1c, 0xc5, 0x2f, 0x52, 0x3b, 0xc4, 0x2d, 0x76, 0x90, 0x52, 0xd2, 0x72, 0x38, 0xb4, 0x83, 0x09,
|
||||
0xad, 0x5b, 0xc7, 0xae, 0x2e, 0xda, 0x45, 0x70, 0xcb, 0x49, 0x8c, 0x87, 0xbd, 0x4b, 0x7a, 0xc9,
|
||||
0x1d, 0x76, 0xd5, 0xc5, 0x45, 0x10, 0xfc, 0x02, 0x8e, 0x7e, 0x94, 0x8e, 0x05, 0x17, 0x27, 0xa9,
|
||||
0x77, 0x7e, 0x10, 0xb9, 0x24, 0x08, 0xe2, 0x0d, 0x6e, 0xff, 0xbc, 0xff, 0xef, 0x3d, 0x5e, 0xfe,
|
||||
0x70, 0x70, 0xc3, 0x0a, 0x46, 0x35, 0x2b, 0xe2, 0x54, 0x68, 0x5a, 0x8c, 0x23, 0x6e, 0xd8, 0x98,
|
||||
0x2e, 0x73, 0x9e, 0xad, 0x88, 0xca, 0xa4, 0x91, 0xa8, 0x53, 0x13, 0xc4, 0x13, 0xc4, 0x13, 0xdd,
|
||||
0x66, 0x9f, 0x36, 0x32, 0xe3, 0xce, 0xd7, 0xed, 0x08, 0x29, 0xa4, 0x1d, 0x69, 0x3d, 0x79, 0xb5,
|
||||
0x27, 0xa4, 0x14, 0x0b, 0x4e, 0x99, 0x8a, 0x29, 0x4b, 0x53, 0x69, 0x98, 0x89, 0x65, 0xaa, 0xfd,
|
||||
0xb6, 0xef, 0xb7, 0xf6, 0x15, 0xe5, 0x57, 0xd4, 0xc4, 0x09, 0xd7, 0x86, 0x25, 0xca, 0x01, 0x61,
|
||||
0x07, 0xa2, 0xb3, 0xba, 0xdb, 0x29, 0xcb, 0x58, 0xa2, 0xe7, 0x7c, 0x99, 0x73, 0x6d, 0xc2, 0x73,
|
||||
0xb8, 0xff, 0x4b, 0xd5, 0x4a, 0xa6, 0x9a, 0xa3, 0x29, 0x6c, 0x2b, 0xab, 0x1c, 0x80, 0x01, 0x18,
|
||||
0xee, 0x4d, 0x7a, 0xa4, 0xe9, 0x2b, 0xc4, 0xb9, 0x66, 0xad, 0xf5, 0x47, 0x3f, 0x98, 0x7b, 0xc7,
|
||||
0xb4, 0xf5, 0xf0, 0xd2, 0x0f, 0x26, 0x8f, 0x00, 0xee, 0xda, 0x64, 0x74, 0x0f, 0x60, 0xdb, 0x81,
|
||||
0x68, 0xd8, 0x1c, 0xf3, 0xb7, 0x57, 0x77, 0xf4, 0x0f, 0xd2, 0x75, 0x0d, 0x0f, 0xef, 0xde, 0xbe,
|
||||
0x9e, 0x77, 0x30, 0xea, 0xd1, 0xc6, 0xc3, 0xba, 0x56, 0xb3, 0x93, 0xed, 0x27, 0x06, 0xaf, 0x25,
|
||||
0x06, 0xeb, 0x12, 0x83, 0x4d, 0x89, 0xc1, 0xb6, 0xc4, 0xe0, 0xa9, 0xc2, 0xc1, 0xa6, 0xc2, 0xc1,
|
||||
0x7b, 0x85, 0x83, 0x8b, 0x91, 0x88, 0xcd, 0x75, 0x1e, 0x91, 0x4b, 0x99, 0xd8, 0xa4, 0xa3, 0x05,
|
||||
0x8b, 0xb4, 0xcb, 0xbc, 0xfd, 0x49, 0x35, 0x2b, 0xc5, 0x75, 0xd4, 0xb6, 0x27, 0x3d, 0xfe, 0x0e,
|
||||
0x00, 0x00, 0xff, 0xff, 0xde, 0xe3, 0xfa, 0xae, 0x03, 0x02, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (this *QueryParamsRequest) VerboseEqual(that interface{}) error {
|
||||
if that == nil {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("that == nil && this != nil")
|
||||
}
|
||||
|
||||
that1, ok := that.(*QueryParamsRequest)
|
||||
if !ok {
|
||||
that2, ok := that.(QueryParamsRequest)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return fmt.Errorf("that is not of type *QueryParamsRequest")
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("that is type *QueryParamsRequest but is nil && this != nil")
|
||||
} else if this == nil {
|
||||
return fmt.Errorf("that is type *QueryParamsRequest but is not nil && this == nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *QueryParamsRequest) Equal(that interface{}) bool {
|
||||
if that == nil {
|
||||
return this == nil
|
||||
}
|
||||
|
||||
that1, ok := that.(*QueryParamsRequest)
|
||||
if !ok {
|
||||
that2, ok := that.(QueryParamsRequest)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
return this == nil
|
||||
} else if this == nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
func (this *QueryParamsResponse) VerboseEqual(that interface{}) error {
|
||||
if that == nil {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("that == nil && this != nil")
|
||||
}
|
||||
|
||||
that1, ok := that.(*QueryParamsResponse)
|
||||
if !ok {
|
||||
that2, ok := that.(QueryParamsResponse)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return fmt.Errorf("that is not of type *QueryParamsResponse")
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("that is type *QueryParamsResponse but is nil && this != nil")
|
||||
} else if this == nil {
|
||||
return fmt.Errorf("that is type *QueryParamsResponse but is not nil && this == nil")
|
||||
}
|
||||
if !this.Params.Equal(&that1.Params) {
|
||||
return fmt.Errorf("Params this(%v) Not Equal that(%v)", this.Params, that1.Params)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *QueryParamsResponse) Equal(that interface{}) bool {
|
||||
if that == nil {
|
||||
return this == nil
|
||||
}
|
||||
|
||||
that1, ok := that.(*QueryParamsResponse)
|
||||
if !ok {
|
||||
that2, ok := that.(QueryParamsResponse)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
return this == nil
|
||||
} else if this == nil {
|
||||
return false
|
||||
}
|
||||
if !this.Params.Equal(&that1.Params) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConn
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion4
|
||||
|
||||
// QueryClient is the client API for Query service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type QueryClient interface {
|
||||
// Params queries all parameters of the savings module.
|
||||
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
|
||||
}
|
||||
|
||||
type queryClient struct {
|
||||
cc grpc1.ClientConn
|
||||
}
|
||||
|
||||
func NewQueryClient(cc grpc1.ClientConn) QueryClient {
|
||||
return &queryClient{cc}
|
||||
}
|
||||
|
||||
func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) {
|
||||
out := new(QueryParamsResponse)
|
||||
err := c.cc.Invoke(ctx, "/kava.savings.v1beta1.Query/Params", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// QueryServer is the server API for Query service.
|
||||
type QueryServer interface {
|
||||
// Params queries all parameters of the savings module.
|
||||
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedQueryServer struct {
|
||||
}
|
||||
|
||||
func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
|
||||
}
|
||||
|
||||
func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
|
||||
s.RegisterService(&_Query_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryParamsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).Params(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/kava.savings.v1beta1.Query/Params",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Query_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "kava.savings.v1beta1.Query",
|
||||
HandlerType: (*QueryServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Params",
|
||||
Handler: _Query_Params_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "kava/savings/v1beta1/query.proto",
|
||||
}
|
||||
|
||||
func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
{
|
||||
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintQuery(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovQuery(v)
|
||||
base := offset
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return base
|
||||
}
|
||||
func (m *QueryParamsRequest) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *QueryParamsResponse) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = m.Params.Size()
|
||||
n += 1 + l + sovQuery(uint64(l))
|
||||
return n
|
||||
}
|
||||
|
||||
func sovQuery(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
func sozQuery(x uint64) (n int) {
|
||||
return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipQuery(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipQuery(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipQuery(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
depth := 0
|
||||
for iNdEx < l {
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowQuery
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
wireType := int(wire & 0x7)
|
||||
switch wireType {
|
||||
case 0:
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowQuery
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx++
|
||||
if dAtA[iNdEx-1] < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 1:
|
||||
iNdEx += 8
|
||||
case 2:
|
||||
var length int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowQuery
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
length |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthQuery
|
||||
}
|
||||
iNdEx += length
|
||||
case 3:
|
||||
depth++
|
||||
case 4:
|
||||
if depth == 0 {
|
||||
return 0, ErrUnexpectedEndOfGroupQuery
|
||||
}
|
||||
depth--
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
if iNdEx < 0 {
|
||||
return 0, ErrInvalidLengthQuery
|
||||
}
|
||||
if depth == 0 {
|
||||
return iNdEx, nil
|
||||
}
|
||||
}
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow")
|
||||
ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
|
||||
)
|
148
x/savings/types/query.pb.gw.go
Normal file
148
x/savings/types/query.pb.gw.go
Normal file
@ -0,0 +1,148 @@
|
||||
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
|
||||
// source: kava/savings/v1beta1/query.proto
|
||||
|
||||
/*
|
||||
Package types is a reverse proxy.
|
||||
|
||||
It translates gRPC into RESTful JSON APIs.
|
||||
*/
|
||||
package types
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/golang/protobuf/descriptor"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/utilities"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// Suppress "imported and not used" errors
|
||||
var _ codes.Code
|
||||
var _ io.Reader
|
||||
var _ status.Status
|
||||
var _ = runtime.String
|
||||
var _ = utilities.NewDoubleArray
|
||||
var _ = descriptor.ForMessage
|
||||
|
||||
func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryParamsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryParamsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
msg, err := server.Params(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
|
||||
// UnaryRPC :call QueryServer directly.
|
||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||
// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.
|
||||
func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error {
|
||||
|
||||
mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but
|
||||
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
||||
func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
||||
conn, err := grpc.Dial(endpoint, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
}()
|
||||
}()
|
||||
|
||||
return RegisterQueryHandler(ctx, mux, conn)
|
||||
}
|
||||
|
||||
// RegisterQueryHandler registers the http handlers for service Query to "mux".
|
||||
// The handlers forward requests to the grpc endpoint over "conn".
|
||||
func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
|
||||
return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn))
|
||||
}
|
||||
|
||||
// RegisterQueryHandlerClient registers the http handlers for service Query
|
||||
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient".
|
||||
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient"
|
||||
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
|
||||
// "QueryClient" to call the correct interceptors.
|
||||
func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error {
|
||||
|
||||
mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"kava", "savings", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
)
|
||||
|
||||
var (
|
||||
forward_Query_Params_0 = runtime.ForwardResponseMessage
|
||||
)
|
318
x/savings/types/store.pb.go
Normal file
318
x/savings/types/store.pb.go
Normal file
@ -0,0 +1,318 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: kava/savings/v1beta1/store.proto
|
||||
|
||||
package types
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
_ "github.com/cosmos/cosmos-proto"
|
||||
_ "github.com/gogo/protobuf/gogoproto"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
_ "google.golang.org/protobuf/types/known/timestamppb"
|
||||
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
|
||||
|
||||
// Params defines the parameters for the savings module.
|
||||
type Params struct {
|
||||
}
|
||||
|
||||
func (m *Params) Reset() { *m = Params{} }
|
||||
func (m *Params) String() string { return proto.CompactTextString(m) }
|
||||
func (*Params) ProtoMessage() {}
|
||||
func (*Params) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_f7110366fa182786, []int{0}
|
||||
}
|
||||
func (m *Params) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_Params.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *Params) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Params.Merge(m, src)
|
||||
}
|
||||
func (m *Params) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *Params) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Params.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Params proto.InternalMessageInfo
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Params)(nil), "kava.savings.v1beta1.Params")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("kava/savings/v1beta1/store.proto", fileDescriptor_f7110366fa182786) }
|
||||
|
||||
var fileDescriptor_f7110366fa182786 = []byte{
|
||||
// 202 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xc8, 0x4e, 0x2c, 0x4b,
|
||||
0xd4, 0x2f, 0x4e, 0x2c, 0xcb, 0xcc, 0x4b, 0x2f, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34,
|
||||
0xd4, 0x2f, 0x2e, 0xc9, 0x2f, 0x4a, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x01, 0xa9,
|
||||
0xd0, 0x83, 0xaa, 0xd0, 0x83, 0xaa, 0x90, 0x92, 0x4c, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0x8e, 0x07,
|
||||
0xab, 0xd1, 0x87, 0x70, 0x20, 0x1a, 0xa4, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0x21, 0xe2, 0x20, 0x16,
|
||||
0x54, 0x54, 0x3e, 0x3d, 0x3f, 0x3f, 0x3d, 0x27, 0x55, 0x1f, 0xcc, 0x4b, 0x2a, 0x4d, 0xd3, 0x2f,
|
||||
0xc9, 0xcc, 0x4d, 0x2d, 0x2e, 0x49, 0xcc, 0x2d, 0x80, 0x28, 0x50, 0xe2, 0xe0, 0x62, 0x0b, 0x48,
|
||||
0x2c, 0x4a, 0xcc, 0x2d, 0x76, 0xf2, 0x7e, 0xf0, 0x50, 0x8e, 0x71, 0xc5, 0x23, 0x39, 0xc6, 0x13,
|
||||
0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86,
|
||||
0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0xd2, 0x4c, 0xcf, 0x2c, 0xc9, 0x28, 0x4d,
|
||||
0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x07, 0x39, 0x4f, 0x37, 0x27, 0x31, 0xa9, 0x18, 0xcc, 0xd2, 0xaf,
|
||||
0x80, 0x7b, 0xa6, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x6c, 0xba, 0x31, 0x20, 0x00, 0x00,
|
||||
0xff, 0xff, 0x87, 0x90, 0xfa, 0x64, 0xe9, 0x00, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (this *Params) VerboseEqual(that interface{}) error {
|
||||
if that == nil {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("that == nil && this != nil")
|
||||
}
|
||||
|
||||
that1, ok := that.(*Params)
|
||||
if !ok {
|
||||
that2, ok := that.(Params)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return fmt.Errorf("that is not of type *Params")
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("that is type *Params but is nil && this != nil")
|
||||
} else if this == nil {
|
||||
return fmt.Errorf("that is type *Params but is not nil && this == nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *Params) Equal(that interface{}) bool {
|
||||
if that == nil {
|
||||
return this == nil
|
||||
}
|
||||
|
||||
that1, ok := that.(*Params)
|
||||
if !ok {
|
||||
that2, ok := that.(Params)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
return this == nil
|
||||
} else if this == nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
func (m *Params) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *Params) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintStore(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovStore(v)
|
||||
base := offset
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return base
|
||||
}
|
||||
func (m *Params) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
return n
|
||||
}
|
||||
|
||||
func sovStore(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
func sozStore(x uint64) (n int) {
|
||||
return sovStore(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *Params) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowStore
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: Params: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipStore(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthStore
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipStore(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, ErrIntOverflowStore
|
||||
}
|
||||
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, ErrIntOverflowStore
|
||||
}
|
||||
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, ErrIntOverflowStore
|
||||
}
|
||||
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, ErrInvalidLengthStore
|
||||
}
|
||||
iNdEx += length
|
||||
case 3:
|
||||
depth++
|
||||
case 4:
|
||||
if depth == 0 {
|
||||
return 0, ErrUnexpectedEndOfGroupStore
|
||||
}
|
||||
depth--
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
if iNdEx < 0 {
|
||||
return 0, ErrInvalidLengthStore
|
||||
}
|
||||
if depth == 0 {
|
||||
return iNdEx, nil
|
||||
}
|
||||
}
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthStore = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowStore = fmt.Errorf("proto: integer overflow")
|
||||
ErrUnexpectedEndOfGroupStore = fmt.Errorf("proto: unexpected end of group")
|
||||
)
|
86
x/savings/types/tx.pb.go
Normal file
86
x/savings/types/tx.pb.go
Normal file
@ -0,0 +1,86 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: kava/savings/v1beta1/tx.proto
|
||||
|
||||
package types
|
||||
|
||||
import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
_ "github.com/gogo/protobuf/gogoproto"
|
||||
grpc1 "github.com/gogo/protobuf/grpc"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
grpc "google.golang.org/grpc"
|
||||
_ "google.golang.org/protobuf/types/known/timestamppb"
|
||||
math "math"
|
||||
)
|
||||
|
||||
// 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
|
||||
|
||||
func init() { proto.RegisterFile("kava/savings/v1beta1/tx.proto", fileDescriptor_c0bf8679b144267a) }
|
||||
|
||||
var fileDescriptor_c0bf8679b144267a = []byte{
|
||||
// 183 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcd, 0x4e, 0x2c, 0x4b,
|
||||
0xd4, 0x2f, 0x4e, 0x2c, 0xcb, 0xcc, 0x4b, 0x2f, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34,
|
||||
0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x01, 0x49, 0xeb, 0x41, 0xa5,
|
||||
0xf5, 0xa0, 0xd2, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0x05, 0xfa, 0x20, 0x16, 0x44, 0xad,
|
||||
0x94, 0x7c, 0x7a, 0x7e, 0x7e, 0x7a, 0x4e, 0xaa, 0x3e, 0x98, 0x97, 0x54, 0x9a, 0xa6, 0x5f, 0x92,
|
||||
0x99, 0x9b, 0x5a, 0x5c, 0x92, 0x98, 0x5b, 0x00, 0x51, 0x60, 0xc4, 0xca, 0xc5, 0xec, 0x5b, 0x9c,
|
||||
0xee, 0xe4, 0xfd, 0xe0, 0xa1, 0x1c, 0xe3, 0x8a, 0x47, 0x72, 0x8c, 0x27, 0x1e, 0xc9, 0x31, 0x5e,
|
||||
0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31,
|
||||
0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x99, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f,
|
||||
0xab, 0x0f, 0x72, 0x80, 0x6e, 0x4e, 0x62, 0x52, 0x31, 0x98, 0xa5, 0x5f, 0x01, 0x77, 0x6b, 0x49,
|
||||
0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0xd8, 0x68, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5a,
|
||||
0xee, 0x09, 0x21, 0xc8, 0x00, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConn
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion4
|
||||
|
||||
// MsgClient is the client API for Msg service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type MsgClient interface {
|
||||
}
|
||||
|
||||
type msgClient struct {
|
||||
cc grpc1.ClientConn
|
||||
}
|
||||
|
||||
func NewMsgClient(cc grpc1.ClientConn) MsgClient {
|
||||
return &msgClient{cc}
|
||||
}
|
||||
|
||||
// MsgServer is the server API for Msg service.
|
||||
type MsgServer interface {
|
||||
}
|
||||
|
||||
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedMsgServer struct {
|
||||
}
|
||||
|
||||
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
|
||||
s.RegisterService(&_Msg_serviceDesc, srv)
|
||||
}
|
||||
|
||||
var _Msg_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "kava.savings.v1beta1.Msg",
|
||||
HandlerType: (*MsgServer)(nil),
|
||||
Methods: []grpc.MethodDesc{},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "kava/savings/v1beta1/tx.proto",
|
||||
}
|
Loading…
Reference in New Issue
Block a user