types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DefaultCodeSpace btypes.CodespaceType = "gov"

	CodeInvalidInput        btypes.CodeType = 701 // invalid input
	CodeInvalidGenesis      btypes.CodeType = 702 // invalid genesis
	CodeUnknownProposal     btypes.CodeType = 703 // unknown proposal
	CodeInvalidVote         btypes.CodeType = 704 // invalid vote
	CodeWrongProposalStatus btypes.CodeType = 705 // wrong status of proposal
)

Governance errors reserve 700 ~ 799.

View Source
const (
	// Default period for deposits & voting
	DefaultDepositPeriod = 7 * 24 * time.Hour  // 7 days
	DefaultVotingPeriod  = 14 * 24 * time.Hour // 14 days
)

Variables

View Source
var (
	// 事件类型
	EventTypeSubmitProposal   = "submit-proposal"   // 提交提议
	EventTypeDepositProposal  = "deposit-proposal"  // 质押提议
	EventTypeVoteProposal     = "vote-proposal"     // 提议投票
	EventTypeInactiveProposal = "inactive-proposal" // 提议失效
	EventTypeActiveProposal   = "active-proposal"   // 提议结束

	// 事件参数
	AttributeKeyModule             = "gov"                    // 模块名
	AttributeKeyProposer           = "proposer"               // 提议账户
	AttributeKeyProposalID         = "proposal-id"            // 提议ID
	AttributeKeyDepositor          = "depositor"              // 质押账户
	AttributeKeyVoter              = "voter"                  // 投票账户
	AttributeKeyProposalResult     = "proposal-result"        // 提议结果
	AttributeKeyProposalType       = "proposal-type"          // 提议类型
	AttributeKeyDropped            = "proposal-dropped"       // 提议删除
	AttributeKeyResultPassed       = "proposal-passed"        // 提议通过
	AttributeKeyResultRejected     = "proposal-rejected"      // 提议拒绝
	AttributeKeyResultVetoRejected = "proposal-veto-rejected" // 提议拒绝(强烈反对)
)
View Source
var (
	KeyDelimiter = []byte(":")
	// Key for getting a the next available proposalID from the store
	KeyNextProposalID = []byte("newProposalID")
	// Prefix key for voting period proposal
	PrefixActiveProposalQueue = []byte("activeProposalQueue")
	// Prefix key for deposit period proposal
	PrefixInactiveProposalQueue = []byte("inactiveProposalQueue")
	// Key for upgrade flag
	KeySoftUpgradeProposal = []byte("upgradeProposal")
)
View Source
var (
	ParamSpace = "gov"

	KeyNormalMinDeposit             = []byte("normal_min_deposit")
	KeyNormalMinProposerDepositRate = []byte("normal_min_proposer_deposit_rate")
	KeyNormalMaxDepositPeriod       = []byte("normal_max_deposit_period")
	KeyNormalVotingPeriod           = []byte("normal_voting_period")
	KeyNormalQuorum                 = []byte("normal_quorum")
	KeyNormalThreshold              = []byte("normal_threshold")
	KeyNormalVeto                   = []byte("normal_veto")
	KeyNormalPenalty                = []byte("normal_penalty")
	KeyNormalBurnRate               = []byte("normal_burn_rate")

	KeyImportantMinDeposit             = []byte("important_min_deposit")
	KeyImportantMinProposerDepositRate = []byte("important_min_proposer_deposit_rate")
	KeyImportantMaxDepositPeriod       = []byte("important_max_deposit_period")
	KeyImportantVotingPeriod           = []byte("important_voting_period")
	KeyImportantQuorum                 = []byte("important_quorum")
	KeyImportantThreshold              = []byte("important_threshold")
	KeyImportantVeto                   = []byte("important_veto")
	KeyImportantPenalty                = []byte("important_penalty")
	KeyImportantBurnRate               = []byte("important_burn_rate")

	KeyCriticalMinDeposit             = []byte("critical_min_deposit")
	KeyCriticalMinProposerDepositRate = []byte("critical_min_proposer_deposit_rate")
	KeyCriticalMaxDepositPeriod       = []byte("critical_max_deposit_period")
	KeyCriticalVotingPeriod           = []byte("critical_voting_period")
	KeyCriticalQuorum                 = []byte("critical_quorum")
	KeyCriticalThreshold              = []byte("critical_threshold")
	KeyCriticalVeto                   = []byte("critical_veto")
	KeyCriticalPenalty                = []byte("critical_penalty")
	KeyCriticalBurnRate               = []byte("critical_burn_rate")
)

Functions

func ErrFinishedProposal

func ErrFinishedProposal(proposalID int64) btypes.Error

func ErrInvalidGenesis

func ErrInvalidGenesis(msg string) btypes.Error

func ErrInvalidInput

func ErrInvalidInput(msg string) btypes.Error

func ErrUnknownProposal

func ErrUnknownProposal(proposalID int64) btypes.Error

func ErrWrongProposalStatus

func ErrWrongProposalStatus(proposalID int64) btypes.Error

func KeyActiveProposalQueueProposal

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

Returns the key for a proposalID in the activeProposalQueue

func KeyDeposit

func KeyDeposit(proposalID int64, depositorAddr btypes.AccAddress) []byte

Key for getting a specific deposit from the store

func KeyDepositsSubspace

func KeyDepositsSubspace(proposalID int64) []byte

Key for getting all deposits on a proposal from the store

func KeyInactiveProposalQueueProposal

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

Returns the key for a proposalID in the activeProposalQueue

func KeyProposal

func KeyProposal(proposalID int64) []byte

Key for getting a specific proposal from the store

func KeyProposalSubspace

func KeyProposalSubspace() []byte

func KeyVote

func KeyVote(proposalID int64, voterAddr btypes.AccAddress) []byte

Key for getting a specific vote from the store

func KeyVotesSubspace

func KeyVotesSubspace(proposalID int64) []byte

Key for getting all votes on a proposal from the store

func KeyVotingPeriodValidators

func KeyVotingPeriodValidators(proposalID int64) []byte

Key for validators set at entering voting period.

func PrefixActiveProposalQueueTime

func PrefixActiveProposalQueueTime(endTime time.Time) []byte

Returns the key for a proposalID in the activeProposalQueue

func PrefixInactiveProposalQueueTime

func PrefixInactiveProposalQueueTime(endTime time.Time) []byte

Returns the key for a proposalID in the activeProposalQueue

func ValidProposalStatus

func ValidProposalStatus(status ProposalStatus) bool

func ValidProposalType

func ValidProposalType(pt ProposalType) bool

is defined GetProposalType?

func ValidVoteOption

func ValidVoteOption(option VoteOption) bool

Is defined VoteOption

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

ValidateGenesis

Types

type DeductOption

type DeductOption byte

Type that deduct deposits

const (
	DepositDeductNone DeductOption = 0x00 // 全部返还
	DepositDeductPart DeductOption = 0x01 // 按参数BurnRate扣除部分
	DepositDeductAll  DeductOption = 0x02 // 扣除全部
)

nolint

type Deposit

type Deposit struct {
	Depositor  types.AccAddress `json:"depositor"`   //  Address of the depositor
	ProposalID int64            `json:"proposal_id"` //  proposalID of the proposal
	Amount     types.BigInt     `json:"amount"`      //  Deposit amount
}

Deposit

func (Deposit) Equals

func (d Deposit) Equals(comp Deposit) bool

func (Deposit) String

func (d Deposit) String() string

type Deposits

type Deposits []Deposit

func (Deposits) String

func (d Deposits) String() string

type GenesisProposal

type GenesisProposal struct {
	Proposal Proposal  `json:"proposal"` // 提议
	Deposits []Deposit `json:"deposits"` // 质押
	Votes    []Vote    `json:"votes"`    // 投票
}

type GenesisState

type GenesisState struct {
	StartingProposalID int64             `json:"starting_proposal_id"` // 下一个提议ID
	Params             Params            `json:"params"`               // 提议相关参数
	Proposals          []GenesisProposal `json:"proposals"`            // 提议
}

创世状态

func DefaultGenesisState

func DefaultGenesisState() GenesisState

get raw genesis raw message for testing

func NewGenesisState

func NewGenesisState(startingProposalID int64, params Params) GenesisState

type LevelParams added in v0.0.8

type LevelParams struct {
	MinDeposit             btypes.BigInt
	MinProposerDepositRate qtypes.Dec
	MaxDepositPeriod       time.Duration
	VotingPeriod           time.Duration
	Quorum                 qtypes.Dec
	Threshold              qtypes.Dec
	Veto                   qtypes.Dec
	Penalty                qtypes.Dec
	BurnRate               qtypes.Dec
}

Params struct for different level

type ModifyInflationProposal

type ModifyInflationProposal struct {
	TextProposal
	TotalAmount      btypes.BigInt         `json:"total_amount"`
	InflationPhrases mint.InflationPhrases `json:"inflation_phrases"`
}

Modify Inflation Phrases Proposal

func NewAddInflationPhrase

func NewAddInflationPhrase(proposer btypes.AccAddress, title, description string, deposit btypes.BigInt, totalAmount btypes.BigInt, phrases mint.InflationPhrases) ModifyInflationProposal

func (ModifyInflationProposal) GetDeposit

func (tp ModifyInflationProposal) GetDeposit() btypes.BigInt

func (ModifyInflationProposal) GetDescription

func (tp ModifyInflationProposal) GetDescription() string

func (ModifyInflationProposal) GetProposalType

func (tp ModifyInflationProposal) GetProposalType() ProposalType

func (ModifyInflationProposal) GetProposer added in v0.1.0

func (tp ModifyInflationProposal) GetProposer() btypes.AccAddress

func (ModifyInflationProposal) GetTitle

func (tp ModifyInflationProposal) GetTitle() string

nolint

type Param

type Param struct {
	Module string `json:"module"`
	Key    string `json:"key"`
	Value  string `json:"value"`
}

func NewParam

func NewParam(module, key, value string) Param

func (Param) String

func (param Param) String() string

type ParameterProposal

type ParameterProposal struct {
	TextProposal
	Params []Param `json:"params"`
}

Parameters change Proposal

func NewParameterProposal

func NewParameterProposal(proposer btypes.AccAddress, title, description string, deposit btypes.BigInt, params []Param) ParameterProposal

func (ParameterProposal) GetDeposit

func (tp ParameterProposal) GetDeposit() btypes.BigInt

func (ParameterProposal) GetDescription

func (tp ParameterProposal) GetDescription() string

func (ParameterProposal) GetProposalType

func (tp ParameterProposal) GetProposalType() ProposalType

func (ParameterProposal) GetProposer added in v0.1.0

func (tp ParameterProposal) GetProposer() btypes.AccAddress

func (ParameterProposal) GetTitle

func (tp ParameterProposal) GetTitle() string

nolint

type Params

type Params struct {
	// params of normal level
	// DepositParams
	NormalMinDeposit             btypes.BigInt `json:"normal_min_deposit"`               //  Minimum deposit for a proposal to enter voting period.
	NormalMinProposerDepositRate qtypes.Dec    `json:"normal_min_proposer_deposit_rate"` //  Minimum deposit rate for proposer to submit a proposal.
	NormalMaxDepositPeriod       time.Duration `json:"normal_max_deposit_period"`        //  Maximum period for Atom holders to deposit on a proposal.
	// VotingParams
	NormalVotingPeriod time.Duration `json:"normal_voting_period"` //  Length of the voting period.
	// TallyParams
	NormalQuorum    qtypes.Dec `json:"normal_quorum"`    //  Minimum percentage of total stake needed to vote for a result to be considered valid
	NormalThreshold qtypes.Dec `json:"normal_threshold"` //  Minimum propotion of Yes votes for proposal to pass.
	NormalVeto      qtypes.Dec `json:"normal_veto"`      //  Minimum value of Veto votes to Total votes ratio for proposal to be vetoed.
	NormalPenalty   qtypes.Dec `json:"normal_penalty"`   //  Penalty if validator does not vote
	// BurnRate
	NormalBurnRate qtypes.Dec `json:"normal_burn_rate"` // Deposit burning rate when proposals pass or reject.

	// params of important level
	// DepositParams
	ImportantMinDeposit             btypes.BigInt `json:"important_min_deposit"`               //  Minimum deposit for a proposal to enter voting period.
	ImportantMinProposerDepositRate qtypes.Dec    `json:"important_min_proposer_deposit_rate"` //  Minimum deposit rate for proposer to submit a proposal.
	ImportantMaxDepositPeriod       time.Duration `json:"important_max_deposit_period"`        //  Maximum period for Atom holders to deposit on a proposal.
	// VotingParams
	ImportantVotingPeriod time.Duration `json:"important_voting_period"` //  Length of the voting period.
	// TallyParams
	ImportantQuorum    qtypes.Dec `json:"important_quorum"`    //  Minimum percentage of total stake needed to vote for a result to be considered valid
	ImportantThreshold qtypes.Dec `json:"important_threshold"` //  Minimum propotion of Yes votes for proposal to pass.
	ImportantVeto      qtypes.Dec `json:"important_veto"`      //  Minimum value of Veto votes to Total votes ratio for proposal to be vetoed.
	ImportantPenalty   qtypes.Dec `json:"important_penalty"`   //  Penalty if validator does not vote
	// BurnRate
	ImportantBurnRate qtypes.Dec `json:"important_burn_rate"` // Deposit burning rate when proposals pass or reject.

	// params of critical level
	// DepositParams
	CriticalMinDeposit             btypes.BigInt `json:"critical_min_deposit"`               //  Minimum deposit for a proposal to enter voting period.
	CriticalMinProposerDepositRate qtypes.Dec    `json:"critical_min_proposer_deposit_rate"` //  Minimum deposit rate for proposer to submit a proposal.
	CriticalMaxDepositPeriod       time.Duration `json:"critical_max_deposit_period"`        //  Maximum period for Atom holders to deposit on a proposal.
	// VotingParams
	CriticalVotingPeriod time.Duration `json:"critical_voting_period"` //  Length of the voting period.
	// TallyParams
	CriticalQuorum    qtypes.Dec `json:"critical_quorum"`    //  Minimum percentage of total stake needed to vote for a result to be considered valid
	CriticalThreshold qtypes.Dec `json:"critical_threshold"` //  Minimum propotion of Yes votes for proposal to pass.
	CriticalVeto      qtypes.Dec `json:"critical_veto"`      //  Minimum value of Veto votes to Total votes ratio for proposal to be vetoed.
	CriticalPenalty   qtypes.Dec `json:"critical_penalty"`   //  Penalty if validator does not vote
	// BurnRate
	CriticalBurnRate qtypes.Dec `json:"critical_burn_rate"` // Deposit burning rate when proposals pass or reject.
}

Params for governance, there are three levels: normal,important,critical.

func DefaultParams

func DefaultParams() Params

func (*Params) GetLevelParams added in v0.0.8

func (p *Params) GetLevelParams(level ProposalLevel) LevelParams

Return levelParams for the specific level

func (*Params) GetParamSpace

func (p *Params) GetParamSpace() string

Param space, the same as the module name.

func (*Params) KeyValuePairs

func (p *Params) KeyValuePairs() qtypes.KeyValuePairs

func (*Params) SetKeyValue added in v0.0.8

func (p *Params) SetKeyValue(key string, value interface{}) btypes.Error

Set new value

func (*Params) Validate

func (p *Params) Validate() btypes.Error

Validate the params as a whole

func (*Params) ValidateKeyValue added in v0.0.8

func (p *Params) ValidateKeyValue(key string, value string) (interface{}, btypes.Error)

Valid single parameter, return the value

type Proposal

type Proposal struct {
	ProposalContent `json:"proposal_content"` // Proposal content interface

	ProposalID int64 `json:"proposal_id"` //  ID of the proposal

	Status           ProposalStatus `json:"proposal_status"`    //  Status of the Proposal
	FinalTallyResult TallyResult    `json:"final_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   btypes.BigInt `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
	VotingStartHeight int64     `json:"voting_start_height"`
	VotingEndTime     time.Time `json:"voting_end_time"` // Time that the VotingPeriod for this proposal will end and votes will be tallied
}

type ProposalContent

type ProposalContent interface {
	GetTitle() string
	GetDescription() string
	GetDeposit() btypes.BigInt
	GetProposalType() ProposalType
	GetProposalLevel() ProposalLevel
	GetProposer() btypes.AccAddress
}

type ProposalLevel added in v0.0.8

type ProposalLevel string

proposal level

const (
	LevelNormal    ProposalLevel = "normal"
	LevelImportant ProposalLevel = "important"
	LevelCritical  ProposalLevel = "critical"
)

type ProposalResult

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)

String to proposalStatus byte. Returns ff if invalid.

func (ProposalStatus) Marshal

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

Marshal needed for protobuf compatibility

func (ProposalStatus) MarshalJSON

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

Marshals to JSON using string

func (ProposalStatus) String

func (ps ProposalStatus) String() string

Turns VoteOption byte to String

func (*ProposalStatus) Unmarshal

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

Unmarshal needed for protobuf compatibility

func (*ProposalStatus) UnmarshalJSON

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

Unmarshals from JSON assuming Bech32 encoding

type ProposalType

type ProposalType byte

Type that represents Proposal Type as a byte

const (
	ProposalTypeNil             ProposalType = 0x00
	ProposalTypeText            ProposalType = 0x01
	ProposalTypeParameterChange ProposalType = 0x02
	ProposalTypeTaxUsage        ProposalType = 0x03
	ProposalTypeModifyInflation ProposalType = 0x04
	ProposalTypeSoftwareUpgrade ProposalType = 0x05
)

func ProposalTypeFromString

func ProposalTypeFromString(str string) (ProposalType, error)

String to proposalType byte. Returns 0xff if invalid.

func (ProposalType) Level added in v0.0.8

func (pt ProposalType) Level() ProposalLevel

Turns VoteOption byte to String

func (ProposalType) String

func (pt ProposalType) String() string

Turns VoteOption byte to String

type SoftwareUpgradeProposal

type SoftwareUpgradeProposal struct {
	TextProposal
	Version       string `json:"version"`
	DataHeight    int64  `json:"data_height"`
	GenesisFile   string `json:"genesis_file"`
	GenesisMD5    string `json:"genesis_md5"`
	ForZeroHeight bool   `json:"for_zero_height"`
}

Software upgrade proposal

func NewSoftwareUpgradeProposal

func NewSoftwareUpgradeProposal(proposer btypes.AccAddress, title, description string, deposit btypes.BigInt,
	version string, dataHeight int64, genesisFile string, genesisMd5 string, forZeroHeight bool) SoftwareUpgradeProposal

func (SoftwareUpgradeProposal) GetDeposit

func (tp SoftwareUpgradeProposal) GetDeposit() btypes.BigInt

func (SoftwareUpgradeProposal) GetDescription

func (tp SoftwareUpgradeProposal) GetDescription() string

func (SoftwareUpgradeProposal) GetProposalType

func (tp SoftwareUpgradeProposal) GetProposalType() ProposalType

func (SoftwareUpgradeProposal) GetProposer added in v0.1.0

func (tp SoftwareUpgradeProposal) GetProposer() btypes.AccAddress

func (SoftwareUpgradeProposal) GetTitle

func (tp SoftwareUpgradeProposal) GetTitle() string

nolint

type TallyResult

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

Tally Results

func EmptyTallyResult

func EmptyTallyResult() TallyResult

func NewTallyResult

func NewTallyResult(yes, abstain, no, noWithVeto btypes.BigInt) TallyResult

func (TallyResult) Equals

func (tr TallyResult) Equals(comp TallyResult) bool

func (TallyResult) String

func (tr TallyResult) String() string

type TaxUsageProposal

type TaxUsageProposal struct {
	TextProposal
	DestAddress btypes.AccAddress `json:"dest_address"`
	Percent     types.Dec         `json:"percent"`
}

TaxUsage Proposal

func NewTaxUsageProposal

func NewTaxUsageProposal(proposer btypes.AccAddress, title, description string, deposit btypes.BigInt, destAddress btypes.AccAddress, percent types.Dec) TaxUsageProposal

func (TaxUsageProposal) GetDeposit

func (tp TaxUsageProposal) GetDeposit() btypes.BigInt

func (TaxUsageProposal) GetDescription

func (tp TaxUsageProposal) GetDescription() string

func (TaxUsageProposal) GetProposalType

func (tp TaxUsageProposal) GetProposalType() ProposalType

func (TaxUsageProposal) GetProposer added in v0.1.0

func (tp TaxUsageProposal) GetProposer() btypes.AccAddress

func (TaxUsageProposal) GetTitle

func (tp TaxUsageProposal) GetTitle() string

nolint

type TextProposal

type TextProposal struct {
	Title       string            `json:"title"`       // Title of the proposal
	Description string            `json:"description"` // Description of the proposal
	Deposit     btypes.BigInt     `json:"deposit"`     // Deposit of the proposal
	Proposer    btypes.AccAddress `json:"proposer"`    // proposer
}

Text Proposal

func NewTextProposal

func NewTextProposal(proposer btypes.AccAddress, title, description string, deposit btypes.BigInt) TextProposal

func (TextProposal) GetDeposit

func (tp TextProposal) GetDeposit() btypes.BigInt

func (TextProposal) GetDescription

func (tp TextProposal) GetDescription() string

func (TextProposal) GetProposalLevel added in v0.0.8

func (tp TextProposal) GetProposalLevel() ProposalLevel

func (TextProposal) GetProposalType

func (tp TextProposal) GetProposalType() ProposalType

func (TextProposal) GetProposer added in v0.1.0

func (tp TextProposal) GetProposer() btypes.AccAddress

func (TextProposal) GetTitle

func (tp TextProposal) GetTitle() string

nolint

type Vote

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

Vote

func (Vote) Equals

func (v Vote) Equals(comp Vote) bool

func (Vote) String

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

type Votes []Vote

Votes is a collection of Vote

func (Votes) String

func (v Votes) String() string

Jump to

Keyboard shortcuts

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