gov

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2019 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Overview

nolint

Index

Constants

View Source
const (
	DefaultCodespace sdk.CodespaceType = "gov"

	CodeUnknownProposal         sdk.CodeType = 1
	CodeInactiveProposal        sdk.CodeType = 2
	CodeAlreadyActiveProposal   sdk.CodeType = 3
	CodeAlreadyFinishedProposal sdk.CodeType = 4
	CodeAddressNotStaked        sdk.CodeType = 5
	CodeInvalidTitle            sdk.CodeType = 6
	CodeInvalidDescription      sdk.CodeType = 7
	CodeInvalidProposalType     sdk.CodeType = 8
	CodeInvalidVote             sdk.CodeType = 9
	CodeInvalidGenesis          sdk.CodeType = 10
	CodeInvalidProposalStatus   sdk.CodeType = 11
	CodeInvalidParam            sdk.CodeType = 12
	CodeInvalidParamOp          sdk.CodeType = 13
	CodeSwitchPeriodInProcess   sdk.CodeType = 14
	CodeInvalidPercent          sdk.CodeType = 15
	CodeInvalidUsageType        sdk.CodeType = 16
	CodeInvalidInput            sdk.CodeType = 17
	CodeInvalidVersion          sdk.CodeType = 18
	CodeInvalidProposal         sdk.CodeType = 19
	CodeNotEnoughInitialDeposit sdk.CodeType = 20
	CodeDepositDeleted          sdk.CodeType = 21
	CodeVoteNotExisted          sdk.CodeType = 22
	CodeDepositNotExisted       sdk.CodeType = 23
	CodeNotInDepositPeriod      sdk.CodeType = 24
	CodeAlreadyVote             sdk.CodeType = 25
	CodeOnlyValidatorVote       sdk.CodeType = 26
	CodeMoreThanMaxProposal     sdk.CodeType = 27
	CodeInvalidUpgradeParams    sdk.CodeType = 28
	CodeEmptyParam              sdk.CodeType = 29
)
View Source
const (
	MetricsSubsystem = "module_gov"
	ValidatorLabel   = "validator_address"
	ProposalIDLabel  = "proposal_id"
	ParamKeyLabel    = "parameter_key"
)
View Source
const (
	CRITICAL_DEPOSIT      = 4000
	IMPORTANT_DEPOSIT     = 2000
	NORMAL_DEPOSIT        = 1000
	CRITICAL              = "Critical"
	IMPORTANT             = "Important"
	NORMAL                = "Normal"
	LOWER_BOUND_AMOUNT    = 10
	UPPER_BOUND_AMOUNT    = 10000
	STABLE_CRITIACAL_NUM  = 1
	DEFAULT_IMPORTANT_NUM = 5
	DEFAULT_NORMAL_NUM    = 2
	MIN_IMPORTANT_NUM     = 1
	MIN_NORMAL_NUM        = 1
)
View Source
const (
	Insert string = "insert"
	Update string = "update"
)
View Source
const (
	QueryProposals = "proposals"
	QueryProposal  = "proposal"
	QueryDeposits  = "deposits"
	QueryDeposit   = "deposit"
	QueryVotes     = "votes"
	QueryVote      = "vote"
	QueryTally     = "tally"
)

query endpoints supported by the governance Querier

View Source
const (
	DefaultParamSpace = "gov"
)

default paramspace for params keeper

View Source
const MsgRoute = "gov"

name to idetify transaction types

View Source
const (
	Prefix = "gov/"
)
View Source
const StartingProposalID = 1

Variables

View Source
var (
	DepositedCoinsAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("govDepositedCoins")))
	BurnRate              = sdk.NewDecWithPrec(2, 1)
	MinDepositRate        = sdk.NewDecWithPrec(3, 1)
)

nolint

View Source
var (
	KeyDelimiter = []byte(":")

	KeyNextProposalID           = []byte("newProposalID")
	PrefixActiveProposalQueue   = []byte("activeProposalQueue")
	PrefixInactiveProposalQueue = []byte("inactiveProposalQueue")
)

Key for getting a the next available proposalID from the store

View Source
var (
	KeySystemHaltHeight     = []byte("SystemHaltHeight")
	KeyCriticalProposal     = []byte("CriticalProposal")
	KeyImportantProposalNum = []byte("ImportantProposalNum")
	KeyNormalProposalNum    = []byte("NormalProposalNum")
	PrefixValidatorSet      = []byte("vs")
)

Key for getting a the next available proposalID from the store

View Source
var (
	KeyCriticalDepositPeriod = []byte(CRITICAL + "DepositPeriod")
	KeyCriticalMinDeposit    = []byte(CRITICAL + "MinDeposit")
	KeyCriticalVotingPeriod  = []byte(CRITICAL + "VotingPeriod")
	KeyCriticalMaxNum        = []byte(CRITICAL + "MaxNum")
	KeyCriticalThreshold     = []byte(CRITICAL + "Threshold")
	KeyCriticalVeto          = []byte(CRITICAL + "Veto")
	KeyCriticalParticipation = []byte(CRITICAL + "Participation")
	KeyCriticalPenalty       = []byte(CRITICAL + "Penalty")

	KeyImportantDepositPeriod = []byte(IMPORTANT + "DepositPeriod")
	KeyImportantMinDeposit    = []byte(IMPORTANT + "MinDeposit")
	KeyImportantVotingPeriod  = []byte(IMPORTANT + "VotingPeriod")
	KeyImportantMaxNum        = []byte(IMPORTANT + "MaxNum")
	KeyImportantThreshold     = []byte(IMPORTANT + "Threshold")
	KeyImportantVeto          = []byte(IMPORTANT + "Veto")
	KeyImportantParticipation = []byte(IMPORTANT + "Participation")
	KeyImportantPenalty       = []byte(IMPORTANT + "Penalty")

	KeyNormalDepositPeriod = []byte(NORMAL + "DepositPeriod")
	KeyNormalMinDeposit    = []byte(NORMAL + "MinDeposit")
	KeyNormalVotingPeriod  = []byte(NORMAL + "VotingPeriod")
	KeyNormalMaxNum        = []byte(NORMAL + "MaxNum")
	KeyNormalThreshold     = []byte(NORMAL + "Threshold")
	KeyNormalVeto          = []byte(NORMAL + "Veto")
	KeyNormalParticipation = []byte(NORMAL + "Participation")
	KeyNormalPenalty       = []byte(NORMAL + "Penalty")

	KeySystemHaltPeriod = []byte("SystemHaltPeriod")
)

Parameter store key

Functions

func AllInvariants added in v0.11.0

func AllInvariants() sdk.Invariant

AllInvariants tests all governance invariants

func EndBlocker

func EndBlocker(ctx sdk.Context, keeper Keeper) (resTags sdk.Tags)

Called every block, process inflation, update validator set

func ErrAddressNotStaked

func ErrAddressNotStaked(codespace sdk.CodespaceType, address sdk.AccAddress) sdk.Error

func ErrAlreadyActiveProposal

func ErrAlreadyActiveProposal(codespace sdk.CodespaceType, proposalID uint64) sdk.Error

func ErrAlreadyFinishedProposal

func ErrAlreadyFinishedProposal(codespace sdk.CodespaceType, proposalID uint64) sdk.Error

func ErrAlreadyVote added in v0.10.0

func ErrAlreadyVote(codespace sdk.CodespaceType, address sdk.AccAddress, proposalID uint64) sdk.Error

func ErrCodeDepositDeleted added in v0.10.0

func ErrCodeDepositDeleted(codespace sdk.CodespaceType, proposalID uint64) sdk.Error

func ErrCodeDepositNotExisted added in v0.10.0

func ErrCodeDepositNotExisted(codespace sdk.CodespaceType, address sdk.AccAddress, proposalID uint64) sdk.Error

func ErrCodeInvalidSwitchHeight added in v0.10.0

func ErrCodeInvalidSwitchHeight(codespace sdk.CodespaceType, blockHeight uint64, switchHeight uint64) sdk.Error

func ErrCodeInvalidVersion added in v0.10.0

func ErrCodeInvalidVersion(codespace sdk.CodespaceType, version uint64) sdk.Error

func ErrCodeVoteNotExisted added in v0.10.0

func ErrCodeVoteNotExisted(codespace sdk.CodespaceType, address sdk.AccAddress, proposalID uint64) sdk.Error

func ErrEmptyParam added in v0.10.0

func ErrEmptyParam(codespace sdk.CodespaceType) sdk.Error

func ErrInactiveProposal

func ErrInactiveProposal(codespace sdk.CodespaceType, proposalID uint64) sdk.Error

func ErrInvalidDescription

func ErrInvalidDescription(codespace sdk.CodespaceType, description string) sdk.Error

func ErrInvalidGenesis

func ErrInvalidGenesis(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrInvalidParam

func ErrInvalidParam(codespace sdk.CodespaceType, str string) sdk.Error

func ErrInvalidParamOp

func ErrInvalidParamOp(codespace sdk.CodespaceType, opStr string) sdk.Error

func ErrInvalidPercent added in v0.10.0

func ErrInvalidPercent(codespace sdk.CodespaceType, percent sdk.Dec) sdk.Error

func ErrInvalidProposalType

func ErrInvalidProposalType(codespace sdk.CodespaceType, proposalType ProposalKind) sdk.Error

func ErrInvalidTitle

func ErrInvalidTitle(codespace sdk.CodespaceType, title string) sdk.Error

func ErrInvalidUpgradeThreshold added in v0.11.0

func ErrInvalidUpgradeThreshold(codespace sdk.CodespaceType, Threshold sdk.Dec) sdk.Error

func ErrInvalidUsageType added in v0.10.0

func ErrInvalidUsageType(codespace sdk.CodespaceType, usageType UsageType) sdk.Error

func ErrInvalidVote

func ErrInvalidVote(codespace sdk.CodespaceType, voteOption VoteOption) sdk.Error

func ErrMoreThanMaxProposal added in v0.10.0

func ErrMoreThanMaxProposal(codespace sdk.CodespaceType, num uint64, proposalLevel string) sdk.Error

func ErrNotEnoughInitialDeposit added in v0.11.0

func ErrNotEnoughInitialDeposit(codespace sdk.CodespaceType, initialDeposit sdk.Coins, minDeposit sdk.Coins) sdk.Error

func ErrNotInDepositPeriod added in v0.10.0

func ErrNotInDepositPeriod(codespace sdk.CodespaceType, proposalID uint64) sdk.Error

func ErrNotProfiler added in v0.10.0

func ErrNotProfiler(codespace sdk.CodespaceType, profiler sdk.AccAddress) sdk.Error

func ErrNotTrustee added in v0.10.0

func ErrNotTrustee(codespace sdk.CodespaceType, trustee sdk.AccAddress) sdk.Error

func ErrOnlyValidatorVote added in v0.10.0

func ErrOnlyValidatorVote(codespace sdk.CodespaceType, address sdk.AccAddress) sdk.Error

func ErrSwitchPeriodInProcess added in v0.7.0

func ErrSwitchPeriodInProcess(codespace sdk.CodespaceType) sdk.Error

func ErrUnknownProposal

func ErrUnknownProposal(codespace sdk.CodespaceType, proposalID uint64) sdk.Error

func Execute added in v0.9.0

func Execute(ctx sdk.Context, gk Keeper, p Proposal) (err error)

func InitGenesis

func InitGenesis(ctx sdk.Context, k Keeper, data GenesisState)

InitGenesis - store genesis parameters

func KeyActiveProposalQueueProposal added in v0.7.0

func KeyActiveProposalQueueProposal(endTime time.Time, proposalID uint64) []byte

Returns the key for a proposalID in the activeProposalQueue

func KeyDeposit

func KeyDeposit(proposalID uint64, depositorAddr sdk.AccAddress) []byte

Key for getting a specific deposit from the store

func KeyDepositsSubspace

func KeyDepositsSubspace(proposalID uint64) []byte

Key for getting all deposits on a proposal from the store

func KeyInactiveProposalQueueProposal added in v0.7.0

func KeyInactiveProposalQueueProposal(endTime time.Time, proposalID uint64) []byte

Returns the key for a proposalID in the activeProposalQueue

func KeyProposal

func KeyProposal(proposalID uint64) []byte

Key for getting a specific proposal from the store

func KeyValidatorSet added in v0.10.0

func KeyValidatorSet(proposalID uint64) []byte

func KeyVote

func KeyVote(proposalID uint64, voterAddr sdk.AccAddress) []byte

Key for getting a specific vote from the store

func KeyVotesSubspace

func KeyVotesSubspace(proposalID uint64) []byte

Key for getting all votes on a proposal from the store

func NewHandler

func NewHandler(keeper Keeper) sdk.Handler

Handle all "gov" type messages.

func NewQuerier added in v0.7.0

func NewQuerier(keeper Keeper) sdk.Querier

func ParamTypeTable added in v0.10.0

func ParamTypeTable() params.TypeTable

ParamTable for mint module

func ParameterProposalExecute added in v0.9.0

func ParameterProposalExecute(ctx sdk.Context, gk Keeper, pp *ParameterProposal) (err error)

func PrefixActiveProposalQueueTime added in v0.7.0

func PrefixActiveProposalQueueTime(endTime time.Time) []byte

Returns the key for a proposalID in the activeProposalQueue

func PrefixInactiveProposalQueueTime added in v0.7.0

func PrefixInactiveProposalQueueTime(endTime time.Time) []byte

Returns the key for a proposalID in the activeProposalQueue

func PrepForZeroHeightGenesis added in v0.10.0

func PrepForZeroHeightGenesis(ctx sdk.Context, k Keeper)

func ProposalEqual

func ProposalEqual(proposalA Proposal, proposalB Proposal) bool

checks if two proposals are equal

func RegisterCodec added in v0.7.0

func RegisterCodec(cdc *codec.Codec)

Register concrete types on codec codec

func SetParameterMetrics added in v0.12.0

func SetParameterMetrics(metrics *Metrics, key string, value interface{})

func SoftwareUpgradeProposalExecute added in v0.9.0

func SoftwareUpgradeProposalExecute(ctx sdk.Context, gk Keeper, sp *SoftwareUpgradeProposal) error

func SortAddresses

func SortAddresses(addrs []sdk.AccAddress)

Sorts Addresses

func SortByteArrays

func SortByteArrays(src [][]byte) [][]byte

Public

func SystemHaltProposalExecute added in v0.10.0

func SystemHaltProposalExecute(ctx sdk.Context, gk Keeper) error

func TaxUsageProposalExecute added in v0.9.0

func TaxUsageProposalExecute(ctx sdk.Context, gk Keeper, p *TaxUsageProposal) (err error)

func ValidProposalStatus added in v0.10.0

func ValidProposalStatus(status ProposalStatus) bool

is defined ProposalType?

func ValidProposalType added in v0.10.0

func ValidProposalType(pt ProposalKind) bool

is defined ProposalType?

func ValidUsageType added in v0.10.0

func ValidUsageType(ut UsageType) bool

is defined UsageType?

func ValidVoteOption added in v0.10.0

func ValidVoteOption(option VoteOption) bool

Is defined VoteOption

func ValidateGenesis added in v0.10.0

func ValidateGenesis(data GenesisState) error

Types

type BasicProposal added in v0.11.0

type BasicProposal struct {
	ProposalID   uint64       `json:"proposal_id"`   //  ID of the proposal
	Title        string       `json:"title"`         //  Title of the proposal
	Description  string       `json:"description"`   //  Description of the proposal
	ProposalType ProposalKind `json:"proposal_type"` //  Type of proposal. Initial set {PlainTextProposal, SoftwareUpgradeProposal}

	Status      ProposalStatus `json:"proposal_status"` //  Status of the Proposal {Pending, Active, Passed, Rejected}
	TallyResult TallyResult    `json:"tally_result"`    //  Result of Tallys

	SubmitTime     time.Time `json:"submit_time"`      //  Time of the block where TxGovSubmitProposal was included
	DepositEndTime time.Time `json:"deposit_end_time"` // Time that the Proposal would expire if deposit amount isn't met
	TotalDeposit   sdk.Coins `json:"total_deposit"`    //  Current deposit on this proposal. Initial value is set at InitialDeposit

	VotingStartTime time.Time `json:"voting_start_time"` //  Time of the block where MinDeposit was reached. -1 if MinDeposit is not reached
	VotingEndTime   time.Time `json:"voting_end_time"`   // Time that the VotingPeriod for this proposal will end and votes will be tallied
}

----------------------------------------------------------- Basic Proposals

func (BasicProposal) GetDepositEndTime added in v0.11.0

func (tp BasicProposal) GetDepositEndTime() time.Time

func (BasicProposal) GetDescription added in v0.11.0

func (tp BasicProposal) GetDescription() string

func (BasicProposal) GetProposalID added in v0.11.0

func (tp BasicProposal) GetProposalID() uint64

nolint

func (BasicProposal) GetProposalType added in v0.11.0

func (tp BasicProposal) GetProposalType() ProposalKind

func (BasicProposal) GetProtocolDefinition added in v0.11.0

func (tp BasicProposal) GetProtocolDefinition() sdk.ProtocolDefinition

func (BasicProposal) GetStatus added in v0.11.0

func (tp BasicProposal) GetStatus() ProposalStatus

func (BasicProposal) GetSubmitTime added in v0.11.0

func (tp BasicProposal) GetSubmitTime() time.Time

func (BasicProposal) GetTallyResult added in v0.11.0

func (tp BasicProposal) GetTallyResult() TallyResult

func (BasicProposal) GetTaxUsage added in v0.11.0

func (tp BasicProposal) GetTaxUsage() TaxUsage

func (BasicProposal) GetTitle added in v0.11.0

func (tp BasicProposal) GetTitle() string

func (BasicProposal) GetTotalDeposit added in v0.11.0

func (tp BasicProposal) GetTotalDeposit() sdk.Coins

func (BasicProposal) GetVotingEndTime added in v0.11.0

func (tp BasicProposal) GetVotingEndTime() time.Time

func (BasicProposal) GetVotingStartTime added in v0.11.0

func (tp BasicProposal) GetVotingStartTime() time.Time

func (*BasicProposal) SetDepositEndTime added in v0.11.0

func (tp *BasicProposal) SetDepositEndTime(depositEndTime time.Time)

func (*BasicProposal) SetDescription added in v0.11.0

func (tp *BasicProposal) SetDescription(description string)

func (*BasicProposal) SetProposalID added in v0.11.0

func (tp *BasicProposal) SetProposalID(proposalID uint64)

func (*BasicProposal) SetProposalType added in v0.11.0

func (tp *BasicProposal) SetProposalType(proposalType ProposalKind)

func (*BasicProposal) SetProtocolDefinition added in v0.11.0

func (tp *BasicProposal) SetProtocolDefinition(sdk.ProtocolDefinition)

func (*BasicProposal) SetStatus added in v0.11.0

func (tp *BasicProposal) SetStatus(status ProposalStatus)

func (*BasicProposal) SetSubmitTime added in v0.11.0

func (tp *BasicProposal) SetSubmitTime(submitTime time.Time)

func (*BasicProposal) SetTallyResult added in v0.11.0

func (tp *BasicProposal) SetTallyResult(tallyResult TallyResult)

func (*BasicProposal) SetTaxUsage added in v0.11.0

func (tp *BasicProposal) SetTaxUsage(taxUsage TaxUsage)

func (*BasicProposal) SetTitle added in v0.11.0

func (tp *BasicProposal) SetTitle(title string)

func (*BasicProposal) SetTotalDeposit added in v0.11.0

func (tp *BasicProposal) SetTotalDeposit(totalDeposit sdk.Coins)

func (*BasicProposal) SetVotingEndTime added in v0.11.0

func (tp *BasicProposal) SetVotingEndTime(votingEndTime time.Time)

func (*BasicProposal) SetVotingStartTime added in v0.11.0

func (tp *BasicProposal) SetVotingStartTime(votingStartTime time.Time)

func (BasicProposal) String added in v0.14.0

func (bp BasicProposal) String() string

type Deposit

type Deposit struct {
	Depositor  sdk.AccAddress `json:"depositor"`   //  Address of the depositor
	ProposalID uint64         `json:"proposal_id"` //  proposalID of the proposal
	Amount     sdk.Coins      `json:"amount"`      //  Deposit amount
}

Deposit

func (Deposit) Empty added in v0.7.0

func (depositA Deposit) Empty() bool

Returns whether a deposit is empty

func (Deposit) Equals added in v0.7.0

func (depositA Deposit) Equals(depositB Deposit) bool

Returns whether 2 deposits are equal

func (Deposit) String added in v0.14.0

func (d Deposit) String() string

type DepositProcedure added in v0.10.0

type DepositProcedure struct {
	MinDeposit       sdk.Coins
	MaxDepositPeriod time.Duration
}

type Deposits added in v0.14.0

type Deposits []Deposit

Deposits is a collection of depoist

func (Deposits) String added in v0.14.0

func (d Deposits) String() string

type GenesisState

type GenesisState struct {
	Params GovParams `json:"params"` // inflation params
}

GenesisState - all gov state that must be provided at genesis

func DefaultGenesisState

func DefaultGenesisState() GenesisState

get raw genesis raw message for testing

func DefaultGenesisStateForCliTest

func DefaultGenesisStateForCliTest() GenesisState

get raw genesis raw message for testing

func ExportGenesis added in v0.7.0

func ExportGenesis(ctx sdk.Context, k Keeper) GenesisState

ExportGenesis - output genesis parameters

func NewGenesisState

func NewGenesisState(systemHaltPeriod int64, params GovParams) GenesisState

type GovParams added in v0.10.0

type GovParams struct {
	CriticalDepositPeriod time.Duration `json:"critical_deposit_period"` //  Maximum period for Atom holders to deposit on a proposal. Initial value: 2 months
	CriticalMinDeposit    sdk.Coins     `json:"critical_min_deposit"`    //  Minimum deposit for a critical proposal to enter voting period.
	CriticalVotingPeriod  time.Duration `json:"critical_voting_period"`  //  Length of the critical voting period.
	CriticalMaxNum        uint64        `json:"critical_max_num"`
	CriticalThreshold     sdk.Dec       `json:"critical_threshold"`     //  Minimum propotion of Yes votes for proposal to pass. Initial value: 0.5
	CriticalVeto          sdk.Dec       `json:"critical_veto"`          //  Minimum value of Veto votes to Total votes ratio for proposal to be vetoed. Initial value: 1/3
	CriticalParticipation sdk.Dec       `json:"critical_participation"` //
	CriticalPenalty       sdk.Dec       `json:"critical_penalty"`       //  Penalty if validator does not vote

	ImportantDepositPeriod time.Duration `json:"important_deposit_period"` //  Maximum period for Atom holders to deposit on a proposal. Initial value: 2 months
	ImportantMinDeposit    sdk.Coins     `json:"important_min_deposit"`    //  Minimum deposit for a important proposal to enter voting period.
	ImportantVotingPeriod  time.Duration `json:"important_voting_period"`  //  Length of the important voting period.
	ImportantMaxNum        uint64        `json:"important_max_num"`
	ImportantThreshold     sdk.Dec       `json:"important_threshold"`     //  Minimum propotion of Yes votes for proposal to pass. Initial value: 0.5
	ImportantVeto          sdk.Dec       `json:"important_veto"`          //  Minimum value of Veto votes to Total votes ratio for proposal to be vetoed. Initial value: 1/3
	ImportantParticipation sdk.Dec       `json:"important_participation"` //
	ImportantPenalty       sdk.Dec       `json:"important_penalty"`       //  Penalty if validator does not vote

	NormalDepositPeriod time.Duration `json:"normal_deposit_period"` //  Maximum period for Atom holders to deposit on a proposal. Initial value: 2 months
	NormalMinDeposit    sdk.Coins     `json:"normal_min_deposit"`    //  Minimum deposit for a normal proposal to enter voting period.
	NormalVotingPeriod  time.Duration `json:"normal_voting_period"`  //  Length of the normal voting period.
	NormalMaxNum        uint64        `json:"normal_max_num"`
	NormalThreshold     sdk.Dec       `json:"normal_threshold"`     //  Minimum propotion of Yes votes for proposal to pass. Initial value: 0.5
	NormalVeto          sdk.Dec       `json:"normal_veto"`          //  Minimum value of Veto votes to Total votes ratio for proposal to be vetoed. Initial value: 1/3
	NormalParticipation sdk.Dec       `json:"normal_participation"` //
	NormalPenalty       sdk.Dec       `json:"normal_penalty"`       //  Penalty if validator does not vote

	SystemHaltPeriod int64 `json:"system_halt_period"`
}

mint parameters

func DefaultParams added in v0.10.0

func DefaultParams() GovParams

default minting module parameters

func DefaultParamsForTest added in v0.11.0

func DefaultParamsForTest() GovParams

func (*GovParams) GetParamSpace added in v0.10.0

func (p *GovParams) GetParamSpace() string

Implements params.ParamStruct

func (*GovParams) KeyValuePairs added in v0.10.0

func (p *GovParams) KeyValuePairs() params.KeyValuePairs

func (GovParams) String added in v0.14.0

func (p GovParams) String() string

func (*GovParams) StringFromBytes added in v0.10.0

func (p *GovParams) StringFromBytes(cdc *codec.Codec, key string, bytes []byte) (string, error)

func (*GovParams) Validate added in v0.10.0

func (p *GovParams) Validate(key string, value string) (interface{}, sdk.Error)

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

Governance ProtocolKeeper

func NewKeeper

func NewKeeper(key sdk.StoreKey, cdc *codec.Codec, paramSpace params.Subspace, paramsKeeper params.Keeper, protocolKeeper sdk.ProtocolKeeper, ck bank.Keeper, dk distribution.Keeper, guardianKeeper guardian.Keeper, ds sdk.DelegationSet, codespace sdk.CodespaceType, metrics *Metrics) Keeper

NewProtocolKeeper 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.

func (Keeper) ActiveProposalQueueIterator added in v0.7.0

func (keeper Keeper) ActiveProposalQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator

Returns an iterator for all the proposals in the Active Queue that expire by endTime

func (Keeper) AddCriticalProposalNum added in v0.10.0

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

func (Keeper) AddDeposit

func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress, depositAmount sdk.Coins) (sdk.Error, bool)

Adds or updates a deposit of a specific depositor on a specific proposal Activates voting period when appropriate

func (Keeper) AddImportantProposalNum added in v0.10.0

func (keeper Keeper) AddImportantProposalNum(ctx sdk.Context)

func (Keeper) AddInitialDeposit added in v0.11.0

func (keeper Keeper) AddInitialDeposit(ctx sdk.Context, proposal Proposal, depositorAddr sdk.AccAddress, initialDeposit sdk.Coins) (sdk.Error, bool)

func (Keeper) AddNormalProposalNum added in v0.10.0

func (keeper Keeper) AddNormalProposalNum(ctx sdk.Context)

func (Keeper) AddProposalNum added in v0.10.0

func (keeper Keeper) AddProposalNum(ctx sdk.Context, p Proposal)

func (Keeper) AddVote

func (keeper Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress, option VoteOption) sdk.Error

Adds a vote on a specific proposal

func (Keeper) DeleteDeposits

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

Deletes all the deposits on a specific proposal without refunding them

func (Keeper) DeleteProposal

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

Implements sdk.AccountKeeper.

func (Keeper) DeleteValidatorSet added in v0.10.0

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

func (Keeper) GetCriticalProposalID added in v0.10.0

func (keeper Keeper) GetCriticalProposalID(ctx sdk.Context) (uint64, bool)

func (Keeper) GetCriticalProposalNum added in v0.10.0

func (keeper Keeper) GetCriticalProposalNum(ctx sdk.Context) uint64

func (Keeper) GetDeposit

func (keeper Keeper) GetDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress) (Deposit, bool)

Gets the deposit of a specific depositor on a specific proposal

func (Keeper) GetDepositProcedure added in v0.10.0

func (Keeper Keeper) GetDepositProcedure(ctx sdk.Context, p Proposal) DepositProcedure

Returns the current Deposit Procedure from the global param store

func (Keeper) GetDeposits

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

Gets all the deposits on a specific proposal

func (Keeper) GetImportantProposalNum added in v0.10.0

func (keeper Keeper) GetImportantProposalNum(ctx sdk.Context) uint64

func (Keeper) GetLastProposalID

func (keeper Keeper) GetLastProposalID(ctx sdk.Context) (proposalID uint64)

Get the last used proposal ID

func (Keeper) GetMaxNumByProposalLevel added in v0.10.0

func (Keeper Keeper) GetMaxNumByProposalLevel(ctx sdk.Context, pl ProposalLevel) uint64

func (Keeper) GetNormalProposalNum added in v0.10.0

func (keeper Keeper) GetNormalProposalNum(ctx sdk.Context) uint64

func (Keeper) GetParamSet added in v0.10.0

func (k Keeper) GetParamSet(ctx sdk.Context) GovParams

get inflation params from the global param store

func (Keeper) GetProposal

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

Get Proposal from store by ProposalID

func (Keeper) GetProposalsFiltered added in v0.7.0

func (keeper Keeper) GetProposalsFiltered(ctx sdk.Context, voterAddr sdk.AccAddress, depositorAddr sdk.AccAddress, status ProposalStatus, numLatest uint64) []Proposal

Get Proposal from store by ProposalID

func (Keeper) GetSystemHaltHeight added in v0.10.0

func (keeper Keeper) GetSystemHaltHeight(ctx sdk.Context) int64

func (Keeper) GetSystemHaltPeriod added in v0.10.0

func (keeper Keeper) GetSystemHaltPeriod(ctx sdk.Context) (SystemHaltPeriod int64)

func (Keeper) GetTallyingProcedure added in v0.10.0

func (Keeper Keeper) GetTallyingProcedure(ctx sdk.Context, p Proposal) TallyingProcedure

Returns the current Tallying Procedure from the global param store

func (Keeper) GetValidatorSet added in v0.10.0

func (keeper Keeper) GetValidatorSet(ctx sdk.Context, proposalID uint64) []sdk.ValAddress

func (Keeper) GetVote

func (keeper Keeper) GetVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress) (Vote, bool)

Gets the vote of a specific voter on a specific proposal

func (Keeper) GetVotes

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

Gets all the votes on a specific proposal

func (Keeper) GetVotingProcedure added in v0.10.0

func (Keeper Keeper) GetVotingProcedure(ctx sdk.Context, p Proposal) VotingProcedure

Returns the current Voting Procedure from the global param store

func (Keeper) HasReachedTheMaxProposalNum added in v0.10.0

func (keeper Keeper) HasReachedTheMaxProposalNum(ctx sdk.Context, pl ProposalLevel) (uint64, bool)

func (Keeper) InactiveProposalQueueIterator added in v0.7.0

func (keeper Keeper) InactiveProposalQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator

Returns an iterator for all the proposals in the Inactive Queue that expire by endTime

func (Keeper) InsertActiveProposalQueue added in v0.7.0

func (keeper Keeper) InsertActiveProposalQueue(ctx sdk.Context, endTime time.Time, proposalID uint64)

Inserts a ProposalID into the active proposal queue at endTime

func (Keeper) InsertInactiveProposalQueue added in v0.7.0

func (keeper Keeper) InsertInactiveProposalQueue(ctx sdk.Context, endTime time.Time, proposalID uint64)

Inserts a ProposalID into the inactive proposal queue at endTime

func (Keeper) NewParametersProposal

func (keeper Keeper) NewParametersProposal(ctx sdk.Context, title string, description string, proposalType ProposalKind, params Params) Proposal

func (Keeper) NewProposal

func (keeper Keeper) NewProposal(ctx sdk.Context, title string, description string, proposalType ProposalKind, param Params) Proposal

func (Keeper) NewSoftwareUpgradeProposal added in v0.9.0

func (keeper Keeper) NewSoftwareUpgradeProposal(ctx sdk.Context, msg MsgSubmitSoftwareUpgradeProposal) Proposal

func (Keeper) NewSystemHaltProposal added in v0.10.0

func (keeper Keeper) NewSystemHaltProposal(ctx sdk.Context, title string, description string, proposalType ProposalKind) Proposal

func (Keeper) NewUsageProposal added in v0.9.0

func (keeper Keeper) NewUsageProposal(ctx sdk.Context, msg MsgSubmitTxTaxUsageProposal) Proposal

func (Keeper) RefundDeposits

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

Returns and deletes all the deposits on a specific proposal

func (Keeper) RemoveFromActiveProposalQueue added in v0.7.0

func (keeper Keeper) RemoveFromActiveProposalQueue(ctx sdk.Context, endTime time.Time, proposalID uint64)

removes a proposalID from the Active Proposal Queue

func (Keeper) RemoveFromInactiveProposalQueue added in v0.7.0

func (keeper Keeper) RemoveFromInactiveProposalQueue(ctx sdk.Context, endTime time.Time, proposalID uint64)

removes a proposalID from the Inactive Proposal Queue

func (Keeper) SetCriticalProposalID added in v0.10.0

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

func (Keeper) SetImportantProposalNum added in v0.10.0

func (keeper Keeper) SetImportantProposalNum(ctx sdk.Context, num uint64)

func (Keeper) SetNormalProposalNum added in v0.10.0

func (keeper Keeper) SetNormalProposalNum(ctx sdk.Context, num uint64)

func (Keeper) SetParamSet added in v0.10.0

func (k Keeper) SetParamSet(ctx sdk.Context, params GovParams)

set inflation params from the global param store

func (Keeper) SetProposal

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

Implements sdk.AccountKeeper.

func (Keeper) SetSystemHaltHeight added in v0.10.0

func (keeper Keeper) SetSystemHaltHeight(ctx sdk.Context, height int64)

func (Keeper) SetValidatorSet added in v0.10.0

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

func (Keeper) SubCriticalProposalNum added in v0.10.0

func (keeper Keeper) SubCriticalProposalNum(ctx sdk.Context)

func (Keeper) SubImportantProposalNum added in v0.10.0

func (keeper Keeper) SubImportantProposalNum(ctx sdk.Context)

func (Keeper) SubNormalProposalNum added in v0.10.0

func (keeper Keeper) SubNormalProposalNum(ctx sdk.Context)

func (Keeper) SubProposalNum added in v0.10.0

func (keeper Keeper) SubProposalNum(ctx sdk.Context, p Proposal)

type Metrics added in v0.12.0

type Metrics struct {
	ProposalStatus metrics.Gauge // 0:DepositPeriod 1:VotingPeriod 2:Pass 3:Reject 4:Other
	Vote           metrics.Gauge // 0:Yes 1:No 2:NoWithVeto 3:Abstain
	Param          metrics.Gauge
}

func NopMetrics added in v0.12.0

func NopMetrics() *Metrics

func PrometheusMetrics added in v0.12.0

func PrometheusMetrics(config *cfg.InstrumentationConfig) *Metrics

PrometheusMetrics returns Metrics build using Prometheus client library.

type MsgDeposit

type MsgDeposit struct {
	ProposalID uint64         `json:"proposal_id"` // ID of the proposal
	Depositor  sdk.AccAddress `json:"depositor"`   // Address of the depositor
	Amount     sdk.Coins      `json:"amount"`      // Coins to add to the proposal's deposit
}

----------------------------------------------------------- MsgDeposit

func NewMsgDeposit

func NewMsgDeposit(depositor sdk.AccAddress, proposalID uint64, amount sdk.Coins) MsgDeposit

func (MsgDeposit) Get

func (msg MsgDeposit) Get(key interface{}) (value interface{})

Implements Msg.

func (MsgDeposit) GetSignBytes

func (msg MsgDeposit) GetSignBytes() []byte

Implements Msg.

func (MsgDeposit) GetSigners

func (msg MsgDeposit) GetSigners() []sdk.AccAddress

Implements Msg.

func (MsgDeposit) Route added in v0.7.0

func (msg MsgDeposit) Route() string

Implements Msg. nolint

func (MsgDeposit) String

func (msg MsgDeposit) String() string

func (MsgDeposit) Type

func (msg MsgDeposit) Type() string

func (MsgDeposit) ValidateBasic

func (msg MsgDeposit) ValidateBasic() sdk.Error

Implements Msg.

type MsgSubmitProposal

type MsgSubmitProposal struct {
	Title          string         `json:"title"`           //  Title of the proposal
	Description    string         `json:"description"`     //  Description of the proposal
	ProposalType   ProposalKind   `json:"proposal_type"`   //  Type of proposal. Initial set {PlainTextProposal, SoftwareUpgradeProposal}
	Proposer       sdk.AccAddress `json:"proposer"`        //  Address of the proposer
	InitialDeposit sdk.Coins      `json:"initial_deposit"` //  Initial deposit paid by sender. Must be strictly positive.
	Params         Params         `json:"params"`
}

----------------------------------------------------------- MsgSubmitProposal

func NewMsgSubmitProposal

func NewMsgSubmitProposal(title string, description string, proposalType ProposalKind, proposer sdk.AccAddress, initialDeposit sdk.Coins, params Params) MsgSubmitProposal

func (MsgSubmitProposal) EnsureLength added in v0.11.0

func (msg MsgSubmitProposal) EnsureLength() sdk.Error

func (MsgSubmitProposal) Get

func (msg MsgSubmitProposal) Get(key interface{}) (value interface{})

Implements Msg.

func (MsgSubmitProposal) GetSignBytes

func (msg MsgSubmitProposal) GetSignBytes() []byte

Implements Msg.

func (MsgSubmitProposal) GetSigners

func (msg MsgSubmitProposal) GetSigners() []sdk.AccAddress

Implements Msg.

func (MsgSubmitProposal) Route added in v0.7.0

func (msg MsgSubmitProposal) Route() string

nolint

func (MsgSubmitProposal) String

func (msg MsgSubmitProposal) String() string

func (MsgSubmitProposal) Type

func (msg MsgSubmitProposal) Type() string

func (MsgSubmitProposal) ValidateBasic

func (msg MsgSubmitProposal) ValidateBasic() sdk.Error

Implements Msg.

type MsgSubmitSoftwareUpgradeProposal added in v0.9.0

type MsgSubmitSoftwareUpgradeProposal struct {
	MsgSubmitProposal
	Version      uint64  `json:"version"`
	Software     string  `json:"software"`
	SwitchHeight uint64  `json:"switch_height"`
	Threshold    sdk.Dec `json:"threshold"`
}

func NewMsgSubmitSoftwareUpgradeProposal added in v0.9.0

func NewMsgSubmitSoftwareUpgradeProposal(msgSubmitProposal MsgSubmitProposal, version uint64, software string, switchHeight uint64, threshold sdk.Dec) MsgSubmitSoftwareUpgradeProposal

func (MsgSubmitSoftwareUpgradeProposal) GetSignBytes added in v0.9.0

func (msg MsgSubmitSoftwareUpgradeProposal) GetSignBytes() []byte

func (MsgSubmitSoftwareUpgradeProposal) ValidateBasic added in v0.9.0

func (msg MsgSubmitSoftwareUpgradeProposal) ValidateBasic() sdk.Error

type MsgSubmitTxTaxUsageProposal added in v0.9.0

type MsgSubmitTxTaxUsageProposal struct {
	MsgSubmitProposal
	Usage       UsageType      `json:"usage"`
	DestAddress sdk.AccAddress `json:"dest_address"`
	Percent     sdk.Dec        `json:"percent"`
}

func NewMsgSubmitTaxUsageProposal added in v0.9.0

func NewMsgSubmitTaxUsageProposal(msgSubmitProposal MsgSubmitProposal, usage UsageType, destAddress sdk.AccAddress, percent sdk.Dec) MsgSubmitTxTaxUsageProposal

func (MsgSubmitTxTaxUsageProposal) GetSignBytes added in v0.9.0

func (msg MsgSubmitTxTaxUsageProposal) GetSignBytes() []byte

func (MsgSubmitTxTaxUsageProposal) ValidateBasic added in v0.9.0

func (msg MsgSubmitTxTaxUsageProposal) ValidateBasic() sdk.Error

type MsgVote

type MsgVote struct {
	ProposalID uint64         `json:"proposal_id"` // ID of the proposal
	Voter      sdk.AccAddress `json:"voter"`       //  address of the voter
	Option     VoteOption     `json:"option"`      //  option from OptionSet chosen by the voter
}

----------------------------------------------------------- MsgVote

func NewMsgVote

func NewMsgVote(voter sdk.AccAddress, proposalID uint64, option VoteOption) MsgVote

func (MsgVote) Get

func (msg MsgVote) Get(key interface{}) (value interface{})

Implements Msg.

func (MsgVote) GetSignBytes

func (msg MsgVote) GetSignBytes() []byte

Implements Msg.

func (MsgVote) GetSigners

func (msg MsgVote) GetSigners() []sdk.AccAddress

Implements Msg.

func (MsgVote) Route added in v0.7.0

func (msg MsgVote) Route() string

Implements Msg. nolint

func (MsgVote) String

func (msg MsgVote) String() string

func (MsgVote) Type

func (msg MsgVote) Type() string

func (MsgVote) ValidateBasic

func (msg MsgVote) ValidateBasic() sdk.Error

Implements Msg.

type Param

type Param struct {
	Subspace string `json:"subspace"`
	Key      string `json:"key"`
	Value    string `json:"value"`
}

type ParameterProposal

type ParameterProposal struct {
	BasicProposal
	Params Params `json:"params"`
}

type Params added in v0.10.0

type Params []Param

type Proposal

type Proposal interface {
	GetProposalID() uint64
	SetProposalID(uint64)

	GetTitle() string
	SetTitle(string)

	GetDescription() string
	SetDescription(string)

	GetProposalType() ProposalKind
	SetProposalType(ProposalKind)

	GetStatus() ProposalStatus
	SetStatus(ProposalStatus)

	GetTallyResult() TallyResult
	SetTallyResult(TallyResult)

	GetSubmitTime() time.Time
	SetSubmitTime(time.Time)

	GetDepositEndTime() time.Time
	SetDepositEndTime(time.Time)

	GetTotalDeposit() sdk.Coins
	SetTotalDeposit(sdk.Coins)

	GetVotingStartTime() time.Time
	SetVotingStartTime(time.Time)

	GetVotingEndTime() time.Time
	SetVotingEndTime(time.Time)

	GetProtocolDefinition() sdk.ProtocolDefinition
	SetProtocolDefinition(sdk.ProtocolDefinition)

	GetTaxUsage() TaxUsage
	SetTaxUsage(TaxUsage)

	String() string
}

----------------------------------------------------------- Proposal interface

type ProposalKind

type ProposalKind byte

Type that represents Proposal Type as a byte

const (
	ProposalTypeNil             ProposalKind = 0x00
	ProposalTypeParameterChange ProposalKind = 0x01
	ProposalTypeSoftwareUpgrade ProposalKind = 0x02
	ProposalTypeSystemHalt      ProposalKind = 0x03
	ProposalTypeTxTaxUsage      ProposalKind = 0x04
)

nolint

func ProposalTypeFromString

func ProposalTypeFromString(str string) (ProposalKind, error)

String to proposalType byte. Returns ff if invalid.

func (ProposalKind) Format

func (pt ProposalKind) Format(s fmt.State, verb rune)

For Printf / Sprintf, returns bech32 when using %s nolint: errcheck

func (ProposalKind) Marshal

func (pt ProposalKind) Marshal() ([]byte, error)

Marshal needed for protobuf compatibility

func (ProposalKind) MarshalJSON

func (pt ProposalKind) MarshalJSON() ([]byte, error)

Marshals to JSON using string

func (ProposalKind) String

func (pt ProposalKind) String() string

Turns VoteOption byte to String

func (*ProposalKind) Unmarshal

func (pt *ProposalKind) Unmarshal(data []byte) error

Unmarshal needed for protobuf compatibility

func (*ProposalKind) UnmarshalJSON

func (pt *ProposalKind) UnmarshalJSON(data []byte) error

Unmarshals from JSON assuming Bech32 encoding

type ProposalLevel added in v0.10.0

type ProposalLevel byte

Type that represents Proposal Level as a byte

const (
	ProposalLevelNil       ProposalLevel = 0x00
	ProposalLevelCritical  ProposalLevel = 0x01
	ProposalLevelImportant ProposalLevel = 0x02
	ProposalLevelNormal    ProposalLevel = 0x03
)

nolint

func GetProposalLevel added in v0.10.0

func GetProposalLevel(p Proposal) ProposalLevel

func GetProposalLevelByProposalKind added in v0.10.0

func GetProposalLevelByProposalKind(p ProposalKind) ProposalLevel

type ProposalQueue

type ProposalQueue []uint64

----------------------------------------------------------- ProposalQueue

type ProposalResult added in v0.10.0

type ProposalResult string
const (
	PASS       ProposalResult = "pass"
	REJECT     ProposalResult = "reject"
	REJECTVETO ProposalResult = "reject-veto"
)

type ProposalStatus

type ProposalStatus byte

Type that represents Proposal Status as a byte

const (
	StatusNil           ProposalStatus = 0x00
	StatusDepositPeriod ProposalStatus = 0x01
	StatusVotingPeriod  ProposalStatus = 0x02
	StatusPassed        ProposalStatus = 0x03
	StatusRejected      ProposalStatus = 0x04
)

nolint

func ProposalStatusFromString

func ProposalStatusFromString(str string) (ProposalStatus, error)

ProposalStatusToString turns a string into a ProposalStatus

func (ProposalStatus) Format

func (status ProposalStatus) Format(s fmt.State, verb rune)

For Printf / Sprintf, returns bech32 when using %s nolint: errcheck

func (ProposalStatus) Marshal

func (status ProposalStatus) Marshal() ([]byte, error)

Marshal needed for protobuf compatibility

func (ProposalStatus) MarshalJSON

func (status ProposalStatus) MarshalJSON() ([]byte, error)

Marshals to JSON using string

func (ProposalStatus) String

func (status ProposalStatus) String() string

Turns VoteStatus byte to String

func (*ProposalStatus) Unmarshal

func (status *ProposalStatus) Unmarshal(data []byte) error

Unmarshal needed for protobuf compatibility

func (*ProposalStatus) UnmarshalJSON

func (status *ProposalStatus) UnmarshalJSON(data []byte) error

Unmarshals from JSON assuming Bech32 encoding

type Proposals added in v0.14.0

type Proposals []Proposal

Proposals is an array of proposal

func (Proposals) String added in v0.14.0

func (p Proposals) String() string

nolint

type QueryDepositParams added in v0.7.0

type QueryDepositParams struct {
	ProposalID uint64
	Depositor  sdk.AccAddress
}

Params for query 'custom/gov/deposit'

type QueryDepositsParams added in v0.7.0

type QueryDepositsParams struct {
	ProposalID uint64
}

Params for query 'custom/gov/deposits'

type QueryProposalParams added in v0.7.0

type QueryProposalParams struct {
	ProposalID uint64
}

Params for query 'custom/gov/proposal'

type QueryProposalsParams added in v0.7.0

type QueryProposalsParams struct {
	Voter          sdk.AccAddress
	Depositor      sdk.AccAddress
	ProposalStatus ProposalStatus
	Limit          uint64
}

Params for query 'custom/gov/proposals'

type QueryTallyParams added in v0.7.0

type QueryTallyParams struct {
	ProposalID uint64
}

Params for query 'custom/gov/tally'

type QueryVoteParams added in v0.7.0

type QueryVoteParams struct {
	ProposalID uint64
	Voter      sdk.AccAddress
}

Params for query 'custom/gov/vote'

type QueryVotesParams added in v0.7.0

type QueryVotesParams struct {
	ProposalID uint64
}

Params for query 'custom/gov/votes'

type SoftwareUpgradeProposal

type SoftwareUpgradeProposal struct {
	BasicProposal
	ProtocolDefinition sdk.ProtocolDefinition `json:"protocol_definition"`
}

func (SoftwareUpgradeProposal) GetProtocolDefinition added in v0.10.0

func (sp SoftwareUpgradeProposal) GetProtocolDefinition() sdk.ProtocolDefinition

func (*SoftwareUpgradeProposal) SetProtocolDefinition added in v0.10.0

func (sp *SoftwareUpgradeProposal) SetProtocolDefinition(upgrade sdk.ProtocolDefinition)

type SystemHaltProposal added in v0.10.0

type SystemHaltProposal struct {
	BasicProposal
}

type TallyResult

type TallyResult struct {
	Yes        sdk.Dec `json:"yes"`
	Abstain    sdk.Dec `json:"abstain"`
	No         sdk.Dec `json:"no"`
	NoWithVeto sdk.Dec `json:"no_with_veto"`
}

----------------------------------------------------------- Tally Results

func EmptyTallyResult

func EmptyTallyResult() TallyResult

checks if two proposals are equal

func (TallyResult) Equals

func (resultA TallyResult) Equals(resultB TallyResult) bool

checks if two proposals are equal

func (TallyResult) String added in v0.14.0

func (tr TallyResult) String() string

type TallyingProcedure added in v0.10.0

type TallyingProcedure struct {
	Threshold     sdk.Dec `json:"threshold"`     //  Minimum propotion of Yes votes for proposal to pass. Initial value: 0.5
	Veto          sdk.Dec `json:"veto"`          //  Minimum value of Veto votes to Total votes ratio for proposal to be vetoed. Initial value: 1/3
	Participation sdk.Dec `json:"participation"` //
	Penalty       sdk.Dec `json:"penalty"`       //  Penalty if validator does not vote
}

type TaxUsage added in v0.10.0

type TaxUsage struct {
	Usage       UsageType      `json:"usage"`
	DestAddress sdk.AccAddress `json:"dest_address"`
	Percent     sdk.Dec        `json:"percent"`
}

type TaxUsageProposal added in v0.10.0

type TaxUsageProposal struct {
	BasicProposal
	TaxUsage TaxUsage `json:"tax_usage"`
}

func (TaxUsageProposal) GetTaxUsage added in v0.10.0

func (tp TaxUsageProposal) GetTaxUsage() TaxUsage

func (*TaxUsageProposal) SetTaxUsage added in v0.10.0

func (tp *TaxUsageProposal) SetTaxUsage(taxUsage TaxUsage)

type UsageType added in v0.10.0

type UsageType byte
const (
	UsageTypeBurn       UsageType = 0x01
	UsageTypeDistribute UsageType = 0x02
	UsageTypeGrant      UsageType = 0x03
)

func UsageTypeFromString added in v0.10.0

func UsageTypeFromString(str string) (UsageType, error)

String to UsageType byte. Returns ff if invalid.

func (UsageType) Format added in v0.10.0

func (ut UsageType) Format(s fmt.State, verb rune)

For Printf / Sprintf, returns bech32 when using %s nolint: errcheck

func (UsageType) Marshal added in v0.10.0

func (ut UsageType) Marshal() ([]byte, error)

Marshal needed for protobuf compatibility

func (UsageType) MarshalJSON added in v0.10.0

func (ut UsageType) MarshalJSON() ([]byte, error)

Marshals to JSON using string

func (UsageType) String added in v0.10.0

func (ut UsageType) String() string

Turns VoteOption byte to String

func (*UsageType) Unmarshal added in v0.10.0

func (ut *UsageType) Unmarshal(data []byte) error

Unmarshal needed for protobuf compatibility

func (*UsageType) UnmarshalJSON added in v0.10.0

func (ut *UsageType) UnmarshalJSON(data []byte) error

Unmarshals from JSON assuming Bech32 encoding

type Vote

type Vote struct {
	Voter      sdk.AccAddress `json:"voter"`       //  address of the voter
	ProposalID uint64         `json:"proposal_id"` //  proposalID of the proposal
	Option     VoteOption     `json:"option"`      //  option from OptionSet chosen by the voter
}

Vote

func (Vote) Empty added in v0.7.0

func (voteA Vote) Empty() bool

Returns whether a vote is empty

func (Vote) Equals added in v0.7.0

func (voteA Vote) Equals(voteB Vote) bool

Returns whether 2 votes are equal

func (Vote) String added in v0.14.0

func (v Vote) String() string

type VoteOption

type VoteOption byte

Type that represents VoteOption as a byte

const (
	OptionEmpty      VoteOption = 0x00
	OptionYes        VoteOption = 0x01
	OptionAbstain    VoteOption = 0x02
	OptionNo         VoteOption = 0x03
	OptionNoWithVeto VoteOption = 0x04
)

nolint

func VoteOptionFromString

func VoteOptionFromString(str string) (VoteOption, error)

String to proposalType byte. Returns ff if invalid.

func (VoteOption) Format

func (vo VoteOption) Format(s fmt.State, verb rune)

For Printf / Sprintf, returns bech32 when using %s nolint: errcheck

func (VoteOption) Marshal

func (vo VoteOption) Marshal() ([]byte, error)

Marshal needed for protobuf compatibility

func (VoteOption) MarshalJSON

func (vo VoteOption) MarshalJSON() ([]byte, error)

Marshals to JSON using string

func (VoteOption) String

func (vo VoteOption) String() string

Turns VoteOption byte to String

func (*VoteOption) Unmarshal

func (vo *VoteOption) Unmarshal(data []byte) error

Unmarshal needed for protobuf compatibility

func (*VoteOption) UnmarshalJSON

func (vo *VoteOption) UnmarshalJSON(data []byte) error

Unmarshals from JSON assuming Bech32 encoding

type Votes added in v0.14.0

type Votes []Vote

Votes is a collection of Vote

func (Votes) String added in v0.14.0

func (v Votes) String() string

type VotingProcedure added in v0.10.0

type VotingProcedure struct {
	VotingPeriod time.Duration `json:"critical_voting_period"` //  Length of the critical voting period.
}

Directories

Path Synopsis
nolint
nolint

Jump to

Keyboard shortcuts

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