Documentation
¶
Overview ¶
nolint
Index ¶
- Constants
- Variables
- func EndBlocker(ctx sdk.Context, keeper Keeper) (resTags sdk.Tags)
- 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 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 ErrInvalidProposalType(codespace sdk.CodespaceType, proposalType ProposalKind) sdk.Error
- func ErrInvalidTitle(codespace sdk.CodespaceType, title string) sdk.Error
- func ErrInvalidVote(codespace sdk.CodespaceType, voteOption VoteOption) sdk.Error
- func ErrSwitchPeriodInProcess(codespace sdk.CodespaceType) sdk.Error
- func ErrUnknownProposal(codespace sdk.CodespaceType, proposalID uint64) sdk.Error
- func InitGenesis(ctx sdk.Context, k Keeper, data GenesisState)
- func KeyActiveProposalQueueProposal(endTime time.Time, proposalID uint64) []byte
- func KeyDeposit(proposalID uint64, depositorAddr sdk.AccAddress) []byte
- func KeyDepositsSubspace(proposalID uint64) []byte
- func KeyInactiveProposalQueueProposal(endTime time.Time, proposalID uint64) []byte
- func KeyProposal(proposalID uint64) []byte
- func KeyVote(proposalID uint64, voterAddr sdk.AccAddress) []byte
- func KeyVotesSubspace(proposalID uint64) []byte
- func NewHandler(keeper Keeper) sdk.Handler
- func NewQuerier(keeper Keeper) sdk.Querier
- func PrefixActiveProposalQueueTime(endTime time.Time) []byte
- func PrefixInactiveProposalQueueTime(endTime time.Time) []byte
- func ProposalEqual(proposalA Proposal, proposalB Proposal) bool
- func RegisterCodec(cdc *codec.Codec)
- func SortAddresses(addrs []sdk.AccAddress)
- func SortByteArrays(src [][]byte) [][]byte
- type Deposit
- type DepositWithMetadata
- type GenesisState
- type Keeper
- func (keeper Keeper) ActiveProposalQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator
- func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress, ...) (sdk.Error, bool)
- func (keeper Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress, ...) sdk.Error
- func (keeper Keeper) DeleteDeposits(ctx sdk.Context, proposalID uint64)
- func (keeper Keeper) DeleteProposal(ctx sdk.Context, proposalID uint64)
- func (keeper Keeper) GetDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress) (Deposit, bool)
- func (keeper Keeper) GetDeposits(ctx sdk.Context, proposalID uint64) sdk.Iterator
- func (keeper Keeper) GetLastProposalID(ctx sdk.Context) (proposalID uint64)
- func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) Proposal
- func (keeper Keeper) GetProposalsFiltered(ctx sdk.Context, voterAddr sdk.AccAddress, depositorAddr sdk.AccAddress, ...) []Proposal
- func (keeper Keeper) GetVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress) (Vote, bool)
- func (keeper Keeper) GetVotes(ctx sdk.Context, proposalID uint64) sdk.Iterator
- func (keeper Keeper) InactiveProposalQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator
- func (keeper Keeper) InsertActiveProposalQueue(ctx sdk.Context, endTime time.Time, proposalID uint64)
- func (keeper Keeper) InsertInactiveProposalQueue(ctx sdk.Context, endTime time.Time, proposalID uint64)
- func (keeper Keeper) NewParametersProposal(ctx sdk.Context, title string, description string, proposalType ProposalKind, ...) Proposal
- func (keeper Keeper) NewProposal(ctx sdk.Context, title string, description string, proposalType ProposalKind, ...) Proposal
- func (keeper Keeper) NewTextProposal(ctx sdk.Context, title string, description string, proposalType ProposalKind) Proposal
- func (keeper Keeper) NewUpgradeProposal(ctx sdk.Context, title string, description string, proposalType ProposalKind) Proposal
- func (keeper Keeper) RefundDeposits(ctx sdk.Context, proposalID uint64)
- func (keeper Keeper) RemoveFromActiveProposalQueue(ctx sdk.Context, endTime time.Time, proposalID uint64)
- func (keeper Keeper) RemoveFromInactiveProposalQueue(ctx sdk.Context, endTime time.Time, proposalID uint64)
- func (keeper Keeper) SetProposal(ctx sdk.Context, proposal Proposal)
- type MsgDeposit
- func (msg MsgDeposit) Get(key interface{}) (value interface{})
- func (msg MsgDeposit) GetSignBytes() []byte
- func (msg MsgDeposit) GetSigners() []sdk.AccAddress
- func (msg MsgDeposit) Route() string
- func (msg MsgDeposit) String() string
- func (msg MsgDeposit) Type() string
- func (msg MsgDeposit) ValidateBasic() sdk.Error
- type MsgSubmitProposal
- func (msg MsgSubmitProposal) Get(key interface{}) (value interface{})
- func (msg MsgSubmitProposal) GetSignBytes() []byte
- func (msg MsgSubmitProposal) GetSigners() []sdk.AccAddress
- func (msg MsgSubmitProposal) Route() string
- func (msg MsgSubmitProposal) String() string
- func (msg MsgSubmitProposal) Type() string
- func (msg MsgSubmitProposal) ValidateBasic() sdk.Error
- type MsgVote
- 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 ProposalOutput
- type ProposalOutputs
- 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 QueryDepositParams
- type QueryDepositsParams
- type QueryProposalParams
- type QueryProposalsParams
- type QueryTallyParams
- type QueryVoteParams
- type QueryVotesParams
- type SoftwareUpgradeProposal
- type TallyResult
- type TextProposal
- func (pp *TextProposal) Execute(ctx sdk.Context, k Keeper) (err error)
- 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 Vote
- type VoteOption
- type VoteWithMetadata
Constants ¶
const ( DefaultCodespace sdk.CodespaceType = 5 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 )
const ( Insert string = "insert" Update string = "update" )
const ( QueryProposals = "proposals" QueryProposal = "proposal" QueryDeposits = "deposits" QueryDeposit = "deposit" QueryVotes = "votes" QueryVote = "vote" QueryTally = "tally" )
query endpoints supported by the governance Querier
const MsgRoute = "gov"
name to idetify transaction types
const (
Prefix = "gov/"
)
Variables ¶
var ( DepositedCoinsAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("govDepositedCoins"))) BurnedDepositCoinsAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("govBurnedDepositCoins"))) )
nolint
var ( KeyDelimiter = []byte(":") KeyNextProposalID = []byte("newProposalID") PrefixActiveProposalQueue = []byte("activeProposalQueue") PrefixInactiveProposalQueue = []byte("inactiveProposalQueue") )
Key for getting a the next available proposalID from the store
Functions ¶
func EndBlocker ¶
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 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 ErrInvalidProposalType ¶
func ErrInvalidProposalType(codespace sdk.CodespaceType, proposalType ProposalKind) sdk.Error
func ErrInvalidTitle ¶
func ErrInvalidTitle(codespace sdk.CodespaceType, title string) sdk.Error
func ErrInvalidVote ¶
func ErrInvalidVote(codespace sdk.CodespaceType, voteOption VoteOption) 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 InitGenesis ¶
func InitGenesis(ctx sdk.Context, k Keeper, data GenesisState)
InitGenesis - store genesis parameters
func KeyActiveProposalQueueProposal ¶ added in v0.7.0
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 ¶
Key for getting all deposits on a proposal from the store
func KeyInactiveProposalQueueProposal ¶ added in v0.7.0
Returns the key for a proposalID in the activeProposalQueue
func KeyProposal ¶
Key for getting a specific proposal from the store
func KeyVote ¶
func KeyVote(proposalID uint64, voterAddr sdk.AccAddress) []byte
Key for getting a specific vote from the store
func KeyVotesSubspace ¶
Key for getting all votes on a proposal from the store
func NewQuerier ¶ added in v0.7.0
func PrefixActiveProposalQueueTime ¶ added in v0.7.0
Returns the key for a proposalID in the activeProposalQueue
func PrefixInactiveProposalQueueTime ¶ added in v0.7.0
Returns the key for a proposalID in the activeProposalQueue
func ProposalEqual ¶
checks if two proposals are equal
func RegisterCodec ¶ added in v0.7.0
Register concrete types on codec codec
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 DepositWithMetadata ¶ added in v0.7.0
type GenesisState ¶
type GenesisState struct {
StartingProposalID uint64 `json:"starting_proposalID"`
Deposits []DepositWithMetadata `json:"deposits"`
Votes []VoteWithMetadata `json:"votes"`
Proposals []Proposal `json:"proposals"`
DepositProcedure govparams.DepositProcedure `json:"deposit_period"`
VotingProcedure govparams.VotingProcedure `json:"voting_period"`
TallyingProcedure govparams.TallyingProcedure `json:"tallying_procedure"`
}
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 DefaultGenesisStateForLCDTest ¶
func DefaultGenesisStateForLCDTest() 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(startingProposalID uint64, dp govparams.DepositProcedure, vp govparams.VotingProcedure, tp govparams.TallyingProcedure) GenesisState
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Governance Keeper
func NewKeeper ¶
func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, ck bank.Keeper, ds sdk.DelegationSet, codespace sdk.CodespaceType) Keeper
NewKeeper 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
Returns an iterator for all the proposals in the Active Queue that expire by endTime
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) 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 ¶
Deletes all the deposits on a specific proposal without refunding them
func (Keeper) DeleteProposal ¶
Implements sdk.AccountKeeper.
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) GetDeposits ¶
Gets all the deposits on a specific proposal
func (Keeper) GetLastProposalID ¶
Get the last used proposal ID
func (Keeper) GetProposal ¶
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) 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) InactiveProposalQueueIterator ¶ added in v0.7.0
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, param Param) Proposal
////////////////// iris begin ///////////////////////////
func (Keeper) NewProposal ¶
func (keeper Keeper) NewProposal(ctx sdk.Context, title string, description string, proposalType ProposalKind, param Param) Proposal
////////////////// iris begin ///////////////////////////
func (Keeper) NewTextProposal ¶
func (keeper Keeper) NewTextProposal(ctx sdk.Context, title string, description string, proposalType ProposalKind) Proposal
Creates a NewProposal
func (Keeper) NewUpgradeProposal ¶
func (Keeper) RefundDeposits ¶
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
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) 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
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.
//////////////////// iris begin ///////////////////////////
Param Param
}
----------------------------------------------------------- MsgSubmitProposal
func NewMsgSubmitProposal ¶
func NewMsgSubmitProposal(title string, description string, proposalType ProposalKind, proposer sdk.AccAddress, initialDeposit sdk.Coins, param Param) MsgSubmitProposal
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) 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 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
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)
//////////////////// iris begin ///////////////////////////
Execute(ctx sdk.Context, k Keeper) error
}
----------------------------------------------------------- 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 )
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 ProposalOutput ¶ added in v0.7.0
type ProposalOutput 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
Param Param `json:"param"`
}
func ConvertProposalToProposalOutput ¶ added in v0.7.0
func ConvertProposalToProposalOutput(proposal Proposal) ProposalOutput
type ProposalOutputs ¶ added in v0.7.0
type ProposalOutputs []ProposalOutput
func ConvertProposalsToProposalOutputs ¶ added in v0.7.0
func ConvertProposalsToProposalOutputs(proposals []Proposal) ProposalOutputs
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 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 {
TextProposal
}
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 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) Execute ¶
func (pp *TextProposal) Execute(ctx sdk.Context, k Keeper) (err error)
////////////////// iris begin ///////////////////////////
func (TextProposal) GetDepositEndTime ¶ added in v0.7.0
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 ¶ added in v0.7.0
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 ¶ added in v0.7.0
func (tp TextProposal) GetVotingEndTime() time.Time
func (TextProposal) GetVotingStartTime ¶ added in v0.7.0
func (tp TextProposal) GetVotingStartTime() time.Time
func (*TextProposal) SetDepositEndTime ¶ added in v0.7.0
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 ¶ added in v0.7.0
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 ¶ added in v0.7.0
func (tp *TextProposal) SetVotingEndTime(votingEndTime time.Time)
func (*TextProposal) SetVotingStartTime ¶ added in v0.7.0
func (tp *TextProposal) SetVotingStartTime(votingStartTime time.Time)
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
type VoteWithMetadata ¶ added in v0.7.0
VoteWithMetadata (just for genesis)