vesting

package
v0.76.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var VestingKey = (&types.PayloadVesting{}).Key()

Functions

This section is empty.

Types

type ActivityStreakVestingMultiplier

type ActivityStreakVestingMultiplier interface {
	GetRewardsVestingMultiplier(party string) num.Decimal
}

type Assets

type Assets interface {
	Get(assetID string) (*assets.Asset, error)
}

type Broker

type Broker interface {
	Send(events events.Event)
}

type Collateral

type Collateral interface {
	TransferVestedRewards(
		ctx context.Context, transfers []*types.Transfer,
	) ([]*types.LedgerMovement, error)
	GetVestingRecovery() map[string]map[string]*num.Uint
	GetAllVestingQuantumBalance(party string) *num.Uint
	GetVestingAccounts() []*types.Account
}

type Config

type Config struct {
	// logging level
	Level encoding.LogLevel
}

func NewDefaultConfig

func NewDefaultConfig() Config

NewDefaultConfig creates an instance of the package specific configuration.

type Engine

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

func New

func New(
	log *logging.Logger,
	c Collateral,
	asvm ActivityStreakVestingMultiplier,
	broker Broker,
	assets Assets,
) *Engine

func (*Engine) AddReward

func (e *Engine) AddReward(
	party, asset string,
	amount *num.Uint,
	lockedForEpochs uint64,
)

func (*Engine) GetRewardBonusMultiplier

func (e *Engine) GetRewardBonusMultiplier(party string) (*num.Uint, num.Decimal)

func (*Engine) OnBenefitTiersUpdate

func (e *Engine) OnBenefitTiersUpdate(
	_ context.Context, v interface{},
) error

func (*Engine) OnCheckpointLoaded

func (e *Engine) OnCheckpointLoaded()

func (*Engine) OnEpochEvent

func (e *Engine) OnEpochEvent(ctx context.Context, epoch types.Epoch)

func (*Engine) OnEpochRestore

func (e *Engine) OnEpochRestore(ctx context.Context, epoch types.Epoch)

func (*Engine) OnRewardVestingBaseRateUpdate

func (e *Engine) OnRewardVestingBaseRateUpdate(
	_ context.Context, baseRate num.Decimal,
) error

func (*Engine) OnRewardVestingMinimumTransferUpdate

func (e *Engine) OnRewardVestingMinimumTransferUpdate(
	_ context.Context, minimumTransfer num.Decimal,
) error

func (*Engine) OnTick added in v0.73.8

func (e *Engine) OnTick(ctx context.Context, _ time.Time)

OnTick is called on the beginning of the block. In here this is a post upgrade.

type PartyRewards

type PartyRewards struct {
	// the amounts per assets still being locked in the
	// account and not available to be released
	// this is a map of:
	// asset -> (remainingEpochLock -> Amount)
	Locked map[string]map[uint64]*num.Uint
	// the current part of the vesting account
	// per asset available for vesting
	Vesting map[string]*num.Uint
}

type SnapshotEngine

type SnapshotEngine struct {
	*Engine
}

func NewSnapshotEngine

func NewSnapshotEngine(
	log *logging.Logger,
	c Collateral,
	asvm ActivityStreakVestingMultiplier,
	broker Broker,
	assets Assets,
) *SnapshotEngine

func (*SnapshotEngine) GetState

func (e *SnapshotEngine) GetState(k string) ([]byte, []types.StateProvider, error)

func (*SnapshotEngine) Keys

func (e *SnapshotEngine) Keys() []string

func (*SnapshotEngine) LoadState

func (e *SnapshotEngine) LoadState(ctx context.Context, p *types.Payload) ([]types.StateProvider, error)

func (*SnapshotEngine) Namespace

func (e *SnapshotEngine) Namespace() types.SnapshotNamespace

func (*SnapshotEngine) Stopped

func (e *SnapshotEngine) Stopped() bool

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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