v0_34

package
v1.7.8 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: Apache-2.0, Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

DONTCOVER nolint

Index

Constants

View Source
const (
	ModuleName = "gov"

	StatusNil           ProposalStatus = 0x00
	StatusDepositPeriod ProposalStatus = 0x01
	StatusVotingPeriod  ProposalStatus = 0x02
	StatusPassed        ProposalStatus = 0x03
	StatusRejected      ProposalStatus = 0x04
	StatusFailed        ProposalStatus = 0x05

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

	ProposalTypeNil             ProposalKind = 0x00
	ProposalTypeText            ProposalKind = 0x01
	ProposalTypeParameterChange ProposalKind = 0x02
)

Variables

This section is empty.

Functions

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

Types

type Deposit

type Deposit struct {
	ProposalID uint64         `json:"proposal_id"`
	Depositor  sdk.AccAddress `json:"depositor"`
	Amount     sdk.Coins      `json:"amount"`
}

type DepositParams

type DepositParams struct {
	MinDeposit       sdk.Coins     `json:"min_deposit,omitempty"`
	MaxDepositPeriod time.Duration `json:"max_deposit_period,omitempty"`
}

type DepositWithMetadata

type DepositWithMetadata struct {
	ProposalID uint64  `json:"proposal_id"`
	Deposit    Deposit `json:"deposit"`
}

type Deposits

type Deposits []Deposit

type GenesisState

type GenesisState struct {
	StartingProposalID uint64                `json:"starting_proposal_id"`
	Deposits           []DepositWithMetadata `json:"deposits"`
	Votes              []VoteWithMetadata    `json:"votes"`
	Proposals          []Proposal            `json:"proposals"`
	DepositParams      DepositParams         `json:"deposit_params"`
	VotingParams       VotingParams          `json:"voting_params"`
	TallyParams        TallyParams           `json:"tally_params"`
}

type Proposal

type Proposal struct {
	ProposalContent `json:"proposal_content"`

	ProposalID uint64 `json:"proposal_id"`

	Status           ProposalStatus `json:"proposal_status"`
	FinalTallyResult TallyResult    `json:"final_tally_result"`

	SubmitTime     time.Time `json:"submit_time"`
	DepositEndTime time.Time `json:"deposit_end_time"`
	TotalDeposit   sdk.Coins `json:"total_deposit"`

	VotingStartTime time.Time `json:"voting_start_time"`
	VotingEndTime   time.Time `json:"voting_end_time"`
}

type ProposalContent

type ProposalContent interface {
	GetTitle() string
	GetDescription() string
	ProposalType() ProposalKind
}

type ProposalKind

type ProposalKind byte

func ProposalTypeFromString

func ProposalTypeFromString(str string) (ProposalKind, error)

func (ProposalKind) Marshal

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

func (ProposalKind) MarshalJSON

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

func (ProposalKind) String

func (pt ProposalKind) String() string

func (*ProposalKind) Unmarshal

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

func (*ProposalKind) UnmarshalJSON

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

type ProposalQueue

type ProposalQueue []uint64

type ProposalStatus

type ProposalStatus byte

func ProposalStatusFromString

func ProposalStatusFromString(str string) (ProposalStatus, error)

ProposalStatusToString turns a string into a ProposalStatus

func (ProposalStatus) Marshal

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

func (ProposalStatus) MarshalJSON

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

func (ProposalStatus) String

func (status ProposalStatus) String() string

func (*ProposalStatus) Unmarshal

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

func (*ProposalStatus) UnmarshalJSON

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

type Proposals

type Proposals []Proposal

type TallyParams

type TallyParams struct {
	Quorum    sdk.Dec `json:"quorum,omitempty"`
	Threshold sdk.Dec `json:"threshold,omitempty"`
	Veto      sdk.Dec `json:"veto,omitempty"`
}

type TallyResult

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

type TextProposal

type TextProposal struct {
	Title       string `json:"title"`
	Description string `json:"description"`
}

func (TextProposal) GetDescription

func (tp TextProposal) GetDescription() string

func (TextProposal) GetTitle

func (tp TextProposal) GetTitle() string

func (TextProposal) ProposalType

func (tp TextProposal) ProposalType() ProposalKind

type Vote

type Vote struct {
	ProposalID uint64         `json:"proposal_id"`
	Voter      sdk.AccAddress `json:"voter"`
	Option     VoteOption     `json:"option"`
}

type VoteOption

type VoteOption byte

func VoteOptionFromString

func VoteOptionFromString(str string) (VoteOption, error)

func (VoteOption) Marshal

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

func (VoteOption) MarshalJSON

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

func (VoteOption) String

func (vo VoteOption) String() string

func (*VoteOption) Unmarshal

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

func (*VoteOption) UnmarshalJSON

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

type VoteWithMetadata

type VoteWithMetadata struct {
	ProposalID uint64 `json:"proposal_id"`
	Vote       Vote   `json:"vote"`
}

type Votes

type Votes []Vote

type VotingParams

type VotingParams struct {
	VotingPeriod time.Duration `json:"voting_period,omitempty"`
}

Jump to

Keyboard shortcuts

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