2019-05-16 08:25:32 -07:00
|
|
|
package params
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
2019-12-05 01:29:54 -08:00
|
|
|
"math/rand"
|
2019-05-16 08:25:32 -07:00
|
|
|
|
2019-06-05 16:26:17 -07:00
|
|
|
"github.com/gorilla/mux"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
|
|
|
|
"github.com/cosmos/cosmos-sdk/client/context"
|
2019-05-16 08:25:32 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
2019-12-05 01:29:54 -08:00
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
2019-06-05 16:26:17 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/types/module"
|
2019-12-05 01:29:54 -08:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/params/simulation"
|
2019-05-16 08:25:32 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/params/types"
|
2019-12-05 01:29:54 -08:00
|
|
|
sim "github.com/cosmos/cosmos-sdk/x/simulation"
|
2019-05-16 08:25:32 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2019-12-05 01:29:54 -08:00
|
|
|
_ module.AppModuleBasic = AppModuleBasic{}
|
|
|
|
_ module.AppModuleSimulation = AppModule{}
|
2019-05-16 08:25:32 -07:00
|
|
|
)
|
|
|
|
|
2019-08-13 15:16:03 -07:00
|
|
|
// AppModuleBasic defines the basic application module used by the params module.
|
2019-05-16 08:25:32 -07:00
|
|
|
type AppModuleBasic struct{}
|
|
|
|
|
2019-08-13 15:16:03 -07:00
|
|
|
// Name returns the params module's name.
|
2019-05-16 08:25:32 -07:00
|
|
|
func (AppModuleBasic) Name() string {
|
2019-08-13 15:16:03 -07:00
|
|
|
return ModuleName
|
2019-05-16 08:25:32 -07:00
|
|
|
}
|
|
|
|
|
2019-08-13 15:16:03 -07:00
|
|
|
// RegisterCodec registers the params module's types for the given codec.
|
2019-05-16 08:25:32 -07:00
|
|
|
func (AppModuleBasic) RegisterCodec(cdc *codec.Codec) {
|
|
|
|
types.RegisterCodec(cdc)
|
|
|
|
}
|
|
|
|
|
2019-08-13 15:16:03 -07:00
|
|
|
// DefaultGenesis returns default genesis state as raw bytes for the params
|
|
|
|
// module.
|
2019-05-16 08:25:32 -07:00
|
|
|
func (AppModuleBasic) DefaultGenesis() json.RawMessage { return nil }
|
|
|
|
|
2019-08-13 15:16:03 -07:00
|
|
|
// ValidateGenesis performs genesis state validation for the params module.
|
2019-05-16 08:25:32 -07:00
|
|
|
func (AppModuleBasic) ValidateGenesis(_ json.RawMessage) error { return nil }
|
2019-06-05 16:26:17 -07:00
|
|
|
|
2019-08-13 15:16:03 -07:00
|
|
|
// RegisterRESTRoutes registers the REST routes for the params module.
|
2019-06-06 08:43:15 -07:00
|
|
|
func (AppModuleBasic) RegisterRESTRoutes(_ context.CLIContext, _ *mux.Router) {}
|
2019-06-05 16:26:17 -07:00
|
|
|
|
2019-08-13 15:16:03 -07:00
|
|
|
// GetTxCmd returns no root tx command for the params module.
|
2019-06-05 16:26:17 -07:00
|
|
|
func (AppModuleBasic) GetTxCmd(_ *codec.Codec) *cobra.Command { return nil }
|
|
|
|
|
2019-08-13 15:16:03 -07:00
|
|
|
// GetQueryCmd returns no root query command for the params module.
|
2019-06-05 16:26:17 -07:00
|
|
|
func (AppModuleBasic) GetQueryCmd(_ *codec.Codec) *cobra.Command { return nil }
|
2019-12-05 01:29:54 -08:00
|
|
|
|
|
|
|
//____________________________________________________________________________
|
|
|
|
|
|
|
|
// AppModule implements an application module for the distribution module.
|
|
|
|
type AppModule struct {
|
|
|
|
AppModuleBasic
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewAppModule creates a new AppModule object
|
|
|
|
func NewAppModule() AppModule {
|
|
|
|
return AppModule{
|
|
|
|
AppModuleBasic: AppModuleBasic{},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//____________________________________________________________________________
|
|
|
|
|
|
|
|
// AppModuleSimulation functions
|
|
|
|
|
|
|
|
// GenerateGenesisState performs a no-op.
|
|
|
|
func (AppModule) GenerateGenesisState(simState *module.SimulationState) {
|
|
|
|
}
|
|
|
|
|
|
|
|
// ProposalContents returns all the params content functions used to
|
|
|
|
// simulate governance proposals.
|
|
|
|
func (am AppModule) ProposalContents(simState module.SimulationState) []sim.WeightedProposalContent {
|
|
|
|
return simulation.ProposalContents(simState.ParamChanges)
|
|
|
|
}
|
|
|
|
|
|
|
|
// RandomizedParams creates randomized distribution param changes for the simulator.
|
|
|
|
func (AppModule) RandomizedParams(r *rand.Rand) []sim.ParamChange {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// RegisterStoreDecoder doesn't register any type.
|
|
|
|
func (AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) {}
|
|
|
|
|
|
|
|
// WeightedOperations returns the all the gov module operations with their respective weights.
|
|
|
|
func (am AppModule) WeightedOperations(_ module.SimulationState) []sim.WeightedOperation {
|
|
|
|
return nil
|
|
|
|
}
|