Documentation ¶
Index ¶
- 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 TimeService
- type Topology
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collateral ¶
type Collateral interface { GetAccountByID(id string) (*types.Account, error) TransferRewards(ctx context.Context, rewardAccountID string, transfers []*types.Transfer) ([]*types.LedgerMovement, error) GetRewardAccountsByType(rewardAcccountType types.AccountType) []*types.Account }
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) *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))
}
TimeService notifies the reward engine at the end of an epoch.
type MarketActivityTracker ¶
type MarketActivityTracker interface { GetAllMarketIDs() []string GetProposer(market string) string GetFeePartyScores(asset string, feeType types.TransferType) []*types.PartyContibutionScore }
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) }