Skip to content

Commit

Permalink
feat: handle wasm proposals in app
Browse files Browse the repository at this point in the history
  • Loading branch information
amimart committed Jun 27, 2022
1 parent 602d2db commit 44b10c0
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 44b10c0

Please sign in to comment.