diff --git a/app/app.go b/app/app.go index 3597bd2a..7b93f77f 100644 --- a/app/app.go +++ b/app/app.go @@ -119,16 +119,40 @@ import ( const ( AccountAddressPrefix = "okp4" Name = "okp4d" + + // If EnabledSpecificProposals is "", and this is "true", then enable all x/wasm proposals. + // If EnabledSpecificProposals is "", and this is not "true", then disable all x/wasm proposals. + ProposalsEnabled = "false" + // If set to non-empty string it must be comma-separated list of values that are all a subset + // of "EnableAllProposals" (takes precedence over ProposalsEnabled) + // https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34 + EnableSpecificProposals = "" ) +// GetEnabledProposals parses the ProposalsEnabled / EnableSpecificProposals values to +// produce a list of enabled proposals to pass into wasmd app. +func GetEnabledProposals() []wasm.ProposalType { + if EnableSpecificProposals == "" { + if ProposalsEnabled == "true" { + return wasm.EnableAllProposals + } + return wasm.DisableAllProposals + } + chunks := strings.Split(EnableSpecificProposals, ",") + proposals, err := wasm.ConvertToProposals(chunks) + if err != nil { + panic(err) + } + return proposals +} + // this line is used by starport scaffolding # stargate/wasm/app/enabledProposals func getGovProposalHandlers() []govclient.ProposalHandler { var govProposalHandlers []govclient.ProposalHandler // this line is used by starport scaffolding # stargate/app/govProposalHandlers - govProposalHandlers = append(govProposalHandlers, wasmclient.ProposalHandlers...) - govProposalHandlers = append(govProposalHandlers, + govProposalHandlers = append(wasmclient.ProposalHandlers, paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.ProposalHandler,