global

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2019 License: Apache-2.0 Imports: 10 Imported by: 8

Documentation

Index

Constants

View Source
const (
	// ModuleKey is the name of the module
	ModuleName = "global"

	// QuerierRoute is the querier route for gov
	QuerierRoute = ModuleName

	QueryTimeEventList   = "timeEventList"
	QueryGlobalMeta      = "globalMeta"
	QueryInflationPool   = "inflationPool"
	QueryConsumptionMeta = "consumptionMeta"
	QueryTPS             = "tps"
	QueryLinoStakeStat   = "linoStakeStat"
	QueryGlobalTime      = "globalTime"
)

Variables

This section is empty.

Functions

func BeginBlocker

func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, gm *GlobalManager)

BeginBlocker - called every begin blocker, udpate transaction per second

func EndBlocker added in v0.2.0

func EndBlocker(ctx sdk.Context, req abci.RequestEndBlock, gm *GlobalManager)

EndBlocker - related to upgrade1update3.

func ErrGetPastDay added in v0.1.1

func ErrGetPastDay() sdk.Error

ErrGetPastDay - error if get past day is negative

func ErrParseEventCacheList added in v0.2.0

func ErrParseEventCacheList() sdk.Error

ErrParseEventCacheList - error if parse event cache list failed

func ErrQueryFailed added in v0.2.0

func ErrQueryFailed() sdk.Error

ErrQueryFailed - error when query global store failed

func ErrRegisterExpiredEvent

func ErrRegisterExpiredEvent(unixTime int64) sdk.Error

ErrRegisterExpiredEvent - error when register event time is before current timestamp

func NewQuerier added in v0.2.0

func NewQuerier(gm GlobalManager) sdk.Querier

creates a querier for global REST endpoints

Types

type GlobalKeeper added in v0.3.0

type GlobalKeeper interface {
	AddFrictionAndRegisterContentRewardEvent(
		ctx sdk.Context, event types.Event, friction types.Coin, evaluate types.MiniDollar) sdk.Error
	GetConsumptionFrictionRate(ctx sdk.Context) (sdk.Dec, sdk.Error)
	GetRewardAndPopFromWindow(ctx sdk.Context, evaluate types.MiniDollar) (types.Coin, sdk.Error)
	AddToValidatorInflationPool(ctx sdk.Context, coin types.Coin) sdk.Error
	GetLastBlockTime(ctx sdk.Context) (int64, sdk.Error)

	// pop out developer monthly inflation from pool.
	PopDeveloperMonthlyInflation(ctx sdk.Context) (types.Coin, sdk.Error)

	// import export
	ImportFromFile(ctx sdk.Context, cdc *codec.Codec, filepath string) error
}

type GlobalManager

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

GlobalManager - encapsulates all basic struct

func NewGlobalManager

func NewGlobalManager(key sdk.StoreKey, holder param.ParamHolder) GlobalManager

NewGlobalManager - return the global manager

func (*GlobalManager) AddFrictionAndRegisterContentRewardEvent

func (gm *GlobalManager) AddFrictionAndRegisterContentRewardEvent(
	ctx sdk.Context, event types.Event, friction types.Coin, evaluate types.MiniDollar) sdk.Error

AddFrictionAndRegisterContentRewardEvent - register reward calculation event at 7 days later

func (*GlobalManager) AddLinoStakeToStat added in v0.1.1

func (gm *GlobalManager) AddLinoStakeToStat(ctx sdk.Context, linoStake types.Coin) sdk.Error

AddLinoStakeToStat - add lino power to total lino power at current day

func (*GlobalManager) AddToDeveloperInflationPool

func (gm *GlobalManager) AddToDeveloperInflationPool(ctx sdk.Context, coin types.Coin) sdk.Error

AddToDeveloperInflationPool - add coin to developer inflation pool

func (*GlobalManager) AddToValidatorInflationPool

func (gm *GlobalManager) AddToValidatorInflationPool(ctx sdk.Context, coin types.Coin) sdk.Error

AddToValidatorInflationPool - add validator inflation to pool

func (*GlobalManager) ClearEventCache added in v0.2.0

func (gm *GlobalManager) ClearEventCache(ctx sdk.Context) sdk.Error

ClearEventCache - clear event cache clear event cache will only be committed at the beginblocker

func (*GlobalManager) CommitEventCache added in v0.2.0

func (gm *GlobalManager) CommitEventCache(ctx sdk.Context) sdk.Error

CommitEvent - append event to event list Commit event cache will only be committed at the endblocker

func (*GlobalManager) DistributeHourlyInflation

func (gm *GlobalManager) DistributeHourlyInflation(ctx sdk.Context) sdk.Error

DistributeHourlyInflation - distribute inflation hourly

func (*GlobalManager) GetChainStartTime

func (gm *GlobalManager) GetChainStartTime(ctx sdk.Context) (int64, sdk.Error)

GetChainStartTime - get chain start time from KVStore

func (*GlobalManager) GetConsumptionFrictionRate

func (gm *GlobalManager) GetConsumptionFrictionRate(ctx sdk.Context) (sdk.Dec, sdk.Error)

GetConsumptionFrictionRate - get consumption friction rate

func (*GlobalManager) GetInfraMonthlyInflation

func (gm *GlobalManager) GetInfraMonthlyInflation(ctx sdk.Context) (types.Coin, sdk.Error)

GetInfraMonthlyInflation - get infra monthly inflation

func (*GlobalManager) GetInterestSince added in v0.1.1

func (gm *GlobalManager) GetInterestSince(ctx sdk.Context, unixTime int64, linoStake types.Coin) (types.Coin, sdk.Error)

GetInterestSince - get interest from unix time till now (exclusive)

func (*GlobalManager) GetLastBlockTime

func (gm *GlobalManager) GetLastBlockTime(ctx sdk.Context) (int64, sdk.Error)

GetLastBlockTime - get last block time from KVStore

func (*GlobalManager) GetPastDay added in v0.1.1

func (gm *GlobalManager) GetPastDay(ctx sdk.Context, unixTime int64) (int64, sdk.Error)

GetPastDay - get start time from KVStore to calculate past day

func (*GlobalManager) GetPastMinutes

func (gm *GlobalManager) GetPastMinutes(ctx sdk.Context) (int64, sdk.Error)

GetPastMinutes - get past minutes from KVStore

func (*GlobalManager) GetRewardAndPopFromWindow

func (gm *GlobalManager) GetRewardAndPopFromWindow(ctx sdk.Context, evaluate types.MiniDollar) (types.Coin, sdk.Error)

GetRewardAndPopFromWindow - after 7 days, one consumption needs to claim its reward from consumption reward pool

func (*GlobalManager) GetTPSCapacityRatio

func (gm *GlobalManager) GetTPSCapacityRatio(ctx sdk.Context) (sdk.Dec, sdk.Error)

GetTPSCapacityRatio - get transaction per second ratio

func (*GlobalManager) GetTimeEventListAtTime

func (gm *GlobalManager) GetTimeEventListAtTime(ctx sdk.Context, unixTime int64) *types.TimeEventList

GetTimeEventListAtTime - get time event list at given time

func (*GlobalManager) GetValidatorHourlyInflation

func (gm *GlobalManager) GetValidatorHourlyInflation(ctx sdk.Context) (types.Coin, sdk.Error)

GetValidatorHourlyInflation - get validator hourly inflation

func (*GlobalManager) ImportFromFile added in v0.3.0

func (gm *GlobalManager) ImportFromFile(ctx sdk.Context, cdc *codec.Codec, filepath string) error

func (*GlobalManager) InitGlobalManager

func (gm *GlobalManager) InitGlobalManager(ctx sdk.Context, totalLino types.Coin) sdk.Error

InitGlobalManager - initialize global manager based on code

func (*GlobalManager) InitGlobalManagerWithConfig

func (gm *GlobalManager) InitGlobalManagerWithConfig(
	ctx sdk.Context, totalLino types.Coin, param model.InitParamList) sdk.Error

InitGlobalManagerWithConfig - initialize global manager based on genesis file

func (*GlobalManager) MinusLinoStakeFromStat added in v0.1.1

func (gm *GlobalManager) MinusLinoStakeFromStat(ctx sdk.Context, linoStake types.Coin) sdk.Error

MinusLinoStakeFromStat - minus lino power from total lino power at current day

func (*GlobalManager) PopDeveloperMonthlyInflation added in v0.3.0

func (gm *GlobalManager) PopDeveloperMonthlyInflation(ctx sdk.Context) (types.Coin, sdk.Error)

PopDeveloperMonthlyInflation - pop out developer monthly inflation and reset current inflation pool to zero. Total coin amount will be updated.

func (*GlobalManager) RecordConsumptionAndLinoStake added in v0.1.1

func (gm *GlobalManager) RecordConsumptionAndLinoStake(ctx sdk.Context) sdk.Error

RecordConsumptionAndLinoStake - records consumption and lino power to LinoStakeStat and renew to new slot

func (*GlobalManager) RegisterCoinReturnEvent

func (gm *GlobalManager) RegisterCoinReturnEvent(
	ctx sdk.Context, events []types.Event, times int64, intervalSec int64) sdk.Error

RegisterCoinReturnEvent - register coin return event with time interval

func (*GlobalManager) RegisterParamChangeEvent

func (gm *GlobalManager) RegisterParamChangeEvent(ctx sdk.Context, event types.Event) sdk.Error

RegisterParamChangeEvent - register parameter change event

func (*GlobalManager) RegisterProposalDecideEvent

func (gm *GlobalManager) RegisterProposalDecideEvent(
	ctx sdk.Context, decideSec int64, event types.Event) sdk.Error

RegisterProposalDecideEvent - register proposal decide event

func (*GlobalManager) RemoveTimeEventList

func (gm *GlobalManager) RemoveTimeEventList(ctx sdk.Context, unixTime int64) sdk.Error

RemoveTimeEventList - remove time event list from KVstore at given time

func (*GlobalManager) SetChainStartTime

func (gm *GlobalManager) SetChainStartTime(ctx sdk.Context, unixTime int64) sdk.Error

SetChainStartTime - set chain start time to KVStore

func (*GlobalManager) SetLastBlockTime

func (gm *GlobalManager) SetLastBlockTime(ctx sdk.Context, unixTime int64) sdk.Error

SetLastBlockTime - set last block time to KVStore

func (*GlobalManager) SetPastMinutes

func (gm *GlobalManager) SetPastMinutes(ctx sdk.Context, minutes int64) sdk.Error

SetPastMinutes - set past minutes to KVStore

func (*GlobalManager) SetTotalLinoAndRecalculateGrowthRate added in v0.1.1

func (gm *GlobalManager) SetTotalLinoAndRecalculateGrowthRate(ctx sdk.Context) sdk.Error

SetTotalLinoAndRecalculateGrowthRate - recalculate annually inflation based on consumption growth rate

func (*GlobalManager) WireCodec

func (gm *GlobalManager) WireCodec() *wire.Codec

WireCodec - access to global manager codec

Directories

Path Synopsis
client
cli

Jump to

Keyboard shortcuts

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