From 123011c2922899ec91568a9f1f393a78a80352bb Mon Sep 17 00:00:00 2001 From: Pino' Surace Date: Fri, 25 Nov 2022 12:13:22 +0100 Subject: [PATCH] Add helper functions to create new proposals --- x/wasm/types/proposal.go | 66 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/x/wasm/types/proposal.go b/x/wasm/types/proposal.go index 1597818597..16eae262de 100644 --- a/x/wasm/types/proposal.go +++ b/x/wasm/types/proposal.go @@ -411,6 +411,22 @@ func (p StoreAndInstantiateContractProposal) MarshalYAML() (interface{}, error) }, nil } +func NewMigrateContractProposal( + title string, + description string, + contract string, + codeID uint64, + msg RawContractMessage, +) *MigrateContractProposal { + return &MigrateContractProposal{ + Title: title, + Description: description, + Contract: contract, + CodeID: codeID, + Msg: msg, + } +} + // ProposalRoute returns the routing key of a parameter change proposal. func (p MigrateContractProposal) ProposalRoute() string { return RouterKey } @@ -468,6 +484,20 @@ func (p MigrateContractProposal) MarshalYAML() (interface{}, error) { }, nil } +func NewSudoContractProposal( + title string, + description string, + contract string, + msg RawContractMessage, +) *SudoContractProposal { + return &SudoContractProposal{ + Title: title, + Description: description, + Contract: contract, + Msg: msg, + } +} + // ProposalRoute returns the routing key of a parameter change proposal. func (p SudoContractProposal) ProposalRoute() string { return RouterKey } @@ -678,6 +708,18 @@ func (p ClearAdminProposal) String() string { `, p.Title, p.Description, p.Contract) } +func NewPinCodesProposal( + title string, + description string, + codeIDs []uint64, +) *PinCodesProposal { + return &PinCodesProposal{ + Title: title, + Description: description, + CodeIDs: codeIDs, + } +} + // ProposalRoute returns the routing key of a parameter change proposal. func (p PinCodesProposal) ProposalRoute() string { return RouterKey } @@ -710,6 +752,18 @@ func (p PinCodesProposal) String() string { `, p.Title, p.Description, p.CodeIDs) } +func NewUnpinCodesProposal( + title string, + description string, + codeIDs []uint64, +) *UnpinCodesProposal { + return &UnpinCodesProposal{ + Title: title, + Description: description, + CodeIDs: codeIDs, + } +} + // ProposalRoute returns the routing key of a parameter change proposal. func (p UnpinCodesProposal) ProposalRoute() string { return RouterKey } @@ -764,6 +818,18 @@ func validateProposalCommons(title, description string) error { return nil } +func NewUpdateInstantiateConfigProposal( + title string, + description string, + accessConfigUpdates []AccessConfigUpdate, +) *UpdateInstantiateConfigProposal { + return &UpdateInstantiateConfigProposal{ + Title: title, + Description: description, + AccessConfigUpdates: accessConfigUpdates, + } +} + // ProposalRoute returns the routing key of a parameter change proposal. func (p UpdateInstantiateConfigProposal) ProposalRoute() string { return RouterKey }