model

package
v0.6.11 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2020 License: Apache-2.0 Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	VoterSubstore         = []byte{0x01} // SubStore for voter info.
	LinoStakeStatSubStore = []byte{0x02} // SubStore for lino stake statistic
)

Functions

func GetLinoStakeStatKey added in v0.6.0

func GetLinoStakeStatKey(day int64) []byte

GetLinoStakeStatKey - get lino power statistic at day from KVStore

func GetVoterKey

func GetVoterKey(me linotypes.AccountKey) []byte

GetVoterKey - "voter substore" + "voter"

func NewVoteDumper added in v0.6.0

func NewVoteDumper(store VoteStorage) *testutils.Dumper

Types

type LinoStakeStat added in v0.6.0

type LinoStakeStat struct {
	TotalConsumptionFriction linotypes.Coin `json:"total_consumption_friction"`
	UnclaimedFriction        linotypes.Coin `json:"unclaimed_friction"`
	TotalLinoStake           linotypes.Coin `json:"total_lino_power"`
	UnclaimedLinoStake       linotypes.Coin `json:"unclaimed_lino_power"`
}

LinoStakeStat - records the information needed by lino power deposit, update and store daily.

type LinoStakeStatIR added in v0.6.0

type LinoStakeStatIR struct {
	TotalConsumptionFriction linotypes.Coin `json:"total_consumption_friction"`
	UnclaimedFriction        linotypes.Coin `json:"unclaimed_friction"`
	TotalLinoStake           linotypes.Coin `json:"total_lino_power"`
	UnclaimedLinoStake       linotypes.Coin `json:"unclaimed_lino_power"`
}

LinoStakeStatIR - records the information needed by lino power deposit, update and store daily.

type StakeStatDayIR added in v0.6.0

type StakeStatDayIR struct {
	Day       int64           `json:"day"`
	StakeStat LinoStakeStatIR `json:"stake_stat"`
}

StakeStatDayIR - stake stats of a day, pk: day

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

func (vs VoteStorage) DoesVoterExist(ctx sdk.Context, accKey linotypes.AccountKey) bool

DoesVoterExist - check if voter exist in KVStore or not

func (VoteStorage) GetLinoStakeStat added in v0.6.0

func (vs VoteStorage) GetLinoStakeStat(ctx sdk.Context, day int64) (*LinoStakeStat, sdk.Error)

GetLinoStakeStat - get lino power statistic at given day

func (VoteStorage) GetVoter

func (vs VoteStorage) GetVoter(ctx sdk.Context, accKey linotypes.AccountKey) (*Voter, sdk.Error)

GetVoter - get voter from KVStore

func (VoteStorage) SetLinoStakeStat added in v0.6.0

func (vs VoteStorage) SetLinoStakeStat(ctx sdk.Context, day int64, lps *LinoStakeStat)

SetLinoStakeStat - set lino power statistic at given day

func (VoteStorage) SetVoter

func (vs VoteStorage) SetVoter(ctx sdk.Context, voter *Voter)

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"`
	StakeStats []StakeStatDayIR `json:"stake_stats"`
}

VoterTablesIR - state of voter

Jump to

Keyboard shortcuts

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