keeper

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2022 License: MIT Imports: 41 Imported by: 0

Documentation

Overview

nolint

Index

Constants

This section is empty.

Variables

View Source
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

func MarkExecutableWithMode(path string, mode os.FileMode) error

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

func NewQuerier(keeper Keeper) sdk.Querier

func ProposalEqual

func ProposalEqual(proposalA types.Proposal, proposalB types.Proposal) bool

ProposalEqual checks if two proposals are equal (note: slow, for tests only)

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

func (keeper Keeper) ActiveAllProposalQueueIterator(ctx sdk.Context) sdk.Iterator

ActiveAllProposalQueueIterator returns an sdk.Iterator for all the proposals in the Active Queue

func (Keeper) ActiveProposalQueueIterator

func (keeper Keeper) ActiveProposalQueueIterator(ctx sdk.Context, endBlock uint64) sdk.Iterator

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

func (k Keeper) ApplyUpgrade(ctx sdk.Context, plan types.Plan) error

ApplyUpgrade will execute the handler associated with the Plan and mark the plan as done.

func (Keeper) CheckValidator

func (keeper Keeper) CheckValidator(ctx sdk.Context, address sdk.ValAddress) error

func (Keeper) ClearIBCState

func (k Keeper) ClearIBCState(ctx sdk.Context, lastHeight int64)

func (Keeper) ClearUpgradePlan

func (k Keeper) ClearUpgradePlan(ctx sdk.Context)

func (Keeper) DeleteProposal

func (keeper Keeper) DeleteProposal(ctx sdk.Context, proposalID uint64)

DeleteProposal deletes a proposal from store

func (Keeper) DownloadAndCheckHash added in v1.2.12

func (k Keeper) DownloadAndCheckHash(ctx sdk.Context, filepath, url, filehash string)

func (Keeper) DownloadBinary

func (k Keeper) DownloadBinary(filepath, url string) error

Download file by url

func (Keeper) GenerateUrl

func (k Keeper) GenerateUrl(urlName string) string

func (Keeper) Get

func (k Keeper) Get(ctx sdk.Context, key []byte, value *int64) error

func (Keeper) GetAllVotes

func (keeper Keeper) GetAllVotes(ctx sdk.Context) (votes types.Votes)

GetAllVotes returns all the votes from the store

func (Keeper) GetDoneHeight

func (k Keeper) GetDoneHeight(ctx sdk.Context, name string) int64

GetDoneHeight returns the height at which the given upgrade was executed

func (Keeper) GetDownloadName

func (k Keeper) GetDownloadName(name string) string

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

func (keeper Keeper) GetProposalID(ctx sdk.Context) (proposalID uint64, err error)

GetProposalID gets the highest proposal ID

func (Keeper) GetProposals

func (keeper Keeper) GetProposals(ctx sdk.Context) (proposals types.Proposals)

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

func (k Keeper) GetUpgradePlan(ctx sdk.Context) (plan types.Plan, havePlan bool)

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) GetVotes

func (keeper Keeper) GetVotes(ctx sdk.Context, proposalID uint64) (votes types.Votes)

GetVotes returns all the votes from a proposal

func (Keeper) InactiveAllProposalQueueIterator

func (keeper Keeper) InactiveAllProposalQueueIterator(ctx sdk.Context) sdk.Iterator

InactiveAllProposalQueueIterator returns an sdk.Iterator for all the proposals in the Inactive Queue

func (Keeper) InactiveProposalQueueIterator

func (keeper Keeper) InactiveProposalQueueIterator(ctx sdk.Context, endBlock uint64) sdk.Iterator

InactiveProposalQueueIterator returns an sdk.Iterator for all the proposals in the Inactive Queue that expire by endTime

func (Keeper) InsertActiveProposalQueue

func (keeper Keeper) InsertActiveProposalQueue(ctx sdk.Context, proposalID uint64, endBlock uint64)

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 (k Keeper) IsMigratedToUpdatedPrefixes(ctx sdk.Context) bool

func (Keeper) IsSkipHeight

func (k Keeper) IsSkipHeight(height int64) bool

IsSkipHeight checks if the given height is part of skipUpgradeHeights

func (Keeper) IterateAllActiveProposalsQueue

func (keeper Keeper) IterateAllActiveProposalsQueue(ctx sdk.Context, cb func(proposal types.Proposal) (stop bool))

func (Keeper) IterateAllInactiveProposalsQueue

func (keeper Keeper) IterateAllInactiveProposalsQueue(ctx sdk.Context, cb func(proposal types.Proposal) (stop bool))

func (Keeper) IterateAllVotes

func (keeper Keeper) IterateAllVotes(ctx sdk.Context, cb func(vote types.Vote) (stop bool))

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) Logger

func (keeper Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) MigrateToUpdatedPrefixes added in v1.2.12

func (k Keeper) MigrateToUpdatedPrefixes(ctx sdk.Context) error

func (Keeper) OSArch

func (k Keeper) OSArch() string

Detect OS to create a url

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

func (k Keeper) ScheduleUpgrade(ctx sdk.Context, plan types.Plan) error

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) Set

func (k Keeper) Set(ctx sdk.Context, key []byte, value *int64) error

func (Keeper) SetProposal

func (keeper Keeper) SetProposal(ctx sdk.Context, proposal types.Proposal)

SetProposal set a proposal to store

func (Keeper) SetProposalID

func (keeper Keeper) SetProposalID(ctx sdk.Context, proposalID uint64)

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) SetVote

func (keeper Keeper) SetVote(ctx sdk.Context, vote types.Vote)

SetVote sets a Vote to the gov 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

func (k Keeper) UrlPageExist(urlPage string) bool

Check if page exists.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL