Documentation
¶
Index ¶
- Constants
- Variables
- func EndBlocker(ctx sdk.Context, keeper Keeper) (resTags sdk.Tags)
- func Execute(ctx sdk.Context, k Keeper, p govtypes.Proposal) (err error)
- func HaltProposalExecute(ctx sdk.Context, k Keeper) error
- func InitGenesis(ctx sdk.Context, k Keeper, data GenesisState)
- func KeyActiveProposalQueueProposal(endTime time.Time, proposalID uint64) []byte
- func KeyDeposit(proposalID uint64, depositorAddr sdk.AccAddress) []byte
- func KeyDepositsSubspace(proposalID uint64) []byte
- func KeyInactiveProposalQueueProposal(endTime time.Time, proposalID uint64) []byte
- func KeyProposal(proposalID uint64) []byte
- func KeyVote(proposalID uint64, voterAddr sdk.AccAddress) []byte
- func KeyVotesSubspace(proposalID uint64) []byte
- func NewHandler(keeper Keeper) sdk.Handler
- func NewQuerier(keeper Keeper) sdk.Querier
- func ParameterProposalExecute(ctx sdk.Context, k Keeper, pp *govtypes.ParameterProposal) (err error)
- func PrefixActiveProposalQueueTime(endTime time.Time) []byte
- func PrefixInactiveProposalQueueTime(endTime time.Time) []byte
- func RegisterCodec(cdc *codec.Codec)
- func SoftwareUpgradeProposalExecute(ctx sdk.Context, k Keeper, sp *govtypes.SoftwareUpgradeProposal) error
- func SortAddresses(addrs []sdk.AccAddress)
- func SortByteArrays(src [][]byte) [][]byte
- func TaxUsageProposalExecute(ctx sdk.Context, k Keeper, p *govtypes.TaxUsageProposal) (err error)
- type DepositWithMetadata
- type GenesisState
- type Keeper
- func (keeper Keeper) ActiveProposalQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator
- func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress, ...) (sdk.Error, bool)
- func (keeper Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress, ...) sdk.Error
- func (keeper Keeper) DeleteDeposits(ctx sdk.Context, proposalID uint64)
- func (keeper Keeper) DeleteProposal(ctx sdk.Context, proposalID uint64)
- func (keeper Keeper) GetDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress) (govtypes.Deposit, bool)
- func (keeper Keeper) GetDeposits(ctx sdk.Context, proposalID uint64) sdk.Iterator
- func (keeper Keeper) GetLastProposalID(ctx sdk.Context) (proposalID uint64)
- func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) govtypes.Proposal
- func (keeper Keeper) GetProposalsFiltered(ctx sdk.Context, voterAddr sdk.AccAddress, depositorAddr sdk.AccAddress, ...) []govtypes.Proposal
- func (keeper Keeper) GetTerminatorHeight(ctx sdk.Context) int64
- func (keeper Keeper) GetTerminatorPeriod(ctx sdk.Context) int64
- func (keeper Keeper) GetVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress) (govtypes.Vote, bool)
- func (keeper Keeper) GetVotes(ctx sdk.Context, proposalID uint64) sdk.Iterator
- func (keeper Keeper) InactiveProposalQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator
- func (keeper Keeper) InsertActiveProposalQueue(ctx sdk.Context, endTime time.Time, proposalID uint64)
- func (keeper Keeper) InsertInactiveProposalQueue(ctx sdk.Context, endTime time.Time, proposalID uint64)
- func (keeper Keeper) NewHaltProposal(ctx sdk.Context, title string, description string, ...) govtypes.Proposal
- func (keeper Keeper) NewParametersProposal(ctx sdk.Context, title string, description string, ...) govtypes.Proposal
- func (keeper Keeper) NewProposal(ctx sdk.Context, title string, description string, ...) govtypes.Proposal
- func (keeper Keeper) NewSoftwareUpgradeProposal(ctx sdk.Context, msg MsgSubmitSoftwareUpgradeProposal) govtypes.Proposal
- func (keeper Keeper) NewTextProposal(ctx sdk.Context, title string, description string, ...) govtypes.Proposal
- func (keeper Keeper) NewUsageProposal(ctx sdk.Context, msg MsgSubmitTxTaxUsageProposal) govtypes.Proposal
- func (keeper Keeper) RefundDeposits(ctx sdk.Context, proposalID uint64)
- func (keeper Keeper) RemoveFromActiveProposalQueue(ctx sdk.Context, endTime time.Time, proposalID uint64)
- func (keeper Keeper) RemoveFromInactiveProposalQueue(ctx sdk.Context, endTime time.Time, proposalID uint64)
- func (keeper Keeper) SetProposal(ctx sdk.Context, proposal govtypes.Proposal)
- func (keeper Keeper) SetTerminatorHeight(ctx sdk.Context, height int64)
- func (keeper Keeper) SetTerminatorPeriod(ctx sdk.Context, height int64)
- type MsgDeposit
- func (msg MsgDeposit) Get(key interface{}) (value interface{})
- func (msg MsgDeposit) GetSignBytes() []byte
- func (msg MsgDeposit) GetSigners() []sdk.AccAddress
- func (msg MsgDeposit) Route() string
- func (msg MsgDeposit) String() string
- func (msg MsgDeposit) Type() string
- func (msg MsgDeposit) ValidateBasic() sdk.Error
- type MsgSubmitProposal
- func (msg MsgSubmitProposal) Get(key interface{}) (value interface{})
- func (msg MsgSubmitProposal) GetSignBytes() []byte
- func (msg MsgSubmitProposal) GetSigners() []sdk.AccAddress
- func (msg MsgSubmitProposal) Route() string
- func (msg MsgSubmitProposal) String() string
- func (msg MsgSubmitProposal) Type() string
- func (msg MsgSubmitProposal) ValidateBasic() sdk.Error
- type MsgSubmitSoftwareUpgradeProposal
- type MsgSubmitTxTaxUsageProposal
- type MsgVote
- type ProposalOutput
- type ProposalOutputs
- type QueryDepositParams
- type QueryDepositsParams
- type QueryProposalParams
- type QueryProposalsParams
- type QueryTallyParams
- type QueryVoteParams
- type QueryVotesParams
- type VoteWithMetadata
Constants ¶
const ( QueryProposals = "proposals" QueryProposal = "proposal" QueryDeposits = "deposits" QueryDeposit = "deposit" QueryVotes = "votes" QueryVote = "vote" QueryTally = "tally" )
query endpoints supported by the governance Querier
const MsgRoute = "gov"
name to idetify transaction types
const (
Prefix = "gov/"
)
Variables ¶
var ( DepositedCoinsAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("govDepositedCoins"))) BurnedDepositCoinsAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("govBurnedDepositCoins"))) )
nolint
var ( KeyDelimiter = []byte(":") KeyNextProposalID = []byte("newProposalID") PrefixActiveProposalQueue = []byte("activeProposalQueue") PrefixInactiveProposalQueue = []byte("inactiveProposalQueue") )
Key for getting a the next available proposalID from the store
var ( KeyTerminatorHeight = []byte("TerminatorHeight") KeyTerminatorPeriod = []byte("TerminatorPeriod") )
Key for getting a the next available proposalID from the store
Functions ¶
func EndBlocker ¶
Called every block, process inflation, update validator set
func HaltProposalExecute ¶ added in v0.9.0
func InitGenesis ¶
func InitGenesis(ctx sdk.Context, k Keeper, data GenesisState)
InitGenesis - store genesis parameters
func KeyActiveProposalQueueProposal ¶ added in v0.7.0
Returns the key for a proposalID in the activeProposalQueue
func KeyDeposit ¶
func KeyDeposit(proposalID uint64, depositorAddr sdk.AccAddress) []byte
Key for getting a specific deposit from the store
func KeyDepositsSubspace ¶
Key for getting all deposits on a proposal from the store
func KeyInactiveProposalQueueProposal ¶ added in v0.7.0
Returns the key for a proposalID in the activeProposalQueue
func KeyProposal ¶
Key for getting a specific proposal from the store
func KeyVote ¶
func KeyVote(proposalID uint64, voterAddr sdk.AccAddress) []byte
Key for getting a specific vote from the store
func KeyVotesSubspace ¶
Key for getting all votes on a proposal from the store
func NewQuerier ¶ added in v0.7.0
func ParameterProposalExecute ¶ added in v0.9.0
func PrefixActiveProposalQueueTime ¶ added in v0.7.0
Returns the key for a proposalID in the activeProposalQueue
func PrefixInactiveProposalQueueTime ¶ added in v0.7.0
Returns the key for a proposalID in the activeProposalQueue
func RegisterCodec ¶ added in v0.7.0
Register concrete types on codec codec
func SoftwareUpgradeProposalExecute ¶ added in v0.9.0
func TaxUsageProposalExecute ¶ added in v0.9.0
Types ¶
type DepositWithMetadata ¶ added in v0.7.0
type GenesisState ¶
type GenesisState struct {
TerminatorPeriod int64 `json:"terminator_period"`
StartingProposalID uint64 `json:"starting_proposalID"`
Deposits []DepositWithMetadata `json:"deposits"`
Votes []VoteWithMetadata `json:"votes"`
Proposals []govtypes.Proposal `json:"proposals"`
DepositProcedure govparams.DepositProcedure `json:"deposit_period"`
VotingProcedure govparams.VotingProcedure `json:"voting_period"`
TallyingProcedure govparams.TallyingProcedure `json:"tallying_procedure"`
}
GenesisState - all gov state that must be provided at genesis
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
get raw genesis raw message for testing
func DefaultGenesisStateForCliTest ¶
func DefaultGenesisStateForCliTest() GenesisState
get raw genesis raw message for testing
func DefaultGenesisStateForLCDTest ¶
func DefaultGenesisStateForLCDTest() GenesisState
get raw genesis raw message for testing
func ExportGenesis ¶ added in v0.7.0
func ExportGenesis(ctx sdk.Context, k Keeper) GenesisState
ExportGenesis - output genesis parameters
func NewGenesisState ¶
func NewGenesisState(startingProposalID uint64, dp govparams.DepositProcedure, vp govparams.VotingProcedure, tp govparams.TallyingProcedure) GenesisState
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Governance Keeper
func NewKeeper ¶
func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, dk distribution.Keeper, ck bank.Keeper, gk guardian.Keeper, ds sdk.DelegationSet, pk protocolKeeper.Keeper, codespace sdk.CodespaceType) Keeper
NewKeeper returns a governance keeper. It handles: - submitting governance proposals - depositing funds into proposals, and activating upon sufficient funds being deposited - users voting on proposals, with weight proportional to stake in the system - and tallying the result of the vote.
func (Keeper) ActiveProposalQueueIterator ¶ added in v0.7.0
Returns an iterator for all the proposals in the Active Queue that expire by endTime
func (Keeper) AddDeposit ¶
func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress, depositAmount sdk.Coins) (sdk.Error, bool)
Adds or updates a deposit of a specific depositor on a specific proposal Activates voting period when appropriate
func (Keeper) AddVote ¶
func (keeper Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress, option govtypes.VoteOption) sdk.Error
Adds a vote on a specific proposal
func (Keeper) DeleteDeposits ¶
Deletes all the deposits on a specific proposal without refunding them
func (Keeper) DeleteProposal ¶
Implements sdk.AccountKeeper.
func (Keeper) GetDeposit ¶
func (keeper Keeper) GetDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress) (govtypes.Deposit, bool)
Gets the deposit of a specific depositor on a specific proposal
func (Keeper) GetDeposits ¶
Gets all the deposits on a specific proposal
func (Keeper) GetLastProposalID ¶
Get the last used proposal ID
func (Keeper) GetProposal ¶
Get Proposal from store by ProposalID
func (Keeper) GetProposalsFiltered ¶ added in v0.7.0
func (keeper Keeper) GetProposalsFiltered(ctx sdk.Context, voterAddr sdk.AccAddress, depositorAddr sdk.AccAddress, status govtypes.ProposalStatus, numLatest uint64) []govtypes.Proposal
Get Proposal from store by ProposalID
func (Keeper) GetTerminatorHeight ¶ added in v0.8.0
func (Keeper) GetTerminatorPeriod ¶ added in v0.8.0
func (Keeper) GetVote ¶
func (keeper Keeper) GetVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress) (govtypes.Vote, bool)
Gets the vote of a specific voter on a specific proposal
func (Keeper) InactiveProposalQueueIterator ¶ added in v0.7.0
Returns an iterator for all the proposals in the Inactive Queue that expire by endTime
func (Keeper) InsertActiveProposalQueue ¶ added in v0.7.0
func (keeper Keeper) InsertActiveProposalQueue(ctx sdk.Context, endTime time.Time, proposalID uint64)
Inserts a ProposalID into the active proposal queue at endTime
func (Keeper) InsertInactiveProposalQueue ¶ added in v0.7.0
func (keeper Keeper) InsertInactiveProposalQueue(ctx sdk.Context, endTime time.Time, proposalID uint64)
Inserts a ProposalID into the inactive proposal queue at endTime
func (Keeper) NewHaltProposal ¶ added in v0.9.0
func (Keeper) NewParametersProposal ¶
func (keeper Keeper) NewParametersProposal(ctx sdk.Context, title string, description string, proposalType govtypes.ProposalKind, param govtypes.Param) govtypes.Proposal
////////////////// iris begin ///////////////////////////
func (Keeper) NewProposal ¶
func (keeper Keeper) NewProposal(ctx sdk.Context, title string, description string, proposalType govtypes.ProposalKind, param govtypes.Param) govtypes.Proposal
////////////////// iris begin ///////////////////////////
func (Keeper) NewSoftwareUpgradeProposal ¶ added in v0.9.0
func (Keeper) NewTextProposal ¶
func (keeper Keeper) NewTextProposal(ctx sdk.Context, title string, description string, proposalType govtypes.ProposalKind) govtypes.Proposal
Creates a NewProposal
func (Keeper) NewUsageProposal ¶ added in v0.9.0
func (Keeper) RefundDeposits ¶
Returns and deletes all the deposits on a specific proposal
func (Keeper) RemoveFromActiveProposalQueue ¶ added in v0.7.0
func (keeper Keeper) RemoveFromActiveProposalQueue(ctx sdk.Context, endTime time.Time, proposalID uint64)
removes a proposalID from the Active Proposal Queue
func (Keeper) RemoveFromInactiveProposalQueue ¶ added in v0.7.0
func (keeper Keeper) RemoveFromInactiveProposalQueue(ctx sdk.Context, endTime time.Time, proposalID uint64)
removes a proposalID from the Inactive Proposal Queue
func (Keeper) SetProposal ¶
Implements sdk.AccountKeeper.
func (Keeper) SetTerminatorHeight ¶ added in v0.8.0
type MsgDeposit ¶
type MsgDeposit struct {
ProposalID uint64 `json:"proposal_id"` // ID of the proposal
Depositor sdk.AccAddress `json:"depositor"` // Address of the depositor
Amount sdk.Coins `json:"amount"` // Coins to add to the proposal's deposit
}
----------------------------------------------------------- MsgDeposit
func NewMsgDeposit ¶
func NewMsgDeposit(depositor sdk.AccAddress, proposalID uint64, amount sdk.Coins) MsgDeposit
func (MsgDeposit) Get ¶
func (msg MsgDeposit) Get(key interface{}) (value interface{})
Implements Msg.
func (MsgDeposit) Route ¶ added in v0.7.0
func (msg MsgDeposit) Route() string
Implements Msg. nolint
func (MsgDeposit) String ¶
func (msg MsgDeposit) String() string
func (MsgDeposit) Type ¶
func (msg MsgDeposit) Type() string
type MsgSubmitProposal ¶
type MsgSubmitProposal struct {
Title string `json:"title"` // Title of the proposal
Description string `json:"description"` // Description of the proposal
ProposalType govtypes.ProposalKind `json:"proposal_type"` // Type of proposal. Initial set {PlainTextProposal, SoftwareUpgradeProposal}
Proposer sdk.AccAddress `json:"proposer"` // Address of the proposer
InitialDeposit sdk.Coins `json:"initial_deposit"` // Initial deposit paid by sender. Must be strictly positive.
//////////////////// iris begin ///////////////////////////
Param govtypes.Param
}
----------------------------------------------------------- MsgSubmitProposal
func NewMsgSubmitProposal ¶
func NewMsgSubmitProposal(title string, description string, proposalType govtypes.ProposalKind, proposer sdk.AccAddress, initialDeposit sdk.Coins, param govtypes.Param) MsgSubmitProposal
func (MsgSubmitProposal) Get ¶
func (msg MsgSubmitProposal) Get(key interface{}) (value interface{})
Implements Msg.
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 MsgSubmitSoftwareUpgradeProposal ¶ added in v0.9.0
type MsgSubmitSoftwareUpgradeProposal struct {
MsgSubmitProposal
Version uint64 `json:"version"`
Software string `json:"software"`
SwitchHeight uint64 `json:"switch_height"`
}
func NewMsgSubmitSoftwareUpgradeProposal ¶ added in v0.9.0
func NewMsgSubmitSoftwareUpgradeProposal(msgSubmitProposal MsgSubmitProposal, version uint64, software string, switchHeight uint64) MsgSubmitSoftwareUpgradeProposal
func (MsgSubmitSoftwareUpgradeProposal) GetSignBytes ¶ added in v0.9.0
func (msg MsgSubmitSoftwareUpgradeProposal) GetSignBytes() []byte
func (MsgSubmitSoftwareUpgradeProposal) ValidateBasic ¶ added in v0.9.0
func (msg MsgSubmitSoftwareUpgradeProposal) ValidateBasic() sdk.Error
type MsgSubmitTxTaxUsageProposal ¶ added in v0.9.0
type MsgSubmitTxTaxUsageProposal struct {
MsgSubmitProposal
Usage govtypes.UsageType `json:"usage"`
DestAddress sdk.AccAddress `json:"dest_address"`
Percent sdk.Dec `json:"percent"`
}
func NewMsgSubmitTaxUsageProposal ¶ added in v0.9.0
func NewMsgSubmitTaxUsageProposal(msgSubmitProposal MsgSubmitProposal, usage govtypes.UsageType, destAddress sdk.AccAddress, percent sdk.Dec) MsgSubmitTxTaxUsageProposal
func (MsgSubmitTxTaxUsageProposal) GetSignBytes ¶ added in v0.9.0
func (msg MsgSubmitTxTaxUsageProposal) GetSignBytes() []byte
func (MsgSubmitTxTaxUsageProposal) ValidateBasic ¶ added in v0.9.0
func (msg MsgSubmitTxTaxUsageProposal) ValidateBasic() sdk.Error
type MsgVote ¶
type MsgVote struct {
ProposalID uint64 `json:"proposal_id"` // ID of the proposal
Voter sdk.AccAddress `json:"voter"` // address of the voter
Option govtypes.VoteOption `json:"option"` // option from OptionSet chosen by the voter
}
----------------------------------------------------------- MsgVote
func NewMsgVote ¶
func NewMsgVote(voter sdk.AccAddress, proposalID uint64, option govtypes.VoteOption) MsgVote
type ProposalOutput ¶ added in v0.7.0
type ProposalOutput struct {
ProposalID uint64 `json:"proposal_id"` // ID of the proposal
Title string `json:"title"` // Title of the proposal
Description string `json:"description"` // Description of the proposal
ProposalType govtypes.ProposalKind `json:"proposal_type"` // Type of proposal. Initial set {PlainTextProposal, SoftwareUpgradeProposal}
Status govtypes.ProposalStatus `json:"proposal_status"` // Status of the Proposal {Pending, Active, Passed, Rejected}
TallyResult govtypes.TallyResult `json:"tally_result"` // Result of Tallys
SubmitTime time.Time `json:"submit_time"` // Time of the block where TxGovSubmitProposal was included
DepositEndTime time.Time `json:"deposit_end_time"` // Time that the Proposal would expire if deposit amount isn't met
TotalDeposit sdk.Coins `json:"total_deposit"` // Current deposit on this proposal. Initial value is set at InitialDeposit
VotingStartTime time.Time `json:"voting_start_time"` // Time of the block where MinDeposit was reached. -1 if MinDeposit is not reached
VotingEndTime time.Time `json:"voting_end_time"` // Time that the VotingPeriod for this proposal will end and votes will be tallied
Param govtypes.Param `json:"param"`
}
func ConvertProposalToProposalOutput ¶ added in v0.7.0
func ConvertProposalToProposalOutput(proposal govtypes.Proposal) ProposalOutput
type ProposalOutputs ¶ added in v0.7.0
type ProposalOutputs []ProposalOutput
func ConvertProposalsToProposalOutputs ¶ added in v0.7.0
func ConvertProposalsToProposalOutputs(proposals []govtypes.Proposal) ProposalOutputs
type QueryDepositParams ¶ added in v0.7.0
type QueryDepositParams struct {
ProposalID uint64
Depositor sdk.AccAddress
}
Params for query 'custom/gov/deposit'
type QueryDepositsParams ¶ added in v0.7.0
type QueryDepositsParams struct {
ProposalID uint64
}
Params for query 'custom/gov/deposits'
type QueryProposalParams ¶ added in v0.7.0
type QueryProposalParams struct {
ProposalID uint64
}
Params for query 'custom/gov/proposal'
type QueryProposalsParams ¶ added in v0.7.0
type QueryProposalsParams struct {
Voter sdk.AccAddress
Depositor sdk.AccAddress
ProposalStatus govtypes.ProposalStatus
Limit uint64
}
Params for query 'custom/gov/proposals'
type QueryTallyParams ¶ added in v0.7.0
type QueryTallyParams struct {
ProposalID uint64
}
Params for query 'custom/gov/tally'
type QueryVoteParams ¶ added in v0.7.0
type QueryVoteParams struct {
ProposalID uint64
Voter sdk.AccAddress
}
Params for query 'custom/gov/vote'
type QueryVotesParams ¶ added in v0.7.0
type QueryVotesParams struct {
ProposalID uint64
}
Params for query 'custom/gov/votes'
type VoteWithMetadata ¶ added in v0.7.0
type VoteWithMetadata struct {
ProposalID uint64 `json:"proposal_id"`
Vote govtypes.Vote `json:"vote"`
}
VoteWithMetadata (just for genesis)