vote

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddStake added in v0.1.1

func ErrAccountNotFound

func ErrAccountNotFound() sdk.Error

ErrAccountNotFound - error if account is not found

func ErrIllegalWithdraw

func ErrIllegalWithdraw() sdk.Error

ErrIllegalWithdraw - error if withdraw is illegal

func ErrInsufficientDeposit

func ErrInsufficientDeposit() sdk.Error

ErrInsufficientDeposit - error if voter deposit is insufficient

func ErrInvalidCoin

func ErrInvalidCoin() sdk.Error

ErrInvalidCoin - error if coin is invalid

func ErrInvalidUsername

func ErrInvalidUsername() sdk.Error

ErrInvalidUsername - error if username is invalid

func ErrValidatorCannotRevoke

func ErrValidatorCannotRevoke() sdk.Error

ErrValidatorCannotRevoke - error if voter is validator

func ErrVoteAlreadyExist

func ErrVoteAlreadyExist() sdk.Error

ErrVoteAlreadyExist - error if user already vote for a proposal

func ErrVoterNotFound added in v0.1.1

func ErrVoterNotFound() sdk.Error

ErrVoteNotFound - error if voter is not found

func MinusStake added in v0.1.1

func NewHandler

NewHandler - Handle all "vote" type messages.

func RegisterWire

func RegisterWire(cdc *wire.Codec)

Register concrete types on wire codec

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) Type

func (msg DelegateMsg) Type() string

Type - implements sdk.Msg

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

Directories

Path Synopsis
commands

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL