Documentation ¶
Index ¶
- func AddStake(ctx sdk.Context, username types.AccountKey, stake types.Coin, vm VoteManager, ...) sdk.Error
- 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 ErrVoterNotFound() sdk.Error
- func MinusStake(ctx sdk.Context, username types.AccountKey, stake types.Coin, vm VoteManager, ...) sdk.Error
- func NewHandler(vm VoteManager, am acc.AccountManager, gm global.GlobalManager, ...) sdk.Handler
- func RegisterWire(cdc *wire.Codec)
- type ClaimInterestMsg
- func (msg ClaimInterestMsg) GetConsumeAmount() types.Coin
- func (msg ClaimInterestMsg) GetPermission() types.Permission
- func (msg ClaimInterestMsg) GetSignBytes() []byte
- func (msg ClaimInterestMsg) GetSigners() []sdk.AccAddress
- func (msg ClaimInterestMsg) String() string
- func (msg ClaimInterestMsg) Type() string
- func (msg ClaimInterestMsg) ValidateBasic() sdk.Error
- 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 StakeInMsg
- func (msg StakeInMsg) GetConsumeAmount() types.Coin
- func (msg StakeInMsg) GetPermission() types.Permission
- func (msg StakeInMsg) GetSignBytes() []byte
- func (msg StakeInMsg) GetSigners() []sdk.AccAddress
- func (msg StakeInMsg) String() string
- func (msg StakeInMsg) Type() string
- func (msg StakeInMsg) ValidateBasic() sdk.Error
- type StakeOutMsg
- func (msg StakeOutMsg) GetConsumeAmount() types.Coin
- func (msg StakeOutMsg) GetPermission() types.Permission
- func (msg StakeOutMsg) GetSignBytes() []byte
- func (msg StakeOutMsg) GetSigners() []sdk.AccAddress
- func (msg StakeOutMsg) String() string
- func (msg StakeOutMsg) Type() string
- func (msg StakeOutMsg) ValidateBasic() sdk.Error
- type VoteManager
- func (vm VoteManager) AddDelegation(ctx sdk.Context, voterName types.AccountKey, delegatorName types.AccountKey, ...) sdk.Error
- func (vm VoteManager) AddInterest(ctx sdk.Context, username types.AccountKey, interest types.Coin) sdk.Error
- func (vm VoteManager) AddLinoStake(ctx sdk.Context, username types.AccountKey, coin types.Coin) 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) ClaimInterest(ctx sdk.Context, username types.AccountKey) (types.Coin, sdk.Error)
- func (vm VoteManager) DelegatorWithdraw(ctx sdk.Context, voterName types.AccountKey, delegatorName types.AccountKey, ...) 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) GetLinoStake(ctx sdk.Context, accKey types.AccountKey) (types.Coin, sdk.Error)
- func (vm VoteManager) GetLinoStakeLastChangedAt(ctx sdk.Context, accKey types.AccountKey) (int64, 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) 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) MinusLinoStake(ctx sdk.Context, username types.AccountKey, coin types.Coin) sdk.Error
- func (vm VoteManager) SetLinoStakeLastChangedAt(ctx sdk.Context, accKey types.AccountKey, lastChangedAt int64) sdk.Error
- func (vm VoteManager) SetValidatorReferenceList(ctx sdk.Context, lst *model.ReferenceList) sdk.Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddStake ¶ added in v0.1.1
func AddStake( ctx sdk.Context, username types.AccountKey, stake types.Coin, vm VoteManager, gm global.GlobalManager, am acc.AccountManager, rm rep.ReputationManager) sdk.Error
func ErrAccountNotFound ¶
ErrAccountNotFound - error if account is not found
func ErrIllegalWithdraw ¶
ErrIllegalWithdraw - error if withdraw is illegal
func ErrInsufficientDeposit ¶
ErrInsufficientDeposit - error if voter deposit is insufficient
func ErrInvalidUsername ¶
ErrInvalidUsername - error if username is invalid
func ErrValidatorCannotRevoke ¶
ErrValidatorCannotRevoke - error if voter is validator
func ErrVoteAlreadyExist ¶
ErrVoteAlreadyExist - error if user already vote for a proposal
func ErrVoterNotFound ¶ added in v0.1.1
ErrVoteNotFound - error if voter is not found
func MinusStake ¶ added in v0.1.1
func MinusStake( ctx sdk.Context, username types.AccountKey, stake types.Coin, vm VoteManager, gm global.GlobalManager, am acc.AccountManager, rm rep.ReputationManager) sdk.Error
func NewHandler ¶
func NewHandler(vm VoteManager, am acc.AccountManager, gm global.GlobalManager, rm rep.ReputationManager) sdk.Handler
NewHandler - Handle all "vote" type messages.
Types ¶
type ClaimInterestMsg ¶ added in v0.1.1
type ClaimInterestMsg struct {
Username types.AccountKey `json:"username"`
}
ClaimInterestMsg - claim interest generated from lino power
func NewClaimInterestMsg ¶ added in v0.1.1
func NewClaimInterestMsg(username string) ClaimInterestMsg
NewClaimInterestMsg - return a ClaimInterestMsg
func (ClaimInterestMsg) GetConsumeAmount ¶ added in v0.1.1
func (msg ClaimInterestMsg) GetConsumeAmount() types.Coin
GetConsumeAmount - implements types.Msg
func (ClaimInterestMsg) GetPermission ¶ added in v0.1.1
func (msg ClaimInterestMsg) GetPermission() types.Permission
GetPermission - implements types.Msg
func (ClaimInterestMsg) GetSignBytes ¶ added in v0.1.1
func (msg ClaimInterestMsg) GetSignBytes() []byte
GetSignBytes - implements sdk.Msg
func (ClaimInterestMsg) GetSigners ¶ added in v0.1.1
func (msg ClaimInterestMsg) GetSigners() []sdk.AccAddress
GetSigners - implements sdk.Msg
func (ClaimInterestMsg) String ¶ added in v0.1.1
func (msg ClaimInterestMsg) String() string
func (ClaimInterestMsg) Type ¶ added in v0.1.1
func (msg ClaimInterestMsg) Type() string
Type - implements sdk.Msg
func (ClaimInterestMsg) ValidateBasic ¶ added in v0.1.1
func (msg ClaimInterestMsg) ValidateBasic() sdk.Error
ValidateBasic - implements sdk.Msg
type DelegateMsg ¶
type DelegateMsg struct { Delegator types.AccountKey `json:"delegator"` Voter types.AccountKey `json:"voter"` Amount types.LNO `json:"amount"` }
DelegateMsg - delegator delegate money to a voter
func NewDelegateMsg ¶
func NewDelegateMsg(delegator string, voter string, amount types.LNO) DelegateMsg
NewDelegateMsg - return DelegateMsg
func (DelegateMsg) GetConsumeAmount ¶
func (msg DelegateMsg) GetConsumeAmount() types.Coin
GetConsumeAmount - implement types.Msg
func (DelegateMsg) GetPermission ¶
func (msg DelegateMsg) GetPermission() types.Permission
GetPermission - implements types.Msg
func (DelegateMsg) GetSignBytes ¶
func (msg DelegateMsg) GetSignBytes() []byte
GetSignBytes - implements sdk.Msg
func (DelegateMsg) GetSigners ¶
func (msg DelegateMsg) GetSigners() []sdk.AccAddress
GetSigners - implements sdk.Msg
func (DelegateMsg) String ¶
func (msg DelegateMsg) String() string
func (DelegateMsg) ValidateBasic ¶
func (msg DelegateMsg) ValidateBasic() sdk.Error
ValidateBasic - implements sdk.Msg
type DelegatorWithdrawMsg ¶
type DelegatorWithdrawMsg struct { Delegator types.AccountKey `json:"delegator"` Voter types.AccountKey `json:"voter"` Amount types.LNO `json:"amount"` }
DelegatorWithdrawMsg - delegator withdraw delegation from a voter
func NewDelegatorWithdrawMsg ¶
func NewDelegatorWithdrawMsg(delegator string, voter string, amount types.LNO) DelegatorWithdrawMsg
NewDelegatorWithdrawMsg - return NewDelegatorWithdrawMsg
func (DelegatorWithdrawMsg) GetConsumeAmount ¶
func (msg DelegatorWithdrawMsg) GetConsumeAmount() types.Coin
GetConsumeAmount - implement types.Msg
func (DelegatorWithdrawMsg) GetPermission ¶
func (msg DelegatorWithdrawMsg) GetPermission() types.Permission
GetPermission - implements types.Msg
func (DelegatorWithdrawMsg) GetSignBytes ¶
func (msg DelegatorWithdrawMsg) GetSignBytes() []byte
GetSignBytes - implements sdk.Msg
func (DelegatorWithdrawMsg) GetSigners ¶
func (msg DelegatorWithdrawMsg) GetSigners() []sdk.AccAddress
GetSigners - implements sdk.Msg
func (DelegatorWithdrawMsg) String ¶
func (msg DelegatorWithdrawMsg) String() string
func (DelegatorWithdrawMsg) Type ¶
func (msg DelegatorWithdrawMsg) Type() string
Type - implements sdk.Msg
func (DelegatorWithdrawMsg) ValidateBasic ¶
func (msg DelegatorWithdrawMsg) ValidateBasic() sdk.Error
ValidateBasic - implements sdk.Msg
type StakeInMsg ¶ added in v0.1.1
type StakeInMsg struct { Username types.AccountKey `json:"username"` Deposit types.LNO `json:"deposit"` }
StakeInMsg - voter deposit
func NewStakeInMsg ¶ added in v0.1.1
func NewStakeInMsg(username string, deposit types.LNO) StakeInMsg
NewStakeInMsg - return a StakeInMsg
func (StakeInMsg) GetConsumeAmount ¶ added in v0.1.1
func (msg StakeInMsg) GetConsumeAmount() types.Coin
GetConsumeAmount - implement types.Msg
func (StakeInMsg) GetPermission ¶ added in v0.1.1
func (msg StakeInMsg) GetPermission() types.Permission
GetPermission - implements types.Msg
func (StakeInMsg) GetSignBytes ¶ added in v0.1.1
func (msg StakeInMsg) GetSignBytes() []byte
GetSignBytes - implements sdk.Msg
func (StakeInMsg) GetSigners ¶ added in v0.1.1
func (msg StakeInMsg) GetSigners() []sdk.AccAddress
GetSigners - implements sdk.Msg
func (StakeInMsg) String ¶ added in v0.1.1
func (msg StakeInMsg) String() string
func (StakeInMsg) Type ¶ added in v0.1.1
func (msg StakeInMsg) Type() string
Type - implements sdk.Msg
func (StakeInMsg) ValidateBasic ¶ added in v0.1.1
func (msg StakeInMsg) ValidateBasic() sdk.Error
ValidateBasic - implements sdk.Msg
type StakeOutMsg ¶ added in v0.1.1
type StakeOutMsg struct { Username types.AccountKey `json:"username"` Amount types.LNO `json:"amount"` }
StakeOutMsg - voter withdraw
func NewStakeOutMsg ¶ added in v0.1.1
func NewStakeOutMsg(username string, amount types.LNO) StakeOutMsg
NewStakeOutMsg - return StakeOutMsg
func (StakeOutMsg) GetConsumeAmount ¶ added in v0.1.1
func (msg StakeOutMsg) GetConsumeAmount() types.Coin
GetConsumeAmount - implement types.Msg
func (StakeOutMsg) GetPermission ¶ added in v0.1.1
func (msg StakeOutMsg) GetPermission() types.Permission
GetPermission - implements types.Msg
func (StakeOutMsg) GetSignBytes ¶ added in v0.1.1
func (msg StakeOutMsg) GetSignBytes() []byte
GetSignBytes - implements sdk.Msg
func (StakeOutMsg) GetSigners ¶ added in v0.1.1
func (msg StakeOutMsg) GetSigners() []sdk.AccAddress
GetSigners - implements sdk.Msg
func (StakeOutMsg) String ¶ added in v0.1.1
func (msg StakeOutMsg) String() string
func (StakeOutMsg) Type ¶ added in v0.1.1
func (msg StakeOutMsg) Type() string
Type - implements sdk.Msg
func (StakeOutMsg) ValidateBasic ¶ added in v0.1.1
func (msg StakeOutMsg) ValidateBasic() sdk.Error
ValidateBasic - implements sdk.Msg
type VoteManager ¶
type VoteManager struct {
// contains filtered or unexported fields
}
VoteManager - vote manager
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
AddDelegation - add delegation
func (VoteManager) AddInterest ¶ added in v0.1.1
func (vm VoteManager) AddInterest( ctx sdk.Context, username types.AccountKey, interest types.Coin) sdk.Error
AddInterest - add interst
func (VoteManager) AddLinoStake ¶ added in v0.1.1
func (vm VoteManager) AddLinoStake(ctx sdk.Context, username types.AccountKey, coin types.Coin) sdk.Error
AddLinoStake - add lino power
func (VoteManager) AddVote ¶
func (vm VoteManager) AddVote(ctx sdk.Context, proposalID types.ProposalKey, voter types.AccountKey, res bool) sdk.Error
AddVote - voter vote for a proposal
func (VoteManager) AddVoter ¶
func (vm VoteManager) AddVoter(ctx sdk.Context, username types.AccountKey, coin types.Coin) sdk.Error
AddVoter - add voter
func (VoteManager) CanBecomeValidator ¶
func (vm VoteManager) CanBecomeValidator(ctx sdk.Context, username types.AccountKey) bool
CanBecomeValidator - check if vote deposit meet requirement or not
func (VoteManager) ClaimInterest ¶ added in v0.1.1
func (vm VoteManager) ClaimInterest( ctx sdk.Context, username types.AccountKey) (types.Coin, sdk.Error)
ClaimInterest - add lino power interst to user balance
func (VoteManager) DelegatorWithdraw ¶
func (vm VoteManager) DelegatorWithdraw( ctx sdk.Context, voterName types.AccountKey, delegatorName types.AccountKey, coin types.Coin) sdk.Error
DelegatorWithdraw - withdraw delegation
func (VoteManager) DoesDelegationExist ¶
func (vm VoteManager) DoesDelegationExist(ctx sdk.Context, voter types.AccountKey, delegator types.AccountKey) bool
DoesVoterExist - check if delegation exist or not
func (VoteManager) DoesVoteExist ¶
func (vm VoteManager) DoesVoteExist(ctx sdk.Context, proposalID types.ProposalKey, accKey types.AccountKey) bool
DoesVoterExist - check if vote exist or not
func (VoteManager) DoesVoterExist ¶
func (vm VoteManager) DoesVoterExist(ctx sdk.Context, accKey types.AccountKey) bool
DoesVoterExist - check if voter exist or not
func (VoteManager) GetAllDelegators ¶
func (vm VoteManager) GetAllDelegators(ctx sdk.Context, voterName types.AccountKey) ([]types.AccountKey, sdk.Error)
GetAllDelegators - get all delegators of a voter
func (VoteManager) GetLinoStake ¶ added in v0.1.1
func (vm VoteManager) GetLinoStake(ctx sdk.Context, accKey types.AccountKey) (types.Coin, sdk.Error)
GetLinoStake - get lino stake
func (VoteManager) GetLinoStakeLastChangedAt ¶ added in v0.1.1
func (vm VoteManager) GetLinoStakeLastChangedAt(ctx sdk.Context, accKey types.AccountKey) (int64, sdk.Error)
GetLinoStakeLastChangedAt - get linoStake last changed time
func (VoteManager) GetPenaltyList ¶
func (vm VoteManager) GetPenaltyList( ctx sdk.Context, proposalID types.ProposalKey, proposalType types.ProposalType, oncallValidators []types.AccountKey) (types.PenaltyList, sdk.Error)
GetPenaltyList - get penalty list if voter is also validator doesn't vote
func (VoteManager) GetValidatorReferenceList ¶
func (vm VoteManager) GetValidatorReferenceList(ctx sdk.Context) (*model.ReferenceList, sdk.Error)
GetValidatorReferenceList - get all delegatee
func (VoteManager) GetVote ¶
func (vm VoteManager) GetVote(ctx sdk.Context, proposalID types.ProposalKey, voter types.AccountKey) (*model.Vote, sdk.Error)
GetVote - get vote detail based on voter and proposal ID
func (VoteManager) GetVotingPower ¶
func (vm VoteManager) GetVotingPower(ctx sdk.Context, voterName types.AccountKey) (types.Coin, sdk.Error)
GetVotingPower - get voter voting power
func (VoteManager) InitGenesis ¶
func (vm VoteManager) InitGenesis(ctx sdk.Context) error
InitGenesis - initialize KV Store
func (VoteManager) IsInValidatorList ¶
func (vm VoteManager) IsInValidatorList(ctx sdk.Context, username types.AccountKey) bool
DoesVoterExist - check if a voter is validator or not
func (VoteManager) IsLegalDelegatorWithdraw ¶
func (vm VoteManager) IsLegalDelegatorWithdraw( ctx sdk.Context, voterName types.AccountKey, delegatorName types.AccountKey, coin types.Coin) bool
IsLegalDelegatorWithdraw - check if delegator withdraw is valid or not
func (VoteManager) IsLegalVoterWithdraw ¶
func (vm VoteManager) IsLegalVoterWithdraw( ctx sdk.Context, username types.AccountKey, coin types.Coin) bool
IsLegalVoterWithdraw - check withdraw voter is not validator
func (VoteManager) MinusLinoStake ¶ added in v0.1.1
func (vm VoteManager) MinusLinoStake(ctx sdk.Context, username types.AccountKey, coin types.Coin) sdk.Error
MinusLinoStake - this method won't check if it is a legal withdraw, caller should check by itself
func (VoteManager) SetLinoStakeLastChangedAt ¶ added in v0.1.1
func (vm VoteManager) SetLinoStakeLastChangedAt(ctx sdk.Context, accKey types.AccountKey, lastChangedAt int64) sdk.Error
SetLinoStakeLastChangedAt - set linoStake last changed time
func (VoteManager) SetValidatorReferenceList ¶
func (vm VoteManager) SetValidatorReferenceList(ctx sdk.Context, lst *model.ReferenceList) sdk.Error
SetValidatorReferenceList - set validator reference list