Documentation ¶
Index ¶
- Constants
- func EndBlocker(ctx sdk.Context, k Keeper) (resTags sdk.Tags)
- func ErrDuplicateProgramID(programID uint64) sdk.Error
- func ErrInvalidDescription() sdk.Error
- func ErrInvalidProgramID(ProgramID uint64) sdk.Error
- func ErrInvalidSubmitBlockHeight(submitBlock int64) sdk.Error
- func ErrInvalidSubmitter(submitter sdk.AccAddress) sdk.Error
- func ErrInvalidTitle() sdk.Error
- func ErrProgramNotFound(ProgramID uint64) sdk.Error
- func ErrRefundFailed(submitter sdk.AccAddress, programID uint64) sdk.Error
- func ErrVoteNotFound() sdk.Error
- func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState)
- func NewHandler(k Keeper) sdk.Handler
- func NewQuerier(keeper Keeper) sdk.Querier
- func RegisterCodec(cdc *codec.Codec)
- func ValidateGenesis(data GenesisState) error
- type GenesisState
- type Keeper
- func (k Keeper) AddVote(ctx sdk.Context, programID uint64, voter sdk.AccAddress, option bool)
- func (k Keeper) CandQueueHas(ctx sdk.Context, endBlock int64, programID uint64) (res bool)
- func (k Keeper) CandQueueInsert(ctx sdk.Context, endBlock int64, programID uint64)
- func (k Keeper) CandQueueIterate(ctx sdk.Context, handler func(uint64) (stop bool))
- func (k Keeper) CandQueueIterateExpired(ctx sdk.Context, endBlock int64, handler func(uint64) (stop bool))
- func (k Keeper) CandQueueRemove(ctx sdk.Context, endBlock int64, programID uint64)
- func (k Keeper) DeleteProgram(ctx sdk.Context, programID uint64)
- func (k Keeper) DeleteVote(ctx sdk.Context, programID uint64, voter sdk.AccAddress)
- func (k Keeper) DeleteVotesForProgram(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) IteratePrograms(ctx sdk.Context, filterInactive bool, handler func(Program) (stop bool))
- func (k Keeper) IterateVotes(ctx sdk.Context, handler func(uint64, sdk.AccAddress, bool) (stop bool))
- func (k Keeper) IterateVotesWithPrefix(ctx sdk.Context, prefix []byte, ...)
- func (k Keeper) NewProgramID(ctx sdk.Context) (programID uint64)
- func (k Keeper) PayDeposit(ctx sdk.Context, submitter sdk.AccAddress) (err sdk.Error)
- func (k Keeper) RefundDeposit(ctx sdk.Context, submitter sdk.AccAddress) (err sdk.Error)
- func (k Keeper) SetParams(ctx sdk.Context, params Params)
- func (k Keeper) StoreProgram(ctx sdk.Context, program Program)
- type MarketKeeper
- type MintKeeper
- type MsgSubmitProgram
- type MsgVoteProgram
- type MsgWithdrawProgram
- func (msg MsgWithdrawProgram) GetSignBytes() []byte
- func (msg MsgWithdrawProgram) GetSigners() []sdk.AccAddress
- func (msg MsgWithdrawProgram) Route() string
- func (msg MsgWithdrawProgram) String() string
- func (msg MsgWithdrawProgram) Type() string
- func (msg MsgWithdrawProgram) ValidateBasic() sdk.Error
- type Params
- type Program
- type Programs
- type QueryActiveListResponse
- type QueryCandidateListResponse
- type QueryVotesParams
- type QueryVotesResponse
- type TreasuryKeeper
- type Vote
- type Votes
Constants ¶
const ( // ModuleName is the name of the budget module ModuleName = "budget" // StoreKey is the string store representation StoreKey = ModuleName // RouterKey is the msg router key for the budget module RouterKey = ModuleName // QuerierRoute is the query router key for the budget module QuerierRoute = ModuleName // DefaultParamspace is for the paramspace notation DefaultParamspace = ModuleName )
const ( // DefaultCodespace nolint DefaultCodespace sdk.CodespaceType = "budget" // Budget errors CodeInvalidProgramID sdk.CodeType = 1 CodeInvalidTitle sdk.CodeType = 2 CodeInvalidDescription sdk.CodeType = 3 CodeProgramNotFound sdk.CodeType = 4 CodeVoteNotFound sdk.CodeType = 5 CodeInvalidSubmitter sdk.CodeType = 6 CodeRefundFailed sdk.CodeType = 7 CodeInvalidSubmitBlockHeight sdk.CodeType = 8 CodeDuplicateProgramID sdk.CodeType = 9 )
const ( QueryProgram = "program" QueryVotes = "votes" QueryActiveList = "active-list" QueryCandidateList = "candidate-list" QueryParams = "params" )
query endpoints supported by the governance Querier
Variables ¶
This section is empty.
Functions ¶
func EndBlocker ¶
EndBlocker is called at the end of every block
func ErrDuplicateProgramID ¶ added in v0.2.0
nolint
func ErrInvalidSubmitBlockHeight ¶ added in v0.2.0
nolint
func ErrRefundFailed ¶ added in v0.0.7
func ErrRefundFailed(submitter sdk.AccAddress, programID uint64) sdk.Error
nolint
func InitGenesis ¶
func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState)
new oracle genesis
func NewHandler ¶
NewHandler creates a new handler for all budget type messages.
func NewQuerier ¶
NewQuerier is the module level router for state queries
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 GenesisState ¶
type GenesisState struct { Params Params `json:"params"` // budget params ActivePrograms Programs `json:"active_programs"` CandidatePrograms Programs `json:"candidate_programs"` Votes Votes `json:"votes"` }
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, activePrograms, candidatePrograms Programs, votes Votes) GenesisState
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
nolint
func NewKeeper ¶
func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, mrk MarketKeeper, mk MintKeeper, tk TreasuryKeeper, valset sdk.ValidatorSet, paramspace params.Subspace) Keeper
NewKeeper crates a new keeper
func (Keeper) CandQueueHas ¶ added in v0.0.7
CandQueueHas Checks if a progrma exists in accordance with the given parameters
func (Keeper) CandQueueInsert ¶ added in v0.0.7
CandQueueInsert Inserts a ProgramID into the Candidate Program queue at endTime
func (Keeper) CandQueueIterate ¶ added in v0.0.7
CandQueueIterate iterate all the Programs in the candidate queue
func (Keeper) CandQueueIterateExpired ¶ added in v0.0.7
func (k Keeper) CandQueueIterateExpired(ctx sdk.Context, endBlock int64, handler func(uint64) (stop bool))
CandQueueIterateExpired iterate all the Programs in the candidate queue that have outspent their voteperiod
func (Keeper) CandQueueRemove ¶ added in v0.0.7
CandQueueRemove removes a ProgramID from the Candidate Program Queue
func (Keeper) DeleteProgram ¶
DeleteProgram deletes a program from the store
func (Keeper) DeleteVote ¶ added in v0.0.7
DeleteVote deletes the vote from the store
func (Keeper) DeleteVotesForProgram ¶ added in v0.2.0
DeleteVotesForProgram deletes the votes for the program from the store
func (Keeper) GetProgram ¶
GetProgram gets the Program with the given id from the store.
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
func (Keeper) IteratePrograms ¶ added in v0.0.7
func (k Keeper) IteratePrograms(ctx sdk.Context, filterInactive bool, handler func(Program) (stop bool))
IteratePrograms iterates programs in the store
func (Keeper) IterateVotes ¶ added in v0.0.7
func (k Keeper) IterateVotes(ctx sdk.Context, handler func(uint64, sdk.AccAddress, bool) (stop bool))
IterateVotes iterates votes in the store
func (Keeper) IterateVotesWithPrefix ¶ added in v0.0.7
func (k Keeper) IterateVotesWithPrefix(ctx sdk.Context, prefix []byte, handler func(uint64, sdk.AccAddress, bool) (stop bool))
IterateVotesWithPrefix iterates votes with given {prefix} in the store
func (Keeper) NewProgramID ¶
NewProgramID generates a new program id; advances sequentially from 1; 0 conflits with vote querier
func (Keeper) PayDeposit ¶ added in v0.0.7
PayDeposit pays the deposit by withdrawing from the submitter's balance.
func (Keeper) RefundDeposit ¶
RefundDeposit refunds the deposit, by crediting the submitter's balance.
type MarketKeeper ¶ added in v0.2.0
type MarketKeeper interface {
GetSwapDecCoin(ctx sdk.Context, offerCoin sdk.DecCoin, askDenom string) (sdk.DecCoin, sdk.Error)
}
expected market keeper
type MintKeeper ¶ added in v0.2.0
type MintKeeper interface { Mint(ctx sdk.Context, recipient sdk.AccAddress, coin sdk.Coin) (err sdk.Error) Burn(ctx sdk.Context, payer sdk.AccAddress, coin sdk.Coin) (err sdk.Error) PeekEpochSeigniorage(ctx sdk.Context, epoch sdk.Int) (epochSeigniorage sdk.Int) }
expected mint keeper
type MsgSubmitProgram ¶ added in v0.0.7
type MsgSubmitProgram struct { Title string `json:"title"` // Title of the Program Description string `json:"description"` // Description of the Program Submitter sdk.AccAddress `json:"submitter"` // Address of the submitter Executor sdk.AccAddress `json:"executor"` // Address of the executor }
MsgSubmitProgram defines a message to create a Program
func NewMsgSubmitProgram ¶ added in v0.0.7
func NewMsgSubmitProgram(title string, description string, submitter sdk.AccAddress, executor sdk.AccAddress) MsgSubmitProgram
NewMsgSubmitProgram submits a message with a new Program
func (MsgSubmitProgram) GetSignBytes ¶ added in v0.0.7
func (msg MsgSubmitProgram) GetSignBytes() []byte
GetSignBytes returns sign byptes
func (MsgSubmitProgram) GetSigners ¶ added in v0.0.7
func (msg MsgSubmitProgram) GetSigners() []sdk.AccAddress
GetSigners returns signer
func (MsgSubmitProgram) Route ¶ added in v0.0.7
func (msg MsgSubmitProgram) Route() string
Route returns msg route
func (MsgSubmitProgram) String ¶ added in v0.0.7
func (msg MsgSubmitProgram) String() string
String stringify the msg
func (MsgSubmitProgram) Type ¶ added in v0.0.7
func (msg MsgSubmitProgram) Type() string
Type returns msg type
func (MsgSubmitProgram) ValidateBasic ¶ added in v0.0.7
func (msg MsgSubmitProgram) ValidateBasic() sdk.Error
ValidateBasic validate msg
type MsgVoteProgram ¶ added in v0.0.7
type MsgVoteProgram struct { ProgramID uint64 `json:"program_id"` // ID of the Program Option bool `json:"option"` // Option chosen by voter Voter sdk.AccAddress `json:"voter"` // Address of the voter }
MsgVoteProgram defines the msg of a staker containing the vote option to an specific Program
func NewMsgVoteProgram ¶ added in v0.0.7
func NewMsgVoteProgram(programID uint64, option bool, voter sdk.AccAddress) MsgVoteProgram
NewMsgVoteProgram creates a MsgVoteProgram instance
func (MsgVoteProgram) GetSignBytes ¶ added in v0.0.7
func (msg MsgVoteProgram) GetSignBytes() []byte
GetSignBytes returns sign byptes
func (MsgVoteProgram) GetSigners ¶ added in v0.0.7
func (msg MsgVoteProgram) GetSigners() []sdk.AccAddress
GetSigners returns signer
func (MsgVoteProgram) Route ¶ added in v0.0.7
func (msg MsgVoteProgram) Route() string
Route returns msg route
func (MsgVoteProgram) String ¶ added in v0.0.7
func (msg MsgVoteProgram) String() string
String stringify the msg
func (MsgVoteProgram) Type ¶ added in v0.0.7
func (msg MsgVoteProgram) Type() string
Type returns msg type
func (MsgVoteProgram) ValidateBasic ¶ added in v0.0.7
func (msg MsgVoteProgram) ValidateBasic() sdk.Error
ValidateBasic validate msg
type MsgWithdrawProgram ¶ added in v0.0.7
type MsgWithdrawProgram struct { ProgramID uint64 `json:"program_id"` // ID of the Program Submitter sdk.AccAddress `json:"submitter"` // Address of the voter }
WithdrawProgramMsg defines the msg of a staker containing the vote option to an specific Program
func NewMsgWithdrawProgram ¶ added in v0.0.7
func NewMsgWithdrawProgram(programID uint64, submitter sdk.AccAddress) MsgWithdrawProgram
NewMsgWithdrawProgram creates a VoteMsg instance
func (MsgWithdrawProgram) GetSignBytes ¶ added in v0.0.7
func (msg MsgWithdrawProgram) GetSignBytes() []byte
GetSignBytes returns sign byptes
func (MsgWithdrawProgram) GetSigners ¶ added in v0.0.7
func (msg MsgWithdrawProgram) GetSigners() []sdk.AccAddress
GetSigners returns signer
func (MsgWithdrawProgram) Route ¶ added in v0.0.7
func (msg MsgWithdrawProgram) Route() string
Route returns msg route
func (MsgWithdrawProgram) String ¶ added in v0.0.7
func (msg MsgWithdrawProgram) String() string
String stringify the msg
func (MsgWithdrawProgram) Type ¶ added in v0.0.7
func (msg MsgWithdrawProgram) Type() string
Type returns msg type
func (MsgWithdrawProgram) ValidateBasic ¶ added in v0.0.7
func (msg MsgWithdrawProgram) ValidateBasic() sdk.Error
ValidateBasic validate msg
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 int64 `json:"vote_period"` // vote period Deposit sdk.Coin `json:"deposit"` // Minimum deposit in TerraSDR }
Params budget parameters
func DefaultParams ¶
func DefaultParams() Params
DefaultParams creates default budget module parameters
type Program ¶
type Program struct { ProgramID uint64 `json:"program_id"` // ID of the Program 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 SubmitBlock int64 `json:"submit_time"` // Block height from which the Program is open for votations }
Program defines the basic properties of a staking Program
func NewProgram ¶
func NewProgram( programID uint64, title string, description string, submitter sdk.AccAddress, executor sdk.AccAddress, submitBlock int64) Program
NewProgram validates deposit and creates a new Program
type QueryActiveListResponse ¶ added in v0.2.2
type QueryActiveListResponse struct {
Actives Programs `json:"actives"`
}
JSON response format
func (QueryActiveListResponse) String ¶ added in v0.2.2
func (r QueryActiveListResponse) String() (out string)
type QueryCandidateListResponse ¶ added in v0.2.2
type QueryCandidateListResponse struct {
Candidates Programs `json:"candidates"`
}
JSON response format
func (QueryCandidateListResponse) String ¶ added in v0.2.2
func (r QueryCandidateListResponse) String() (out string)
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 QueryVotesResponse ¶ added in v0.2.2
type QueryVotesResponse struct {
Votes Votes `json:"votes"`
}
JSON response format
func (QueryVotesResponse) String ¶ added in v0.2.2
func (r QueryVotesResponse) String() (out string)
type TreasuryKeeper ¶ added in v0.2.0
type TreasuryKeeper interface { GetRewardWeight(ctx sdk.Context, epoch sdk.Int) (rewardWeight sdk.Dec) SetRewardWeight(ctx sdk.Context, weight sdk.Dec) }
expected treasury keeper
type Vote ¶ added in v0.0.7
type Vote MsgVoteProgram
no-lint