Documentation ¶
Index ¶
- Constants
- Variables
- func ParamKeyTable() params.KeyTable
- func ProposalHandler(_ sdk.Context, c types.Content) error
- func ValidProposalStatus(status ProposalStatus) bool
- func ValidateGenesis(data GenesisState) error
- type CertKeeper
- type Deposit
- type DepositParams
- type Deposits
- type GenesisState
- type ParamSubspace
- 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) String() string
- func (status *ProposalStatus) Unmarshal(data []byte) error
- func (status *ProposalStatus) UnmarshalJSON(data []byte) error
- type Proposals
- type QueryProposalsParams
- type ShieldKeeper
- type StakingKeeper
- type TallyParams
- type UpgradeKeeper
- type Vote
- type Votes
Constants ¶
const ( AttributeKeyDepositor = "depositor" AttributeKeyVoter = "voter" AttributeTxHash = "txhash" )
const ( // StatusNil is the nil status. StatusNil ProposalStatus = iota // StatusDepositPeriod is the deposit period status. StatusDepositPeriod // StatusCertifierVotingPeriod is the certifier voting period status. StatusCertifierVotingPeriod // StatusValidatorVotingPeriod is the validator voting period status. StatusValidatorVotingPeriod // StatusPassed is the passed status. StatusPassed // StatusRejected is the rejected status. StatusRejected // StatusFailed is the failed status. StatusFailed // DepositPeriod is the string of DepositPeriod. DepositPeriod = "DepositPeriod" // CertifierVotingPeriod is the string of CertifierVotingPeriod. CertifierVotingPeriod = "CertifierVotingPeriod" // ValidatorVotingPeriod is the string of ValidatorVotingPeriod. ValidatorVotingPeriod = "ValidatorVotingPeriod" // Passed is the string of Passed. Passed = "Passed" // Rejected is the string of Rejected. Rejected = "Rejected" // Failed is the string of Failed. Failed = "Failed" )
const ( ProposalTypeText string = "Text" ProposalTypeSoftwareUpgrade string = "SoftwareUpgrade" )
Proposal types
Variables ¶
var ( ParamStoreKeyDepositParams = []byte("depositparams") ParamStoreKeyVotingParams = []byte("votingparams") ParamStoreKeyTallyParams = []byte("tallyparams") )
parameter store keys
Functions ¶
func ParamKeyTable ¶
ParamKeyTable is the key declaration for parameters.
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 ValidProposalStatus ¶
func ValidProposalStatus(status ProposalStatus) bool
ValidProposalStatus returns true if the proposal status is valid and false otherwise.
func ValidateGenesis ¶
func ValidateGenesis(data GenesisState) error
ValidateGenesis validates crisis genesis data.
Types ¶
type CertKeeper ¶
type CertKeeper interface { IsCertifier(ctx sdk.Context, addr sdk.AccAddress) bool GetAllCertifiers(ctx sdk.Context) (certifiers cert.Certifiers) GetCertifier(ctx sdk.Context, certifierAddress sdk.AccAddress) (cert.Certifier, error) HasCertifierAlias(ctx sdk.Context, alias string) bool IsCertified(ctx sdk.Context, requestContentType string, content string, certType string) bool GetCertifiedIdentities(ctx sdk.Context) []sdk.AccAddress }
type Deposit ¶
Deposit wraps the deposit made by an account address to an active proposal and corresponding txhash.
func NewDeposit ¶
func NewDeposit(proposalID uint64, depositor sdk.AccAddress, amount sdk.Coins, txhash string) Deposit
NewDeposit creates a new Deposit instance.
type DepositParams ¶
type DepositParams struct { // Minimum initial deposit when users submitting a proposal MinInitialDeposit sdk.Coins `json:"min_initial_deposit,omitempty" yaml:"min_initial_deposit,omitempty"` // Minimum deposit for a proposal to enter voting period. MinDeposit sdk.Coins `json:"min_deposit,omitempty" yaml:"min_deposit,omitempty"` // Maximum period for CTK holders to deposit on a proposal. Initial value: 2 months MaxDepositPeriod time.Duration `json:"max_deposit_period,omitempty" yaml:"max_deposit_period,omitempty"` }
DepositParams struct around deposits for governance
func NewDepositParams ¶
func NewDepositParams(minInitialDeposit, minDeposit sdk.Coins, maxDepositPeriod time.Duration) DepositParams
NewDepositParams creates a new DepositParams object
func (DepositParams) Equal ¶
func (dp DepositParams) Equal(dp2 DepositParams) bool
Equal checks equality of DepositParams
func (DepositParams) String ¶
func (dp DepositParams) String() string
type GenesisState ¶
type GenesisState struct { StartingProposalID uint64 `json:"starting_proposal_id" yaml:"starting_proposal_id"` Deposits Deposits `json:"deposits" yaml:"deposits"` Votes Votes `json:"votes" yaml:"votes"` Proposals Proposals `json:"proposals" yaml:"proposals"` DepositParams DepositParams `json:"deposit_params" yaml:"deposit_params"` VotingParams govTypes.VotingParams `json:"voting_params" yaml:"voting_params"` TallyParams TallyParams `json:"tally_params" yaml:"tally_params"` }
GenesisState defines the governance genesis state.
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
DefaultGenesisState creates a default GenesisState object.
func NewGenesisState ¶
func NewGenesisState(startingProposalID uint64, dp DepositParams, vp govTypes.VotingParams, tp TallyParams) GenesisState
NewGenesisState creates a new GenesisState object.
type ParamSubspace ¶
type Params ¶
type Params struct { VotingParams govTypes.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 govTypes.VotingParams, tp TallyParams, dp DepositParams) Params
NewParams returns a Params structs including voting, deposit and tally params
type Proposal ¶
type Proposal struct { // proposal content interface types.Content `json:"content" yaml:"content"` // ID of the proposal ProposalID uint64 `json:"id" yaml:"id"` // status of the Proposal {Pending, Active, Passed, Rejected} Status ProposalStatus `json:"proposal_status" yaml:"proposal_status"` // whether or not the proposer is a council member (validator or certifier) IsProposerCouncilMember bool `json:"is_proposer_council_member" yaml:"is_proposer_council_member"` // proposer address ProposerAddress sdk.AccAddress `json:"proposer_address" yaml:"proposer_address"` // result of Tally FinalTallyResult gov.TallyResult `json:"final_tally_result" yaml:"final_tally_result"` // time of the block where TxGovSubmitProposal was included SubmitTime time.Time `json:"submit_time" yaml:"submit_time"` // time that the Proposal would expire if deposit amount isn't met DepositEndTime time.Time `json:"deposit_end_time" yaml:"deposit_end_time"` // current deposit on this proposal TotalDeposit sdk.Coins `json:"total_deposit" yaml:"total_deposit"` // VotingStartTime is the time of the block where MinDeposit was reached. // It is set to -1 if MinDeposit is not reached. VotingStartTime time.Time `json:"voting_start_time" yaml:"voting_start_time"` // time that the VotingPeriodString for this proposal will end and votes will be tallied VotingEndTime time.Time `json:"voting_end_time" yaml:"voting_end_time"` }
Proposal defines a struct used by the governance module to allow for voting on network changes.
func NewProposal ¶
func NewProposal(content types.Content, id uint64, proposerAddress sdk.AccAddress, isProposerCouncilMember bool, submitTime time.Time, depositEndTime time.Time) Proposal
NewProposal returns a new proposal.
func (Proposal) HasSecurityVoting ¶
HasSecurityVoting returns true if the proposal needs to go through security (certifier) voting before stake (validator) voting.
type ProposalQueue ¶
type ProposalQueue []uint64
ProposalQueue is a type alias that represents a list of proposal IDs.
type ProposalStatus ¶
type ProposalStatus byte
ProposalStatus is a type alias that represents a proposal status as a byte
func ProposalStatusFromString ¶
func ProposalStatusFromString(str string) (ProposalStatus, error)
ProposalStatusFromString turns a string into a ProposalStatus.
func (ProposalStatus) Format ¶
func (status ProposalStatus) Format(s fmt.State, verb rune)
Format implements the fmt.Formatter interface.
func (ProposalStatus) Marshal ¶
func (status ProposalStatus) Marshal() ([]byte, error)
Marshal implements the Marshal method for protobuf compatibility.
func (ProposalStatus) MarshalJSON ¶
func (status ProposalStatus) MarshalJSON() ([]byte, error)
MarshalJSON marshals to JSON using string.
func (ProposalStatus) String ¶
func (status ProposalStatus) String() string
String implements the Stringer interface.
func (*ProposalStatus) Unmarshal ¶
func (status *ProposalStatus) Unmarshal(data []byte) error
Unmarshal implements the Unmarshal method for protobuf compatibility.
func (*ProposalStatus) UnmarshalJSON ¶
func (status *ProposalStatus) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals from JSON assuming Bech32 encoding.
type QueryProposalsParams ¶
type QueryProposalsParams struct { Page int Limit int Voter sdk.AccAddress Depositor sdk.AccAddress ProposalStatus ProposalStatus }
QueryProposalsParams defines data structure for querying 'custom/gov/proposals'.
func NewQueryProposalsParams ¶
func NewQueryProposalsParams(page, limit int, status ProposalStatus, voter, depositor sdk.AccAddress) QueryProposalsParams
NewQueryProposalsParams creates a new instance of QueryProposalsParams.
type ShieldKeeper ¶ added in v1.0.0
type ShieldKeeper interface { GetPurchaseList(ctx sdk.Context, poolID uint64, purchaser sdk.AccAddress) (shield.PurchaseList, bool) GetClaimProposalParams(ctx sdk.Context) shield.ClaimProposalParams SecureCollaterals(ctx sdk.Context, poolID uint64, purchaser sdk.AccAddress, purchaseID uint64, loss sdk.Coins, lockPeriod time.Duration) error RestoreShield(ctx sdk.Context, poolID uint64, purchaser sdk.AccAddress, id uint64, loss sdk.Coins) error ClaimEnd(ctx sdk.Context, id, poolID uint64, loss sdk.Coins) }
type StakingKeeper ¶ added in v1.1.0
type StakingKeeper interface { IterateBondedValidatorsByPower(sdk.Context, func(index int64, validator stakingexported.ValidatorI) (stop bool)) TotalBondedTokens(sdk.Context) sdk.Int IterateDelegations(ctx sdk.Context, delegator sdk.AccAddress, fn func(index int64, delegation stakingexported.DelegationI) (stop bool)) BondDenom(sdk.Context) string GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator staking.Validator, found bool) }
type TallyParams ¶
type TallyParams struct { DefaultTally govTypes.TallyParams CertifierUpdateSecurityVoteTally govTypes.TallyParams CertifierUpdateStakeVoteTally govTypes.TallyParams }
func (TallyParams) String ¶
func (tp TallyParams) String() string