69 lines
2.3 KiB
Go
69 lines
2.3 KiB
Go
package types
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
gov "github.com/cosmos/cosmos-sdk/x/gov/types"
|
|
)
|
|
|
|
const (
|
|
ProposalTypeSoftwareUpgrade string = "SoftwareUpgrade"
|
|
ProposalTypeCancelSoftwareUpgrade string = "CancelSoftwareUpgrade"
|
|
)
|
|
|
|
func NewSoftwareUpgradeProposal(title, description string, plan Plan) gov.Content {
|
|
return &SoftwareUpgradeProposal{title, description, plan}
|
|
}
|
|
|
|
// Implements Proposal Interface
|
|
var _ gov.Content = &SoftwareUpgradeProposal{}
|
|
|
|
func init() {
|
|
gov.RegisterProposalType(ProposalTypeSoftwareUpgrade)
|
|
gov.RegisterProposalTypeCodec(&SoftwareUpgradeProposal{}, "cosmos-sdk/SoftwareUpgradeProposal")
|
|
gov.RegisterProposalType(ProposalTypeCancelSoftwareUpgrade)
|
|
gov.RegisterProposalTypeCodec(&CancelSoftwareUpgradeProposal{}, "cosmos-sdk/CancelSoftwareUpgradeProposal")
|
|
}
|
|
|
|
func (sup *SoftwareUpgradeProposal) GetTitle() string { return sup.Title }
|
|
func (sup *SoftwareUpgradeProposal) GetDescription() string { return sup.Description }
|
|
func (sup *SoftwareUpgradeProposal) ProposalRoute() string { return RouterKey }
|
|
func (sup *SoftwareUpgradeProposal) ProposalType() string { return ProposalTypeSoftwareUpgrade }
|
|
func (sup *SoftwareUpgradeProposal) ValidateBasic() error {
|
|
if err := sup.Plan.ValidateBasic(); err != nil {
|
|
return err
|
|
}
|
|
return gov.ValidateAbstract(sup)
|
|
}
|
|
|
|
func (sup SoftwareUpgradeProposal) String() string {
|
|
return fmt.Sprintf(`Software Upgrade Proposal:
|
|
Title: %s
|
|
Description: %s
|
|
`, sup.Title, sup.Description)
|
|
}
|
|
|
|
func NewCancelSoftwareUpgradeProposal(title, description string) gov.Content {
|
|
return &CancelSoftwareUpgradeProposal{title, description}
|
|
}
|
|
|
|
// Implements Proposal Interface
|
|
var _ gov.Content = &CancelSoftwareUpgradeProposal{}
|
|
|
|
func (sup *CancelSoftwareUpgradeProposal) GetTitle() string { return sup.Title }
|
|
func (sup *CancelSoftwareUpgradeProposal) GetDescription() string { return sup.Description }
|
|
func (sup *CancelSoftwareUpgradeProposal) ProposalRoute() string { return RouterKey }
|
|
func (sup *CancelSoftwareUpgradeProposal) ProposalType() string {
|
|
return ProposalTypeCancelSoftwareUpgrade
|
|
}
|
|
func (sup *CancelSoftwareUpgradeProposal) ValidateBasic() error {
|
|
return gov.ValidateAbstract(sup)
|
|
}
|
|
|
|
func (sup CancelSoftwareUpgradeProposal) String() string {
|
|
return fmt.Sprintf(`Cancel Software Upgrade Proposal:
|
|
Title: %s
|
|
Description: %s
|
|
`, sup.Title, sup.Description)
|
|
}
|