Documentation ¶
Index ¶
- Variables
- func ErrFailedToMarshalVoter(err error) sdk.Error
- func ErrFailedToUnmarshalVoter(err error) sdk.Error
- func ErrReferenceListNotFound() sdk.Error
- func ErrVoteNotFound() sdk.Error
- func ErrVoterNotFound() sdk.Error
- func GetVoterKey(me types.AccountKey) []byte
- type VoteStorage
- func (vs VoteStorage) DeleteVoter(ctx sdk.Context, username types.AccountKey) sdk.Error
- func (vs VoteStorage) DoesVoterExist(ctx sdk.Context, accKey types.AccountKey) bool
- func (vs VoteStorage) GetVoter(ctx sdk.Context, accKey types.AccountKey) (*Voter, sdk.Error)
- func (vs VoteStorage) SetVoter(ctx sdk.Context, accKey types.AccountKey, voter *Voter) sdk.Error
- func (vs VoteStorage) StoreMap(ctx sdk.Context) utils.StoreMap
- type Voter
- type VoterIR
- type VoterTablesIR
Constants ¶
This section is empty.
Variables ¶
var (
VoterSubstore = []byte{0x01}
)
Functions ¶
func ErrFailedToMarshalVoter ¶
ErrFailedToMarshalVoter - error if marshal voter failed
func ErrFailedToUnmarshalVoter ¶
ErrFailedToUnmarshalVoter - error if unmarshal voter failed
func ErrReferenceListNotFound ¶
ErrReferenceListNotFound - error if reference list is not found in KVStore
func ErrVoteNotFound ¶
ErrVoteNotFound - error if vote is not found in KVStore
func ErrVoterNotFound ¶
ErrVoterNotFound - error if voter is not found in KVStore
func GetVoterKey ¶
func GetVoterKey(me types.AccountKey) []byte
GetVoterKey - "voter substore" + "voter"
Types ¶
type VoteStorage ¶
type VoteStorage struct {
// contains filtered or unexported fields
}
VoteStorage - vote storage
func NewVoteStorage ¶
func NewVoteStorage(key sdk.StoreKey) VoteStorage
NewVoteStorage - new vote storage
func (VoteStorage) DeleteVoter ¶
func (vs VoteStorage) DeleteVoter(ctx sdk.Context, username types.AccountKey) sdk.Error
DeleteVoter - delete voter from KVStore
func (VoteStorage) DoesVoterExist ¶
func (vs VoteStorage) DoesVoterExist(ctx sdk.Context, accKey types.AccountKey) bool
DoesVoterExist - check if voter exist in KVStore or not
func (VoteStorage) GetVoter ¶
func (vs VoteStorage) GetVoter(ctx sdk.Context, accKey types.AccountKey) (*Voter, sdk.Error)
GetVoter - get voter from KVStore
func (VoteStorage) SetVoter ¶
func (vs VoteStorage) SetVoter(ctx sdk.Context, accKey types.AccountKey, voter *Voter) sdk.Error
SetVoter - set voter to KVStore
type Voter ¶
type Voter struct { Username linotypes.AccountKey `json:"username"` LinoStake linotypes.Coin `json:"lino_stake"` LastPowerChangeAt int64 `json:"last_power_change_at"` Interest linotypes.Coin `json:"interest"` Duty types.VoterDuty `json:"duty"` FrozenAmount linotypes.Coin `json:"frozen_amount"` }
Voter - a voter in blockchain is account with voter deposit, who can vote for a proposal
type VoterIR ¶ added in v0.4.0
type VoterIR struct { Username linotypes.AccountKey `json:"username"` LinoStake linotypes.Coin `json:"lino_stake"` LastPowerChangeAt int64 `json:"last_power_change_at"` Interest linotypes.Coin `json:"interest"` Duty types.VoterDuty `json:"duty"` FrozenAmount linotypes.Coin `json:"frozen_amount"` }
VoterIR - pk: username
type VoterTablesIR ¶ added in v0.2.0
VoterTablesIR - state of voter