Documentation
¶
Index ¶
- Variables
- func ErrAccountNotFound() sdk.Error
- func ErrIllegalWithdraw() sdk.Error
- func ErrInsufficientDeposit() sdk.Error
- func ErrInvalidCoin() sdk.Error
- func ErrInvalidUsername() sdk.Error
- func ErrValidatorCannotRevoke() sdk.Error
- func ErrVoteAlreadyExist() sdk.Error
- func InitGlobalManager(ctx sdk.Context, gm global.GlobalManager) error
- func NewHandler(vm VoteManager, am acc.AccountManager, gm global.GlobalManager) sdk.Handler
- func RegisterWire(cdc *wire.Codec)
- type DelegateMsg
- func (msg DelegateMsg) GetConsumeAmount() types.Coin
- func (msg DelegateMsg) GetPermission() types.Permission
- func (msg DelegateMsg) GetSignBytes() []byte
- func (msg DelegateMsg) GetSigners() []sdk.AccAddress
- func (msg DelegateMsg) String() string
- func (msg DelegateMsg) Type() string
- func (msg DelegateMsg) ValidateBasic() sdk.Error
- type DelegatorWithdrawMsg
- func (msg DelegatorWithdrawMsg) GetConsumeAmount() types.Coin
- func (msg DelegatorWithdrawMsg) GetPermission() types.Permission
- func (msg DelegatorWithdrawMsg) GetSignBytes() []byte
- func (msg DelegatorWithdrawMsg) GetSigners() []sdk.AccAddress
- func (msg DelegatorWithdrawMsg) String() string
- func (msg DelegatorWithdrawMsg) Type() string
- func (msg DelegatorWithdrawMsg) ValidateBasic() sdk.Error
- type RevokeDelegationMsg
- func (msg RevokeDelegationMsg) GetConsumeAmount() types.Coin
- func (msg RevokeDelegationMsg) GetPermission() types.Permission
- func (msg RevokeDelegationMsg) GetSignBytes() []byte
- func (msg RevokeDelegationMsg) GetSigners() []sdk.AccAddress
- func (msg RevokeDelegationMsg) String() string
- func (msg RevokeDelegationMsg) Type() string
- func (msg RevokeDelegationMsg) ValidateBasic() sdk.Error
- type VoteManager
- func (vm VoteManager) AddDelegation(ctx sdk.Context, voterName types.AccountKey, delegatorName types.AccountKey, ...) sdk.Error
- func (vm VoteManager) AddVote(ctx sdk.Context, proposalID types.ProposalKey, voter types.AccountKey, ...) sdk.Error
- func (vm VoteManager) AddVoter(ctx sdk.Context, username types.AccountKey, coin types.Coin) sdk.Error
- func (vm VoteManager) CanBecomeValidator(ctx sdk.Context, username types.AccountKey) bool
- func (vm VoteManager) DelegatorWithdraw(ctx sdk.Context, voterName types.AccountKey, delegatorName types.AccountKey, ...) sdk.Error
- func (vm VoteManager) DelegatorWithdrawAll(ctx sdk.Context, voterName types.AccountKey, delegatorName types.AccountKey) (types.Coin, sdk.Error)
- func (vm VoteManager) Deposit(ctx sdk.Context, username types.AccountKey, coin types.Coin) sdk.Error
- func (vm VoteManager) DoesDelegationExist(ctx sdk.Context, voter types.AccountKey, delegator types.AccountKey) bool
- func (vm VoteManager) DoesVoteExist(ctx sdk.Context, proposalID types.ProposalKey, accKey types.AccountKey) bool
- func (vm VoteManager) DoesVoterExist(ctx sdk.Context, accKey types.AccountKey) bool
- func (vm VoteManager) GetAllDelegators(ctx sdk.Context, voterName types.AccountKey) ([]types.AccountKey, sdk.Error)
- func (vm VoteManager) GetPenaltyList(ctx sdk.Context, proposalID types.ProposalKey, proposalType types.ProposalType, ...) (types.PenaltyList, sdk.Error)
- func (vm VoteManager) GetValidatorReferenceList(ctx sdk.Context) (*model.ReferenceList, sdk.Error)
- func (vm VoteManager) GetVote(ctx sdk.Context, proposalID types.ProposalKey, voter types.AccountKey) (*model.Vote, sdk.Error)
- func (vm VoteManager) GetVoterDeposit(ctx sdk.Context, accKey types.AccountKey) (types.Coin, sdk.Error)
- func (vm VoteManager) GetVotingPower(ctx sdk.Context, voterName types.AccountKey) (types.Coin, sdk.Error)
- func (vm VoteManager) InitGenesis(ctx sdk.Context) error
- func (vm VoteManager) IsInValidatorList(ctx sdk.Context, username types.AccountKey) bool
- func (vm VoteManager) IsLegalDelegatorWithdraw(ctx sdk.Context, voterName types.AccountKey, delegatorName types.AccountKey, ...) bool
- func (vm VoteManager) IsLegalVoterWithdraw(ctx sdk.Context, username types.AccountKey, coin types.Coin) bool
- func (vm VoteManager) SetValidatorReferenceList(ctx sdk.Context, lst *model.ReferenceList) sdk.Error
- func (vm VoteManager) VoterWithdraw(ctx sdk.Context, username types.AccountKey, coin types.Coin) sdk.Error
- func (vm VoteManager) VoterWithdrawAll(ctx sdk.Context, username types.AccountKey) (types.Coin, sdk.Error)
- type VoterDepositMsg
- func (msg VoterDepositMsg) GetConsumeAmount() types.Coin
- func (msg VoterDepositMsg) GetPermission() types.Permission
- func (msg VoterDepositMsg) GetSignBytes() []byte
- func (msg VoterDepositMsg) GetSigners() []sdk.AccAddress
- func (msg VoterDepositMsg) String() string
- func (msg VoterDepositMsg) Type() string
- func (msg VoterDepositMsg) ValidateBasic() sdk.Error
- type VoterRevokeMsg
- func (msg VoterRevokeMsg) GetConsumeAmount() types.Coin
- func (msg VoterRevokeMsg) GetPermission() types.Permission
- func (msg VoterRevokeMsg) GetSignBytes() []byte
- func (msg VoterRevokeMsg) GetSigners() []sdk.AccAddress
- func (msg VoterRevokeMsg) String() string
- func (msg VoterRevokeMsg) Type() string
- func (msg VoterRevokeMsg) ValidateBasic() sdk.Error
- type VoterWithdrawMsg
- func (msg VoterWithdrawMsg) GetConsumeAmount() types.Coin
- func (msg VoterWithdrawMsg) GetPermission() types.Permission
- func (msg VoterWithdrawMsg) GetSignBytes() []byte
- func (msg VoterWithdrawMsg) GetSigners() []sdk.AccAddress
- func (msg VoterWithdrawMsg) String() string
- func (msg VoterWithdrawMsg) Type() string
- func (msg VoterWithdrawMsg) ValidateBasic() sdk.Error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TestAccountKVStoreKey = sdk.NewKVStoreKey("account") TestVoteKVStoreKey = sdk.NewKVStoreKey("vote") TestGlobalKVStoreKey = sdk.NewKVStoreKey("global") TestParamKVStoreKey = sdk.NewKVStoreKey("param") )
Construct some global addrs and txs for tests.
Functions ¶
func ErrIllegalWithdraw ¶
func ErrInsufficientDeposit ¶
func ErrInvalidCoin ¶
func ErrInvalidUsername ¶
func ErrVoteAlreadyExist ¶
func InitGlobalManager ¶
func InitGlobalManager(ctx sdk.Context, gm global.GlobalManager) error
func NewHandler ¶
func NewHandler(vm VoteManager, am acc.AccountManager, gm global.GlobalManager) sdk.Handler
Types ¶
type DelegateMsg ¶
type DelegateMsg struct {
Delegator types.AccountKey `json:"delegator"`
Voter types.AccountKey `json:"voter"`
Amount types.LNO `json:"amount"`
}
func NewDelegateMsg ¶
func NewDelegateMsg(delegator string, voter string, amount types.LNO) DelegateMsg
func (DelegateMsg) GetConsumeAmount ¶
func (msg DelegateMsg) GetConsumeAmount() types.Coin
Implements Msg.
func (DelegateMsg) GetPermission ¶
func (msg DelegateMsg) GetPermission() types.Permission
func (DelegateMsg) GetSignBytes ¶
func (msg DelegateMsg) GetSignBytes() []byte
func (DelegateMsg) GetSigners ¶
func (msg DelegateMsg) GetSigners() []sdk.AccAddress
func (DelegateMsg) String ¶
func (msg DelegateMsg) String() string
func (DelegateMsg) Type ¶
func (msg DelegateMsg) Type() string
func (DelegateMsg) ValidateBasic ¶
func (msg DelegateMsg) ValidateBasic() sdk.Error
type DelegatorWithdrawMsg ¶
type DelegatorWithdrawMsg struct {
Delegator types.AccountKey `json:"delegator"`
Voter types.AccountKey `json:"voter"`
Amount types.LNO `json:"amount"`
}
func NewDelegatorWithdrawMsg ¶
func NewDelegatorWithdrawMsg(delegator string, voter string, amount types.LNO) DelegatorWithdrawMsg
---------------------------------------- DelegatoWithdrawMsg Msg Implementations
func (DelegatorWithdrawMsg) GetConsumeAmount ¶
func (msg DelegatorWithdrawMsg) GetConsumeAmount() types.Coin
Implements Msg.
func (DelegatorWithdrawMsg) GetPermission ¶
func (msg DelegatorWithdrawMsg) GetPermission() types.Permission
func (DelegatorWithdrawMsg) GetSignBytes ¶
func (msg DelegatorWithdrawMsg) GetSignBytes() []byte
func (DelegatorWithdrawMsg) GetSigners ¶
func (msg DelegatorWithdrawMsg) GetSigners() []sdk.AccAddress
func (DelegatorWithdrawMsg) String ¶
func (msg DelegatorWithdrawMsg) String() string
func (DelegatorWithdrawMsg) Type ¶
func (msg DelegatorWithdrawMsg) Type() string
func (DelegatorWithdrawMsg) ValidateBasic ¶
func (msg DelegatorWithdrawMsg) ValidateBasic() sdk.Error
type RevokeDelegationMsg ¶
type RevokeDelegationMsg struct {
Delegator types.AccountKey `json:"delegator"`
Voter types.AccountKey `json:"voter"`
}
func NewRevokeDelegationMsg ¶
func NewRevokeDelegationMsg(delegator string, voter string) RevokeDelegationMsg
func (RevokeDelegationMsg) GetConsumeAmount ¶
func (msg RevokeDelegationMsg) GetConsumeAmount() types.Coin
Implements Msg.
func (RevokeDelegationMsg) GetPermission ¶
func (msg RevokeDelegationMsg) GetPermission() types.Permission
func (RevokeDelegationMsg) GetSignBytes ¶
func (msg RevokeDelegationMsg) GetSignBytes() []byte
func (RevokeDelegationMsg) GetSigners ¶
func (msg RevokeDelegationMsg) GetSigners() []sdk.AccAddress
func (RevokeDelegationMsg) String ¶
func (msg RevokeDelegationMsg) String() string
func (RevokeDelegationMsg) Type ¶
func (msg RevokeDelegationMsg) Type() string
func (RevokeDelegationMsg) ValidateBasic ¶
func (msg RevokeDelegationMsg) ValidateBasic() sdk.Error
type VoteManager ¶
type VoteManager struct {
// contains filtered or unexported fields
}
func NewVoteManager ¶
func NewVoteManager(key sdk.StoreKey, holder param.ParamHolder) VoteManager
func (VoteManager) AddDelegation ¶
func (vm VoteManager) AddDelegation(ctx sdk.Context, voterName types.AccountKey, delegatorName types.AccountKey, coin types.Coin) sdk.Error
func (VoteManager) AddVote ¶
func (vm VoteManager) AddVote(ctx sdk.Context, proposalID types.ProposalKey, voter types.AccountKey, res bool) sdk.Error
only support change parameter proposal now
func (VoteManager) AddVoter ¶
func (vm VoteManager) AddVoter(ctx sdk.Context, username types.AccountKey, coin types.Coin) sdk.Error
func (VoteManager) CanBecomeValidator ¶
func (vm VoteManager) CanBecomeValidator(ctx sdk.Context, username types.AccountKey) bool
func (VoteManager) DelegatorWithdraw ¶
func (vm VoteManager) DelegatorWithdraw( ctx sdk.Context, voterName types.AccountKey, delegatorName types.AccountKey, coin types.Coin) sdk.Error
func (VoteManager) DelegatorWithdrawAll ¶
func (vm VoteManager) DelegatorWithdrawAll(ctx sdk.Context, voterName types.AccountKey, delegatorName types.AccountKey) (types.Coin, sdk.Error)
func (VoteManager) Deposit ¶
func (vm VoteManager) Deposit(ctx sdk.Context, username types.AccountKey, coin types.Coin) sdk.Error
func (VoteManager) DoesDelegationExist ¶
func (vm VoteManager) DoesDelegationExist(ctx sdk.Context, voter types.AccountKey, delegator types.AccountKey) bool
func (VoteManager) DoesVoteExist ¶
func (vm VoteManager) DoesVoteExist(ctx sdk.Context, proposalID types.ProposalKey, accKey types.AccountKey) bool
func (VoteManager) DoesVoterExist ¶
func (vm VoteManager) DoesVoterExist(ctx sdk.Context, accKey types.AccountKey) bool
func (VoteManager) GetAllDelegators ¶
func (vm VoteManager) GetAllDelegators(ctx sdk.Context, voterName types.AccountKey) ([]types.AccountKey, sdk.Error)
func (VoteManager) GetPenaltyList ¶
func (vm VoteManager) GetPenaltyList( ctx sdk.Context, proposalID types.ProposalKey, proposalType types.ProposalType, oncallValidators []types.AccountKey) (types.PenaltyList, sdk.Error)
func (VoteManager) GetValidatorReferenceList ¶
func (vm VoteManager) GetValidatorReferenceList(ctx sdk.Context) (*model.ReferenceList, sdk.Error)
func (VoteManager) GetVote ¶
func (vm VoteManager) GetVote(ctx sdk.Context, proposalID types.ProposalKey, voter types.AccountKey) (*model.Vote, sdk.Error)
func (VoteManager) GetVoterDeposit ¶
func (vm VoteManager) GetVoterDeposit(ctx sdk.Context, accKey types.AccountKey) (types.Coin, sdk.Error)
func (VoteManager) GetVotingPower ¶
func (vm VoteManager) GetVotingPower(ctx sdk.Context, voterName types.AccountKey) (types.Coin, sdk.Error)
func (VoteManager) InitGenesis ¶
func (vm VoteManager) InitGenesis(ctx sdk.Context) error
func (VoteManager) IsInValidatorList ¶
func (vm VoteManager) IsInValidatorList(ctx sdk.Context, username types.AccountKey) bool
func (VoteManager) IsLegalDelegatorWithdraw ¶
func (vm VoteManager) IsLegalDelegatorWithdraw( ctx sdk.Context, voterName types.AccountKey, delegatorName types.AccountKey, coin types.Coin) bool
func (VoteManager) IsLegalVoterWithdraw ¶
func (vm VoteManager) IsLegalVoterWithdraw( ctx sdk.Context, username types.AccountKey, coin types.Coin) bool
func (VoteManager) SetValidatorReferenceList ¶
func (vm VoteManager) SetValidatorReferenceList(ctx sdk.Context, lst *model.ReferenceList) sdk.Error
func (VoteManager) VoterWithdraw ¶
func (vm VoteManager) VoterWithdraw(ctx sdk.Context, username types.AccountKey, coin types.Coin) sdk.Error
this method won't check if it is a legal withdraw, caller should check by itself
func (VoteManager) VoterWithdrawAll ¶
func (vm VoteManager) VoterWithdrawAll(ctx sdk.Context, username types.AccountKey) (types.Coin, sdk.Error)
type VoterDepositMsg ¶
type VoterDepositMsg struct {
Username types.AccountKey `json:"username"`
Deposit types.LNO `json:"deposit"`
}
func NewVoterDepositMsg ¶
func NewVoterDepositMsg(username string, deposit types.LNO) VoterDepositMsg
func (VoterDepositMsg) GetConsumeAmount ¶
func (msg VoterDepositMsg) GetConsumeAmount() types.Coin
Implements Msg.
func (VoterDepositMsg) GetPermission ¶
func (msg VoterDepositMsg) GetPermission() types.Permission
func (VoterDepositMsg) GetSignBytes ¶
func (msg VoterDepositMsg) GetSignBytes() []byte
func (VoterDepositMsg) GetSigners ¶
func (msg VoterDepositMsg) GetSigners() []sdk.AccAddress
func (VoterDepositMsg) String ¶
func (msg VoterDepositMsg) String() string
func (VoterDepositMsg) Type ¶
func (msg VoterDepositMsg) Type() string
func (VoterDepositMsg) ValidateBasic ¶
func (msg VoterDepositMsg) ValidateBasic() sdk.Error
type VoterRevokeMsg ¶
type VoterRevokeMsg struct {
Username types.AccountKey `json:"username"`
}
func NewVoterRevokeMsg ¶
func NewVoterRevokeMsg(username string) VoterRevokeMsg
func (VoterRevokeMsg) GetConsumeAmount ¶
func (msg VoterRevokeMsg) GetConsumeAmount() types.Coin
Implements Msg.
func (VoterRevokeMsg) GetPermission ¶
func (msg VoterRevokeMsg) GetPermission() types.Permission
func (VoterRevokeMsg) GetSignBytes ¶
func (msg VoterRevokeMsg) GetSignBytes() []byte
func (VoterRevokeMsg) GetSigners ¶
func (msg VoterRevokeMsg) GetSigners() []sdk.AccAddress
func (VoterRevokeMsg) String ¶
func (msg VoterRevokeMsg) String() string
func (VoterRevokeMsg) Type ¶
func (msg VoterRevokeMsg) Type() string
func (VoterRevokeMsg) ValidateBasic ¶
func (msg VoterRevokeMsg) ValidateBasic() sdk.Error
type VoterWithdrawMsg ¶
type VoterWithdrawMsg struct {
Username types.AccountKey `json:"username"`
Amount types.LNO `json:"amount"`
}
func NewVoterWithdrawMsg ¶
func NewVoterWithdrawMsg(username string, amount types.LNO) VoterWithdrawMsg
---------------------------------------- VoterWithdrawMsg Msg Implementations
func (VoterWithdrawMsg) GetConsumeAmount ¶
func (msg VoterWithdrawMsg) GetConsumeAmount() types.Coin
Implements Msg.
func (VoterWithdrawMsg) GetPermission ¶
func (msg VoterWithdrawMsg) GetPermission() types.Permission
func (VoterWithdrawMsg) GetSignBytes ¶
func (msg VoterWithdrawMsg) GetSignBytes() []byte
func (VoterWithdrawMsg) GetSigners ¶
func (msg VoterWithdrawMsg) GetSigners() []sdk.AccAddress
func (VoterWithdrawMsg) String ¶
func (msg VoterWithdrawMsg) String() string
func (VoterWithdrawMsg) Type ¶
func (msg VoterWithdrawMsg) Type() string
func (VoterWithdrawMsg) ValidateBasic ¶
func (msg VoterWithdrawMsg) ValidateBasic() sdk.Error
Click to show internal directories.
Click to hide internal directories.