manager

package
v0.6.11 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MultiStakingHooks

type MultiStakingHooks []StakingHooks

combine multiple staking hooks, all hook functions are run in array sequence

func NewMultiStakingHooks

func NewMultiStakingHooks(hooks ...StakingHooks) MultiStakingHooks

func (MultiStakingHooks) AfterAddingStake

func (h MultiStakingHooks) AfterAddingStake(ctx sdk.Context, username linotypes.AccountKey) sdk.Error

nolint

func (MultiStakingHooks) AfterSlashing

func (h MultiStakingHooks) AfterSlashing(ctx sdk.Context, username linotypes.AccountKey) sdk.Error

func (MultiStakingHooks) AfterSubtractingStake

func (h MultiStakingHooks) AfterSubtractingStake(ctx sdk.Context, username linotypes.AccountKey) sdk.Error

type StakingHooks

type StakingHooks interface {
	AfterAddingStake(ctx sdk.Context, username linotypes.AccountKey) sdk.Error
	AfterSubtractingStake(ctx sdk.Context, username linotypes.AccountKey) sdk.Error
	AfterSlashing(ctx sdk.Context, username linotypes.AccountKey) sdk.Error
}

StakingHooks event hooks for staking validator object (noalias)

type VoteManager

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

VoteManager - vote manager

func NewVoteManager

func NewVoteManager(key sdk.StoreKey, holder param.ParamKeeper, am acc.AccountKeeper, gm global.GlobalKeeper) VoteManager

NewVoteManager - new vote manager

func (VoteManager) AfterAddingStake

func (vm VoteManager) AfterAddingStake(ctx sdk.Context, username linotypes.AccountKey) sdk.Error

AfterAddingStake - call hook if registered

func (VoteManager) AfterSlashing

func (vm VoteManager) AfterSlashing(ctx sdk.Context, username linotypes.AccountKey) sdk.Error

AfterSubtractingStake - call hook if registered

func (VoteManager) AfterSubtractingStake

func (vm VoteManager) AfterSubtractingStake(ctx sdk.Context, username linotypes.AccountKey) sdk.Error

AfterSubtractingStake - call hook if registered

func (VoteManager) AssignDuty

func (vm VoteManager) AssignDuty(ctx sdk.Context, username linotypes.AccountKey, duty types.VoterDuty, frozenAmount linotypes.Coin) sdk.Error

AssignDuty froze some amount of stake and assign a duty to user.

func (VoteManager) ClaimInterest

func (vm VoteManager) ClaimInterest(ctx sdk.Context, username linotypes.AccountKey) sdk.Error

ClaimInterest - add lino power interst to user balance

func (VoteManager) DailyAdvanceLinoStakeStats added in v0.6.0

func (vm VoteManager) DailyAdvanceLinoStakeStats(ctx sdk.Context) sdk.Error

AdvanceLinoStakeStats - save consumption and lino power to LinoStakeStat of a new day. It need to be executed daily.

func (VoteManager) DoesVoterExist

func (vm VoteManager) DoesVoterExist(ctx sdk.Context, username linotypes.AccountKey) bool

DoesVoterExist - check if voter exist or not

func (VoteManager) ExecUnassignDutyEvent

func (vm VoteManager) ExecUnassignDutyEvent(ctx sdk.Context, event types.UnassignDutyEvent) sdk.Error

ExecUnassignDutyEvent - execute unassign duty events.

func (VoteManager) ExportToFile

func (vm VoteManager) ExportToFile(ctx sdk.Context, cdc *codec.Codec, filepath string) error

Export storage state.

func (VoteManager) GetLinoStake

func (vm VoteManager) GetLinoStake(ctx sdk.Context, username linotypes.AccountKey) (linotypes.Coin, sdk.Error)

func (VoteManager) GetStakeStatsOfDay added in v0.6.0

func (vm VoteManager) GetStakeStatsOfDay(ctx sdk.Context, day int64) (*model.LinoStakeStat, sdk.Error)

func (VoteManager) GetVoter

func (vm VoteManager) GetVoter(ctx sdk.Context, username linotypes.AccountKey) (*model.Voter, sdk.Error)

func (VoteManager) GetVoterDuty

func (vm VoteManager) GetVoterDuty(ctx sdk.Context, username linotypes.AccountKey) (types.VoterDuty, sdk.Error)

func (VoteManager) ImportFromFile

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

Import storage state.

func (VoteManager) InitGenesis added in v0.6.0

func (vm VoteManager) InitGenesis(ctx sdk.Context)

func (VoteManager) RecordFriction added in v0.6.0

func (vm VoteManager) RecordFriction(ctx sdk.Context, friction linotypes.Coin) sdk.Error

func (*VoteManager) SetHooks

func (vm *VoteManager) SetHooks(sh StakingHooks) *VoteManager

Set the validator hooks

func (VoteManager) SlashStake

func (vm VoteManager) SlashStake(ctx sdk.Context, username linotypes.AccountKey, amount linotypes.Coin, destPool linotypes.PoolName) (slashedAmount linotypes.Coin, err sdk.Error)

SlashStake - slash as much as it can, regardless of frozen money

func (VoteManager) StakeIn

func (vm VoteManager) StakeIn(ctx sdk.Context, username linotypes.AccountKey, amount linotypes.Coin) sdk.Error

func (VoteManager) StakeInFor

func (vm VoteManager) StakeInFor(ctx sdk.Context, sender linotypes.AccountKey,
	receiver linotypes.AccountKey, amount linotypes.Coin) sdk.Error

func (VoteManager) StakeOut

func (vm VoteManager) StakeOut(ctx sdk.Context, username linotypes.AccountKey, amount linotypes.Coin) sdk.Error

func (VoteManager) UnassignDuty

func (vm VoteManager) UnassignDuty(ctx sdk.Context, username linotypes.AccountKey, waitingPeriodSec int64) sdk.Error

UnassignDuty register unassign duty event with time after waitingPeriodSec seconds.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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