Documentation ¶
Overview ¶
nolint
Index ¶
- Constants
- Variables
- func ErrAddressNotStaked(codespace sdk.CodespaceType, address sdk.AccAddress) sdk.Error
- func ErrAlreadyActiveProposal(codespace sdk.CodespaceType, proposalID int64) sdk.Error
- func ErrAlreadyFinishedProposal(codespace sdk.CodespaceType, proposalID int64) sdk.Error
- func ErrInactiveProposal(codespace sdk.CodespaceType, proposalID int64) sdk.Error
- func ErrInvalidDescription(codespace sdk.CodespaceType, msg string) sdk.Error
- func ErrInvalidGenesis(codespace sdk.CodespaceType, msg string) sdk.Error
- func ErrInvalidProposal(codespace sdk.CodespaceType, msg string) sdk.Error
- func ErrInvalidProposalType(codespace sdk.CodespaceType, proposalType ProposalKind) sdk.Error
- func ErrInvalidSideChainId(codespace sdk.CodespaceType, sideChain string) sdk.Error
- func ErrInvalidTitle(codespace sdk.CodespaceType, msg string) sdk.Error
- func ErrInvalidVote(codespace sdk.CodespaceType, voteOption VoteOption) sdk.Error
- func ErrInvalidVotingPeriod(codespace sdk.CodespaceType, votingPeriod time.Duration) sdk.Error
- func ErrUnknownProposal(codespace sdk.CodespaceType, proposalID int64) sdk.Error
- func InitGenesis(ctx sdk.Context, k Keeper, data GenesisState)
- func KeyDeposit(proposalID int64, depositerAddr sdk.AccAddress) []byte
- func KeyDepositsSubspace(proposalID int64) []byte
- func KeyProposal(proposalID int64) []byte
- func KeyVote(proposalID int64, voterAddr sdk.AccAddress) []byte
- func KeyVotesSubspace(proposalID int64) []byte
- func NewHandler(keeper Keeper) sdk.Handler
- func NewQuerier(keeper Keeper) sdk.Querier
- func ParamTypeTable() params.TypeTable
- func ProposalEqual(proposalA Proposal, proposalB Proposal) bool
- func RegisterCodec(cdc *codec.Codec)
- func RequestPrepare(ctx sdk.Context, k Keeper, req abci.RequestQuery, p SideChainIder) (newCtx sdk.Context, err sdk.Error)
- func ShouldPopActiveProposalQueue(ctx sdk.Context, keeper Keeper) bool
- func ShouldPopInactiveProposalQueue(ctx sdk.Context, keeper Keeper) bool
- type BaseParams
- type DelistTradingPairParams
- type Deposit
- type DepositParams
- type GenesisState
- type GovHooks
- type Keeper
- func (keeper Keeper) ActivateVotingPeriod(ctx sdk.Context, proposal Proposal)
- func (keeper Keeper) ActiveProposalQueuePeek(ctx sdk.Context) Proposal
- func (keeper Keeper) ActiveProposalQueuePop(ctx sdk.Context) Proposal
- func (keeper Keeper) ActiveProposalQueuePush(ctx sdk.Context, proposal Proposal)
- func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID int64, depositerAddr sdk.AccAddress, ...) (sdk.Error, bool)
- func (keeper Keeper) AddHooks(proposalType ProposalKind, hooks GovHooks) Keeper
- func (keeper Keeper) AddVote(ctx sdk.Context, proposalID int64, voterAddr sdk.AccAddress, option VoteOption) sdk.Error
- func (keeper Keeper) DeleteProposal(ctx sdk.Context, proposal Proposal)
- func (keeper Keeper) DistributeDeposits(ctx sdk.Context, proposalID int64)
- func (keeper Keeper) GetDeposit(ctx sdk.Context, proposalID int64, depositerAddr sdk.AccAddress) (Deposit, bool)
- func (keeper Keeper) GetDepositParams(ctx sdk.Context) DepositParams
- func (keeper Keeper) GetDeposits(ctx sdk.Context, proposalID int64) sdk.Iterator
- func (keeper Keeper) GetLastProposalID(ctx sdk.Context) (proposalID int64)
- func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID int64) Proposal
- func (keeper Keeper) GetProposalsFiltered(ctx sdk.Context, voterAddr sdk.AccAddress, depositerAddr sdk.AccAddress, ...) []Proposal
- func (keeper Keeper) GetTallyParams(ctx sdk.Context) TallyParams
- func (keeper Keeper) GetVote(ctx sdk.Context, proposalID int64, voterAddr sdk.AccAddress) (Vote, bool)
- func (keeper Keeper) GetVotes(ctx sdk.Context, proposalID int64) sdk.Iterator
- func (keeper Keeper) InactiveProposalQueuePeek(ctx sdk.Context) Proposal
- func (keeper Keeper) InactiveProposalQueuePop(ctx sdk.Context) Proposal
- func (keeper Keeper) InactiveProposalQueuePush(ctx sdk.Context, proposal Proposal)
- func (keeper Keeper) Iterate(ctx sdk.Context, voterAddr sdk.AccAddress, depositerAddr sdk.AccAddress, ...)
- func (keeper Keeper) NewTextProposal(ctx sdk.Context, title string, description string, proposalType ProposalKind, ...) Proposal
- func (keeper Keeper) OnProposalSubmitted(ctx sdk.Context, proposal Proposal) error
- func (keeper Keeper) RefundDeposits(ctx sdk.Context, proposalID int64)
- func (keeper Keeper) SetDepositParams(ctx sdk.Context, depositParams DepositParams)
- func (keeper Keeper) SetInitialProposalID(ctx sdk.Context, proposalID int64) sdk.Error
- func (keeper Keeper) SetProposal(ctx sdk.Context, proposal Proposal)
- func (keeper Keeper) SetTallyParams(ctx sdk.Context, tallyParams TallyParams)
- func (keeper *Keeper) SetupForSideChain(scKeeper SideChainKeeper)
- type ListTradingPairParams
- type MsgDeposit
- func (msg MsgDeposit) Get(key interface{}) (value interface{})
- func (msg MsgDeposit) GetInvolvedAddresses() []sdk.AccAddress
- 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 MsgSideChainDeposit
- func (msg MsgSideChainDeposit) GetInvolvedAddresses() []sdk.AccAddress
- func (msg MsgSideChainDeposit) GetSignBytes() []byte
- func (msg MsgSideChainDeposit) GetSigners() []sdk.AccAddress
- func (msg MsgSideChainDeposit) Route() string
- func (msg MsgSideChainDeposit) String() string
- func (msg MsgSideChainDeposit) Type() string
- func (msg MsgSideChainDeposit) ValidateBasic() sdk.Error
- type MsgSideChainSubmitProposal
- func (msg MsgSideChainSubmitProposal) GetInvolvedAddresses() []sdk.AccAddress
- func (msg MsgSideChainSubmitProposal) GetSignBytes() []byte
- func (msg MsgSideChainSubmitProposal) GetSigners() []sdk.AccAddress
- func (msg MsgSideChainSubmitProposal) Route() string
- func (msg MsgSideChainSubmitProposal) String() string
- func (msg MsgSideChainSubmitProposal) Type() string
- func (msg MsgSideChainSubmitProposal) ValidateBasic() sdk.Error
- type MsgSideChainVote
- func (msg MsgSideChainVote) GetInvolvedAddresses() []sdk.AccAddress
- func (msg MsgSideChainVote) GetSignBytes() []byte
- func (msg MsgSideChainVote) GetSigners() []sdk.AccAddress
- func (msg MsgSideChainVote) Route() string
- func (msg MsgSideChainVote) String() string
- func (msg MsgSideChainVote) Type() string
- func (msg MsgSideChainVote) ValidateBasic() sdk.Error
- type MsgSubmitProposal
- func (msg MsgSubmitProposal) Get(key interface{}) (value interface{})
- func (msg MsgSubmitProposal) GetInvolvedAddresses() []sdk.AccAddress
- 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
- func (msg MsgVote) Get(key interface{}) (value interface{})
- func (msg MsgVote) GetInvolvedAddresses() []sdk.AccAddress
- func (msg MsgVote) GetSignBytes() []byte
- func (msg MsgVote) GetSigners() []sdk.AccAddress
- func (msg MsgVote) Route() string
- func (msg MsgVote) String() string
- func (msg MsgVote) Type() string
- func (msg MsgVote) ValidateBasic() sdk.Error
- 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 QueryDepositParams
- type QueryDepositsParams
- type QueryProposalParams
- type QueryProposalsParams
- type QueryTallyParams
- type QueryVoteParams
- type QueryVotesParams
- type SideChainIder
- type SideChainKeeper
- type SimpleProposal
- type TallyParams
- type TallyResult
- type TextProposal
- func (tp TextProposal) GetDescription() string
- func (tp TextProposal) GetProposalID() int64
- 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) GetVotingPeriod() time.Duration
- func (tp TextProposal) GetVotingStartTime() time.Time
- func (tp *TextProposal) SetDescription(description string)
- func (tp *TextProposal) SetProposalID(proposalID int64)
- 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) SetVotingPeriod(votingPeriod time.Duration)
- func (tp *TextProposal) SetVotingStartTime(votingStartTime time.Time)
- type Vote
- type VoteOption
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 CodeInvalidProposal sdk.CodeType = 12 CodeInvalidVotingPeriod sdk.CodeType = 13 CodeInvalidSideChainId sdk.CodeType = 14 )
const ( MsgTypeSideSubmitProposal = "side_submit_proposal" MsgTypeSideDeposit = "side_deposit" MsgTypeSideVote = "side_vote" )
const ( MsgRoute = "gov" MaxTitleLength = 128 MaxDescriptionLength int = 2048 MaxVotingPeriod = 2 * 7 * 24 * 60 * 60 * time.Second // 2 weeks )
name to identify transaction types
const ( QueryProposals = "proposals" QueryProposal = "proposal" QueryDeposits = "deposits" QueryDeposit = "deposit" QueryVotes = "votes" QueryVote = "vote" QueryTally = "tally" )
query endpoints supported by the governance Querier
const (
DefaultDepositDenom = "steak"
)
const (
DefaultParamSpace = "gov"
)
Parameter store default namestore
const (
// Place holder for query and cli
NativeChainID = ""
)
Variables ¶
var ( ParamStoreKeyDepositParams = []byte("depositparams") ParamStoreKeyTallyParams = []byte("tallyparams") // Will hold deposit of both BC chain and side chain. DepositedCoinsAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("AximchainDepositedCoins"))) )
Parameter store key
var ( KeyNextProposalID = []byte("newProposalID") KeyActiveProposalQueue = []byte("activeProposalQueue") KeyInactiveProposalQueue = []byte("inactiveProposalQueue") )
Key for getting a the next available proposalID from the store
Functions ¶
func ErrAddressNotStaked ¶
func ErrAddressNotStaked(codespace sdk.CodespaceType, address sdk.AccAddress) sdk.Error
func ErrAlreadyActiveProposal ¶
func ErrAlreadyActiveProposal(codespace sdk.CodespaceType, proposalID int64) sdk.Error
func ErrAlreadyFinishedProposal ¶
func ErrAlreadyFinishedProposal(codespace sdk.CodespaceType, proposalID int64) sdk.Error
func ErrInactiveProposal ¶
func ErrInactiveProposal(codespace sdk.CodespaceType, proposalID int64) sdk.Error
func ErrInvalidDescription ¶
func ErrInvalidDescription(codespace sdk.CodespaceType, msg string) sdk.Error
func ErrInvalidGenesis ¶
func ErrInvalidGenesis(codespace sdk.CodespaceType, msg string) sdk.Error
func ErrInvalidProposal ¶
func ErrInvalidProposal(codespace sdk.CodespaceType, msg string) sdk.Error
func ErrInvalidProposalType ¶
func ErrInvalidProposalType(codespace sdk.CodespaceType, proposalType ProposalKind) sdk.Error
func ErrInvalidSideChainId ¶
func ErrInvalidSideChainId(codespace sdk.CodespaceType, sideChain string) sdk.Error
func ErrInvalidTitle ¶
func ErrInvalidTitle(codespace sdk.CodespaceType, msg string) sdk.Error
func ErrInvalidVote ¶
func ErrInvalidVote(codespace sdk.CodespaceType, voteOption VoteOption) sdk.Error
func ErrInvalidVotingPeriod ¶
func ErrUnknownProposal ¶
func ErrUnknownProposal(codespace sdk.CodespaceType, proposalID int64) sdk.Error
func InitGenesis ¶
func InitGenesis(ctx sdk.Context, k Keeper, data GenesisState)
InitGenesis - store genesis parameters
func KeyDeposit ¶
func KeyDeposit(proposalID int64, depositerAddr 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 KeyProposal ¶
Key for getting a specific proposal from the store
func KeyVote ¶
func KeyVote(proposalID int64, 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 ¶
func ProposalEqual ¶
checks if two proposals are equal
func RequestPrepare ¶
func RequestPrepare(ctx sdk.Context, k Keeper, req abci.RequestQuery, p SideChainIder) (newCtx sdk.Context, err sdk.Error)
Types ¶
type BaseParams ¶
type BaseParams struct {
SideChainId string
}
func NewBaseParams ¶
func NewBaseParams(sideChainId string) BaseParams
func (BaseParams) GetSideChainId ¶
func (p BaseParams) GetSideChainId() string
type DelistTradingPairParams ¶
type DelistTradingPairParams struct { BaseAssetSymbol string `json:"base_asset_symbol"` // base asset symbol QuoteAssetSymbol string `json:"quote_asset_symbol"` // quote asset symbol Justification string `json:"justification"` // justification IsExecuted bool `json:"is_executed"` // is this proposal executed }
-----------------------------------------------------------
type Deposit ¶
type Deposit struct { Depositer sdk.AccAddress `json:"depositer"` // Address of the depositer ProposalID int64 `json:"proposal_id"` // proposalID of the proposal Amount sdk.Coins `json:"amount"` // Deposit amount }
Deposit
type DepositParams ¶
type DepositParams struct { MinDeposit sdk.Coins `json:"min_deposit"` // Minimum deposit for a proposal to enter voting period. MaxDepositPeriod time.Duration `json:"max_deposit_period"` // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 months }
Param around Deposits for governance
type GenesisState ¶
type GenesisState struct { StartingProposalID int64 `json:"starting_proposalID"` DepositParams DepositParams `json:"deposit_params"` TallyParams TallyParams `json:"tally_params"` }
GenesisState - all staking state that must be provided at genesis
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
get raw genesis raw message for testing
func NewGenesisState ¶
func NewGenesisState(startingProposalID int64, dp DepositParams, tp TallyParams) GenesisState
func WriteGenesis ¶
func WriteGenesis(ctx sdk.Context, k Keeper) GenesisState
WriteGenesis - output genesis parameters
type GovHooks ¶
type GovHooks interface {
OnProposalSubmitted(ctx sdk.Context, proposal Proposal) error // Must be called when a proposal submitted
}
event hooks for governance
type Keeper ¶
type Keeper struct { // if you want to enable side chains, you need call `SetupForSideChain` ScKeeper SideChainKeeper // contains filtered or unexported fields }
Governance Keeper
func NewKeeper ¶
func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, paramsKeeper params.Keeper, paramSpace params.Subspace, ck bank.Keeper, ds sdk.DelegationSet, codespace sdk.CodespaceType, pool *sdk.Pool) 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) ActivateVotingPeriod ¶
func (Keeper) ActiveProposalQueuePeek ¶
Return the Proposal at the front of the ProposalQueue
func (Keeper) ActiveProposalQueuePop ¶
Remove and return a Proposal from the front of the ProposalQueue
func (Keeper) ActiveProposalQueuePush ¶
Add a proposalID to the ProposalQueue sorted by expire time
func (Keeper) AddDeposit ¶
func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID int64, depositerAddr sdk.AccAddress, depositAmount sdk.Coins) (sdk.Error, bool)
Adds or updates a deposit of a specific depositer on a specific proposal Activates voting period when appropriate
func (Keeper) AddHooks ¶
func (keeper Keeper) AddHooks(proposalType ProposalKind, hooks GovHooks) Keeper
AddHooks add hooks for gov keeper
func (Keeper) AddVote ¶
func (keeper Keeper) AddVote(ctx sdk.Context, proposalID int64, voterAddr sdk.AccAddress, option VoteOption) sdk.Error
Adds a vote on a specific proposal
func (Keeper) DeleteProposal ¶
Implements sdk.AccountKeeper.
func (Keeper) DistributeDeposits ¶
DistributeDeposits distributes deposits to proposer
func (Keeper) GetDeposit ¶
func (keeper Keeper) GetDeposit(ctx sdk.Context, proposalID int64, depositerAddr sdk.AccAddress) (Deposit, bool)
Gets the deposit of a specific depositer on a specific proposal
func (Keeper) GetDepositParams ¶
func (keeper Keeper) GetDepositParams(ctx sdk.Context) DepositParams
Returns the current Deposit Params from the global param store nolint: errcheck
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 ¶
func (keeper Keeper) GetProposalsFiltered(ctx sdk.Context, voterAddr sdk.AccAddress, depositerAddr sdk.AccAddress, status ProposalStatus, numLatest int64) []Proposal
Get Proposal from store by ProposalID
func (Keeper) GetTallyParams ¶
func (keeper Keeper) GetTallyParams(ctx sdk.Context) TallyParams
Returns the current Tally Params from the global param store nolint: errcheck
func (Keeper) GetVote ¶
func (keeper Keeper) GetVote(ctx sdk.Context, proposalID int64, voterAddr sdk.AccAddress) (Vote, bool)
Gets the vote of a specific voter on a specific proposal
func (Keeper) InactiveProposalQueuePeek ¶
Return the Proposal at the front of the ProposalQueue
func (Keeper) InactiveProposalQueuePop ¶
Remove and return a Proposal from the front of the ProposalQueue
func (Keeper) InactiveProposalQueuePush ¶
Add a proposalID to the back of the ProposalQueue
func (Keeper) Iterate ¶
func (keeper Keeper) Iterate(ctx sdk.Context, voterAddr sdk.AccAddress, depositerAddr sdk.AccAddress, status ProposalStatus, numLatest int64, reverse bool, iter func(Proposal) bool)
func (Keeper) NewTextProposal ¶
func (keeper Keeper) NewTextProposal(ctx sdk.Context, title string, description string, proposalType ProposalKind, votingPeriod time.Duration) Proposal
Creates a NewProposal
func (Keeper) OnProposalSubmitted ¶
func (Keeper) RefundDeposits ¶
Returns and deletes all the deposits on a specific proposal
func (Keeper) SetDepositParams ¶
func (keeper Keeper) SetDepositParams(ctx sdk.Context, depositParams DepositParams)
nolint: errcheck
func (Keeper) SetInitialProposalID ¶
func (Keeper) SetProposal ¶
Implements sdk.AccountKeeper.
func (Keeper) SetTallyParams ¶
func (keeper Keeper) SetTallyParams(ctx sdk.Context, tallyParams TallyParams)
nolint: errcheck
func (*Keeper) SetupForSideChain ¶
func (keeper *Keeper) SetupForSideChain(scKeeper SideChainKeeper)
type ListTradingPairParams ¶
type ListTradingPairParams struct { BaseAssetSymbol string `json:"base_asset_symbol"` // base asset symbol QuoteAssetSymbol string `json:"quote_asset_symbol"` // quote asset symbol InitPrice int64 `json:"init_price"` // init price Description string `json:"description"` // description ExpireTime time.Time `json:"expire_time"` // expire time }
-----------------------------------------------------------
type MsgDeposit ¶
type MsgDeposit struct { ProposalID int64 `json:"proposal_id"` // ID of the proposal Depositer sdk.AccAddress `json:"depositer"` // Address of the depositer Amount sdk.Coins `json:"amount"` // Coins to add to the proposal's deposit }
----------------------------------------------------------- MsgDeposit
func NewMsgDeposit ¶
func NewMsgDeposit(depositer sdk.AccAddress, proposalID int64, amount sdk.Coins) MsgDeposit
func (MsgDeposit) Get ¶
func (msg MsgDeposit) Get(key interface{}) (value interface{})
Implements Msg.
func (MsgDeposit) GetInvolvedAddresses ¶
func (msg MsgDeposit) GetInvolvedAddresses() []sdk.AccAddress
func (MsgDeposit) String ¶
func (msg MsgDeposit) String() string
func (MsgDeposit) Type ¶
func (msg MsgDeposit) Type() string
type MsgSideChainDeposit ¶
type MsgSideChainDeposit struct { ProposalID int64 `json:"proposal_id"` // ID of the proposal Depositer sdk.AccAddress `json:"depositer"` // Address of the depositer Amount sdk.Coins `json:"amount"` // Coins to add to the proposal's deposit SideChainId string `json:"side_chain_id"` }
----------------------------------------------------------- MsgSideChainDeposit
func NewMsgSideChainDeposit ¶
func NewMsgSideChainDeposit(depositer sdk.AccAddress, proposalID int64, amount sdk.Coins, sideChainId string) MsgSideChainDeposit
func (MsgSideChainDeposit) GetInvolvedAddresses ¶
func (msg MsgSideChainDeposit) GetInvolvedAddresses() []sdk.AccAddress
Implements Msg. Identical to MsgDeposit, keep here for code readability.
func (MsgSideChainDeposit) GetSignBytes ¶
func (msg MsgSideChainDeposit) GetSignBytes() []byte
Implements Msg.
func (MsgSideChainDeposit) GetSigners ¶
func (msg MsgSideChainDeposit) GetSigners() []sdk.AccAddress
Implements Msg. Identical to MsgDeposit, keep here for code readability.
func (MsgSideChainDeposit) String ¶
func (msg MsgSideChainDeposit) String() string
func (MsgSideChainDeposit) Type ¶
func (msg MsgSideChainDeposit) Type() string
func (MsgSideChainDeposit) ValidateBasic ¶
func (msg MsgSideChainDeposit) ValidateBasic() sdk.Error
Implements Msg.
type MsgSideChainSubmitProposal ¶
type MsgSideChainSubmitProposal 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. VotingPeriod time.Duration `json:"voting_period"` // Length of the voting period (s) SideChainId string `json:"side_chain_id"` }
----------------------------------------------------------- MsgSideChainSubmitProposal
func NewMsgSideChainSubmitProposal ¶
func NewMsgSideChainSubmitProposal(title string, description string, proposalType ProposalKind, proposer sdk.AccAddress, initialDeposit sdk.Coins, votingPeriod time.Duration, sideChainId string) MsgSideChainSubmitProposal
func (MsgSideChainSubmitProposal) GetInvolvedAddresses ¶
func (msg MsgSideChainSubmitProposal) GetInvolvedAddresses() []sdk.AccAddress
Implements Msg. Identical to MsgSubmitProposal, keep here for code readability.
func (MsgSideChainSubmitProposal) GetSignBytes ¶
func (msg MsgSideChainSubmitProposal) GetSignBytes() []byte
Implements Msg.
func (MsgSideChainSubmitProposal) GetSigners ¶
func (msg MsgSideChainSubmitProposal) GetSigners() []sdk.AccAddress
Implements Msg. Identical to MsgSubmitProposal, keep here for code readability.
func (MsgSideChainSubmitProposal) Route ¶
func (msg MsgSideChainSubmitProposal) Route() string
nolint
func (MsgSideChainSubmitProposal) String ¶
func (msg MsgSideChainSubmitProposal) String() string
func (MsgSideChainSubmitProposal) Type ¶
func (msg MsgSideChainSubmitProposal) Type() string
func (MsgSideChainSubmitProposal) ValidateBasic ¶
func (msg MsgSideChainSubmitProposal) ValidateBasic() sdk.Error
Implements Msg.
type MsgSideChainVote ¶
type MsgSideChainVote struct { ProposalID int64 `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 SideChainId string `json:"side_chain_id"` }
func NewMsgSideChainVote ¶
func NewMsgSideChainVote(voter sdk.AccAddress, proposalID int64, option VoteOption, sideChainId string) MsgSideChainVote
func (MsgSideChainVote) GetInvolvedAddresses ¶
func (msg MsgSideChainVote) GetInvolvedAddresses() []sdk.AccAddress
Implements Msg. Identical to MsgVote, keep here for code readability.
func (MsgSideChainVote) GetSignBytes ¶
func (msg MsgSideChainVote) GetSignBytes() []byte
Implements Msg.
func (MsgSideChainVote) GetSigners ¶
func (msg MsgSideChainVote) GetSigners() []sdk.AccAddress
Implements Msg. Identical to MsgVote, keep here for code readability.
func (MsgSideChainVote) Route ¶
func (msg MsgSideChainVote) Route() string
func (MsgSideChainVote) String ¶
func (msg MsgSideChainVote) String() string
func (MsgSideChainVote) Type ¶
func (msg MsgSideChainVote) Type() string
func (MsgSideChainVote) ValidateBasic ¶
func (msg MsgSideChainVote) 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. VotingPeriod time.Duration `json:"voting_period"` // Length of the voting period (s) }
----------------------------------------------------------- MsgSubmitProposal
func NewMsgSubmitProposal ¶
func NewMsgSubmitProposal(title string, description string, proposalType ProposalKind, proposer sdk.AccAddress, initialDeposit sdk.Coins, votingPeriod time.Duration) MsgSubmitProposal
func (MsgSubmitProposal) Get ¶
func (msg MsgSubmitProposal) Get(key interface{}) (value interface{})
Implements Msg.
func (MsgSubmitProposal) GetInvolvedAddresses ¶
func (msg MsgSubmitProposal) GetInvolvedAddresses() []sdk.AccAddress
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 int64 `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 int64, option VoteOption) MsgVote
func (MsgVote) GetInvolvedAddresses ¶
func (msg MsgVote) GetInvolvedAddresses() []sdk.AccAddress
type Proposal ¶
type Proposal interface { GetProposalID() int64 SetProposalID(int64) 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) GetTotalDeposit() sdk.Coins SetTotalDeposit(sdk.Coins) GetVotingStartTime() time.Time SetVotingStartTime(time.Time) GetVotingPeriod() time.Duration SetVotingPeriod(time.Duration) }
----------------------------------------------------------- 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 ProposalTypeListTradingPair ProposalKind = 0x04 // ProposalTypeFeeChange belongs to ProposalTypeParameterChange. We use this to make it easily to distinguish。 ProposalTypeFeeChange ProposalKind = 0x05 ProposalTypeCreateValidator ProposalKind = 0x06 ProposalTypeRemoveValidator ProposalKind = 0x07 ProposalTypeDelistTradingPair ProposalKind = 0x08 ProposalTypeManageChanPermission ProposalKind = 0x09 )
nolint
const ( // side chain params change ProposalTypeSCParamsChange ProposalKind = 0x81 // cross side chain param change ProposalTypeCSCParamsChange ProposalKind = 0x82 )
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 []int64
----------------------------------------------------------- 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 StatusExecuted ProposalStatus = 0x05 )
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 ¶
type QueryDepositParams struct { BaseParams ProposalID int64 Depositer sdk.AccAddress }
Params for query 'custom/gov/deposit'
type QueryDepositsParams ¶
type QueryDepositsParams struct { BaseParams ProposalID int64 }
Params for query 'custom/gov/deposits'
type QueryProposalParams ¶
type QueryProposalParams struct { BaseParams ProposalID int64 }
Params for query 'custom/gov/proposal'
type QueryProposalsParams ¶
type QueryProposalsParams struct { BaseParams Voter sdk.AccAddress Depositer sdk.AccAddress ProposalStatus ProposalStatus NumLatestProposals int64 }
Params for query 'custom/gov/proposals'
type QueryTallyParams ¶
type QueryTallyParams struct { BaseParams ProposalID int64 }
Params for query 'custom/gov/tally'
type QueryVoteParams ¶
type QueryVoteParams struct { BaseParams ProposalID int64 Voter sdk.AccAddress }
Params for query 'custom/gov/vote'
type QueryVotesParams ¶
type QueryVotesParams struct { BaseParams ProposalID int64 }
Params for query 'custom/gov/votes'
type SideChainIder ¶
type SideChainIder interface {
GetSideChainId() string
}
type SideChainKeeper ¶
type SimpleProposal ¶
func EndBlocker ¶
func EndBlocker(baseCtx sdk.Context, keeper Keeper) (refundProposals, notRefundProposals []SimpleProposal)
type TallyParams ¶
type TallyParams struct { Quorum sdk.Dec `json:"quorum"` // Minimum percentage of total stake needed to vote for a result to be considered valid. Initial value: 0.5 Threshold sdk.Dec `json:"threshold"` // Minimum proportion 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 }
Param around Tally votes in governance
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"` Total sdk.Dec `json:"total"` }
----------------------------------------------------------- Tally Results
func (TallyResult) Equals ¶
func (resultA TallyResult) Equals(resultB TallyResult) bool
checks if two proposals are equal
type TextProposal ¶
type TextProposal struct { ProposalID int64 `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} VotingPeriod time.Duration `json:"voting_period"` // Length of the voting period 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"` // Height of the block where TxGovSubmitProposal was included TotalDeposit sdk.Coins `json:"total_deposit"` // Current deposit on this proposal. Initial value is set at InitialDeposit VotingStartTime time.Time `json:"voting_start_time"` // Height of the block where MinDeposit was reached. -1 if MinDeposit is not reached }
----------------------------------------------------------- Text Proposals
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) GetVotingPeriod ¶
func (tp TextProposal) GetVotingPeriod() time.Duration
func (TextProposal) GetVotingStartTime ¶
func (tp TextProposal) GetVotingStartTime() time.Time
func (*TextProposal) SetDescription ¶
func (tp *TextProposal) SetDescription(description string)
func (*TextProposal) SetProposalID ¶
func (tp *TextProposal) SetProposalID(proposalID int64)
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) SetVotingPeriod ¶
func (tp *TextProposal) SetVotingPeriod(votingPeriod time.Duration)
func (*TextProposal) SetVotingStartTime ¶
func (tp *TextProposal) SetVotingStartTime(votingStartTime time.Time)
type Vote ¶
type Vote struct { Voter sdk.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
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