github.com/InjectiveLabs/sdk-go@v1.53.0/chain/peggy/types/proposal.go (about)

     1  package types
     2  
     3  import (
     4  	govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
     5  )
     6  
     7  // constants
     8  const (
     9  	ProposalTypeBlacklistEthereumAddresses string = "ProposalTypeBlacklistEthereumAddresses"
    10  	ProposalTypeRevokeEthereumBlacklist    string = "ProposalTypeRevokeEthereumBlacklist"
    11  )
    12  
    13  func init() {
    14  	govtypes.RegisterProposalType(ProposalTypeBlacklistEthereumAddresses)
    15  	govtypes.RegisterProposalType(ProposalTypeRevokeEthereumBlacklist)
    16  }
    17  
    18  // Implements Proposal Interface
    19  var _ govtypes.Content = &BlacklistEthereumAddressesProposal{}
    20  var _ govtypes.Content = &RevokeEthereumBlacklistProposal{}
    21  
    22  // GetTitle returns the title of this proposal.
    23  func (p *BlacklistEthereumAddressesProposal) GetTitle() string {
    24  	return p.Title
    25  }
    26  
    27  // GetDescription returns the description of this proposal.
    28  func (p *BlacklistEthereumAddressesProposal) GetDescription() string {
    29  	return p.Description
    30  }
    31  
    32  // ProposalRoute returns router key of this proposal.
    33  func (p *BlacklistEthereumAddressesProposal) ProposalRoute() string { return RouterKey }
    34  
    35  // ProposalType returns proposal type of this proposal.
    36  func (p *BlacklistEthereumAddressesProposal) ProposalType() string {
    37  	return ProposalTypeBlacklistEthereumAddresses
    38  }
    39  
    40  // ValidateBasic returns ValidateBasic result of this proposal.
    41  func (p *BlacklistEthereumAddressesProposal) ValidateBasic() error {
    42  	for _, blacklistAddress := range p.BlacklistAddresses {
    43  		if _, err := NewEthAddress(blacklistAddress); err != nil {
    44  			return err
    45  		}
    46  	}
    47  	return govtypes.ValidateAbstract(p)
    48  }
    49  
    50  // GetTitle returns the title of this proposal.
    51  func (p *RevokeEthereumBlacklistProposal) GetTitle() string {
    52  	return p.Title
    53  }
    54  
    55  // GetDescription returns the description of this proposal.
    56  func (p *RevokeEthereumBlacklistProposal) GetDescription() string {
    57  	return p.Description
    58  }
    59  
    60  // ProposalRoute returns router key of this proposal.
    61  func (p *RevokeEthereumBlacklistProposal) ProposalRoute() string { return RouterKey }
    62  
    63  // ProposalType returns proposal type of this proposal.
    64  func (p *RevokeEthereumBlacklistProposal) ProposalType() string {
    65  	return ProposalTypeRevokeEthereumBlacklist
    66  }
    67  
    68  // ValidateBasic returns ValidateBasic result of this proposal.
    69  func (p *RevokeEthereumBlacklistProposal) ValidateBasic() error {
    70  	for _, blacklistAddress := range p.BlacklistAddresses {
    71  		if _, err := NewEthAddress(blacklistAddress); err != nil {
    72  			return err
    73  		}
    74  	}
    75  	return govtypes.ValidateAbstract(p)
    76  }