Documentation ¶
Index ¶
- type ActivityStreak
- type Broker
- type Collateral
- type Config
- type Delegation
- type Engine
- func (e *Engine) OnEpochEvent(ctx context.Context, epoch types.Epoch)
- func (e *Engine) OnEpochRestore(ctx context.Context, epoch types.Epoch)
- func (e *Engine) UpdateAssetForStakingAndDelegation(ctx context.Context, asset string) error
- func (e *Engine) UpdateCompetitionLevelForStakingRewardScheme(ctx context.Context, compLevel num.Decimal) error
- func (e *Engine) UpdateDelegatorShareForStakingRewardScheme(ctx context.Context, delegatorShare num.Decimal) error
- func (e *Engine) UpdateErsatzRewardFactor(ctx context.Context, ersatzRewardFactor num.Decimal) error
- func (e *Engine) UpdateMaxPayoutPerParticipantForStakingRewardScheme(ctx context.Context, maxPayoutPerParticipant num.Decimal) error
- func (e *Engine) UpdateMinValidatorsStakingRewardScheme(ctx context.Context, minValidators int64) error
- func (e *Engine) UpdateMinimumValidatorStakeForStakingRewardScheme(ctx context.Context, minValStake num.Decimal) error
- func (e *Engine) UpdateOptimalStakeMultiplierStakingRewardScheme(ctx context.Context, optimalStakeMultiplier num.Decimal) error
- type EpochEngine
- type MarketActivityTracker
- type Teams
- type TimeService
- type Topology
- type Transfers
- type Vesting
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActivityStreak ¶ added in v0.73.0
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 ¶
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 ¶
OnEpochEvent calculates the reward amounts parties get for available reward schemes.
func (*Engine) OnEpochRestore ¶
func (*Engine) UpdateAssetForStakingAndDelegation ¶
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.
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 TimeService ¶
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
}