Documentation ¶
Index ¶
- Constants
- Variables
- func GetKeyFromID(id uint64) []byte
- func GetVoteKey(proposalID uint64, voter sdk.AccAddress) []byte
- func RegisterCodec(cdc *codec.Codec)
- func RegisterPermissionTypeCodec(o interface{}, name string)
- func RegisterProposalTypeCodec(o interface{}, name string)
- func Uint64FromBytes(bz []byte) uint64
- type AccountKeeper
- type AllowedAssetParam
- type AllowedAssetParams
- type AllowedCollateralParam
- type AllowedCollateralParams
- type AllowedDebtParam
- type AllowedMarket
- type AllowedMarkets
- type AllowedMoneyMarket
- type AllowedMoneyMarkets
- type AllowedParam
- type AllowedParams
- type BaseCommittee
- func (c BaseCommittee) GetDescription() string
- func (c BaseCommittee) GetID() uint64
- func (c BaseCommittee) GetMembers() []sdk.AccAddress
- func (c BaseCommittee) GetPermissions() []Permission
- func (c BaseCommittee) GetProposalDuration() time.Duration
- func (c BaseCommittee) GetTallyOption() TallyOption
- func (c BaseCommittee) GetType() string
- func (c BaseCommittee) GetVoteThreshold() sdk.Dec
- func (c BaseCommittee) HasMember(addr sdk.AccAddress) bool
- func (c BaseCommittee) HasPermissionsFor(ctx sdk.Context, appCdc *codec.Codec, pk ParamKeeper, proposal PubProposal) bool
- func (c BaseCommittee) SetMembers(members []sdk.AccAddress) BaseCommittee
- func (c BaseCommittee) SetPermissions(permissions []Permission) BaseCommittee
- func (c BaseCommittee) SetProposalDuration(proposalDuration time.Duration) BaseCommittee
- func (c BaseCommittee) SetVoteThreshold(voteThreshold sdk.Dec) BaseCommittee
- func (c BaseCommittee) String() string
- func (c BaseCommittee) Validate() error
- type Committee
- type CommitteeChangeProposal
- func (ccp CommitteeChangeProposal) GetDescription() string
- func (ccp CommitteeChangeProposal) GetTitle() string
- func (ccp CommitteeChangeProposal) ProposalRoute() string
- func (ccp CommitteeChangeProposal) ProposalType() string
- func (ccp CommitteeChangeProposal) String() string
- func (ccp CommitteeChangeProposal) ValidateBasic() error
- type CommitteeDeleteProposal
- func (cdp CommitteeDeleteProposal) GetDescription() string
- func (cdp CommitteeDeleteProposal) GetTitle() string
- func (cdp CommitteeDeleteProposal) ProposalRoute() string
- func (cdp CommitteeDeleteProposal) ProposalType() string
- func (cdp CommitteeDeleteProposal) String() string
- func (cdp CommitteeDeleteProposal) ValidateBasic() error
- type Committees
- type GenesisState
- type GodPermission
- type MemberCommittee
- type MsgSubmitProposal
- type MsgVote
- type ParamKeeper
- type Permission
- type Proposal
- type ProposalOutcome
- type ProposalPollingStatus
- type PubProposal
- type QueryCommitteeParams
- type QueryProposalParams
- type QueryRawParamsParams
- type QueryVoteParams
- type SimpleParamChangePermission
- type SoftwareUpgradePermission
- type SubParamChangePermission
- type SupplyKeeper
- type TallyOption
- func (t TallyOption) Marshal() ([]byte, error)
- func (t TallyOption) MarshalJSON() ([]byte, error)
- func (t TallyOption) MarshalYAML() ([]byte, error)
- func (t TallyOption) String() string
- func (t *TallyOption) Unmarshal(data []byte) error
- func (t *TallyOption) UnmarshalJSON(data []byte) error
- func (t *TallyOption) UnmarshalYAML(data []byte) error
- type TextPermission
- type TokenCommittee
- type Vote
- type VoteType
- func (vt VoteType) Marshal() ([]byte, error)
- func (vt VoteType) MarshalJSON() ([]byte, error)
- func (vt VoteType) MarshalYAML() ([]byte, error)
- func (vt VoteType) String() string
- func (vt *VoteType) Unmarshal(data []byte) error
- func (vt *VoteType) UnmarshalJSON(data []byte) error
- func (vt *VoteType) UnmarshalYAML(data []byte) error
- func (vt VoteType) Validate() error
Constants ¶
const ( BaseCommitteeType = "kava/BaseCommittee" MemberCommitteeType = "kava/MemberCommittee" // Committee is composed of member addresses that vote to enact proposals within their permissions TokenCommitteeType = "kava/TokenCommittee" // Committee is composed of token holders with voting power determined by total token balance BondDenom = "ukava" )
const ( EventTypeProposalSubmit = "proposal_submit" EventTypeProposalClose = "proposal_close" EventTypeProposalVote = "proposal_vote" AttributeValueCategory = "committee" AttributeKeyCommitteeID = "committee_id" AttributeKeyProposalID = "proposal_id" AttributeKeyDeadline = "deadline" AttributeKeyProposalCloseStatus = "status" AttributeKeyVoter = "voter" AttributeKeyVote = "vote" AttributeKeyProposalOutcome = "proposal_outcome" AttributeKeyProposalTally = "proposal_tally" )
Module event types
const ( // ModuleName The name that will be used throughout the module ModuleName = "committee" // StoreKey Top level store key where all module items will be stored StoreKey = ModuleName // RouterKey Top level router key RouterKey = ModuleName // QuerierRoute Top level query string QuerierRoute = ModuleName // DefaultParamspace default name for parameter store DefaultParamspace = ModuleName )
const ( TypeMsgSubmitProposal = "commmittee_submit_proposal" // 'committee' prefix appended to avoid potential conflicts with gov msg types TypeMsgVote = "committee_vote" )
const ( ProposalTypeCommitteeChange = "CommitteeChange" ProposalTypeCommitteeDelete = "CommitteeDelete" )
const ( QueryCommittees = "committees" QueryCommittee = "committee" QueryProposals = "proposals" QueryProposal = "proposal" QueryNextProposalID = "next-proposal-id" QueryVotes = "votes" QueryVote = "vote" QueryTally = "tally" QueryRawParams = "raw_params" )
Query endpoints supported by the Querier
const DefaultNextProposalID uint64 = 1
DefaultNextProposalID is the starting poiint for proposal IDs.
const MaxCommitteeDescriptionLength int = 512
Variables ¶
var ( ErrUnknownCommittee = sdkerrors.Register(ModuleName, 2, "committee not found") ErrInvalidCommittee = sdkerrors.Register(ModuleName, 3, "invalid committee") ErrUnknownProposal = sdkerrors.Register(ModuleName, 4, "proposal not found") ErrProposalExpired = sdkerrors.Register(ModuleName, 5, "proposal expired") ErrInvalidPubProposal = sdkerrors.Register(ModuleName, 6, "invalid pubproposal") ErrUnknownVote = sdkerrors.Register(ModuleName, 7, "vote not found") ErrInvalidGenesis = sdkerrors.Register(ModuleName, 8, "invalid genesis") ErrNoProposalHandlerExists = sdkerrors.Register(ModuleName, 9, "pubproposal has no corresponding handler") ErrUnknownSubspace = sdkerrors.Register(ModuleName, 10, "subspace not found") ErrInvalidVoteType = sdkerrors.Register(ModuleName, 11, "invalid vote type") )
var ( CommitteeKeyPrefix = []byte{0x00} // prefix for keys that store committees ProposalKeyPrefix = []byte{0x01} // prefix for keys that store proposals VoteKeyPrefix = []byte{0x02} // prefix for keys that store votes NextProposalIDKey = []byte{0x03} // key for the next proposal id )
Key prefixes
var ModuleCdc *codec.Codec
ModuleCdc is a generic codec to be used throughout module
Functions ¶
func GetKeyFromID ¶
GetKeyFromID returns the bytes to use as a key for a uint64 id
func GetVoteKey ¶
func GetVoteKey(proposalID uint64, voter sdk.AccAddress) []byte
func RegisterCodec ¶
RegisterCodec registers the necessary types for the module
func RegisterPermissionTypeCodec ¶
func RegisterPermissionTypeCodec(o interface{}, name string)
RegisterPermissionTypeCodec allows external modules to register their own permission types on the internal ModuleCdc. This allows the MsgSubmitProposal to be correctly Amino encoded and decoded (when the msg contains a CommitteeChangeProposal).
func RegisterProposalTypeCodec ¶
func RegisterProposalTypeCodec(o interface{}, name string)
RegisterProposalTypeCodec allows external modules to register their own pubproposal types on the internal ModuleCdc. This allows the MsgSubmitProposal to be correctly Amino encoded and decoded.
func Uint64FromBytes ¶
Uint64FromBytes converts some fixed length bytes back into a uint64.
Types ¶
type AccountKeeper ¶ added in v0.15.0
type AccountKeeper interface {
GetAccount(ctx sdk.Context, addr sdk.AccAddress) authexported.Account
}
AccountKeeper defines the expected account keeper (noalias)
type AllowedAssetParam ¶
type AllowedAssetParam struct { Denom string `json:"denom" yaml:"denom"` CoinID bool `json:"coin_id" yaml:"coin_id"` Limit bool `json:"limit" yaml:"limit"` Active bool `json:"active" yaml:"active"` MaxSwapAmount bool `json:"max_swap_amount" yaml:"max_swap_amount"` MinBlockLock bool `json:"min_block_lock" yaml:"min_block_lock"` }
AllowedAssetParam bep3 asset parameters that can be changed by committee
func (AllowedAssetParam) Allows ¶
func (aap AllowedAssetParam) Allows(current, incoming bep3types.AssetParam) bool
Allows bep3 AssetParam parameters than can be changed by committee
type AllowedAssetParams ¶
type AllowedAssetParams []AllowedAssetParam
AllowedAssetParams slice of AllowedAssetParam
func (AllowedAssetParams) Allows ¶
func (aaps AllowedAssetParams) Allows(current, incoming bep3types.AssetParams) bool
Allows determines if asset params changes are permitted
type AllowedCollateralParam ¶
type AllowedCollateralParam struct { Type string `json:"type" yaml:"type"` Denom bool `json:"denom" yaml:"denom"` LiquidationRatio bool `json:"liquidation_ratio" yaml:"liquidation_ratio"` DebtLimit bool `json:"debt_limit" yaml:"debt_limit"` StabilityFee bool `json:"stability_fee" yaml:"stability_fee"` AuctionSize bool `json:"auction_size" yaml:"auction_size"` LiquidationPenalty bool `json:"liquidation_penalty" yaml:"liquidation_penalty"` Prefix bool `json:"prefix" yaml:"prefix"` SpotMarketID bool `json:"spot_market_id" yaml:"spot_market_id"` LiquidationMarketID bool `json:"liquidation_market_id" yaml:"liquidation_market_id"` ConversionFactor bool `json:"conversion_factor" yaml:"conversion_factor"` KeeperRewardPercentage bool `json:"keeper_reward_percentage" yaml:"keeper_reward_percentage"` CheckCollateralizationIndexCount bool `json:"check_collateralization_index_count" yaml:"check_collateralization_index_count"` }
AllowedCollateralParam permission struct for changes to collateral parameter keys (cdp module)
func NewAllowedCollateralParam ¶ added in v0.11.0
func NewAllowedCollateralParam( ctype string, denom, liqRatio, debtLimit, stabilityFee, auctionSize, liquidationPenalty, prefix, spotMarket, liquidationMarket, conversionFactor, keeperReward, ltvIndexCount bool) AllowedCollateralParam
NewAllowedCollateralParam return a new AllowedCollateralParam
func (AllowedCollateralParam) Allows ¶
func (acp AllowedCollateralParam) Allows(current, incoming cdptypes.CollateralParam) bool
Allows determine if collateral param changes are permitted
type AllowedCollateralParams ¶
type AllowedCollateralParams []AllowedCollateralParam
AllowedCollateralParams slice of AllowedCollateralParam
func (AllowedCollateralParams) Allows ¶
func (acps AllowedCollateralParams) Allows(current, incoming cdptypes.CollateralParams) bool
Allows determine if collateral params changes are permitted
type AllowedDebtParam ¶
type AllowedDebtParam struct { Denom bool `json:"denom" yaml:"denom"` ReferenceAsset bool `json:"reference_asset" yaml:"reference_asset"` ConversionFactor bool `json:"conversion_factor" yaml:"conversion_factor"` DebtFloor bool `json:"debt_floor" yaml:"debt_floor"` }
AllowedDebtParam permission struct for changes to debt parameter keys (cdp module)
type AllowedMarket ¶
type AllowedMarket struct { MarketID string `json:"market_id" yaml:"market_id"` BaseAsset bool `json:"base_asset" yaml:"base_asset"` QuoteAsset bool `json:"quote_asset" yaml:"quote_asset"` Oracles bool `json:"oracles" yaml:"oracles"` Active bool `json:"active" yaml:"active"` }
AllowedMarket permission struct for market parameters (pricefeed module)
func (AllowedMarket) Allows ¶
func (am AllowedMarket) Allows(current, incoming pricefeedtypes.Market) bool
Allows determines if market param changes are permitted
type AllowedMarkets ¶
type AllowedMarkets []AllowedMarket
AllowedMarkets slice of AllowedMarket
func (AllowedMarkets) Allows ¶
func (ams AllowedMarkets) Allows(current, incoming pricefeedtypes.Markets) bool
Allows determines if markets params changed are permitted
type AllowedMoneyMarket ¶ added in v0.13.0
type AllowedMoneyMarket struct { Denom string `json:"denom" yaml:"denom"` BorrowLimit bool `json:"borrow_limit" yaml:"borrow_limit"` SpotMarketID bool `json:"spot_market_id" yaml:"spot_market_id"` ConversionFactor bool `json:"conversion_factor" yaml:"conversion_factor"` InterestRateModel bool `json:"interest_rate_model" yaml:"interest_rate_model"` ReserveFactor bool `json:"reserve_factor" yaml:"reserve_factor"` KeeperRewardPercentage bool `json:"keeper_reward_percentage" yaml:"keeper_reward_percentage"` }
AllowedMoneyMarket permission struct for money market parameters (hard module)
func NewAllowedMoneyMarket ¶ added in v0.13.0
func NewAllowedMoneyMarket(denom string, bl, sm, cf, irm, rf, kr bool) AllowedMoneyMarket
NewAllowedMoneyMarket returns a new AllowedMoneyMarket
func (AllowedMoneyMarket) Allows ¶ added in v0.13.0
func (amm AllowedMoneyMarket) Allows(current, incoming hard.MoneyMarket) bool
Allows determines if money market param changes are permitted
type AllowedMoneyMarkets ¶ added in v0.13.0
type AllowedMoneyMarkets []AllowedMoneyMarket
AllowedMoneyMarkets slice of AllowedMoneyMarket
func (AllowedMoneyMarkets) Allows ¶ added in v0.13.0
func (amms AllowedMoneyMarkets) Allows(current, incoming hard.MoneyMarkets) bool
Allows determins if money market params changes are permitted
type AllowedParam ¶
type AllowedParam struct { Subspace string `json:"subspace" yaml:"subspace"` Key string `json:"key" yaml:"key"` }
AllowedParam permission type for module parameter keys
type AllowedParams ¶
type AllowedParams []AllowedParam
AllowedParams slice of AllowedParam
func (AllowedParams) Contains ¶
func (allowed AllowedParams) Contains(paramChange paramstypes.ParamChange) bool
Contains checks if a key is included in param permissions
type BaseCommittee ¶ added in v0.15.0
type BaseCommittee struct { ID uint64 `json:"id" yaml:"id"` Description string `json:"description" yaml:"description"` Members []sdk.AccAddress `json:"members" yaml:"members"` Permissions []Permission `json:"permissions" yaml:"permissions"` VoteThreshold sdk.Dec `json:"vote_threshold" yaml:"vote_threshold"` // Smallest percentage that must vote for a proposal to pass ProposalDuration time.Duration `json:"proposal_duration" yaml:"proposal_duration"` // The length of time a proposal remains active for. Proposals will close earlier if they get enough votes. TallyOption TallyOption `json:"tally_option" yaml:"tally_option"` }
BaseCommittee is a common type shared by all Committees
func (BaseCommittee) GetDescription ¶ added in v0.15.0
func (c BaseCommittee) GetDescription() string
GetDescription is a getter for committee description
func (BaseCommittee) GetID ¶ added in v0.15.0
func (c BaseCommittee) GetID() uint64
GetID is a getter for committee ID
func (BaseCommittee) GetMembers ¶ added in v0.15.0
func (c BaseCommittee) GetMembers() []sdk.AccAddress
GetMembers is a getter for committee members
func (BaseCommittee) GetPermissions ¶ added in v0.15.0
func (c BaseCommittee) GetPermissions() []Permission
GetPermissions is a getter for committee permissions
func (BaseCommittee) GetProposalDuration ¶ added in v0.15.0
func (c BaseCommittee) GetProposalDuration() time.Duration
GetProposalDuration is a getter for committee ProposalDuration
func (BaseCommittee) GetTallyOption ¶ added in v0.15.0
func (c BaseCommittee) GetTallyOption() TallyOption
GetTallyOption is a getter for committee TallyOption
func (BaseCommittee) GetType ¶ added in v0.15.0
func (c BaseCommittee) GetType() string
GetType is a getter for committee type
func (BaseCommittee) GetVoteThreshold ¶ added in v0.15.0
func (c BaseCommittee) GetVoteThreshold() sdk.Dec
GetVoteThreshold is a getter for committee VoteThreshold
func (BaseCommittee) HasMember ¶ added in v0.15.0
func (c BaseCommittee) HasMember(addr sdk.AccAddress) bool
HasMember returns if a committee contains a given member address
func (BaseCommittee) HasPermissionsFor ¶ added in v0.15.0
func (c BaseCommittee) HasPermissionsFor(ctx sdk.Context, appCdc *codec.Codec, pk ParamKeeper, proposal PubProposal) bool
HasPermissionsFor returns whether the committee is authorized to enact a proposal. As long as one permission allows the proposal then it goes through. Its the OR of all permissions.
func (BaseCommittee) SetMembers ¶ added in v0.15.0
func (c BaseCommittee) SetMembers(members []sdk.AccAddress) BaseCommittee
SetMembers is a setter for committee members
func (BaseCommittee) SetPermissions ¶ added in v0.15.0
func (c BaseCommittee) SetPermissions(permissions []Permission) BaseCommittee
SetPermissions is a setter for committee permissions
func (BaseCommittee) SetProposalDuration ¶ added in v0.15.0
func (c BaseCommittee) SetProposalDuration(proposalDuration time.Duration) BaseCommittee
SetProposalDuration is a setter for committee ProposalDuration
func (BaseCommittee) SetVoteThreshold ¶ added in v0.15.0
func (c BaseCommittee) SetVoteThreshold(voteThreshold sdk.Dec) BaseCommittee
SetVoteThreshold is a setter for committee VoteThreshold
func (BaseCommittee) String ¶ added in v0.15.0
func (c BaseCommittee) String() string
String implements fmt.Stringer
func (BaseCommittee) Validate ¶ added in v0.15.0
func (c BaseCommittee) Validate() error
Validate validates BaseCommittee fields
type Committee ¶
type Committee interface { GetID() uint64 GetType() string GetDescription() string GetMembers() []sdk.AccAddress SetMembers([]sdk.AccAddress) BaseCommittee HasMember(addr sdk.AccAddress) bool GetPermissions() []Permission SetPermissions([]Permission) Committee HasPermissionsFor(ctx sdk.Context, appCdc *codec.Codec, pk ParamKeeper, proposal PubProposal) bool GetProposalDuration() time.Duration SetProposalDuration(time.Duration) BaseCommittee GetVoteThreshold() sdk.Dec SetVoteThreshold(sdk.Dec) BaseCommittee GetTallyOption() TallyOption Validate() error }
Committee is an interface for handling common actions on committees
type CommitteeChangeProposal ¶
type CommitteeChangeProposal struct { Title string `json:"title" yaml:"title"` Description string `json:"description" yaml:"description"` NewCommittee Committee `json:"new_committee" yaml:"new_committee"` }
CommitteeChangeProposal is a gov proposal for creating a new committee or modifying an existing one.
func NewCommitteeChangeProposal ¶
func NewCommitteeChangeProposal(title string, description string, newCommittee Committee) CommitteeChangeProposal
func (CommitteeChangeProposal) GetDescription ¶
func (ccp CommitteeChangeProposal) GetDescription() string
GetDescription returns the description of the proposal.
func (CommitteeChangeProposal) GetTitle ¶
func (ccp CommitteeChangeProposal) GetTitle() string
GetTitle returns the title of the proposal.
func (CommitteeChangeProposal) ProposalRoute ¶
func (ccp CommitteeChangeProposal) ProposalRoute() string
ProposalRoute returns the routing key of the proposal.
func (CommitteeChangeProposal) ProposalType ¶
func (ccp CommitteeChangeProposal) ProposalType() string
ProposalType returns the type of the proposal.
func (CommitteeChangeProposal) String ¶
func (ccp CommitteeChangeProposal) String() string
String implements the Stringer interface.
func (CommitteeChangeProposal) ValidateBasic ¶
func (ccp CommitteeChangeProposal) ValidateBasic() error
ValidateBasic runs basic stateless validity checks
type CommitteeDeleteProposal ¶
type CommitteeDeleteProposal struct { Title string `json:"title" yaml:"title"` Description string `json:"description" yaml:"description"` CommitteeID uint64 `json:"committee_id" yaml:"committee_id"` }
CommitteeDeleteProposal is a gov proposal for removing a committee.
func NewCommitteeDeleteProposal ¶
func NewCommitteeDeleteProposal(title string, description string, committeeID uint64) CommitteeDeleteProposal
func (CommitteeDeleteProposal) GetDescription ¶
func (cdp CommitteeDeleteProposal) GetDescription() string
GetDescription returns the description of the proposal.
func (CommitteeDeleteProposal) GetTitle ¶
func (cdp CommitteeDeleteProposal) GetTitle() string
GetTitle returns the title of the proposal.
func (CommitteeDeleteProposal) ProposalRoute ¶
func (cdp CommitteeDeleteProposal) ProposalRoute() string
ProposalRoute returns the routing key of the proposal.
func (CommitteeDeleteProposal) ProposalType ¶
func (cdp CommitteeDeleteProposal) ProposalType() string
ProposalType returns the type of the proposal.
func (CommitteeDeleteProposal) String ¶
func (cdp CommitteeDeleteProposal) String() string
String implements the Stringer interface.
func (CommitteeDeleteProposal) ValidateBasic ¶
func (cdp CommitteeDeleteProposal) ValidateBasic() error
ValidateBasic runs basic stateless validity checks
type GenesisState ¶
type GenesisState struct { NextProposalID uint64 `json:"next_proposal_id" yaml:"next_proposal_id"` Committees Committees `json:"committees" yaml:"committees"` Proposals []Proposal `json:"proposals" yaml:"proposals"` Votes []Vote `json:"votes" yaml:"votes"` }
GenesisState is state that must be provided at chain genesis.
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
DefaultGenesisState returns the default genesis state for the module.
func NewGenesisState ¶
func NewGenesisState(nextProposalID uint64, committees Committees, proposals []Proposal, votes []Vote) GenesisState
NewGenesisState returns a new genesis state object for the module.
func (GenesisState) Equal ¶
func (data GenesisState) Equal(data2 GenesisState) bool
Equal checks whether two gov GenesisState structs are equivalent
func (GenesisState) IsEmpty ¶
func (data GenesisState) IsEmpty() bool
IsEmpty returns true if a GenesisState is empty
func (GenesisState) Validate ¶
func (gs GenesisState) Validate() error
Validate performs basic validation of genesis data.
type GodPermission ¶
type GodPermission struct{}
GodPermission allows any governance proposal. It is used mainly for testing.
func (GodPermission) Allows ¶
func (GodPermission) Allows(sdk.Context, *codec.Codec, ParamKeeper, PubProposal) bool
Allows implement permission interface
func (GodPermission) MarshalYAML ¶
func (GodPermission) MarshalYAML() (interface{}, error)
MarshalYAML implement yaml marshalling
type MemberCommittee ¶ added in v0.15.0
type MemberCommittee struct {
BaseCommittee `json:"base_committee" yaml:"base_committee"`
}
MemberCommittee is an alias of BaseCommittee
func NewMemberCommittee ¶ added in v0.15.0
func NewMemberCommittee(id uint64, description string, members []sdk.AccAddress, permissions []Permission, threshold sdk.Dec, duration time.Duration, tallyOption TallyOption) MemberCommittee
NewMemberCommittee instantiates a new instance of MemberCommittee
func (MemberCommittee) GetType ¶ added in v0.15.0
func (c MemberCommittee) GetType() string
GetType is a getter for committee type
func (MemberCommittee) SetPermissions ¶ added in v0.15.0
func (c MemberCommittee) SetPermissions(permissions []Permission) Committee
SetPermissions is a setter for committee permissions
func (MemberCommittee) Validate ¶ added in v0.15.0
func (c MemberCommittee) Validate() error
Validate validates the committee's fields
type MsgSubmitProposal ¶
type MsgSubmitProposal struct { PubProposal PubProposal `json:"pub_proposal" yaml:"pub_proposal"` Proposer sdk.AccAddress `json:"proposer" yaml:"proposer"` CommitteeID uint64 `json:"committee_id" yaml:"committee_id"` }
MsgSubmitProposal is used by committee members to create a new proposal that they can vote on.
func NewMsgSubmitProposal ¶
func NewMsgSubmitProposal(pubProposal PubProposal, proposer sdk.AccAddress, committeeID uint64) MsgSubmitProposal
NewMsgSubmitProposal creates a new MsgSubmitProposal instance
func (MsgSubmitProposal) GetSignBytes ¶
func (msg MsgSubmitProposal) GetSignBytes() []byte
GetSignBytes gets the canonical byte representation of the Msg.
func (MsgSubmitProposal) GetSigners ¶
func (msg MsgSubmitProposal) GetSigners() []sdk.AccAddress
GetSigners returns the addresses of signers that must sign.
func (MsgSubmitProposal) Route ¶
func (msg MsgSubmitProposal) Route() string
Route return the message type used for routing the message.
func (MsgSubmitProposal) Type ¶
func (msg MsgSubmitProposal) Type() string
Type returns a human-readable string for the message, intended for utilization within events.
func (MsgSubmitProposal) ValidateBasic ¶
func (msg MsgSubmitProposal) ValidateBasic() error
ValidateBasic does a simple validation check that doesn't require access to any other information.
type MsgVote ¶
type MsgVote struct { ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"` Voter sdk.AccAddress `json:"voter" yaml:"voter"` VoteType VoteType `json:"vote_type" yaml:"vote_type"` }
MsgVote is submitted by committee members to vote on proposals.
func NewMsgVote ¶
func NewMsgVote(voter sdk.AccAddress, proposalID uint64, voteType VoteType) MsgVote
NewMsgVote creates a message to cast a vote on an active proposal
func (MsgVote) GetSignBytes ¶
GetSignBytes gets the canonical byte representation of the Msg.
func (MsgVote) GetSigners ¶
func (msg MsgVote) GetSigners() []sdk.AccAddress
GetSigners returns the addresses of signers that must sign.
func (MsgVote) Type ¶
Type returns a human-readable string for the message, intended for utilization within events.
func (MsgVote) ValidateBasic ¶
ValidateBasic does a simple validation check that doesn't require access to any other information.
type Permission ¶
type Permission interface {
Allows(sdk.Context, *codec.Codec, ParamKeeper, PubProposal) bool
}
Permission is anything with a method that validates whether a proposal is allowed by it or not.
type Proposal ¶
type Proposal struct { PubProposal `json:"pub_proposal" yaml:"pub_proposal"` ID uint64 `json:"id" yaml:"id"` CommitteeID uint64 `json:"committee_id" yaml:"committee_id"` Deadline time.Time `json:"deadline" yaml:"deadline"` }
Proposal is an internal record of a governance proposal submitted to a committee.
func NewProposal ¶
func (Proposal) HasExpiredBy ¶
HasExpiredBy calculates if the proposal will have expired by a certain time. All votes must be cast before deadline, those cast at time == deadline are not valid
type ProposalOutcome ¶ added in v0.15.0
type ProposalOutcome uint64
ProposalOutcome indicates the status of a proposal when it's closed and deleted from the store
const ( // Passed indicates that the proposal passed and was successfully enacted Passed ProposalOutcome = iota // Failed indicates that the proposal failed and was not enacted Failed // Invalid indicates that proposal passed but an error occurred when attempting to enact it Invalid )
func MatchMarshaledOutcome ¶ added in v0.15.0
func MatchMarshaledOutcome(value []byte, cdc *codec.Codec) (ProposalOutcome, error)
func (ProposalOutcome) Marshal ¶ added in v0.15.0
func (p ProposalOutcome) Marshal(cdc *codec.Codec) ([]byte, error)
func (ProposalOutcome) String ¶ added in v0.15.0
func (p ProposalOutcome) String() string
type ProposalPollingStatus ¶ added in v0.15.0
type ProposalPollingStatus struct { ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"` YesVotes sdk.Dec `json:"yes_votes" yaml:"yes_votes"` CurrentVotes sdk.Dec `json:"current_votes" yaml:"current_votes"` PossibleVotes sdk.Dec `json:"possible_votes" yaml:"possible_votes"` VoteThreshold sdk.Dec `json:"vote_threshold" yaml:"vote_threshold"` Quorum sdk.Dec `json:"quorum" yaml:"quorum"` }
func NewProposalPollingStatus ¶ added in v0.15.0
func NewProposalPollingStatus(proposalID uint64, yesVotes, currentVotes, possibleVotes, voteThreshold, quorum sdk.Dec) ProposalPollingStatus
func (ProposalPollingStatus) String ¶ added in v0.15.0
func (p ProposalPollingStatus) String() string
String implements fmt.Stringer
type PubProposal ¶
PubProposal is the interface that all proposals must fulfill to be submitted to a committee. Proposal types can be created external to this module. For example a ParamChangeProposal, or CommunityPoolSpendProposal. It is pinned to the equivalent type in the gov module to create compatibility between proposal types.
type QueryCommitteeParams ¶
type QueryCommitteeParams struct {
CommitteeID uint64 `json:"committee_id" yaml:"committee_id"`
}
func NewQueryCommitteeParams ¶
func NewQueryCommitteeParams(committeeID uint64) QueryCommitteeParams
type QueryProposalParams ¶
type QueryProposalParams struct {
ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"`
}
func NewQueryProposalParams ¶
func NewQueryProposalParams(proposalID uint64) QueryProposalParams
type QueryRawParamsParams ¶ added in v0.11.0
func NewQueryRawParamsParams ¶ added in v0.11.0
func NewQueryRawParamsParams(subspace, key string) QueryRawParamsParams
type QueryVoteParams ¶
type QueryVoteParams struct { ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"` Voter sdk.AccAddress `json:"voter" yaml:"voter"` }
func NewQueryVoteParams ¶
func NewQueryVoteParams(proposalID uint64, voter sdk.AccAddress) QueryVoteParams
type SimpleParamChangePermission ¶
type SimpleParamChangePermission struct {
AllowedParams AllowedParams `json:"allowed_params" yaml:"allowed_params"`
}
SimpleParamChangePermission only allows changes to certain params
func (SimpleParamChangePermission) Allows ¶
func (perm SimpleParamChangePermission) Allows(_ sdk.Context, _ *codec.Codec, _ ParamKeeper, p PubProposal) bool
Allows implement permission interface
func (SimpleParamChangePermission) MarshalYAML ¶
func (perm SimpleParamChangePermission) MarshalYAML() (interface{}, error)
MarshalYAML implement yaml marshalling
type SoftwareUpgradePermission ¶
type SoftwareUpgradePermission struct{}
SoftwareUpgradePermission permission type for software upgrade proposals
func (SoftwareUpgradePermission) Allows ¶
func (SoftwareUpgradePermission) Allows(_ sdk.Context, _ *codec.Codec, _ ParamKeeper, p PubProposal) bool
Allows implement permission interface
func (SoftwareUpgradePermission) MarshalYAML ¶
func (SoftwareUpgradePermission) MarshalYAML() (interface{}, error)
MarshalYAML implement yaml marshalling
type SubParamChangePermission ¶
type SubParamChangePermission struct { AllowedParams AllowedParams `json:"allowed_params" yaml:"allowed_params"` AllowedCollateralParams AllowedCollateralParams `json:"allowed_collateral_params" yaml:"allowed_collateral_params"` AllowedDebtParam AllowedDebtParam `json:"allowed_debt_param" yaml:"allowed_debt_param"` AllowedAssetParams AllowedAssetParams `json:"allowed_asset_params" yaml:"allowed_asset_params"` AllowedMarkets AllowedMarkets `json:"allowed_markets" yaml:"allowed_markets"` AllowedMoneyMarkets AllowedMoneyMarkets `json:"allowed_money_markets" yaml:"allowed_money_markets"` }
SubParamChangePermission permission type for allowing changes to specific sub-keys within module parameter keys
func (SubParamChangePermission) Allows ¶
func (perm SubParamChangePermission) Allows(ctx sdk.Context, appCdc *codec.Codec, pk ParamKeeper, p PubProposal) bool
Allows implement permission interface
func (SubParamChangePermission) MarshalYAML ¶
func (perm SubParamChangePermission) MarshalYAML() (interface{}, error)
MarshalYAML implement yaml marshalling
type SupplyKeeper ¶ added in v0.15.0
type SupplyKeeper interface {
GetSupply(ctx sdk.Context) (supply supplyexported.SupplyI)
}
SupplyKeeper defines the expected supply keeper (noalias)
type TallyOption ¶ added in v0.15.0
type TallyOption uint64
const ( NullTallyOption TallyOption = iota FirstPastThePost TallyOption = iota // Votes are tallied each block and the proposal passes as soon as the vote threshold is reached Deadline TallyOption = iota // Votes are tallied exactly once, when the deadline time is reached )
func TallyOptionFromString ¶ added in v0.15.0
func TallyOptionFromString(str string) (TallyOption, error)
TallyOptionFromString returns a TallyOption from a string. It returns an error if the string is invalid.
func (TallyOption) Marshal ¶ added in v0.15.0
func (t TallyOption) Marshal() ([]byte, error)
Marshal needed for protobuf compatibility.
func (TallyOption) MarshalJSON ¶ added in v0.15.0
func (t TallyOption) MarshalJSON() ([]byte, error)
Marshals to JSON using string.
func (TallyOption) MarshalYAML ¶ added in v0.15.0
func (t TallyOption) MarshalYAML() ([]byte, error)
Marshals to YAML using string.
func (TallyOption) String ¶ added in v0.15.0
func (t TallyOption) String() string
String implements the Stringer interface.
func (*TallyOption) Unmarshal ¶ added in v0.15.0
func (t *TallyOption) Unmarshal(data []byte) error
Unmarshal needed for protobuf compatibility.
func (*TallyOption) UnmarshalJSON ¶ added in v0.15.0
func (t *TallyOption) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes from JSON assuming Bech32 encoding.
func (*TallyOption) UnmarshalYAML ¶ added in v0.15.0
func (t *TallyOption) UnmarshalYAML(data []byte) error
UnmarshalJSON decodes from YAML assuming Bech32 encoding.
type TextPermission ¶
type TextPermission struct{}
TextPermission allows any text governance proposal.
func (TextPermission) Allows ¶
func (TextPermission) Allows(_ sdk.Context, _ *codec.Codec, _ ParamKeeper, p PubProposal) bool
Allows implement permission interface
func (TextPermission) MarshalYAML ¶
func (TextPermission) MarshalYAML() (interface{}, error)
MarshalYAML implement yaml marshalling
type TokenCommittee ¶ added in v0.15.0
type TokenCommittee struct { BaseCommittee `json:"base_committee" yaml:"base_committee"` Quorum sdk.Dec `json:"quorum" yaml:"quorum"` TallyDenom string `json:"tally_denom" yaml:"tally_denom"` }
TokenCommittee supports voting on proposals by token holders
func NewTokenCommittee ¶ added in v0.15.0
func NewTokenCommittee(id uint64, description string, members []sdk.AccAddress, permissions []Permission, threshold sdk.Dec, duration time.Duration, tallyOption TallyOption, quorum sdk.Dec, tallyDenom string) TokenCommittee
NewTokenCommittee instantiates a new instance of TokenCommittee
func (TokenCommittee) GetQuorum ¶ added in v0.15.0
func (c TokenCommittee) GetQuorum() sdk.Dec
GetQuorum returns the quorum of the committee
func (TokenCommittee) GetTallyDenom ¶ added in v0.15.0
func (c TokenCommittee) GetTallyDenom() string
GetTallyDenom returns the tally denom of the committee
func (TokenCommittee) GetType ¶ added in v0.15.0
func (c TokenCommittee) GetType() string
GetType is a getter for committee type
func (TokenCommittee) SetPermissions ¶ added in v0.15.0
func (c TokenCommittee) SetPermissions(permissions []Permission) Committee
SetPermissions is a setter for committee permissions
func (TokenCommittee) String ¶ added in v0.15.0
func (c TokenCommittee) String() string
String implements fmt.Stringer
func (TokenCommittee) Validate ¶ added in v0.15.0
func (c TokenCommittee) Validate() error
Validate validates the committee's fields
type Vote ¶
type Vote struct { ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"` Voter sdk.AccAddress `json:"voter" yaml:"voter"` VoteType VoteType `json:"vote_type" yaml:"vote_type"` }
type VoteType ¶ added in v0.15.0
type VoteType uint64
func VoteTypeFromString ¶ added in v0.15.0
VoteTypeFromString returns a VoteType from a string. It returns an error if the string is invalid.
func (VoteType) MarshalJSON ¶ added in v0.15.0
Marshals to JSON using string.
func (VoteType) MarshalYAML ¶ added in v0.15.0
Marshals to YAML using string.
func (*VoteType) UnmarshalJSON ¶ added in v0.15.0
UnmarshalJSON decodes from JSON assuming Bech32 encoding.
func (*VoteType) UnmarshalYAML ¶ added in v0.15.0
UnmarshalJSON decodes from YAML assuming Bech32 encoding.