Documentation
¶
Overview ¶
nolint
Index ¶
- Constants
- func ErrAddressNotStaked(codespace sdk.CodespaceType, address sdk.AccAddress) sdk.Error
- func ErrAlreadyActiveProposal(codespace sdk.CodespaceType, proposalID uint64) sdk.Error
- func ErrAlreadyFinishedProposal(codespace sdk.CodespaceType, proposalID uint64) sdk.Error
- func ErrCodeDepositDeleted(codespace sdk.CodespaceType, proposalID uint64) sdk.Error
- func ErrCodeDepositNotExisted(codespace sdk.CodespaceType, address sdk.AccAddress, proposalID uint64) sdk.Error
- func ErrCodeInvalidSwitchHeight(codespace sdk.CodespaceType, blockHeight uint64, switchHeight uint64) sdk.Error
- func ErrCodeInvalidVersion(codespace sdk.CodespaceType, version uint64) sdk.Error
- func ErrCodeVoteDeleted(codespace sdk.CodespaceType, proposalID uint64) sdk.Error
- func ErrCodeVoteNotExisted(codespace sdk.CodespaceType, address sdk.AccAddress, proposalID uint64) sdk.Error
- func ErrInactiveProposal(codespace sdk.CodespaceType, proposalID uint64) sdk.Error
- func ErrInvalidDescription(codespace sdk.CodespaceType, description string) sdk.Error
- func ErrInvalidGenesis(codespace sdk.CodespaceType, msg string) sdk.Error
- func ErrInvalidParam(codespace sdk.CodespaceType) sdk.Error
- func ErrInvalidParamOp(codespace sdk.CodespaceType, opStr string) sdk.Error
- func ErrInvalidPercent(codespace sdk.CodespaceType, percent sdk.Dec) sdk.Error
- func ErrInvalidProposalType(codespace sdk.CodespaceType, proposalType ProposalKind) sdk.Error
- func ErrInvalidTitle(codespace sdk.CodespaceType, title string) sdk.Error
- func ErrInvalidUsageType(codespace sdk.CodespaceType, usageType UsageType) sdk.Error
- func ErrInvalidVote(codespace sdk.CodespaceType, voteOption VoteOption) sdk.Error
- func ErrNotProfiler(codespace sdk.CodespaceType, profiler sdk.AccAddress) sdk.Error
- func ErrNotTrustee(codespace sdk.CodespaceType, trustee sdk.AccAddress) sdk.Error
- func ErrSwitchPeriodInProcess(codespace sdk.CodespaceType) sdk.Error
- func ErrUnknownProposal(codespace sdk.CodespaceType, proposalID uint64) sdk.Error
- func ProposalEqual(proposalA Proposal, proposalB Proposal) bool
- func RegisterCodec(cdc *codec.Codec)
- func ValidProposalStatus(status ProposalStatus) bool
- func ValidProposalType(pt ProposalKind) bool
- func ValidUsageType(ut UsageType) bool
- func ValidVoteOption(option VoteOption) bool
- type Deposit
- type HaltProposal
- type Param
- type ParameterConfigFile
- type ParameterProposal
- type Proposal
- type ProposalKind
- func (pt ProposalKind) Format(s fmt.State, verb rune)
- func (pt ProposalKind) Marshal() ([]byte, error)
- func (pt ProposalKind) MarshalJSON() ([]byte, error)
- func (pt ProposalKind) String() string
- func (pt *ProposalKind) Unmarshal(data []byte) error
- func (pt *ProposalKind) UnmarshalJSON(data []byte) error
- type ProposalQueue
- type ProposalStatus
- func (status ProposalStatus) Format(s fmt.State, verb rune)
- func (status ProposalStatus) Marshal() ([]byte, error)
- func (status ProposalStatus) MarshalJSON() ([]byte, error)
- func (status ProposalStatus) String() string
- func (status *ProposalStatus) Unmarshal(data []byte) error
- func (status *ProposalStatus) UnmarshalJSON(data []byte) error
- type SoftwareUpgradeProposal
- type TallyResult
- type TaxUsageProposal
- type TextProposal
- func (tp TextProposal) GetDepositEndTime() time.Time
- func (tp TextProposal) GetDescription() string
- func (tp TextProposal) GetProposalID() uint64
- func (tp TextProposal) GetProposalType() ProposalKind
- func (tp TextProposal) GetStatus() ProposalStatus
- func (tp TextProposal) GetSubmitTime() time.Time
- func (tp TextProposal) GetTallyResult() TallyResult
- func (tp TextProposal) GetTitle() string
- func (tp TextProposal) GetTotalDeposit() sdk.Coins
- func (tp TextProposal) GetVotingEndTime() time.Time
- func (tp TextProposal) GetVotingStartTime() time.Time
- func (tp *TextProposal) SetDepositEndTime(depositEndTime time.Time)
- func (tp *TextProposal) SetDescription(description string)
- func (tp *TextProposal) SetProposalID(proposalID uint64)
- func (tp *TextProposal) SetProposalType(proposalType ProposalKind)
- func (tp *TextProposal) SetStatus(status ProposalStatus)
- func (tp *TextProposal) SetSubmitTime(submitTime time.Time)
- func (tp *TextProposal) SetTallyResult(tallyResult TallyResult)
- func (tp *TextProposal) SetTitle(title string)
- func (tp *TextProposal) SetTotalDeposit(totalDeposit sdk.Coins)
- func (tp *TextProposal) SetVotingEndTime(votingEndTime time.Time)
- func (tp *TextProposal) SetVotingStartTime(votingStartTime time.Time)
- type UsageType
- type Vote
- type VoteOption
Constants ¶
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 //////////////////// iris begin /////////////////////////// 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 CodeInvalidSwitchHeight sdk.CodeType = 19 CodeVoteDeleted sdk.CodeType = 20 CodeDepositDeleted sdk.CodeType = 21 CodeVoteNotExisted sdk.CodeType = 22 CodeDepositNotExisted sdk.CodeType = 23 )
const ( Insert string = "insert" Update string = "update" )
Variables ¶
This section is empty.
Functions ¶
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 ErrCodeDepositDeleted ¶
func ErrCodeDepositDeleted(codespace sdk.CodespaceType, proposalID uint64) sdk.Error
func ErrCodeDepositNotExisted ¶
func ErrCodeDepositNotExisted(codespace sdk.CodespaceType, address sdk.AccAddress, proposalID uint64) sdk.Error
func ErrCodeInvalidVersion ¶
func ErrCodeInvalidVersion(codespace sdk.CodespaceType, version uint64) sdk.Error
func ErrCodeVoteDeleted ¶
func ErrCodeVoteDeleted(codespace sdk.CodespaceType, proposalID uint64) sdk.Error
func ErrCodeVoteNotExisted ¶
func ErrCodeVoteNotExisted(codespace sdk.CodespaceType, address sdk.AccAddress, proposalID uint64) 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) sdk.Error
////////////////// iris begin ///////////////////////////
func ErrInvalidParamOp ¶
func ErrInvalidParamOp(codespace sdk.CodespaceType, opStr string) sdk.Error
func ErrInvalidPercent ¶
func ErrInvalidProposalType ¶
func ErrInvalidProposalType(codespace sdk.CodespaceType, proposalType ProposalKind) sdk.Error
func ErrInvalidTitle ¶
func ErrInvalidTitle(codespace sdk.CodespaceType, title string) sdk.Error
func ErrInvalidUsageType ¶
func ErrInvalidUsageType(codespace sdk.CodespaceType, usageType UsageType) sdk.Error
func ErrInvalidVote ¶
func ErrInvalidVote(codespace sdk.CodespaceType, voteOption VoteOption) sdk.Error
func ErrNotProfiler ¶
func ErrNotProfiler(codespace sdk.CodespaceType, profiler sdk.AccAddress) sdk.Error
func ErrNotTrustee ¶
func ErrNotTrustee(codespace sdk.CodespaceType, trustee sdk.AccAddress) sdk.Error
func ErrSwitchPeriodInProcess ¶
func ErrSwitchPeriodInProcess(codespace sdk.CodespaceType) sdk.Error
func ErrUnknownProposal ¶
func ErrUnknownProposal(codespace sdk.CodespaceType, proposalID uint64) sdk.Error
func ProposalEqual ¶
checks if two proposals are equal
func ValidProposalStatus ¶
func ValidProposalStatus(status ProposalStatus) bool
is defined ProposalType?
Types ¶
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
type HaltProposal ¶
type HaltProposal struct {
TextProposal
}
type ParameterConfigFile ¶
type ParameterConfigFile struct {
Govparams govparams.ParamSet `json:"gov"`
}
func (*ParameterConfigFile) GetParamFromKey ¶
func (pd *ParameterConfigFile) GetParamFromKey(keyStr string, opStr string) (Param, error)
type ParameterProposal ¶
type ParameterProposal struct {
TextProposal
Param Param `json:"params"`
}
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)
}
----------------------------------------------------------- Proposal interface
type ProposalKind ¶
type ProposalKind byte
Type that represents Proposal Type as a byte
const ( ProposalTypeNil ProposalKind = 0x00 ProposalTypeText ProposalKind = 0x01 ProposalTypeParameterChange ProposalKind = 0x02 ProposalTypeSoftwareUpgrade ProposalKind = 0x03 //////////////////// iris begin ///////////////////////////// ProposalTypeSoftwareHalt ProposalKind = 0x04 ProposalTypeTxTaxUsage ProposalKind = 0x05 )
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) 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 ProposalQueue ¶
type ProposalQueue []uint64
----------------------------------------------------------- ProposalQueue
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 SoftwareUpgradeProposal ¶
type SoftwareUpgradeProposal struct {
TextProposal
Version uint64
Software string
SwitchHeight uint64
}
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 (TallyResult) Equals ¶
func (resultA TallyResult) Equals(resultB TallyResult) bool
checks if two proposals are equal
type TaxUsageProposal ¶
type TaxUsageProposal struct {
TextProposal
Usage UsageType
DestAddress sdk.AccAddress
Percent sdk.Dec
}
type TextProposal ¶
type TextProposal 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
}
----------------------------------------------------------- Text Proposals
func (TextProposal) GetDepositEndTime ¶
func (tp TextProposal) GetDepositEndTime() time.Time
func (TextProposal) GetDescription ¶
func (tp TextProposal) GetDescription() string
func (TextProposal) GetProposalType ¶
func (tp TextProposal) GetProposalType() ProposalKind
func (TextProposal) GetStatus ¶
func (tp TextProposal) GetStatus() ProposalStatus
func (TextProposal) GetSubmitTime ¶
func (tp TextProposal) GetSubmitTime() time.Time
func (TextProposal) GetTallyResult ¶
func (tp TextProposal) GetTallyResult() TallyResult
func (TextProposal) GetTitle ¶
func (tp TextProposal) GetTitle() string
func (TextProposal) GetTotalDeposit ¶
func (tp TextProposal) GetTotalDeposit() sdk.Coins
func (TextProposal) GetVotingEndTime ¶
func (tp TextProposal) GetVotingEndTime() time.Time
func (TextProposal) GetVotingStartTime ¶
func (tp TextProposal) GetVotingStartTime() time.Time
func (*TextProposal) SetDepositEndTime ¶
func (tp *TextProposal) SetDepositEndTime(depositEndTime time.Time)
func (*TextProposal) SetDescription ¶
func (tp *TextProposal) SetDescription(description string)
func (*TextProposal) SetProposalID ¶
func (tp *TextProposal) SetProposalID(proposalID uint64)
func (*TextProposal) SetProposalType ¶
func (tp *TextProposal) SetProposalType(proposalType ProposalKind)
func (*TextProposal) SetStatus ¶
func (tp *TextProposal) SetStatus(status ProposalStatus)
func (*TextProposal) SetSubmitTime ¶
func (tp *TextProposal) SetSubmitTime(submitTime time.Time)
func (*TextProposal) SetTallyResult ¶
func (tp *TextProposal) SetTallyResult(tallyResult TallyResult)
func (*TextProposal) SetTitle ¶
func (tp *TextProposal) SetTitle(title string)
func (*TextProposal) SetTotalDeposit ¶
func (tp *TextProposal) SetTotalDeposit(totalDeposit sdk.Coins)
func (*TextProposal) SetVotingEndTime ¶
func (tp *TextProposal) SetVotingEndTime(votingEndTime time.Time)
func (*TextProposal) SetVotingStartTime ¶
func (tp *TextProposal) SetVotingStartTime(votingStartTime time.Time)
type UsageType ¶
type UsageType byte
func UsageTypeFromString ¶
String to UsageType byte. Returns ff if invalid.
func (UsageType) MarshalJSON ¶
Marshals to JSON using string
func (*UsageType) UnmarshalJSON ¶
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
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) 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