Documentation ¶
Index ¶
- Variables
- func GetLinoStakeStatKey(day int64) []byte
- func GetVoterKey(me linotypes.AccountKey) []byte
- func NewVoteDumper(store VoteStorage) *testutils.Dumper
- type LinoStakeStat
- type LinoStakeStatIR
- type StakeStatDayIR
- type VoteStorage
- func (vs VoteStorage) DoesVoterExist(ctx sdk.Context, accKey linotypes.AccountKey) bool
- func (vs VoteStorage) GetLinoStakeStat(ctx sdk.Context, day int64) (*LinoStakeStat, sdk.Error)
- func (vs VoteStorage) GetVoter(ctx sdk.Context, accKey linotypes.AccountKey) (*Voter, sdk.Error)
- func (vs VoteStorage) SetLinoStakeStat(ctx sdk.Context, day int64, lps *LinoStakeStat)
- func (vs VoteStorage) SetVoter(ctx sdk.Context, voter *Voter)
- 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} // SubStore for voter info. LinoStakeStatSubStore = []byte{0x02} // SubStore for lino stake statistic )
Functions ¶
func GetLinoStakeStatKey ¶ added in v0.6.0
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
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