Documentation
¶
Overview ¶
DONTCOVER nolint
Index ¶
- Constants
- func ValidateAbstract(c Content) error
- type Content
- type Deposit
- type DepositParams
- type DepositWithMetadata
- type Deposits
- type GenesisState
- type Handler
- type Proposal
- type ProposalContent
- type ProposalKind
- type ProposalQueue
- type ProposalStatus
- type Proposals
- type TallyParams
- type TallyResult
- type TextProposal
- type Vote
- type VoteOption
- type VoteWithMetadata
- type Votes
- type VotingParams
Constants ¶
View Source
const ( ModuleName = "gov" StatusNil ProposalStatus = 0x00 StatusDepositPeriod ProposalStatus = 0x01 StatusVotingPeriod ProposalStatus = 0x02 StatusPassed ProposalStatus = 0x03 StatusRejected ProposalStatus = 0x04 StatusFailed ProposalStatus = 0x05 OptionEmpty VoteOption = 0x00 OptionYes VoteOption = 0x01 OptionAbstain VoteOption = 0x02 OptionNo VoteOption = 0x03 OptionNoWithVeto VoteOption = 0x04 ProposalTypeNil ProposalKind = 0x00 ProposalTypeText ProposalKind = 0x01 ProposalTypeParameterChange ProposalKind = 0x02 )
View Source
const ( MaxDescriptionLength int = 5000 MaxTitleLength int = 140 )
Constants pertaining to a Content object
Variables ¶
This section is empty.
Functions ¶
func ValidateAbstract ¶
ValidateAbstract validates a proposal's abstract contents returning an error if invalid.
Types ¶
type Content ¶
type Content interface { GetTitle() string GetDescription() string ProposalRoute() string ProposalType() string ValidateBasic() error String() string }
Content defines an interface that a proposal must implement. It contains information such as the title and description along with the type and routing information for the appropriate handler to process the proposal. Content can have additional fields, which will handled by a proposal's Handler.
type Deposit ¶
type Deposit struct { ProposalID uint64 `json:"proposal_id"` Depositor sdk.AccAddress `json:"depositor"` Amount sdk.Coins `json:"amount"` }
type DepositParams ¶
type DepositWithMetadata ¶
type GenesisState ¶
type GenesisState struct { StartingProposalID uint64 `json:"starting_proposal_id"` Deposits []DepositWithMetadata `json:"deposits"` Votes []VoteWithMetadata `json:"votes"` Proposals []Proposal `json:"proposals"` DepositParams DepositParams `json:"deposit_params"` VotingParams VotingParams `json:"voting_params"` TallyParams TallyParams `json:"tally_params"` }
type Handler ¶
Handler defines a function that handles a proposal after it has passed the governance process.
type Proposal ¶
type Proposal struct { ProposalContent `json:"proposal_content"` ProposalID uint64 `json:"proposal_id"` Status ProposalStatus `json:"proposal_status"` FinalTallyResult TallyResult `json:"final_tally_result"` SubmitTime time.Time `json:"submit_time"` DepositEndTime time.Time `json:"deposit_end_time"` TotalDeposit sdk.Coins `json:"total_deposit"` VotingStartTime time.Time `json:"voting_start_time"` VotingEndTime time.Time `json:"voting_end_time"` }
type ProposalContent ¶
type ProposalContent interface { GetTitle() string GetDescription() string ProposalType() ProposalKind }
type ProposalKind ¶
type ProposalKind byte
func ProposalTypeFromString ¶
func ProposalTypeFromString(str string) (ProposalKind, error)
func (ProposalKind) Marshal ¶
func (pt ProposalKind) Marshal() ([]byte, error)
func (ProposalKind) MarshalJSON ¶
func (pt ProposalKind) MarshalJSON() ([]byte, error)
func (ProposalKind) String ¶
func (pt ProposalKind) String() string
func (*ProposalKind) Unmarshal ¶
func (pt *ProposalKind) Unmarshal(data []byte) error
func (*ProposalKind) UnmarshalJSON ¶
func (pt *ProposalKind) UnmarshalJSON(data []byte) error
type ProposalQueue ¶
type ProposalQueue []uint64
type ProposalStatus ¶
type ProposalStatus byte
func ProposalStatusFromString ¶
func ProposalStatusFromString(str string) (ProposalStatus, error)
ProposalStatusToString turns a string into a ProposalStatus
func (ProposalStatus) Marshal ¶
func (status ProposalStatus) Marshal() ([]byte, error)
func (ProposalStatus) MarshalJSON ¶
func (status ProposalStatus) MarshalJSON() ([]byte, error)
func (ProposalStatus) String ¶
func (status ProposalStatus) String() string
func (*ProposalStatus) Unmarshal ¶
func (status *ProposalStatus) Unmarshal(data []byte) error
func (*ProposalStatus) UnmarshalJSON ¶
func (status *ProposalStatus) UnmarshalJSON(data []byte) error
type TallyParams ¶
type TallyResult ¶
type TextProposal ¶
func (TextProposal) GetDescription ¶
func (tp TextProposal) GetDescription() string
func (TextProposal) GetTitle ¶
func (tp TextProposal) GetTitle() string
func (TextProposal) ProposalType ¶
func (tp TextProposal) ProposalType() ProposalKind
type Vote ¶
type Vote struct { ProposalID uint64 `json:"proposal_id"` Voter sdk.AccAddress `json:"voter"` Option VoteOption `json:"option"` }
type VoteOption ¶
type VoteOption byte
func VoteOptionFromString ¶
func VoteOptionFromString(str string) (VoteOption, error)
func (VoteOption) Marshal ¶
func (vo VoteOption) Marshal() ([]byte, error)
func (VoteOption) MarshalJSON ¶
func (vo VoteOption) MarshalJSON() ([]byte, error)
func (VoteOption) String ¶
func (vo VoteOption) String() string
func (*VoteOption) Unmarshal ¶
func (vo *VoteOption) Unmarshal(data []byte) error
func (*VoteOption) UnmarshalJSON ¶
func (vo *VoteOption) UnmarshalJSON(data []byte) error
type VoteWithMetadata ¶
type VotingParams ¶
Click to show internal directories.
Click to hide internal directories.