Documentation
¶
Overview ¶
nolint
Index ¶
- Variables
- func MarkExecutableWithMode(path string, mode os.FileMode) error
- func NewQuerier(keeper Keeper) sdk.Querier
- func ProposalEqual(proposalA types.Proposal, proposalB types.Proposal) bool
- type Keeper
- func (keeper Keeper) ActiveAllProposalQueueIterator(ctx sdk.Context) sdk.Iterator
- func (keeper Keeper) ActiveProposalQueueIterator(ctx sdk.Context, endBlock uint64) sdk.Iterator
- func (keeper Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.ValAddress, ...) error
- func (k Keeper) ApplyUpgrade(ctx sdk.Context, plan types.Plan) error
- func (keeper Keeper) CheckValidator(ctx sdk.Context, address sdk.ValAddress) error
- func (k Keeper) ClearIBCState(ctx sdk.Context, lastHeight int64)
- func (k Keeper) ClearUpgradePlan(ctx sdk.Context)
- func (keeper Keeper) DeleteProposal(ctx sdk.Context, proposalID uint64)
- func (k Keeper) DownloadAndCheckHash(ctx sdk.Context, filepath, url, filehash string)
- func (k Keeper) DownloadBinary(filepath, url string) error
- func (k Keeper) GenerateUrl(urlName string) string
- func (k Keeper) Get(ctx sdk.Context, key []byte, value *int64) error
- func (keeper Keeper) GetAllVotes(ctx sdk.Context) (votes types.Votes)
- func (k Keeper) GetDoneHeight(ctx sdk.Context, name string) int64
- func (k Keeper) GetDownloadName(name string) string
- func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (proposal types.Proposal, ok bool)
- func (keeper Keeper) GetProposalID(ctx sdk.Context) (proposalID uint64, err error)
- func (keeper Keeper) GetProposals(ctx sdk.Context) (proposals types.Proposals)
- func (keeper Keeper) GetTallyParams(ctx sdk.Context) types.TallyParams
- func (k Keeper) GetUpgradePlan(ctx sdk.Context) (plan types.Plan, havePlan bool)
- func (keeper Keeper) GetVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.ValAddress) (vote types.Vote, found bool)
- func (keeper Keeper) GetVotes(ctx sdk.Context, proposalID uint64) (votes types.Votes)
- func (keeper Keeper) InactiveAllProposalQueueIterator(ctx sdk.Context) sdk.Iterator
- func (keeper Keeper) InactiveProposalQueueIterator(ctx sdk.Context, endBlock uint64) sdk.Iterator
- func (keeper Keeper) InsertActiveProposalQueue(ctx sdk.Context, proposalID uint64, endBlock uint64)
- func (keeper Keeper) InsertInactiveProposalQueue(ctx sdk.Context, proposalID uint64, endBlock uint64)
- func (k Keeper) IsMigratedToUpdatedPrefixes(ctx sdk.Context) bool
- func (k Keeper) IsSkipHeight(height int64) bool
- func (keeper Keeper) IterateAllActiveProposalsQueue(ctx sdk.Context, cb func(proposal types.Proposal) (stop bool))
- func (keeper Keeper) IterateAllInactiveProposalsQueue(ctx sdk.Context, cb func(proposal types.Proposal) (stop bool))
- func (keeper Keeper) IterateAllVotes(ctx sdk.Context, cb func(vote types.Vote) (stop bool))
- func (keeper Keeper) IterateProposals(ctx sdk.Context, cb func(proposal types.Proposal) (stop bool))
- func (keeper Keeper) IterateVotes(ctx sdk.Context, proposalID uint64, cb func(vote types.Vote) (stop bool))
- func (keeper Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MigrateToUpdatedPrefixes(ctx sdk.Context) error
- func (k Keeper) OSArch() string
- func (keeper Keeper) RemoveFromActiveProposalQueue(ctx sdk.Context, proposalID uint64, endBlock uint64)
- func (keeper Keeper) RemoveFromInactiveProposalQueue(ctx sdk.Context, proposalID uint64, endBlock uint64)
- func (k Keeper) ScheduleUpgrade(ctx sdk.Context, plan types.Plan) error
- func (k Keeper) Set(ctx sdk.Context, key []byte, value *int64) error
- func (keeper Keeper) SetProposal(ctx sdk.Context, proposal types.Proposal)
- func (keeper Keeper) SetProposalID(ctx sdk.Context, proposalID uint64)
- func (keeper Keeper) SetTallyParams(ctx sdk.Context, tallyParams types.TallyParams)
- func (keeper Keeper) SetVote(ctx sdk.Context, vote types.Vote)
- func (keeper Keeper) SubmitProposal(ctx sdk.Context, content types.Content, ...) (types.Proposal, error)
- func (keeper Keeper) Tally(ctx sdk.Context, proposal types.Proposal) (passes bool, tallyResults types.TallyResult, totalVotingPower sdk.Dec)
- func (k Keeper) UrlPageExist(urlPage string) bool
Constants ¶
This section is empty.
Variables ¶
var ( TestAddrs = []sdk.AccAddress{ delAddr1, delAddr2, delAddr3, valAccAddr1, valAccAddr2, valAccAddr3, } TestProposal = types.NewProposal(types.Content{Title: "Title", Description: "Description"}, 1, 1, 10) )
dummy addresses used for testing
Functions ¶
func MarkExecutableWithMode ¶
MarkExecutable will try to set the executable bits if not already set Fails if file doesn't exist or we cannot set those bits
func NewQuerier ¶
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper defines the governance module Keeper
func NewKeeper ¶
func NewKeeper( cdc *codec.Codec, key sdk.StoreKey, paramSpace types.ParamSubspace, supplyKeeper types.SupplyKeeper, vk types.ValidatorKeeper, rtr types.Router, ) 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.
CONTRACT: the parameter Subspace must have the param key table already initialized
func (Keeper) ActiveAllProposalQueueIterator ¶
ActiveAllProposalQueueIterator returns an sdk.Iterator for all the proposals in the Active Queue
func (Keeper) ActiveProposalQueueIterator ¶
ActiveProposalQueueIterator returns an sdk.Iterator for all the proposals in the Active Queue that expire by endTime
func (Keeper) AddVote ¶
func (keeper Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.ValAddress, option types.VoteOption) error
AddVote adds a vote on a specific proposal
func (Keeper) ApplyUpgrade ¶
ApplyUpgrade will execute the handler associated with the Plan and mark the plan as done.
func (Keeper) CheckValidator ¶
func (Keeper) ClearUpgradePlan ¶
func (Keeper) DeleteProposal ¶
DeleteProposal deletes a proposal from store
func (Keeper) DownloadAndCheckHash ¶ added in v1.2.12
func (Keeper) DownloadBinary ¶
Download file by url
func (Keeper) GenerateUrl ¶
func (Keeper) GetAllVotes ¶
GetAllVotes returns all the votes from the store
func (Keeper) GetDoneHeight ¶
GetDoneHeight returns the height at which the given upgrade was executed
func (Keeper) GetDownloadName ¶
Generate name of download file.
func (Keeper) GetProposal ¶
func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (proposal types.Proposal, ok bool)
GetProposal get proposal from store by ProposalID
func (Keeper) GetProposalID ¶
GetProposalID gets the highest proposal ID
func (Keeper) GetProposals ¶
GetProposals returns all the proposals from store
func (Keeper) GetTallyParams ¶
func (keeper Keeper) GetTallyParams(ctx sdk.Context) types.TallyParams
GetTallyParams returns the current TallyParam from the global param store
func (Keeper) GetUpgradePlan ¶
GetUpgradePlan returns the currently scheduled Plan if any, setting havePlan to true if there is a scheduled upgrade or false if there is none
func (Keeper) GetVote ¶
func (keeper Keeper) GetVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.ValAddress) (vote types.Vote, found bool)
GetVote gets the vote from an address on a specific proposal
func (Keeper) InactiveAllProposalQueueIterator ¶
InactiveAllProposalQueueIterator returns an sdk.Iterator for all the proposals in the Inactive Queue
func (Keeper) InactiveProposalQueueIterator ¶
InactiveProposalQueueIterator returns an sdk.Iterator for all the proposals in the Inactive Queue that expire by endTime
func (Keeper) InsertActiveProposalQueue ¶
InsertActiveProposalQueue inserts a ProposalID into the active proposal queue at endBlock
func (Keeper) InsertInactiveProposalQueue ¶
func (keeper Keeper) InsertInactiveProposalQueue(ctx sdk.Context, proposalID uint64, endBlock uint64)
InsertInactiveProposalQueue Inserts a ProposalID into the inactive proposal queue at endBlock
func (Keeper) IsMigratedToUpdatedPrefixes ¶ added in v1.2.12
func (Keeper) IsSkipHeight ¶
IsSkipHeight checks if the given height is part of skipUpgradeHeights
func (Keeper) IterateAllActiveProposalsQueue ¶
func (Keeper) IterateAllInactiveProposalsQueue ¶
func (Keeper) IterateAllVotes ¶
IterateAllVotes iterates over the all the stored votes and performs a callback function
func (Keeper) IterateProposals ¶
func (keeper Keeper) IterateProposals(ctx sdk.Context, cb func(proposal types.Proposal) (stop bool))
IterateProposals iterates over the all the proposals and performs a callback function
func (Keeper) IterateVotes ¶
func (keeper Keeper) IterateVotes(ctx sdk.Context, proposalID uint64, cb func(vote types.Vote) (stop bool))
IterateVotes iterates over the all the proposals votes and performs a callback function
func (Keeper) MigrateToUpdatedPrefixes ¶ added in v1.2.12
func (Keeper) RemoveFromActiveProposalQueue ¶
func (keeper Keeper) RemoveFromActiveProposalQueue(ctx sdk.Context, proposalID uint64, endBlock uint64)
RemoveFromActiveProposalQueue removes a proposalID from the Active Proposal Queue
func (Keeper) RemoveFromInactiveProposalQueue ¶
func (keeper Keeper) RemoveFromInactiveProposalQueue(ctx sdk.Context, proposalID uint64, endBlock uint64)
RemoveFromInactiveProposalQueue removes a proposalID from the Inactive Proposal Queue
func (Keeper) ScheduleUpgrade ¶
ScheduleUpgrade schedules an upgrade based on the specified plan. If there is another Plan already scheduled, it will overwrite it (implicitly cancelling the current plan)
func (Keeper) SetProposal ¶
SetProposal set a proposal to store
func (Keeper) SetProposalID ¶
SetProposalID sets the new proposal ID to the store
func (Keeper) SetTallyParams ¶
func (keeper Keeper) SetTallyParams(ctx sdk.Context, tallyParams types.TallyParams)
SetTallyParams sets TallyParams to the global param store
func (Keeper) SubmitProposal ¶
func (keeper Keeper) SubmitProposal(ctx sdk.Context, content types.Content, votingStartBlock, votingEndBlock uint64) (types.Proposal, error)
SubmitProposal create new proposal given a content
func (Keeper) Tally ¶
func (keeper Keeper) Tally(ctx sdk.Context, proposal types.Proposal) (passes bool, tallyResults types.TallyResult, totalVotingPower sdk.Dec)
Tally iterates over the votes and updates the tally of a proposal based on the voting power of the voters
func (Keeper) UrlPageExist ¶
Check if page exists.