model

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2019 License: Apache-2.0 Imports: 6 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	VoterSubstore = []byte{0x01}
)

Functions

func ErrFailedToMarshalVoter

func ErrFailedToMarshalVoter(err error) sdk.Error

ErrFailedToMarshalVoter - error if marshal voter failed

func ErrFailedToUnmarshalVoter

func ErrFailedToUnmarshalVoter(err error) sdk.Error

ErrFailedToUnmarshalVoter - error if unmarshal voter failed

func ErrReferenceListNotFound

func ErrReferenceListNotFound() sdk.Error

ErrReferenceListNotFound - error if reference list is not found in KVStore

func ErrVoteNotFound

func ErrVoteNotFound() sdk.Error

ErrVoteNotFound - error if vote is not found in KVStore

func ErrVoterNotFound

func ErrVoterNotFound() sdk.Error

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

func (VoteStorage) StoreMap added in v0.4.0

func (vs VoteStorage) StoreMap(ctx sdk.Context) utils.StoreMap

StoreMap - map of all substores

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

type VoterTablesIR struct {
	Version int       `json:"version"`
	Voters  []VoterIR `json:"voters"`
}

VoterTablesIR - state of voter

Jump to

Keyboard shortcuts

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