v0_15

package
v0.19.2-testnet Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
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"
)
View Source
const MaxCommitteeDescriptionLength int = 512
View Source
const (
	// ModuleName The name that will be used throughout the module
	ModuleName = "committee"
)

Variables

This section is empty.

Functions

func RegisterLegacyAminoCodec

func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)

Types

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

type AllowedAssetParams

type AllowedAssetParams []AllowedAssetParam

AllowedAssetParams slice of AllowedAssetParam

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

func NewAllowedCollateralParam(
	ctype string, denom, liqRatio, debtLimit,
	stabilityFee, auctionSize, liquidationPenalty,
	prefix, spotMarket, liquidationMarket, conversionFactor, keeperReward, ltvIndexCount bool,
) AllowedCollateralParam

NewAllowedCollateralParam return a new AllowedCollateralParam

type AllowedCollateralParams

type AllowedCollateralParams []AllowedCollateralParam

AllowedCollateralParams slice of AllowedCollateralParam

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)

type AllowedMarkets

type AllowedMarkets []AllowedMarket

AllowedMarkets slice of AllowedMarket

type AllowedMoneyMarket

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

func NewAllowedMoneyMarket(denom string, bl, sm, cf, irm, rf, kr bool) AllowedMoneyMarket

NewAllowedMoneyMarket returns a new AllowedMoneyMarket

type AllowedMoneyMarkets

type AllowedMoneyMarkets []AllowedMoneyMarket

AllowedMoneyMarkets slice of AllowedMoneyMarket

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

type BaseCommittee

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

func (c BaseCommittee) GetDescription() string

GetDescription is a getter for committee description

func (BaseCommittee) GetID

func (c BaseCommittee) GetID() uint64

GetID is a getter for committee ID

func (BaseCommittee) GetMembers

func (c BaseCommittee) GetMembers() []sdk.AccAddress

GetMembers is a getter for committee members

func (BaseCommittee) GetPermissions

func (c BaseCommittee) GetPermissions() []Permission

GetPermissions is a getter for committee permissions

func (BaseCommittee) GetProposalDuration

func (c BaseCommittee) GetProposalDuration() time.Duration

GetProposalDuration is a getter for committee ProposalDuration

func (BaseCommittee) GetTallyOption

func (c BaseCommittee) GetTallyOption() TallyOption

GetTallyOption is a getter for committee TallyOption

func (BaseCommittee) GetType

func (c BaseCommittee) GetType() string

GetType is a getter for committee type

func (BaseCommittee) GetVoteThreshold

func (c BaseCommittee) GetVoteThreshold() sdk.Dec

GetVoteThreshold is a getter for committee VoteThreshold

func (BaseCommittee) HasMember

func (c BaseCommittee) HasMember(addr sdk.AccAddress) bool

HasMember returns if a committee contains a given member address

func (BaseCommittee) SetMembers

func (c BaseCommittee) SetMembers(members []sdk.AccAddress) BaseCommittee

SetMembers is a setter for committee members

func (BaseCommittee) SetPermissions

func (c BaseCommittee) SetPermissions(permissions []Permission) BaseCommittee

SetPermissions is a setter for committee permissions

func (BaseCommittee) SetProposalDuration

func (c BaseCommittee) SetProposalDuration(proposalDuration time.Duration) BaseCommittee

SetProposalDuration is a setter for committee ProposalDuration

func (BaseCommittee) SetVoteThreshold

func (c BaseCommittee) SetVoteThreshold(voteThreshold sdk.Dec) BaseCommittee

SetVoteThreshold is a setter for committee VoteThreshold

func (BaseCommittee) Validate

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

	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.

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.

type Committees

type Committees []Committee

Committees is a slice of committees

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.

type GodPermission

type GodPermission struct{}

GodPermission allows any governance proposal. It is used mainly for testing.

type MemberCommittee

type MemberCommittee struct {
	BaseCommittee `json:"base_committee" yaml:"base_committee"`
}

MemberCommittee is an alias of BaseCommittee

func NewMemberCommittee

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

func (c MemberCommittee) GetType() string

GetType is a getter for committee type

func (MemberCommittee) SetPermissions

func (c MemberCommittee) SetPermissions(permissions []Permission) Committee

SetPermissions is a setter for committee permissions

func (MemberCommittee) Validate

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.

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.

type Permission

type Permission interface{}

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 NewProposal(pubProposal PubProposal, id uint64, committeeID uint64, deadline time.Time) Proposal

func (Proposal) HasExpiredBy

func (p Proposal) HasExpiredBy(time time.Time) bool

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 PubProposal

type PubProposal v036gov.Content

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 SimpleParamChangePermission

type SimpleParamChangePermission struct {
	AllowedParams AllowedParams `json:"allowed_params" yaml:"allowed_params"`
}

SimpleParamChangePermission only allows changes to certain params

type SoftwareUpgradePermission

type SoftwareUpgradePermission struct{}

SoftwareUpgradePermission permission type for software upgrade proposals

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

func (perm SubParamChangePermission) MarshalYAML() (interface{}, error)

MarshalYAML implement yaml marshalling

type TallyOption

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

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

func (t TallyOption) Marshal() ([]byte, error)

Marshal needed for protobuf compatibility.

func (TallyOption) MarshalJSON

func (t TallyOption) MarshalJSON() ([]byte, error)

Marshals to JSON using string.

func (TallyOption) String

func (t TallyOption) String() string

String implements the Stringer interface.

func (*TallyOption) Unmarshal

func (t *TallyOption) Unmarshal(data []byte) error

Unmarshal needed for protobuf compatibility.

func (*TallyOption) UnmarshalJSON

func (t *TallyOption) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes from JSON assuming Bech32 encoding.

type TextPermission

type TextPermission struct{}

TextPermission allows any text governance proposal.

type TokenCommittee

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

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

func (c TokenCommittee) GetQuorum() sdk.Dec

GetQuorum returns the quorum of the committee

func (TokenCommittee) GetTallyDenom

func (c TokenCommittee) GetTallyDenom() string

GetTallyDenom returns the tally denom of the committee

func (TokenCommittee) GetType

func (c TokenCommittee) GetType() string

GetType is a getter for committee type

func (TokenCommittee) SetPermissions

func (c TokenCommittee) SetPermissions(permissions []Permission) Committee

SetPermissions is a setter for committee permissions

func (TokenCommittee) Validate

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"`
}

func NewVote

func NewVote(proposalID uint64, voter sdk.AccAddress, voteType VoteType) Vote

func (Vote) Validate

func (v Vote) Validate() error

type VoteType

type VoteType uint64
const (
	NullVoteType VoteType = iota // 0
	Yes          VoteType = iota // 1
	No           VoteType = iota // 2
	Abstain      VoteType = iota // 3
)

func VoteTypeFromString

func VoteTypeFromString(str string) (VoteType, error)

VoteTypeFromString returns a VoteType from a string. It returns an error if the string is invalid.

func (VoteType) Marshal

func (vt VoteType) Marshal() ([]byte, error)

Marshal needed for protobuf compatibility.

func (VoteType) MarshalJSON

func (vt VoteType) MarshalJSON() ([]byte, error)

Marshals to JSON using string.

func (VoteType) String

func (vt VoteType) String() string

String implements the Stringer interface.

func (*VoteType) Unmarshal

func (vt *VoteType) Unmarshal(data []byte) error

Unmarshal needed for protobuf compatibility.

func (*VoteType) UnmarshalJSON

func (vt *VoteType) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes from JSON assuming Bech32 encoding.

func (VoteType) Validate

func (vt VoteType) Validate() error

Jump to

Keyboard shortcuts

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