rewards

package
v0.77.7 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivityStreak added in v0.73.0

type ActivityStreak interface {
	GetRewardsDistributionMultiplier(party string) num.Decimal
}

type Broker

type Broker interface {
	Send(event events.Event)
	SendBatch(events []events.Event)
}

Broker for sending events.

type Collateral

type Collateral interface {
	GetAccountByID(id string) (*types.Account, error)
	TransferRewards(ctx context.Context, rewardAccountID string, transfers []*types.Transfer, rewardType types.AccountType) ([]*types.LedgerMovement, error)
	GetRewardAccountsByType(rewardAcccountType types.AccountType) []*types.Account
	GetAssetQuantum(asset string) (num.Decimal, error)
}

Collateral engine provides access to account data and transferring rewards.

type Config

type Config struct {
	Level encoding.LogLevel `long:"log-level"`
}

Config represent the configuration of the collateral engine.

func NewDefaultConfig

func NewDefaultConfig() Config

NewDefaultConfig creates an instance of the package specific configuration, given a pointer to a logger instance to be used for logging within the package.

type Delegation

type Delegation interface {
	ProcessEpochDelegations(ctx context.Context, epoch types.Epoch) []*types.ValidatorData
	GetValidatorData() []*types.ValidatorData
}

Delegation engine for getting validation data.

type Engine

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

Engine is the reward engine handling reward payouts.

func New

func New(log *logging.Logger, config Config, broker Broker, delegation Delegation, epochEngine EpochEngine, collateral Collateral, ts TimeService, marketActivityTracker MarketActivityTracker, topology Topology, vesting Vesting, transfers Transfers, activityStreak ActivityStreak) *Engine

New instantiate a new rewards engine.

func (*Engine) OnEpochEvent

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

OnEpochEvent calculates the reward amounts parties get for available reward schemes.

func (*Engine) OnEpochRestore

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

func (*Engine) UpdateAssetForStakingAndDelegation

func (e *Engine) UpdateAssetForStakingAndDelegation(ctx context.Context, asset string) error

func (*Engine) UpdateCompetitionLevelForStakingRewardScheme

func (e *Engine) UpdateCompetitionLevelForStakingRewardScheme(ctx context.Context, compLevel num.Decimal) error

UpdateCompetitionLevelForStakingRewardScheme is called when the competition level has changed.

func (*Engine) UpdateDelegatorShareForStakingRewardScheme

func (e *Engine) UpdateDelegatorShareForStakingRewardScheme(ctx context.Context, delegatorShare num.Decimal) error

UpdateDelegatorShareForStakingRewardScheme is a callback for changes in the network param for delegator share.

func (*Engine) UpdateErsatzRewardFactor

func (e *Engine) UpdateErsatzRewardFactor(ctx context.Context, ersatzRewardFactor num.Decimal) error

UpdateErsatzRewardFactor updates the ratio of staking and delegation reward that goes to ersatz validators.

func (*Engine) UpdateMaxPayoutPerParticipantForStakingRewardScheme

func (e *Engine) UpdateMaxPayoutPerParticipantForStakingRewardScheme(ctx context.Context, maxPayoutPerParticipant num.Decimal) error

UpdateMaxPayoutPerParticipantForStakingRewardScheme is a callback for changes in the network param for max payout per participant.

func (*Engine) UpdateMinValidatorsStakingRewardScheme

func (e *Engine) UpdateMinValidatorsStakingRewardScheme(ctx context.Context, minValidators int64) error

UpdateMinValidatorsStakingRewardScheme is called when the the network parameter for min validator has changed.

func (*Engine) UpdateMinimumValidatorStakeForStakingRewardScheme

func (e *Engine) UpdateMinimumValidatorStakeForStakingRewardScheme(ctx context.Context, minValStake num.Decimal) error

UpdateMinimumValidatorStakeForStakingRewardScheme updaates the value of minimum validator stake for being considered for rewards.

func (*Engine) UpdateOptimalStakeMultiplierStakingRewardScheme

func (e *Engine) UpdateOptimalStakeMultiplierStakingRewardScheme(ctx context.Context, optimalStakeMultiplier num.Decimal) error

UpdateOptimalStakeMultiplierStakingRewardScheme updaates the value of optimal stake multiplier.

type EpochEngine

type EpochEngine interface {
	NotifyOnEpoch(f func(context.Context, types.Epoch), r func(context.Context, types.Epoch))
}

EpochEngine notifies the reward engine at the end of an epoch.

type MarketActivityTracker

type MarketActivityTracker interface {
	GetAllMarketIDs() []string
	GetProposer(market string) string
	CalculateMetricForIndividuals(ctx context.Context, ds *vega.DispatchStrategy) []*types.PartyContributionScore
	CalculateMetricForTeams(ctx context.Context, ds *vega.DispatchStrategy) ([]*types.PartyContributionScore, map[string][]*types.PartyContributionScore)
	GetLastEpochTakeFees(asset string, market []string, epochs int32) map[string]*num.Uint
}

type Teams added in v0.73.0

type Teams interface {
	GetTeamMembers([]string) map[string][]string
	GetAllPartiesInTeams() []string
}

type TimeService

type TimeService interface {
	GetTimeNow() time.Time
}

TimeService notifies the reward engine on time updates.

type Topology

type Topology interface {
	GetRewardsScores(ctx context.Context, epochSeq string, delegationState []*types.ValidatorData, stakeScoreParams types.StakeScoreParams) (*types.ScoreData, *types.ScoreData)
	RecalcValidatorSet(ctx context.Context, epochSeq string, delegationState []*types.ValidatorData, stakeScoreParams types.StakeScoreParams) []*types.PartyContributionScore
}

type Transfers added in v0.73.0

type Transfers interface {
	GetDispatchStrategy(string) *proto.DispatchStrategy
}

type Vesting added in v0.73.0

type Vesting interface {
	AddReward(party, asset string, amount *num.Uint, lockedForEpochs uint64)
	GetSingleAndSummedRewardBonusMultipliers(party string) (vesting.MultiplierAndQuantBalance, vesting.MultiplierAndQuantBalance)
}

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