Documentation ¶
Index ¶
- func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, gm GlobalManager) (tags sdk.Tags)
- func ErrAmountOfConsumptionExponent() sdk.Error
- func ErrGetPastDay() sdk.Error
- func ErrRegisterExpiredEvent(unixTime int64) sdk.Error
- func PostConsumptionTimesAdjustment(numOfConsumptionOnAuthor int64, paras *param.EvaluateOfContentValueParam) float64
- func PostTimeAdjustment(elapseTime int64, paras *param.EvaluateOfContentValueParam) float64
- func PostTotalConsumptionAdjustment(totalReward int64, paras *param.EvaluateOfContentValueParam) float64
- type GlobalManager
- func (gm GlobalManager) AddConsumption(ctx sdk.Context, coin types.Coin) sdk.Error
- func (gm GlobalManager) AddFrictionAndRegisterContentRewardEvent(ctx sdk.Context, event types.Event, friction types.Coin, evaluate 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) DistributeHourlyInflation(ctx sdk.Context) sdk.Error
- func (gm GlobalManager) EvaluateConsumption(ctx sdk.Context, coin types.Coin, numOfConsumptionOnAuthor int64, ...) (types.Coin, sdk.Error)
- func (gm GlobalManager) GetChainStartTime(ctx sdk.Context) (int64, sdk.Error)
- func (gm GlobalManager) GetConsumption(ctx sdk.Context) (types.Coin, sdk.Error)
- func (gm GlobalManager) GetConsumptionFrictionRate(ctx sdk.Context) (sdk.Rat, sdk.Error)
- func (gm GlobalManager) GetDeveloperMonthlyInflation(ctx sdk.Context) (types.Coin, 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.Coin, penaltyScore sdk.Rat) (types.Coin, sdk.Error)
- func (gm GlobalManager) GetTPSCapacityRatio(ctx sdk.Context) (sdk.Rat, 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) 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) 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) UpdateTPS(ctx sdk.Context) sdk.Error
- func (gm GlobalManager) WireCodec() *wire.Codec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BeginBlocker ¶
func BeginBlocker( ctx sdk.Context, req abci.RequestBeginBlock, gm GlobalManager) (tags sdk.Tags)
BeginBlocker - called every begin blocker, udpate transaction per second
func ErrAmountOfConsumptionExponent ¶ added in v0.1.1
ErrAmountOfConsumptionExponent - error when transfer global parameter from rat to float failed
func ErrGetPastDay ¶ added in v0.1.1
ErrGetPastDay - error if get past day is negative
func ErrRegisterExpiredEvent ¶
ErrRegisterExpiredEvent - error when register event time is before current timestamp
func PostConsumptionTimesAdjustment ¶
func PostConsumptionTimesAdjustment( numOfConsumptionOnAuthor int64, paras *param.EvaluateOfContentValueParam) float64
PostConsumptionTimesAdjustment - consumption times adjustment = 1/(1+e^(n-offset)) + 1
func PostTimeAdjustment ¶
func PostTimeAdjustment( elapseTime int64, paras *param.EvaluateOfContentValueParam) float64
PostTimeAdjustment - post time adjustment = 1/(1+e^(t/base - offset))
func PostTotalConsumptionAdjustment ¶
func PostTotalConsumptionAdjustment( totalReward int64, paras *param.EvaluateOfContentValueParam) float64
PostTotalConsumptionAdjustment - total consumption adjustment = 1/(1+e^(c/base - offset)) + 1
Types ¶
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) AddConsumption ¶
AddConsumption - add consumption to global meta, which is used to compute GDP
func (GlobalManager) AddFrictionAndRegisterContentRewardEvent ¶
func (gm GlobalManager) AddFrictionAndRegisterContentRewardEvent( ctx sdk.Context, event types.Event, friction types.Coin, evaluate types.Coin) 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) DistributeHourlyInflation ¶
func (gm GlobalManager) DistributeHourlyInflation(ctx sdk.Context) sdk.Error
DistributeHourlyInflation - distribute inflation hourly
func (GlobalManager) EvaluateConsumption ¶
func (gm GlobalManager) EvaluateConsumption( ctx sdk.Context, coin types.Coin, numOfConsumptionOnAuthor int64, created int64, totalReward types.Coin) (types.Coin, sdk.Error)
EvaluateConsumption - evaluate consumption
func (GlobalManager) GetChainStartTime ¶
GetChainStartTime - get chain start time from KVStore
func (GlobalManager) GetConsumption ¶
GetConsumption - get this year consumption
func (GlobalManager) GetConsumptionFrictionRate ¶
GetConsumptionFrictionRate - get consumption friction rate
func (GlobalManager) GetDeveloperMonthlyInflation ¶
GetDeveloperMonthlyInflation - get developer monthly inflation
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.Coin, penaltyScore sdk.Rat) (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) 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) 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) UpdateTPS ¶
func (gm GlobalManager) UpdateTPS(ctx sdk.Context) sdk.Error
UpdateTPS - update current tps based on current block information
func (GlobalManager) WireCodec ¶
func (gm GlobalManager) WireCodec() *wire.Codec
WireCodec - access to global manager codec