-
Notifications
You must be signed in to change notification settings - Fork 330
/
proposal_submit_fraud.go
74 lines (58 loc) · 2.01 KB
/
proposal_submit_fraud.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package types
import (
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
)
const (
// ProposalTypeSubmitFraud defines the type for a SubmitFraudProposal
ProposalTypeSubmitFraud = "SubmitFraud"
)
// Assert SubmitFraudProposal implements govtypes.Content at compile-time
var _ govtypes.Content = &SubmitFraudProposal{}
func init() {
govtypes.RegisterProposalType(ProposalTypeSubmitFraud)
}
// NewSubmitFraudProposal creates a new submit fraud proposal.
//
//nolint:interfacer
func NewSubmitFraudProposal(title, description, rollappId string, height uint64, seqaddr, clientId string) *SubmitFraudProposal {
return &SubmitFraudProposal{
Title: title,
Description: description,
RollappId: rollappId,
IbcClientId: clientId,
FraudelentHeight: height,
FraudelentSequencerAddress: seqaddr,
}
}
// GetTitle returns the title of a submit fraud proposal.
func (sfp *SubmitFraudProposal) GetTitle() string { return sfp.Title }
// GetDescription returns the description of a submit fraud proposal.
func (sfp *SubmitFraudProposal) GetDescription() string { return sfp.Description }
// ProposalRoute returns the routing key of a submit fraud proposal.
func (sfp *SubmitFraudProposal) ProposalRoute() string { return RouterKey }
// ProposalType returns the type of a submit fraud proposal.
func (sfp *SubmitFraudProposal) ProposalType() string { return ProposalTypeSubmitFraud }
// ValidateBasic runs basic stateless validity checks
func (sfp *SubmitFraudProposal) ValidateBasic() error {
err := govtypes.ValidateAbstract(sfp)
if err != nil {
return err
}
if sfp.RollappId == "" {
return ErrInvalidRollappID
}
if sfp.IbcClientId == "" {
return ErrInvalidClientState
}
if sfp.FraudelentHeight == 0 {
return ErrInvalidHeight
}
if sfp.FraudelentSequencerAddress == "" {
return ErrWrongProposerAddr
}
return nil
}
// String implements the Stringer interface.
func (sfp SubmitFraudProposal) String() string {
return sfp.Description
}