Skip to content

Commit

Permalink
Add helper functions to create new proposals
Browse files Browse the repository at this point in the history
  • Loading branch information
pinosu committed Nov 25, 2022
1 parent d2fef5f commit 123011c
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions x/wasm/types/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand Down Expand Up @@ -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 }

Expand Down Expand Up @@ -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 }

Expand Down Expand Up @@ -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 }

Expand Down Expand Up @@ -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 }

Expand Down

0 comments on commit 123011c

Please sign in to comment.