From 6259f032523851c8123e9a1672612852f4e27853 Mon Sep 17 00:00:00 2001 From: harish Date: Wed, 16 Feb 2022 22:24:28 +0530 Subject: [PATCH 1/3] go.mod: bump onft & marketplace versions --- go.mod | 4 ++-- go.sum | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index d3347ed4..e0cdbd35 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/OmniFlix/omniflixhub go 1.17 require ( - github.com/OmniFlix/marketplace v0.2.0-alpha.2 - github.com/OmniFlix/onft v0.3.0-alpha.1 + github.com/OmniFlix/marketplace v0.2.0 + github.com/OmniFlix/onft v0.3.0 github.com/cosmos/cosmos-sdk v0.45.1 github.com/cosmos/ibc-go/v2 v2.0.3 github.com/gogo/protobuf v1.3.3 diff --git a/go.sum b/go.sum index 6fd22a5c..b8914513 100644 --- a/go.sum +++ b/go.sum @@ -94,10 +94,11 @@ github.com/Microsoft/go-winio v0.5.0 h1:Elr9Wn+sGKPlkaBvwu4mTrxtmOp3F3yV9qhaHbXG github.com/Microsoft/go-winio v0.5.0/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= -github.com/OmniFlix/marketplace v0.2.0-alpha.2 h1:xh3AWWUqmh2zAW6DndwUC4hZMdF08xjyd6YPO+6zRtU= -github.com/OmniFlix/marketplace v0.2.0-alpha.2/go.mod h1:z/u3ndafrxT1k6O2dxoogD2C1gjrnS+t5wet7316ruA= -github.com/OmniFlix/onft v0.3.0-alpha.1 h1:r52CUJOohS7FMhGwF8eZXd9evm2O8+1DIoobmbhq6gg= +github.com/OmniFlix/marketplace v0.2.0 h1:VvPk9MkM3OUUbikR8jDLMdfdgKcXunlY+OXJkPH0ZII= +github.com/OmniFlix/marketplace v0.2.0/go.mod h1:z/u3ndafrxT1k6O2dxoogD2C1gjrnS+t5wet7316ruA= github.com/OmniFlix/onft v0.3.0-alpha.1/go.mod h1:y1RknOuWIm2FhShS8Cb03mgyryYu7xZa+PzG5lN3O3A= +github.com/OmniFlix/onft v0.3.0 h1:VDMFJuBEI+OyvcPCBXph+sS6OY7i1uQ9H0I0ZpleU8Q= +github.com/OmniFlix/onft v0.3.0/go.mod h1:y1RknOuWIm2FhShS8Cb03mgyryYu7xZa+PzG5lN3O3A= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OpenPeeDeeP/depguard v1.0.1/go.mod h1:xsIw86fROiiwelg+jB2uM9PiKihMMmUx/1V+TNhjQvM= From 76cf3c8815d703edf180145c99892d34491b0adf Mon Sep 17 00:00:00 2001 From: harish Date: Wed, 16 Feb 2022 22:25:34 +0530 Subject: [PATCH 2/3] refactor: fix names --- x/alloc/keeper/keeper.go | 2 +- x/alloc/module.go | 32 ++++++++++++++++---------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/x/alloc/keeper/keeper.go b/x/alloc/keeper/keeper.go index 39ec6d59..ddd65b4c 100644 --- a/x/alloc/keeper/keeper.go +++ b/x/alloc/keeper/keeper.go @@ -58,7 +58,7 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } -// GetModuleAccountBalance gets the airdrop coin balance of module account +// GetModuleAccountBalance gets the coin balance of module account func (k Keeper) GetModuleAccountAddress(ctx sdk.Context) sdk.AccAddress { return k.accountKeeper.GetModuleAddress(types.ModuleName) } diff --git a/x/alloc/module.go b/x/alloc/module.go index 2bbc47bb..66d6c8d2 100644 --- a/x/alloc/module.go +++ b/x/alloc/module.go @@ -32,7 +32,7 @@ var ( // AppModuleBasic // ---------------------------------------------------------------------------- -// AppModuleBasic implements the AppModuleBasic interface for the capability module. +// AppModuleBasic implements the AppModuleBasic interface for the alloc module. type AppModuleBasic struct { cdc codec.BinaryCodec } @@ -41,7 +41,7 @@ func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { return AppModuleBasic{cdc: cdc} } -// Name returns the capability module's name. +// Name returns the alloc module's name. func (AppModuleBasic) Name() string { return types.ModuleName } @@ -59,12 +59,12 @@ func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { types.RegisterInterfaces(reg) } -// DefaultGenesis returns the capability module's default genesis state. +// DefaultGenesis returns the alloc module's default genesis state. func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { return cdc.MustMarshalJSON(types.DefaultGenesis()) } -// ValidateGenesis performs genesis state validation for the capability module. +// ValidateGenesis performs genesis state validation for the alloc module. func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { var genState types.GenesisState if err := cdc.UnmarshalJSON(bz, &genState); err != nil { @@ -73,7 +73,7 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod return genState.Validate() } -// RegisterRESTRoutes registers the capability module's REST service handlers. +// RegisterRESTRoutes registers the alloc module's REST service handlers. func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { } @@ -90,7 +90,7 @@ func (a AppModuleBasic) GetTxCmd() *cobra.Command { return cli.GetTxCmd() } -// GetQueryCmd returns the capability module's root query command. +// GetQueryCmd returns the alloc module's root query command. func (AppModuleBasic) GetQueryCmd() *cobra.Command { return cli.GetQueryCmd(types.StoreKey) } @@ -99,7 +99,7 @@ func (AppModuleBasic) GetQueryCmd() *cobra.Command { // AppModule // ---------------------------------------------------------------------------- -// AppModule implements the AppModule interface for the capability module. +// AppModule implements the AppModule interface for the alloc module. type AppModule struct { AppModuleBasic @@ -113,20 +113,20 @@ func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule { } } -// Name returns the capability module's name. +// Name returns the alloc module's name. func (am AppModule) Name() string { return am.AppModuleBasic.Name() } -// Route returns the capability module's message routing key. +// Route returns the alloc module's message routing key. func (am AppModule) Route() sdk.Route { return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) } -// QuerierRoute returns the capability module's query routing key. +// QuerierRoute returns the alloc module's query routing key. func (AppModule) QuerierRoute() string { return types.QuerierRoute } -// LegacyQuerierHandler returns the capability module's Querier. +// LegacyQuerierHandler returns the alloc module's Querier. func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { return nil } @@ -137,10 +137,10 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterQueryServer(cfg.QueryServer(), am.keeper) } -// RegisterInvariants registers the capability module's invariants. +// RegisterInvariants registers the alloc module's invariants. func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} -// InitGenesis performs the capability module's genesis initialization It returns +// InitGenesis performs the alloc module's genesis initialization It returns // no validator updates. func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { var genState types.GenesisState @@ -152,7 +152,7 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.Ra return []abci.ValidatorUpdate{} } -// ExportGenesis returns the capability module's exported genesis state as raw JSON bytes. +// ExportGenesis returns the alloc module's exported genesis state as raw JSON bytes. func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { genState := ExportGenesis(ctx, am.keeper) return cdc.MustMarshalJSON(genState) @@ -161,12 +161,12 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw // ConsensusVersion implements ConsensusVersion. func (AppModule) ConsensusVersion() uint64 { return 2 } -// BeginBlock executes all ABCI BeginBlock logic respective to the capability module. +// BeginBlock executes all ABCI BeginBlock logic respective to the alloc module. func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { BeginBlocker(ctx, am.keeper) } -// EndBlock executes all ABCI EndBlock logic respective to the capability module. It +// EndBlock executes all ABCI EndBlock logic respective to the alloc module. It // returns no validator updates. func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { return []abci.ValidatorUpdate{} From 286c0ff2bcad089f45547a2521996ab7e74f712e Mon Sep 17 00:00:00 2001 From: harish Date: Wed, 16 Feb 2022 22:26:31 +0530 Subject: [PATCH 3/3] x/alloc: add cli params query --- x/alloc/client/cli/query.go | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/x/alloc/client/cli/query.go b/x/alloc/client/cli/query.go index f011eb4c..360668b8 100644 --- a/x/alloc/client/cli/query.go +++ b/x/alloc/client/cli/query.go @@ -2,6 +2,7 @@ package cli import ( "fmt" + "github.com/cosmos/cosmos-sdk/client/flags" "github.com/OmniFlix/omniflixhub/x/alloc/types" "github.com/cosmos/cosmos-sdk/client" @@ -18,8 +19,36 @@ func GetQueryCmd(queryRoute string) *cobra.Command { SuggestionsMinimumDistance: 2, RunE: client.ValidateCmd, } - + cmd.AddCommand( + GetCmdQueryParams(), + ) // this line is used by starport scaffolding # 1 return cmd } + +// GetCmdQueryParams implements the query params command. +func GetCmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Args: cobra.NoArgs, + Short: "Query alloc params", + RunE: func(cmd *cobra.Command, _ []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(&res.Params) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +}