Documentation ¶
Overview ¶
nolint
Index ¶
- Constants
- Variables
- func ActiveProposalByTimeKey(endTime time.Time) []byte
- func ActiveProposalQueueKey(proposalID uint64, endTime time.Time) []byte
- func DepositKey(proposalID uint64, depositorAddr sdk.AccAddress) []byte
- func DepositsKey(proposalID uint64) []byte
- func ErrInitialDepositNotEnough(initDeposit string) sdk.Error
- func ErrInvalidAddress(address string) sdk.Error
- func ErrInvalidCoins() sdk.Error
- func ErrInvalidGenesis() sdk.Error
- func ErrInvalidHeight(h, ch, max uint64) sdk.Error
- func ErrInvalidProposalContent(msg string) sdk.Error
- func ErrInvalidProposalType(proposalType string) sdk.Error
- func ErrInvalidProposer() sdk.Error
- func ErrInvalidVote(voteOption VoteOption) sdk.Error
- func ErrInvalidateProposalStatus() sdk.Error
- func ErrNoProposalHandlerExists(content interface{}) sdk.Error
- func ErrUnknownGovParamType() sdk.Error
- func ErrUnknownProposal(proposalID uint64) sdk.Error
- func InactiveProposalByTimeKey(endTime time.Time) []byte
- func InactiveProposalQueueKey(proposalID uint64, endTime time.Time) []byte
- func IsValidProposalType(ty string) bool
- func ParamKeyTable() subspace.KeyTable
- func ProposalHandler(_ sdk.Context, p *Proposal) sdk.Error
- func ProposalKey(proposalID uint64) []byte
- func RegisterCodec(cdc *codec.Codec)
- func RegisterProposalType(ty string)
- func RegisterProposalTypeCodec(o interface{}, name string)
- func SplitActiveProposalQueueKey(key []byte) (proposalID uint64, endTime time.Time)
- func SplitInactiveProposalQueueKey(key []byte) (proposalID uint64, endTime time.Time)
- func SplitKeyDeposit(key []byte) (proposalID uint64, depositorAddr sdk.AccAddress)
- func SplitKeyVote(key []byte) (proposalID uint64, voterAddr sdk.AccAddress)
- func SplitProposalKey(key []byte) (proposalID uint64)
- func SplitWaitingProposalQueueKey(key []byte) (proposalID uint64, height uint64)
- func ValidProposalStatus(status ProposalStatus) bool
- func ValidVoteOption(option VoteOption) bool
- func ValidateAbstract(codespace string, c Content) sdk.Error
- func VoteKey(proposalID uint64, voterAddr sdk.AccAddress) []byte
- func VotesKey(proposalID uint64) []byte
- func WaitingProposalByBlockHeightKey(blockHeight uint64) []byte
- func WaitingProposalQueueKey(proposalID uint64, blockHeight uint64) []byte
- type CM45DepositParams
- type CM45Params
- type CM45Proposal
- type CM45TallyParams
- type CM45VotingParams
- type Content
- type Deposit
- type DepositParams
- type Deposits
- type Handler
- type MsgDeposit
- type MsgSubmitProposal
- type MsgVote
- type Params
- type Proposal
- type ProposalQueue
- type ProposalStatus
- func (status ProposalStatus) Format(s fmt.State, verb rune)
- func (status ProposalStatus) Marshal() ([]byte, error)
- func (status ProposalStatus) MarshalJSON() ([]byte, error)
- func (status ProposalStatus) MarshalYAML() (interface{}, error)
- func (status ProposalStatus) String() string
- func (status ProposalStatus) ToCM45Status() string
- func (status *ProposalStatus) Unmarshal(data []byte) error
- func (status *ProposalStatus) UnmarshalJSON(data []byte) error
- type Proposals
- type QueryDepositParams
- type QueryProposalParams
- type QueryProposalsParams
- type QueryVoteParams
- type SoftwareUpgradeProposal
- func (sup SoftwareUpgradeProposal) GetDescription() string
- func (sup SoftwareUpgradeProposal) GetTitle() string
- func (sup SoftwareUpgradeProposal) ProposalRoute() string
- func (sup SoftwareUpgradeProposal) ProposalType() string
- func (sup SoftwareUpgradeProposal) String() string
- func (sup SoftwareUpgradeProposal) ValidateBasic() sdk.Error
- type TallyParams
- type TallyResult
- type TextProposal
- type Vote
- type VoteOption
- type Votes
- type VotingParams
- type WrappedDeposits
- type WrappedProposal
- type WrappedProposals
- type WrappedTallyResult
Constants ¶
const ( MaxDescriptionLength int = 5000 MaxTitleLength int = 140 MaxExtraBodyLength int = 5000 MaxExtraActionLength int = 140 )
Constants pertaining to a Content object
const ( DefaultCodespace string = "gov" BaseGovError uint32 = 68000 CodeInvalidAddress uint32 = BaseGovError CodeUnknownProposal uint32 = BaseGovError + 1 CodeInvalidContent uint32 = BaseGovError + 2 CodeInvalidProposalType uint32 = BaseGovError + 3 CodeInvalidVote uint32 = BaseGovError + 4 CodeInvalidGenesis uint32 = BaseGovError + 5 CodeProposalHandlerNotExists uint32 = BaseGovError + 6 CodeInvalidProposalStatus uint32 = BaseGovError + 7 CodeInitialDepositNotEnough uint32 = BaseGovError + 8 CodeInvalidProposer uint32 = BaseGovError + 9 CodeInvalidHeight uint32 = BaseGovError + 10 CodeInvalidCoins uint32 = BaseGovError + 11 CodeUnknownParamType uint32 = BaseGovError + 12 )
const ( // AttributeKeyProposalStatus defines the proposal status attribute in gov AttributeKeyProposalStatus = "proposal_status" EventTypeSubmitProposal = "submit_proposal" EventTypeProposalDeposit = "proposal_deposit" EventTypeProposalVote = "proposal_vote" EventTypeProposalVoteTally = "proposal_vote_tally" EventTypeInactiveProposal = "inactive_proposal" EventTypeActiveProposal = "active_proposal" AttributeKeyProposalResult = "proposal_result" AttributeKeyProposalLog = "proposal_result_log" AttributeKeyOption = "option" AttributeKeyProposalID = "proposal_id" AttributeKeyVotingPeriodStart = "voting_period_start" AttributeValueCategory = "governance" AttributeValueProposalDropped = "proposal_dropped" // didn't meet min deposit AttributeValueProposalPassed = "proposal_passed" // met vote quorum AttributeValueProposalRejected = "proposal_rejected" // didn't meet vote quorum AttributeValueProposalFailed = "proposal_failed" // error on proposal handler )
const ( // ModuleName is the name of the module ModuleName = "gov" // StoreKey is the store key string for gov StoreKey = ModuleName // RouterKey is the message route for gov RouterKey = ModuleName // QuerierRoute is the querier route for gov QuerierRoute = ModuleName // DefaultParamspace default name for parameter store DefaultParamspace = ModuleName )
const ( TypeMsgDeposit = "deposit" TypeMsgVote = "vote" TypeMsgSubmitProposal = "submit_proposal" )
Governance message types and routes
const ( ProposalTypeText string = "Text" ProposalTypeSoftwareUpgrade string = "SoftwareUpgrade" )
Proposal types
const ( QueryParams = "params" QueryProposals = "proposals" QueryProposal = "proposal" QueryCM45Proposals = "cm45proposals" QueryCM45Proposal = "cm45proposal" QueryDeposits = "deposits" QueryDeposit = "deposit" QueryVotes = "votes" QueryVote = "vote" QueryTally = "tally" ParamDeposit = "deposit" ParamVoting = "voting" ParamTallying = "tallying" )
query endpoints supported by the governance Querier
Variables ¶
var ( ProposalsKeyPrefix = []byte{0x00} ActiveProposalQueuePrefix = []byte{0x01} InactiveProposalQueuePrefix = []byte{0x02} ProposalIDKey = []byte{0x03} DepositsKeyPrefix = []byte{0x10} VotesKeyPrefix = []byte{0x20} // PrefixWaitingProposalQueue defines the prefix of waiting proposal queue PrefixWaitingProposalQueue = []byte{0x30} )
Keys for governance store Items are stored with the following key: values
- 0x00<proposalID_Bytes>: Proposal
- 0x01<endTime_Bytes><proposalID_Bytes>: activeProposalID
- 0x02<endTime_Bytes><proposalID_Bytes>: inactiveProposalID
- 0x03: nextProposalID
- 0x10<proposalID_Bytes><depositorAddr_Bytes>: Deposit
- 0x20<proposalID_Bytes><voterAddr_Bytes>: Voter
var ( ParamStoreKeyDepositParams = []byte("depositparams") ParamStoreKeyVotingParams = []byte("votingparams") ParamStoreKeyTallyParams = []byte("tallyparams") )
Parameter store key
var ModuleCdc = codec.New()
module codec
Functions ¶
func ActiveProposalByTimeKey ¶
ActiveProposalByTimeKey gets the active proposal queue key by endTime
func ActiveProposalQueueKey ¶
ActiveProposalQueueKey returns the key for a proposalID in the activeProposalQueue
func DepositKey ¶
func DepositKey(proposalID uint64, depositorAddr sdk.AccAddress) []byte
DepositKey key of a specific deposit from the store
func DepositsKey ¶
DepositsKey gets the first part of the deposits key based on the proposalID
func ErrInvalidAddress ¶
func ErrInvalidCoins ¶
func ErrInvalidGenesis ¶
func ErrInvalidHeight ¶
func ErrInvalidProposalType ¶
func ErrInvalidProposer ¶
func ErrInvalidVote ¶
func ErrInvalidVote(voteOption VoteOption) sdk.Error
func ErrUnknownGovParamType ¶
func ErrUnknownProposal ¶
func InactiveProposalByTimeKey ¶
InactiveProposalByTimeKey gets the inactive proposal queue key by endTime
func InactiveProposalQueueKey ¶
InactiveProposalQueueKey returns the key for a proposalID in the inactiveProposalQueue
func IsValidProposalType ¶
IsValidProposalType returns a boolean determining if the proposal type is valid.
NOTE: Modules with their own proposal types must register them.
func ProposalHandler ¶
ProposalHandler implements the Handler interface for governance module-based proposals (ie. TextProposal and SoftwareUpgradeProposal). Since these are merely signaling mechanisms at the moment and do not affect state, it performs a no-op.
func ProposalKey ¶
ProposalKey gets a specific proposal from the store
func RegisterCodec ¶
RegisterCodec registers all the necessary types and interfaces for governance.
func RegisterProposalType ¶
func RegisterProposalType(ty string)
RegisterProposalType registers a proposal type. It will panic if the type is already registered.
func RegisterProposalTypeCodec ¶
func RegisterProposalTypeCodec(o interface{}, name string)
RegisterProposalTypeCodec registers an external proposal content type defined in another module for the internal ModuleCdc. This allows the MsgSubmitProposal to be correctly Amino encoded and decoded.
func SplitActiveProposalQueueKey ¶
SplitActiveProposalQueueKey split the active proposal key and returns the proposal id and endTime
func SplitInactiveProposalQueueKey ¶
SplitInactiveProposalQueueKey split the inactive proposal key and returns the proposal id and endTime
func SplitKeyDeposit ¶
func SplitKeyDeposit(key []byte) (proposalID uint64, depositorAddr sdk.AccAddress)
SplitKeyDeposit split the deposits key and returns the proposal id and depositor address
func SplitKeyVote ¶
func SplitKeyVote(key []byte) (proposalID uint64, voterAddr sdk.AccAddress)
SplitKeyVote split the votes key and returns the proposal id and voter address
func SplitProposalKey ¶
SplitProposalKey split the proposal key and returns the proposal id
func SplitWaitingProposalQueueKey ¶
SplitWaitingProposalQueueKey split the active proposal key and returns the proposal id and endTime
func ValidProposalStatus ¶
func ValidProposalStatus(status ProposalStatus) bool
ValidProposalStatus returns true if the proposal status is valid and false otherwise.
func ValidVoteOption ¶
func ValidVoteOption(option VoteOption) bool
ValidVoteOption returns true if the vote option is valid and false otherwise.
func ValidateAbstract ¶
ValidateAbstract validates a proposal's abstract contents returning an error if invalid.
func VoteKey ¶
func VoteKey(proposalID uint64, voterAddr sdk.AccAddress) []byte
VoteKey key of a specific vote from the store
func WaitingProposalByBlockHeightKey ¶
WaitingProposalByBlockHeightKey gets the waiting proposal queue key by block height
func WaitingProposalQueueKey ¶
WaitingProposalQueueKey returns the key for a proposalID in the WaitingProposalQueue
Types ¶
type CM45DepositParams ¶ added in v1.7.0
type CM45Params ¶ added in v1.7.0
type CM45Params struct { VotingParams CM45VotingParams `json:"voting_params" yaml:"voting_params"` TallyParams CM45TallyParams `json:"tally_params" yaml:"tally_params"` DepositParams CM45DepositParams `json:"deposit_params" yaml:"deposit_parmas"` }
func NewCM45Params ¶ added in v1.7.0
func NewCM45Params(vp CM45VotingParams, tp CM45TallyParams, dp CM45DepositParams) CM45Params
type CM45Proposal ¶ added in v1.7.0
type CM45Proposal struct { Content `json:"content" yaml:"content"` // Proposal content interface ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"` // ID of the proposal Status string `json:"status" yaml:"status"` // Status of the Proposal {Pending, Active, Passed, Rejected} FinalTallyResult TallyResult `json:"final_tally_result" yaml:"final_tally_result"` // Result of Tallys SubmitTime time.Time `json:"submit_time" yaml:"submit_time"` // Time of the block where TxGovSubmitProposal was included DepositEndTime time.Time `json:"deposit_end_time" yaml:"deposit_end_time"` // Time that the Proposal would expire if deposit amount isn't met TotalDeposit sdk.SysCoins `json:"total_deposit" yaml:"total_deposit"` // Current deposit on this proposal. Initial value is set at InitialDeposit VotingStartTime time.Time `json:"voting_start_time" yaml:"voting_start_time"` // Time of the block where MinDeposit was reached. -1 if MinDeposit is not reached VotingEndTime time.Time `json:"voting_end_time" yaml:"voting_end_time"` // Time that the VotingPeriod for this proposal will end and votes will be tallied }
CM45Proposal is constructed to be compatible with the REST API of cosmos v0.45.1
type CM45TallyParams ¶ added in v1.7.0
type CM45TallyParams struct { Quorum sdk.Dec `json:"quorum,omitempty" yaml:"quorum,omitempty"` // Minimum percentage of total stake needed to vote for a result to be considered valid Threshold sdk.Dec `json:"threshold,omitempty" yaml:"threshold,omitempty"` // Minimum proportion of Yes votes for proposal to pass. Initial value: 0.5 Veto sdk.Dec `json:"veto_threshold,omitempty" yaml:"veto_threshold,omitempty"` // Minimum value of Veto votes to Total votes ratio for proposal to be vetoed. Initial value: 1/3 YesInVotePeriod sdk.Dec `json:"yes_in_vote_period,omitempty" yaml:"yes_in_vote_period,omitempty"` // }
type CM45VotingParams ¶ added in v1.7.0
type CM45VotingParams struct {
VotingPeriod string `json:"voting_period,omitempty" yaml:"voting_period,omitempty"` // Length of the voting period.
}
type Content ¶
type Content interface { GetTitle() string GetDescription() string ProposalRoute() string ProposalType() string ValidateBasic() sdk.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.
func ContentFromProposalType ¶
ContentFromProposalType returns a Content object based on the proposal type.
func NewTextProposal ¶
type Deposit ¶
type Deposit struct { ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"` // proposalID of the proposal Depositor sdk.AccAddress `json:"depositor" yaml:"depositor"` // Address of the depositor Amount sdk.SysCoins `json:"amount" yaml:"amount"` // Deposit amount }
Deposit
func NewDeposit ¶
NewDeposit creates a new Deposit instance
type DepositParams ¶
type DepositParams struct { MinDeposit sdk.SysCoins `json:"min_deposit,omitempty" yaml:"min_deposit,omitempty"` // Minimum deposit for a proposal to enter voting period. MaxDepositPeriod time.Duration `json:"max_deposit_period,omitempty" yaml:"max_deposit_period,omitempty"` // Maximum period for okt holders to deposit on a proposal. Initial value: 2 months }
Param around deposits for governance
func DefaultDepositParams ¶ added in v1.7.0
func DefaultDepositParams() DepositParams
func NewDepositParams ¶
func NewDepositParams(minDeposit sdk.SysCoins, maxDepositPeriod time.Duration) DepositParams
NewDepositParams creates a new DepositParams object
func (DepositParams) Equal ¶
func (dp DepositParams) Equal(dp2 DepositParams) bool
Checks equality of DepositParams
func (DepositParams) String ¶
func (dp DepositParams) String() string
func (DepositParams) ToCM45DepositParams ¶ added in v1.7.0
func (p DepositParams) ToCM45DepositParams() CM45DepositParams
type Handler ¶
Handler defines a function that handles a proposal after it has passed the governance process.
type MsgDeposit ¶
type MsgDeposit struct { ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"` // ID of the proposal Depositor sdk.AccAddress `json:"depositor" yaml:"depositor"` // Address of the depositor Amount sdk.SysCoins `json:"amount" yaml:"amount"` // Coins to add to the proposal's deposit }
MsgDeposit
func NewMsgDeposit ¶
func NewMsgDeposit(depositor sdk.AccAddress, proposalID uint64, amount sdk.SysCoins) MsgDeposit
func (MsgDeposit) String ¶
func (msg MsgDeposit) String() string
func (MsgDeposit) Type ¶
func (msg MsgDeposit) Type() string
type MsgSubmitProposal ¶
type MsgSubmitProposal struct { Content Content `json:"content" yaml:"content"` InitialDeposit sdk.SysCoins `json:"initial_deposit" yaml:"initial_deposit"` // Initial deposit paid by sender. Must be strictly positive Proposer sdk.AccAddress `json:"proposer" yaml:"proposer"` // Address of the proposer }
MsgSubmitProposal
func NewMsgSubmitProposal ¶
func NewMsgSubmitProposal(content Content, initialDeposit sdk.SysCoins, proposer sdk.AccAddress) MsgSubmitProposal
func (MsgSubmitProposal) GetSignBytes ¶
func (msg MsgSubmitProposal) GetSignBytes() []byte
Implements Msg.
func (MsgSubmitProposal) GetSigners ¶
func (msg MsgSubmitProposal) GetSigners() []sdk.AccAddress
Implements Msg.
func (MsgSubmitProposal) String ¶
func (msg MsgSubmitProposal) String() string
func (MsgSubmitProposal) Type ¶
func (msg MsgSubmitProposal) Type() string
func (MsgSubmitProposal) ValidateBasic ¶
func (msg MsgSubmitProposal) ValidateBasic() sdk.Error
Implements Msg.
type MsgVote ¶
type MsgVote struct { ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"` // ID of the proposal Voter sdk.AccAddress `json:"voter" yaml:"voter"` // address of the voter Option VoteOption `json:"option" yaml:"option"` // option from OptionSet chosen by the voter }
MsgVote
func NewMsgVote ¶
func NewMsgVote(voter sdk.AccAddress, proposalID uint64, option VoteOption) MsgVote
type Params ¶
type Params struct { VotingParams VotingParams `json:"voting_params" yaml:"voting_params"` TallyParams TallyParams `json:"tally_params" yaml:"tally_params"` DepositParams DepositParams `json:"deposit_params" yaml:"deposit_parmas"` }
Params returns all of the governance params
func NewParams ¶
func NewParams(vp VotingParams, tp TallyParams, dp DepositParams) Params
type Proposal ¶
type Proposal struct { Content `json:"content" yaml:"content"` // Proposal content interface ProposalID uint64 `json:"id" yaml:"id"` // ID of the proposal Status ProposalStatus `json:"proposal_status" yaml:"proposal_status"` // Status of the Proposal {Pending, Active, Passed, Rejected} FinalTallyResult TallyResult `json:"final_tally_result" yaml:"final_tally_result"` // Result of Tallys SubmitTime time.Time `json:"submit_time" yaml:"submit_time"` // Time of the block where TxGovSubmitProposal was included DepositEndTime time.Time `json:"deposit_end_time" yaml:"deposit_end_time"` // Time that the Proposal would expire if deposit amount isn't met TotalDeposit sdk.SysCoins `json:"total_deposit" yaml:"total_deposit"` // Current deposit on this proposal. Initial value is set at InitialDeposit VotingStartTime time.Time `json:"voting_start_time" yaml:"voting_start_time"` // Time of the block where MinDeposit was reached. -1 if MinDeposit is not reached VotingEndTime time.Time `json:"voting_end_time" yaml:"voting_end_time"` // Time that the VotingPeriod for this proposal will end and votes will be tallied }
Proposal defines a struct used by the governance module to allow for voting on network changes.
func NewProposal ¶
func WrapProposalForCosmosAPI ¶ added in v1.6.3
WrapProposalForCosmosAPI is for compatibility with the standard cosmos REST API
func (Proposal) ToCM45Proposal ¶ added in v1.7.0
func (p Proposal) ToCM45Proposal() CM45Proposal
type ProposalStatus ¶
type ProposalStatus byte
ProposalStatus is a type alias that represents a proposal status as a byte
const ( StatusNil ProposalStatus = 0x00 StatusDepositPeriod ProposalStatus = 0x01 StatusVotingPeriod ProposalStatus = 0x02 StatusPassed ProposalStatus = 0x03 StatusRejected ProposalStatus = 0x04 StatusFailed ProposalStatus = 0x05 )
nolint
func ProposalStatusFromString ¶
func ProposalStatusFromString(str string) (ProposalStatus, error)
ProposalStatusToString turns a string into a ProposalStatus
func (ProposalStatus) Format ¶
func (status ProposalStatus) Format(s fmt.State, verb rune)
Format implements the fmt.Formatter interface. nolint: errcheck
func (ProposalStatus) Marshal ¶
func (status ProposalStatus) Marshal() ([]byte, error)
Marshal needed for protobuf compatibility
func (ProposalStatus) MarshalJSON ¶
func (status ProposalStatus) MarshalJSON() ([]byte, error)
Marshals to JSON using string
func (ProposalStatus) MarshalYAML ¶
func (status ProposalStatus) MarshalYAML() (interface{}, error)
func (ProposalStatus) String ¶
func (status ProposalStatus) String() string
String implements the Stringer interface.
func (ProposalStatus) ToCM45Status ¶ added in v1.7.0
func (status ProposalStatus) ToCM45Status() string
func (*ProposalStatus) Unmarshal ¶
func (status *ProposalStatus) Unmarshal(data []byte) error
Unmarshal needed for protobuf compatibility
func (*ProposalStatus) UnmarshalJSON ¶
func (status *ProposalStatus) UnmarshalJSON(data []byte) error
Unmarshals from JSON assuming Bech32 encoding
type QueryDepositParams ¶
type QueryDepositParams struct { ProposalID uint64 Depositor sdk.AccAddress }
Params for query 'custom/gov/deposit'
func NewQueryDepositParams ¶
func NewQueryDepositParams(proposalID uint64, depositor sdk.AccAddress) QueryDepositParams
creates a new instance of QueryDepositParams
type QueryProposalParams ¶
type QueryProposalParams struct {
ProposalID uint64
}
Params for queries: - 'custom/gov/proposal' - 'custom/gov/deposits' - 'custom/gov/tally' - 'custom/gov/votes'
func NewQueryProposalParams ¶
func NewQueryProposalParams(proposalID uint64) QueryProposalParams
creates a new instance of QueryProposalParams
type QueryProposalsParams ¶
type QueryProposalsParams struct { Voter sdk.AccAddress Depositor sdk.AccAddress ProposalStatus ProposalStatus Limit uint64 }
Params for query 'custom/gov/proposals'
func NewQueryProposalsParams ¶
func NewQueryProposalsParams(status ProposalStatus, limit uint64, voter, depositor sdk.AccAddress) QueryProposalsParams
creates a new instance of QueryProposalsParams
type QueryVoteParams ¶
type QueryVoteParams struct { ProposalID uint64 Voter sdk.AccAddress }
Params for query 'custom/gov/vote'
func NewQueryVoteParams ¶
func NewQueryVoteParams(proposalID uint64, voter sdk.AccAddress) QueryVoteParams
creates a new instance of QueryVoteParams
type SoftwareUpgradeProposal ¶
type SoftwareUpgradeProposal struct { Title string `json:"title" yaml:"title"` Description string `json:"description" yaml:"description"` }
Software Upgrade Proposals TODO: We have to add fields for SUP specific arguments e.g. commit hash, upgrade date, etc.
func (SoftwareUpgradeProposal) GetDescription ¶
func (sup SoftwareUpgradeProposal) GetDescription() string
func (SoftwareUpgradeProposal) GetTitle ¶
func (sup SoftwareUpgradeProposal) GetTitle() string
nolint
func (SoftwareUpgradeProposal) ProposalRoute ¶
func (sup SoftwareUpgradeProposal) ProposalRoute() string
func (SoftwareUpgradeProposal) ProposalType ¶
func (sup SoftwareUpgradeProposal) ProposalType() string
func (SoftwareUpgradeProposal) String ¶
func (sup SoftwareUpgradeProposal) String() string
func (SoftwareUpgradeProposal) ValidateBasic ¶
func (sup SoftwareUpgradeProposal) ValidateBasic() sdk.Error
type TallyParams ¶
type TallyParams struct { Quorum sdk.Dec `json:"quorum,omitempty" yaml:"quorum,omitempty"` // Minimum percentage of total stake needed to vote for a result to be considered valid Threshold sdk.Dec `json:"threshold,omitempty" yaml:"threshold,omitempty"` // Minimum proportion of Yes votes for proposal to pass. Initial value: 0.5 Veto sdk.Dec `json:"veto,omitempty" yaml:"veto,omitempty"` // Minimum value of Veto votes to Total votes ratio for proposal to be vetoed. Initial value: 1/3 YesInVotePeriod sdk.Dec `json:"yes_in_vote_period,omitempty" yaml:"yes_in_vote_period,omitempty"` // }
Param around Tallying votes in governance
func DefaultTallyParams ¶ added in v1.7.0
func DefaultTallyParams() TallyParams
func NewTallyParams ¶
func NewTallyParams(quorum, threshold, veto sdk.Dec) TallyParams
NewTallyParams creates a new TallyParams object
func (TallyParams) String ¶
func (tp TallyParams) String() string
func (TallyParams) ToCM45TallyParams ¶ added in v1.7.0
func (tp TallyParams) ToCM45TallyParams() CM45TallyParams
type TallyResult ¶
type TallyResult struct { // total power of accounts whose votes are voted to the current validator set TotalPower sdk.Dec `json:"total_power"` // total power of accounts who has voted for a proposal TotalVotedPower sdk.Dec `json:"total_voted_power"` Yes sdk.Dec `json:"yes"` Abstain sdk.Dec `json:"abstain"` No sdk.Dec `json:"no"` NoWithVeto sdk.Dec `json:"no_with_veto"` }
Tally Results
func EmptyTallyResult ¶
func EmptyTallyResult(totalVoting sdk.Dec) TallyResult
EmptyTallyResult returns an empty TallyResult.
func NewTallyResult ¶
func NewTallyResult(yes, abstain, no, noWithVeto sdk.Dec) TallyResult
func NewTallyResultFromMap ¶
func NewTallyResultFromMap(results map[VoteOption]sdk.Dec) TallyResult
func (TallyResult) Equals ¶
func (tr TallyResult) Equals(comp TallyResult) bool
Equals returns if two proposals are equal.
func (TallyResult) String ¶
func (tr TallyResult) String() string
type TextProposal ¶
type TextProposal struct { Title string `json:"title" yaml:"title"` Description string `json:"description" yaml:"description"` }
Text Proposal
func (TextProposal) GetDescription ¶
func (tp TextProposal) GetDescription() string
func (TextProposal) ProposalRoute ¶
func (tp TextProposal) ProposalRoute() string
func (TextProposal) ProposalType ¶
func (tp TextProposal) ProposalType() string
func (TextProposal) String ¶
func (tp TextProposal) String() string
func (TextProposal) ValidateBasic ¶
func (tp TextProposal) ValidateBasic() sdk.Error
type Vote ¶
type Vote struct { ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"` // proposalID of the proposal Voter sdk.AccAddress `json:"voter" yaml:"voter"` // address of the voter Option VoteOption `json:"option" yaml:"option"` // option from OptionSet chosen by the voter }
Vote
func NewVote ¶
func NewVote(proposalID uint64, voter sdk.AccAddress, option VoteOption) Vote
NewVote creates a new Vote instance
type VoteOption ¶
type VoteOption byte
VoteOption defines a vote option
const ( OptionEmpty VoteOption = 0x00 OptionYes VoteOption = 0x01 OptionAbstain VoteOption = 0x02 OptionNo VoteOption = 0x03 OptionNoWithVeto VoteOption = 0x04 )
Vote options
func VoteOptionFromString ¶
func VoteOptionFromString(str string) (VoteOption, error)
VoteOptionFromString returns a VoteOption from a string. It returns an error if the string is invalid.
func (VoteOption) Format ¶
func (vo VoteOption) Format(s fmt.State, verb rune)
Format implements the fmt.Formatter interface. nolint: errcheck
func (VoteOption) Marshal ¶
func (vo VoteOption) Marshal() ([]byte, error)
Marshal needed for protobuf compatibility.
func (VoteOption) MarshalJSON ¶
func (vo VoteOption) MarshalJSON() ([]byte, error)
Marshals to JSON using string.
func (VoteOption) String ¶
func (vo VoteOption) String() string
String implements the Stringer interface.
func (*VoteOption) Unmarshal ¶
func (vo *VoteOption) Unmarshal(data []byte) error
Unmarshal needed for protobuf compatibility.
func (*VoteOption) UnmarshalJSON ¶
func (vo *VoteOption) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes from JSON assuming Bech32 encoding.
type VotingParams ¶
type VotingParams struct {
VotingPeriod time.Duration `json:"voting_period,omitempty" yaml:"voting_period,omitempty"` // Length of the voting period.
}
Param around Voting in governance
func DefaultVotingParams ¶ added in v1.7.0
func DefaultVotingParams() VotingParams
func NewVotingParams ¶
func NewVotingParams(votingPeriod time.Duration) VotingParams
NewVotingParams creates a new VotingParams object
func (VotingParams) String ¶
func (vp VotingParams) String() string
func (VotingParams) ToCM45VotingParams ¶ added in v1.7.0
func (vp VotingParams) ToCM45VotingParams() CM45VotingParams
type WrappedDeposits ¶ added in v1.7.0
type WrappedDeposits struct {
Ds Deposits `json:"deposits" yaml:"result"`
}
func NewWrappedDeposits ¶ added in v1.7.0
func NewWrappedDeposits(ds Deposits) WrappedDeposits
type WrappedProposal ¶ added in v1.7.0
type WrappedProposal struct {
P CM45Proposal `json:"proposal" yaml:"result"`
}
func NewWrappedProposal ¶ added in v1.7.0
func NewWrappedProposal(p CM45Proposal) WrappedProposal
type WrappedProposals ¶ added in v1.7.0
type WrappedProposals struct {
Ps []CM45Proposal `json:"proposals" yaml:"result"`
}
func NewWrappedProposals ¶ added in v1.7.0
func NewWrappedProposals(ps []CM45Proposal) WrappedProposals
type WrappedTallyResult ¶ added in v1.7.0
type WrappedTallyResult struct {
TR TallyResult `json:"tally"`
}
func NewWrappedTallyResult ¶ added in v1.7.0
func NewWrappedTallyResult(tr TallyResult) WrappedTallyResult