github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/cosmos-sdk/x/params/module.go (about) 1 package params 2 3 import ( 4 "encoding/json" 5 "math/rand" 6 7 "github.com/gorilla/mux" 8 "github.com/spf13/cobra" 9 10 "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/client/context" 11 "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/codec" 12 sdk "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/types" 13 "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/types/module" 14 "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/x/params/simulation" 15 "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/x/params/types" 16 sim "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/x/simulation" 17 ) 18 19 var ( 20 _ module.AppModuleBasic = AppModuleBasic{} 21 _ module.AppModuleSimulation = AppModule{} 22 ) 23 24 // AppModuleBasic defines the basic application module used by the params module. 25 type AppModuleBasic struct{} 26 27 // Name returns the params module's name. 28 func (AppModuleBasic) Name() string { 29 return ModuleName 30 } 31 32 // RegisterCodec registers the params module's types for the given codec. 33 func (AppModuleBasic) RegisterCodec(cdc *codec.Codec) { 34 types.RegisterCodec(cdc) 35 } 36 37 // DefaultGenesis returns default genesis state as raw bytes for the params 38 // module. 39 func (AppModuleBasic) DefaultGenesis() json.RawMessage { return nil } 40 41 // ValidateGenesis performs genesis state validation for the params module. 42 func (AppModuleBasic) ValidateGenesis(_ json.RawMessage) error { return nil } 43 44 // RegisterRESTRoutes registers the REST routes for the params module. 45 func (AppModuleBasic) RegisterRESTRoutes(_ context.CLIContext, _ *mux.Router) {} 46 47 // GetTxCmd returns no root tx command for the params module. 48 func (AppModuleBasic) GetTxCmd(_ *codec.Codec) *cobra.Command { return nil } 49 50 // GetQueryCmd returns no root query command for the params module. 51 func (AppModuleBasic) GetQueryCmd(_ *codec.Codec) *cobra.Command { return nil } 52 53 //____________________________________________________________________________ 54 55 // AppModule implements an application module for the distribution module. 56 type AppModule struct { 57 AppModuleBasic 58 } 59 60 // NewAppModule creates a new AppModule object 61 func NewAppModule() AppModule { 62 return AppModule{ 63 AppModuleBasic: AppModuleBasic{}, 64 } 65 } 66 67 //____________________________________________________________________________ 68 69 // AppModuleSimulation functions 70 71 // GenerateGenesisState performs a no-op. 72 func (AppModule) GenerateGenesisState(simState *module.SimulationState) { 73 } 74 75 // ProposalContents returns all the params content functions used to 76 // simulate governance proposals. 77 func (am AppModule) ProposalContents(simState module.SimulationState) []sim.WeightedProposalContent { 78 return simulation.ProposalContents(simState.ParamChanges) 79 } 80 81 // RandomizedParams creates randomized distribution param changes for the simulator. 82 func (AppModule) RandomizedParams(r *rand.Rand) []sim.ParamChange { 83 return nil 84 } 85 86 // RegisterStoreDecoder doesn't register any type. 87 func (AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) {} 88 89 // WeightedOperations returns the all the gov module operations with their respective weights. 90 func (am AppModule) WeightedOperations(_ module.SimulationState) []sim.WeightedOperation { 91 return nil 92 }