model

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2019 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TimeEventListSubStore   = []byte{0x00} // SubStore for time event list
	GlobalMetaSubStore      = []byte{0x01} // SubStore for global meta
	InflationPoolSubStore   = []byte{0x02} // SubStore for allocation
	ConsumptionMetaSubStore = []byte{0x03} // SubStore for consumption meta
	TpsSubStore             = []byte{0x04} // SubStore for tps
	TimeSubStore            = []byte{0x05} // SubStore for time
	LinoStakeStatSubStore   = []byte{0x06} // SubStore for lino power statistic
)

Functions

func ErrFailedToMarshalConsumptionMeta

func ErrFailedToMarshalConsumptionMeta(err error) sdk.Error

ErrFailedToMarshalConsumptionMeta - error if marshal consumption meta failed

func ErrFailedToMarshalGlobalMeta

func ErrFailedToMarshalGlobalMeta(err error) sdk.Error

ErrFailedToMarshalGlobalMeta - error if marshal global meta failed

func ErrFailedToMarshalInflationPool

func ErrFailedToMarshalInflationPool(err error) sdk.Error

ErrFailedToMarshalInflationPool - error if marshal inflation pool failed

func ErrFailedToMarshalTPS

func ErrFailedToMarshalTPS(err error) sdk.Error

ErrFailedToMarshalTPS - error if marshal tps failed

func ErrFailedToMarshalTime

func ErrFailedToMarshalTime(err error) sdk.Error

ErrFailedToMarshalTime - error if marshal time failed

func ErrFailedToMarshalTimeEventList

func ErrFailedToMarshalTimeEventList(err error) sdk.Error

ErrFailedToMarshalTimeEventList - error if marshal time event list failed

func ErrFailedToUnmarshalConsumptionMeta

func ErrFailedToUnmarshalConsumptionMeta(err error) sdk.Error

ErrFailedToUnmarshalConsumptionMeta - error if unmarshal consumption meta failed

func ErrFailedToUnmarshalGlobalMeta

func ErrFailedToUnmarshalGlobalMeta(err error) sdk.Error

ErrFailedToUnmarshalGlobalMeta - error if unmarshal global meta failed

func ErrFailedToUnmarshalInflationPool

func ErrFailedToUnmarshalInflationPool(err error) sdk.Error

ErrFailedToUnmarshalInflationPool - error if unmarshal inflation pool failed

func ErrFailedToUnmarshalLinoStakeStatistic added in v0.1.1

func ErrFailedToUnmarshalLinoStakeStatistic(err error) sdk.Error

ErrFailedToUnmarshalLinoStakeStatistic - error if unmarshal lino power statistic failed

func ErrFailedToUnmarshalTPS

func ErrFailedToUnmarshalTPS(err error) sdk.Error

ErrFailedToUnmarshalTPS - error if unmarshal tps failed

func ErrFailedToUnmarshalTime

func ErrFailedToUnmarshalTime(err error) sdk.Error

ErrFailedToUnmarshalTime - error if unmarshal time failed

func ErrFailedToUnmarshalTimeEventList

func ErrFailedToUnmarshalTimeEventList(err error) sdk.Error

ErrFailedToUnmarshalTimeEventList - error if unmarshal time event list failed

func ErrGlobalConsumptionMetaNotFound

func ErrGlobalConsumptionMetaNotFound() sdk.Error

ErrGlobalConsumptionMetaNotFound - error if global consumption meta is not found in KVStore

func ErrGlobalMetaNotFound

func ErrGlobalMetaNotFound() sdk.Error

ErrGlobalMetaNotFound - error if global meta not found in KVStore

func ErrGlobalTPSNotFound

func ErrGlobalTPSNotFound() sdk.Error

ErrGlobalTPSNotFound - error if global tps is not found in KVStore

func ErrGlobalTimeNotFound

func ErrGlobalTimeNotFound() sdk.Error

ErrGlobalTimeNotFound - error if global time is not found in KVStore

func ErrInflationPoolNotFound

func ErrInflationPoolNotFound() sdk.Error

ErrInflationPoolNotFound - error if inflation pool is not found in KVStore

func ErrLinoStakeStatisticNotFound added in v0.1.1

func ErrLinoStakeStatisticNotFound() sdk.Error

ErrLinoStakeStatisticNotFound - error if lino power statistic not found in KVStore

func GetConsumptionMetaKey

func GetConsumptionMetaKey() []byte

GetConsumptionMetaKey - "consumption meta substore"

func GetGlobalMetaKey

func GetGlobalMetaKey() []byte

GetGlobalMetaKey - "global meta substore"

func GetInflationPoolKey

func GetInflationPoolKey() []byte

GetInflationPoolKey - "inflation pool substore"

func GetLinoStakeStatKey added in v0.1.1

func GetLinoStakeStatKey(day int64) []byte

GetLinoStakeStatKey - get lino power statistic at day from KVStore

func GetTPSKey

func GetTPSKey() []byte

GetTPSKey - "tps substore"

func GetTimeEventListKey

func GetTimeEventListKey(unixTime int64) []byte

GetTimeEventListKey - get time event list from KVStore

func GetTimeKey

func GetTimeKey() []byte

GetTimeKey - "time substore"

Types

type ConsumptionMeta

type ConsumptionMeta struct {
	ConsumptionFrictionRate      sdk.Dec          `json:"consumption_friction_rate"`
	ConsumptionWindow            types.MiniDollar `json:"consumption_window"`
	ConsumptionRewardPool        types.Coin       `json:"consumption_reward_pool"`
	ConsumptionFreezingPeriodSec int64            `json:"consumption_freezing_period_second"`
}

ConsumptionMeta ConsumptionFrictionRate: percentage the user consumption deducted and added to the TotalLinoInflationPool ConsumptionWindow records all content related consumption within the freezing period ConsumptionFreezingPeriodHr is the time content createor can get remain consumption after friction

type ConsumptionMetaIR added in v0.2.0

type ConsumptionMetaIR struct {
	ConsumptionFrictionRate      sdk.Dec          `json:"consumption_friction_rate"`
	ConsumptionWindow            types.MiniDollar `json:"consumption_window"`
	ConsumptionRewardPool        types.Coin       `json:"consumption_reward_pool"`
	ConsumptionFreezingPeriodSec int64            `json:"consumption_freezing_period_second"`
}

ConsumptionMetaIR - ConsumptionFrictionRate rat -> float string

type EventCache added in v0.2.0

type EventCache struct {
	UnixTime  int64         `json:"unix_time"`
	EventList []types.Event `json:"event_list"`
}

type GlobalMeta

type GlobalMeta struct {
	TotalLinoCoin         types.Coin `json:"total_lino_coin"`
	LastYearTotalLinoCoin types.Coin `json:"last_year_total_lino_coin"`
}

GlobalMeta - global statistic information

type GlobalMetaIR added in v0.4.0

type GlobalMetaIR struct {
	TotalLinoCoin         types.Coin `json:"total_lino_coin"`
	LastYearTotalLinoCoin types.Coin `json:"last_year_total_lino_coin"`
}

GlobalMetaIR - global statistic information

type GlobalStakeStatDayIR added in v0.4.0

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

GlobalStakeStatDayIR - stake stats of a day, pk: day

type GlobalStorage

type GlobalStorage struct {
	// contains filtered or unexported fields
}

GlobalStorage - global storage

func NewGlobalStorage

func NewGlobalStorage(key sdk.StoreKey) GlobalStorage

NewGlobalStorage - new global storage

func (GlobalStorage) GetConsumptionMeta

func (gs GlobalStorage) GetConsumptionMeta(ctx sdk.Context) (*ConsumptionMeta, sdk.Error)

GetConsumptionMeta - get consumption meta from KVStore

func (GlobalStorage) GetGlobalMeta

func (gs GlobalStorage) GetGlobalMeta(ctx sdk.Context) (*GlobalMeta, sdk.Error)

GetGlobalMeta - get global meta from KVStore

func (GlobalStorage) GetGlobalTime

func (gs GlobalStorage) GetGlobalTime(ctx sdk.Context) (*GlobalTime, sdk.Error)

GetGlobalTime - get global time from KVStore

func (GlobalStorage) GetInflationPool

func (gs GlobalStorage) GetInflationPool(ctx sdk.Context) (*InflationPool, sdk.Error)

GetInflationPool - get inflation pool from KVStore

func (GlobalStorage) GetLinoStakeStat added in v0.1.1

func (gs GlobalStorage) GetLinoStakeStat(ctx sdk.Context, day int64) (*LinoStakeStat, sdk.Error)

GetLinoStakeStat - get lino power statistic at given day

func (GlobalStorage) GetTPS

func (gs GlobalStorage) GetTPS(ctx sdk.Context) (*TPS, sdk.Error)

GetTPS - get tps from KVStore

func (GlobalStorage) GetTimeEventList

func (gs GlobalStorage) GetTimeEventList(ctx sdk.Context, unixTime int64) (*types.TimeEventList, sdk.Error)

GetTimeEventList - get time event list at given unix time

func (GlobalStorage) InitGlobalState

func (gs GlobalStorage) InitGlobalState(
	ctx sdk.Context, totalLino types.Coin) sdk.Error

InitGlobalState - initialization based on code

func (GlobalStorage) InitGlobalStateWithConfig

func (gs GlobalStorage) InitGlobalStateWithConfig(
	ctx sdk.Context, totalLino types.Coin, param InitParamList) sdk.Error

InitGlobalStateWithConfig - initialization based on genesis config file

func (GlobalStorage) PartialStoreMap added in v0.4.0

func (gs GlobalStorage) PartialStoreMap(ctx sdk.Context) utils.StoreMap

func (GlobalStorage) RemoveTimeEventList

func (gs GlobalStorage) RemoveTimeEventList(ctx sdk.Context, unixTime int64) sdk.Error

RemoveTimeEventList - remove time event list at given unix time

func (GlobalStorage) SetConsumptionMeta

func (gs GlobalStorage) SetConsumptionMeta(ctx sdk.Context, consumptionMeta *ConsumptionMeta) sdk.Error

SetConsumptionMeta - set consumption meta to KVStore

func (GlobalStorage) SetGlobalMeta

func (gs GlobalStorage) SetGlobalMeta(ctx sdk.Context, globalMeta *GlobalMeta) sdk.Error

SetGlobalMeta - set global meta to KVStore

func (GlobalStorage) SetGlobalTime

func (gs GlobalStorage) SetGlobalTime(ctx sdk.Context, globalTime *GlobalTime) sdk.Error

SetGlobalTime - set global time to KVStore

func (GlobalStorage) SetInflationPool

func (gs GlobalStorage) SetInflationPool(ctx sdk.Context, inflationPool *InflationPool) sdk.Error

SetInflationPool - set inflation pool to KVStore

func (GlobalStorage) SetLinoStakeStat added in v0.1.1

func (gs GlobalStorage) SetLinoStakeStat(ctx sdk.Context, day int64, lps *LinoStakeStat) sdk.Error

SetLinoStakeStat - set lino power statistic at given day

func (GlobalStorage) SetTPS

func (gs GlobalStorage) SetTPS(ctx sdk.Context, tps *TPS) sdk.Error

SetTPS - set tps to KVStore

func (GlobalStorage) SetTimeEventList

func (gs GlobalStorage) SetTimeEventList(ctx sdk.Context, unixTime int64, lst *types.TimeEventList) sdk.Error

SetTimeEventList - set time event list at given unix time

func (GlobalStorage) WireCodec

func (gs GlobalStorage) WireCodec() *wire.Codec

WireCodec - access to global storage codec

type GlobalTablesIR added in v0.2.0

type GlobalTablesIR struct {
	Version              int                    `json:"version"`
	GlobalTimeEventLists []GlobalTimeEventsIR   `json:"global_time_event_lists"`
	GlobalStakeStats     []GlobalStakeStatDayIR `json:"global_stake_stats"`
	Meta                 GlobalMetaIR           `json:"meta"`
	InflationPool        InflationPoolIR        `json:"inflation_pool"`
	ConsumptionMeta      ConsumptionMetaIR      `json:"consumption_meta"`
	TPS                  TPSIR                  `json:"tps"`
	Time                 GlobalTimeIR           `json:"time"`
}

GlobalTablesIR - state

type GlobalTime

type GlobalTime struct {
	ChainStartTime int64 `json:"chain_start_time"`
	LastBlockTime  int64 `json:"last_block_time"`
	PastMinutes    int64 `json:"past_minutes"`
}

GlobalTime - global time

type GlobalTimeEventsIR added in v0.4.0

type GlobalTimeEventsIR struct {
	UnixTime      int64               `json:"unix_time"`
	TimeEventList types.TimeEventList `json:"time_event_list"`
}

GlobalTimeEventsIR - events, pk: UnixTime

type GlobalTimeIR added in v0.4.0

type GlobalTimeIR struct {
	ChainStartTime int64 `json:"chain_start_time"`
	LastBlockTime  int64 `json:"last_block_time"`
	PastMinutes    int64 `json:"past_minutes"`
}

GlobalTimeIR - global time

type InflationPool

type InflationPool struct {
	DeveloperInflationPool types.Coin `json:"developer_inflation_pool"`
	ValidatorInflationPool types.Coin `json:"validator_inflation_pool"`
}

InflationPool, determined by GlobalAllocation DeveloperInflationPool inflation pool for developer ValidatorInflationPool inflation pool for validator

type InflationPoolIR added in v0.4.0

type InflationPoolIR struct {
	InfraInflationPool     types.Coin `json:"infra_inflation_pool"` // deprecated
	DeveloperInflationPool types.Coin `json:"developer_inflation_pool"`
	ValidatorInflationPool types.Coin `json:"validator_inflation_pool"`
}

InflationPoolIR -

type InitParamList

type InitParamList struct {
	MaxTPS                       sdk.Dec `json:"max_tps"`
	ConsumptionFrictionRate      sdk.Dec `json:"consumption_friction_rate"`
	ConsumptionFreezingPeriodSec int64   `json:"consumption_freezing_period_second"`
}

InitParamList - genesis parameters

type LinoStakeStat added in v0.1.1

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

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

type LinoStakeStatIR added in v0.4.0

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

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

type TPS

type TPS struct {
	CurrentTPS sdk.Dec `json:"current_tps"`
	MaxTPS     sdk.Dec `json:"max_tps"`
}

TPS - transaction per section

type TPSIR added in v0.2.0

type TPSIR struct {
	CurrentTPS sdk.Dec `json:"current_tps"`
	MaxTPS     sdk.Dec `json:"max_tps"`
}

TPSIR - all from rat to float string

Jump to

Keyboard shortcuts

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