Documentation ¶
Index ¶
- Constants
- func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, gm *GlobalManager)
- func EndBlocker(ctx sdk.Context, req abci.RequestEndBlock, gm *GlobalManager)
- func ErrGetPastDay() sdk.Error
- func ErrParseEventCacheList() sdk.Error
- func ErrQueryFailed() sdk.Error
- func ErrRegisterExpiredEvent(unixTime int64) sdk.Error
- func NewQuerier(gm GlobalManager) sdk.Querier
- type GlobalKeeper
- type GlobalManager
- func (gm *GlobalManager) AddFrictionAndRegisterContentRewardEvent(ctx sdk.Context, event types.Event, friction types.Coin, ...) sdk.Error
- func (gm *GlobalManager) AddLinoStakeToStat(ctx sdk.Context, linoStake types.Coin) sdk.Error
- func (gm *GlobalManager) AddToDeveloperInflationPool(ctx sdk.Context, coin types.Coin) sdk.Error
- func (gm *GlobalManager) AddToValidatorInflationPool(ctx sdk.Context, coin types.Coin) sdk.Error
- func (gm *GlobalManager) ClearEventCache(ctx sdk.Context) sdk.Error
- func (gm *GlobalManager) CommitEventCache(ctx sdk.Context) sdk.Error
- func (gm *GlobalManager) DistributeHourlyInflation(ctx sdk.Context) sdk.Error
- func (gm *GlobalManager) GetChainStartTime(ctx sdk.Context) (int64, sdk.Error)
- func (gm *GlobalManager) GetConsumptionFrictionRate(ctx sdk.Context) (sdk.Dec, sdk.Error)
- func (gm *GlobalManager) GetInfraMonthlyInflation(ctx sdk.Context) (types.Coin, sdk.Error)
- func (gm *GlobalManager) GetInterestSince(ctx sdk.Context, unixTime int64, linoStake types.Coin) (types.Coin, sdk.Error)
- func (gm *GlobalManager) GetLastBlockTime(ctx sdk.Context) (int64, sdk.Error)
- func (gm *GlobalManager) GetPastDay(ctx sdk.Context, unixTime int64) (int64, sdk.Error)
- func (gm *GlobalManager) GetPastMinutes(ctx sdk.Context) (int64, sdk.Error)
- func (gm *GlobalManager) GetRewardAndPopFromWindow(ctx sdk.Context, evaluate types.MiniDollar) (types.Coin, sdk.Error)
- func (gm *GlobalManager) GetTPSCapacityRatio(ctx sdk.Context) (sdk.Dec, sdk.Error)
- func (gm *GlobalManager) GetTimeEventListAtTime(ctx sdk.Context, unixTime int64) *types.TimeEventList
- func (gm *GlobalManager) GetValidatorHourlyInflation(ctx sdk.Context) (types.Coin, sdk.Error)
- func (gm *GlobalManager) ImportFromFile(ctx sdk.Context, cdc *codec.Codec, filepath string) error
- func (gm *GlobalManager) InitGlobalManager(ctx sdk.Context, totalLino types.Coin) sdk.Error
- func (gm *GlobalManager) InitGlobalManagerWithConfig(ctx sdk.Context, totalLino types.Coin, param model.InitParamList) sdk.Error
- func (gm *GlobalManager) MinusLinoStakeFromStat(ctx sdk.Context, linoStake types.Coin) sdk.Error
- func (gm *GlobalManager) PopDeveloperMonthlyInflation(ctx sdk.Context) (types.Coin, sdk.Error)
- func (gm *GlobalManager) RecordConsumptionAndLinoStake(ctx sdk.Context) sdk.Error
- func (gm *GlobalManager) RegisterCoinReturnEvent(ctx sdk.Context, events []types.Event, times int64, intervalSec int64) sdk.Error
- func (gm *GlobalManager) RegisterParamChangeEvent(ctx sdk.Context, event types.Event) sdk.Error
- func (gm *GlobalManager) RegisterProposalDecideEvent(ctx sdk.Context, decideSec int64, event types.Event) sdk.Error
- func (gm *GlobalManager) RemoveTimeEventList(ctx sdk.Context, unixTime int64) sdk.Error
- func (gm *GlobalManager) SetChainStartTime(ctx sdk.Context, unixTime int64) sdk.Error
- func (gm *GlobalManager) SetLastBlockTime(ctx sdk.Context, unixTime int64) sdk.Error
- func (gm *GlobalManager) SetPastMinutes(ctx sdk.Context, minutes int64) sdk.Error
- func (gm *GlobalManager) SetTotalLinoAndRecalculateGrowthRate(ctx sdk.Context) sdk.Error
- func (gm *GlobalManager) WireCodec() *wire.Codec
Constants ¶
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
ErrGetPastDay - error if get past day is negative
func ErrParseEventCacheList ¶ added in v0.2.0
ErrParseEventCacheList - error if parse event cache list failed
func ErrQueryFailed ¶ added in v0.2.0
ErrQueryFailed - error when query global store failed
func ErrRegisterExpiredEvent ¶
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
AddLinoStakeToStat - add lino power to total lino power at current day
func (*GlobalManager) AddToDeveloperInflationPool ¶
AddToDeveloperInflationPool - add coin to developer inflation pool
func (*GlobalManager) AddToValidatorInflationPool ¶
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 ¶
GetChainStartTime - get chain start time from KVStore
func (*GlobalManager) GetConsumptionFrictionRate ¶
GetConsumptionFrictionRate - get consumption friction rate
func (*GlobalManager) GetInfraMonthlyInflation ¶
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 ¶
GetLastBlockTime - get last block time from KVStore
func (*GlobalManager) GetPastDay ¶ added in v0.1.1
GetPastDay - get start time from KVStore to calculate past day
func (*GlobalManager) GetPastMinutes ¶
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 ¶
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 ¶
GetValidatorHourlyInflation - get validator hourly inflation
func (*GlobalManager) ImportFromFile ¶ added in v0.3.0
func (*GlobalManager) InitGlobalManager ¶
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
MinusLinoStakeFromStat - minus lino power from total lino power at current day
func (*GlobalManager) PopDeveloperMonthlyInflation ¶ added in v0.3.0
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 ¶
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 ¶
RemoveTimeEventList - remove time event list from KVstore at given time
func (*GlobalManager) SetChainStartTime ¶
SetChainStartTime - set chain start time to KVStore
func (*GlobalManager) SetLastBlockTime ¶
SetLastBlockTime - set last block time to KVStore
func (*GlobalManager) SetPastMinutes ¶
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