Documentation ¶
Index ¶
- Constants
- Variables
- func EndBlocker(ctx sdk.Context, k Keeper) (claims map[string]sdk.Int, resTags sdk.Tags)
- func ErrDepositDenom() sdk.Error
- func ErrEmptyProgramQueue() sdk.Error
- func ErrInvalidDescription() sdk.Error
- func ErrInvalidOption(msg string) sdk.Error
- func ErrInvalidProgramID(msg string) sdk.Error
- func ErrInvalidSubmitter(submitter sdk.AccAddress) sdk.Error
- func ErrInvalidTitle() sdk.Error
- func ErrInvalidVotingWindow(msg string) sdk.Error
- func ErrMinimumDeposit() sdk.Error
- func ErrProgramNotFound(ProgramID uint64) sdk.Error
- func ErrProgramQueueNotFound() sdk.Error
- func ErrVoteNotFound() sdk.Error
- func ErrVotingPeriodClosed() sdk.Error
- func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState)
- func KeyCandidate(endTime time.Time, programID uint64) []byte
- func KeyProgram(programID uint64) []byte
- func KeyVote(programID uint64, voterAddr sdk.AccAddress) []byte
- func NewHandler(k Keeper) sdk.Handler
- func NewQuerier(keeper Keeper) sdk.Querier
- func ParamKeyTable() params.KeyTable
- func PrefixCandidateQueueTime(endTime time.Time) []byte
- func PrefixVoteForProgram(programID uint64) []byte
- func RegisterCodec(cdc *codec.Codec)
- func ValidateGenesis(data GenesisState) error
- type CodeType
- type GenesisState
- type Keeper
- func (k Keeper) CandidateQueueHas(ctx sdk.Context, program Program, programID uint64) (res bool)
- func (k Keeper) CandidateQueueInsert(ctx sdk.Context, program Program, programID uint64)
- func (k Keeper) CandidateQueueRemove(ctx sdk.Context, program Program, programID uint64)
- func (k Keeper) ClearVotesForProgram(ctx sdk.Context, programID uint64)
- func (k Keeper) DeleteProgram(ctx sdk.Context, programID uint64)
- func (k Keeper) GetParams(ctx sdk.Context) Params
- func (k Keeper) GetProgram(ctx sdk.Context, programID uint64) (res Program, err sdk.Error)
- func (k Keeper) GetVote(ctx sdk.Context, programID uint64, voter sdk.AccAddress) (res bool, err sdk.Error)
- func (k Keeper) IterateActivePrograms(ctx sdk.Context, handler func(uint64, Program) (stop bool))
- func (k Keeper) IterateMatureCandidates(ctx sdk.Context, endTime time.Time, handler func(uint64, Program) (stop bool))
- func (k Keeper) NewProgramID(ctx sdk.Context) (programID uint64)
- func (k Keeper) RefundDeposit(ctx sdk.Context, programID uint64) (err sdk.Error)
- func (k Keeper) SetParams(ctx sdk.Context, params Params)
- func (k Keeper) SetProgram(ctx sdk.Context, programID uint64, program Program)
- func (k Keeper) SetVote(ctx sdk.Context, programID uint64, voter sdk.AccAddress, option bool)
- type Params
- type Program
- type QueryVotesParams
- type SubmitProgramMsg
- type VoteMsg
- type WithdrawProgramMsg
- func (msg WithdrawProgramMsg) GetSignBytes() []byte
- func (msg WithdrawProgramMsg) GetSigners() []sdk.AccAddress
- func (msg WithdrawProgramMsg) Route() string
- func (msg WithdrawProgramMsg) String() string
- func (msg WithdrawProgramMsg) Type() string
- func (msg WithdrawProgramMsg) ValidateBasic() sdk.Error
Constants ¶
const ( QueryProgram = "program" QueryVotes = "votes" QueryActiveList = "active-list" QueryCandidateList = "candidate-list" QueryParams = "params" )
query endpoints supported by the governance Querier
const ( RouterKey = "budget" // QuerierRoute is the querier route for budget QuerierRoute = "budget" )
RouterKey is they name of the budget module
const StoreKey = "budget"
StoreKey is string representation of the store key for budget
Variables ¶
var ( KeyDelimiter = []byte(":") PrefixProgram = []byte("program") PrefixVote = []byte("vote") KeyNextProgramID = []byte("new-program-id") PrefixCandidateQueue = []byte("candidate-queue") ParamStoreKeyParams = []byte("params") DefaultParamspace = "budget" )
nolint
Functions ¶
func EndBlocker ¶
EndBlocker is called at the end of every block
func InitGenesis ¶
func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState)
new oracle genesis
func KeyCandidate ¶
Returns the key for a programID in the activeprogramQueue
func KeyProgram ¶
KeyProgram creates a key of the form "Programs"|{state}|{ProgramID}
func KeyVote ¶
func KeyVote(programID uint64, voterAddr sdk.AccAddress) []byte
Key for getting a specific vote from the store
func NewHandler ¶
NewHandler creates a new handler for all budget type messages.
func NewQuerier ¶
NewQuerier is the module level router for state queries
func PrefixCandidateQueueTime ¶
Returns the key for a programID in the activeprogramQueue
func PrefixVoteForProgram ¶
Key for getting a specific vote from the store
func ValidateGenesis ¶
func ValidateGenesis(data GenesisState) error
ValidateGenesis validates the provided oracle genesis state to ensure the expected invariants holds. (i.e. params in correct bounds, no duplicate validators)
Types ¶
type CodeType ¶
const ( DefaultCodespace sdk.CodespaceType = "budget" // Budget errors CodeInvalidOption CodeType = 1 CodeInvalidProgramID CodeType = 2 CodeVotingPeriodClosed CodeType = 3 CodeEmptyProgramQueue CodeType = 4 CodeInvalidTitle CodeType = 5 CodeInvalidDescription CodeType = 6 CodeInvalidVotingWindow CodeType = 7 CodeProgramNotFound CodeType = 8 CodeVoteNotFound CodeType = 9 CodeProgramQueueNotFound CodeType = 10 CodeInvalidDeposit CodeType = 11 CodeInvalidSubmitter CodeType = 12 )
type GenesisState ¶
type GenesisState struct {
Params Params `json:"params"` // budget params
}
GenesisState - all distribution state that must be provided at genesis
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
get raw genesis raw message for testing
func ExportGenesis ¶
func ExportGenesis(ctx sdk.Context, keeper Keeper) GenesisState
ExportGenesis returns a GenesisState for a given context and keeper. The GenesisState will contain the pool, and validator/delegator distribution info's
func NewGenesisState ¶
func NewGenesisState(params Params) GenesisState
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
nolint
func NewKeeper ¶
func NewKeeper(key sdk.StoreKey, cdc *codec.Codec, bk bank.Keeper, codespace sdk.CodespaceType, valset sdk.ValidatorSet, paramspace params.Subspace) Keeper
NewKeeper crates a new keeper with write and read access
func (Keeper) CandidateQueueHas ¶
CandidateQueueHas Checks if a progrma exists in accordance with the given parameters
func (Keeper) CandidateQueueInsert ¶
CandidateQueueInsert Inserts a ProgramID into the Candidate Program queue at endTime
func (Keeper) CandidateQueueRemove ¶
CandidateQueueRemove removes a ProgramID from the Candidate Program Queue
func (Keeper) ClearVotesForProgram ¶
func (Keeper) DeleteProgram ¶
DeleteProgram deletes a program from the context
func (Keeper) GetProgram ¶
GetProgram gets the Program with the given id from the context.
func (Keeper) GetVote ¶
func (k Keeper) GetVote(ctx sdk.Context, programID uint64, voter sdk.AccAddress) (res bool, err sdk.Error)
GetVote returns the given option of a Program stored in the keeper Used to check if an address already voted
func (Keeper) IterateActivePrograms ¶
IteratePrograms iterates through programs in the store
func (Keeper) IterateMatureCandidates ¶
func (k Keeper) IterateMatureCandidates(ctx sdk.Context, endTime time.Time, handler func(uint64, Program) (stop bool))
IterateMatureCandidates Returns an iterator for all the Programs in the Candidate Queue that expire by endTime
func (Keeper) NewProgramID ¶
Get the last used proposal ID
func (Keeper) RefundDeposit ¶
RefundDeposit refunds the deposit
func (Keeper) SetProgram ¶
SetProgram sets a Program to the context
type Params ¶
type Params struct { ActiveThreshold sdk.Dec `json:"active_threshold"` // threshold of vote that will transition a program open -> active budget queue LegacyThreshold sdk.Dec `json:"legacy_threshold"` // threshold of vote that will transition a program active -> legacy budget queue VotePeriod time.Duration `json:"vote_period"` // vote period MinDeposit sdk.Coin `json:"min_deposit"` // Minimum deposit in TerraSDR }
Params oracle parameters
func DefaultParams ¶
func DefaultParams() Params
DefaultParams creates default oracle module parameters
type Program ¶
type Program struct { Title string `json:"title"` // Title of the Program Description string `json:"description"` // Description of the Program Submitter sdk.AccAddress `json:"submitter"` // Validator address of the proposer Executor sdk.AccAddress `json:"executor"` // Account address of the executor SubmitTime time.Time `json:"submit_time"` // Block height from which the Program is open for votations Deposit sdk.Coin `json:"deposit"` // Coins deposited in escrow Tally sdk.Int `json:"tally_result"` }
Program defines the basic properties of a staking Program
func NewProgram ¶
func NewProgram( title string, description string, submitter sdk.AccAddress, executor sdk.AccAddress, submitTime time.Time, deposit sdk.Coin) Program
NewProgram validates deposit and creates a new Program
type QueryVotesParams ¶
type QueryVotesParams struct { Voter sdk.AccAddress ProgramID uint64 }
Params for query 'custom/oracle/votes'
func NewQueryVotesParams ¶
func NewQueryVotesParams(voter sdk.AccAddress, programID uint64) QueryVotesParams
creates a new instance of QueryVoteParams
type SubmitProgramMsg ¶
type SubmitProgramMsg struct { Title string // Title of the Program Description string // Description of the Program Deposit sdk.Coin // Deposit paid by submitter. Must be > MinDeposit to enter voting period Submitter sdk.AccAddress // Address of the submitter Executor sdk.AccAddress // Address of the executor }
SubmitProgramMsg defines a message to create a Program
func NewSubmitProgramMsg ¶
func NewSubmitProgramMsg(title string, description string, deposit sdk.Coin, submitter sdk.AccAddress, executor sdk.AccAddress) SubmitProgramMsg
NewSubmitProgramMsg submits a message with a new Program
func (SubmitProgramMsg) GetSignBytes ¶
func (msg SubmitProgramMsg) GetSignBytes() []byte
Implements Msg
func (SubmitProgramMsg) GetSigners ¶
func (msg SubmitProgramMsg) GetSigners() []sdk.AccAddress
Implements Msg
func (SubmitProgramMsg) String ¶
func (msg SubmitProgramMsg) String() string
func (SubmitProgramMsg) ValidateBasic ¶
func (msg SubmitProgramMsg) ValidateBasic() sdk.Error
Implements Msg
type VoteMsg ¶
type VoteMsg struct { ProgramID uint64 // ID of the Program Option bool // Option chosen by voter Voter sdk.AccAddress // Address of the voter }
VoteMsg defines the msg of a staker containing the vote option to an specific Program
func NewVoteMsg ¶
func NewVoteMsg(programID uint64, option bool, voter sdk.AccAddress) VoteMsg
NewVoteMsg creates a VoteMsg instance
type WithdrawProgramMsg ¶
type WithdrawProgramMsg struct { ProgramID uint64 // ID of the Program Submitter sdk.AccAddress // Address of the voter }
WithdrawProgramMsg defines the msg of a staker containing the vote option to an specific Program
func NewWithdrawProgramMsg ¶
func NewWithdrawProgramMsg(programID uint64, submitter sdk.AccAddress) WithdrawProgramMsg
NewVoteMsg creates a VoteMsg instance
func (WithdrawProgramMsg) GetSignBytes ¶
func (msg WithdrawProgramMsg) GetSignBytes() []byte
Implements Msg
func (WithdrawProgramMsg) GetSigners ¶
func (msg WithdrawProgramMsg) GetSigners() []sdk.AccAddress
Implements Msg
func (WithdrawProgramMsg) Type ¶
func (msg WithdrawProgramMsg) Type() string
Type implements sdk.Msg
func (WithdrawProgramMsg) ValidateBasic ¶
func (msg WithdrawProgramMsg) ValidateBasic() sdk.Error
Implements Msg