Documentation ¶
Index ¶
- Constants
- Variables
- type Broker
- type Engine
- func (e *Engine) ApplyReferralCode(ctx context.Context, party types.PartyID, setID types.ReferralSetID) error
- func (e *Engine) CheckSufficientBalanceForApplyReferralCode(party types.PartyID, balance *num.Uint) error
- func (e *Engine) CheckSufficientBalanceForCreateOrUpdateReferralSet(party types.PartyID, balance *num.Uint) error
- func (e *Engine) CreateReferralSet(ctx context.Context, party types.PartyID, ...) error
- func (e *Engine) GetReferrer(referee types.PartyID) (types.PartyID, error)
- func (e *Engine) HasProgramEnded() bool
- func (e *Engine) OnEpoch(ctx context.Context, ep types.Epoch)
- func (e *Engine) OnEpochRestore(_ context.Context, ep types.Epoch)
- func (e *Engine) OnMinBalanceForApplyReferralCodeUpdated(_ context.Context, min *num.Uint) error
- func (e *Engine) OnMinBalanceForReferralProgramUpdated(_ context.Context, min *num.Uint) error
- func (e *Engine) OnReferralProgramMaxPartyNotionalVolumeByQuantumPerEpochUpdate(_ context.Context, value *num.Uint) error
- func (e *Engine) OnReferralProgramMaxReferralRewardProportionUpdate(_ context.Context, value num.Decimal) error
- func (e *Engine) OnReferralProgramMinStakedVegaTokensUpdate(_ context.Context, value *num.Uint) error
- func (e *Engine) PartyOwnsReferralSet(referer types.PartyID, setID types.ReferralSetID) error
- func (e *Engine) ReferralDiscountFactorsForParty(party types.PartyID) types.Factors
- func (e *Engine) RewardsFactorForParty(party types.PartyID) types.Factors
- func (e *Engine) RewardsFactorsMultiplierAppliedForParty(party types.PartyID) types.Factors
- func (e *Engine) RewardsMultiplierForParty(party types.PartyID) num.Decimal
- func (e *Engine) UpdateProgram(newProgram *types.ReferralProgram)
- type EpochEngine
- type MarketActivityTracker
- type SnapshottedEngine
- func (e *SnapshottedEngine) GetState(k string) ([]byte, []types.StateProvider, error)
- func (e *SnapshottedEngine) Keys() []string
- func (e *SnapshottedEngine) LoadState(_ context.Context, p *types.Payload) ([]types.StateProvider, error)
- func (e *SnapshottedEngine) Namespace() types.SnapshotNamespace
- func (e *SnapshottedEngine) StopSnapshots()
- func (e *SnapshottedEngine) Stopped() bool
- type StakingBalances
- type TimeService
Constants ¶
View Source
const MaximumWindowLength uint64 = 200
Variables ¶
View Source
var ( ErrIsAlreadyAReferee = func(party types.PartyID) error { return fmt.Errorf("party %q has already been referred", party) } ErrIsAlreadyAReferrer = func(party types.PartyID) error { return fmt.Errorf("party %q is already a referrer", party) } ErrUnknownReferralCode = func(code types.ReferralSetID) error { return fmt.Errorf("no referral set for referral code %q", code) } ErrNotEligibleForReferralRewards = func(party string, balance, required *num.Uint) error { return fmt.Errorf("party %q not eligible for referral rewards, staking balance required of %s got %s", party, required.String(), balance.String()) } ErrNotPartOfAReferralSet = func(party types.PartyID) error { return fmt.Errorf("party %q is not part of a referral set", party) } ErrPartyDoesNotOwnReferralSet = func(party types.PartyID) error { return fmt.Errorf("party %q does not own the referral set", party) } ErrUnknownSetID = errors.New("unknown set ID") )
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func NewEngine ¶
func NewEngine(broker Broker, timeSvc TimeService, mat MarketActivityTracker, staking StakingBalances) *Engine
func (*Engine) ApplyReferralCode ¶
func (*Engine) CheckSufficientBalanceForApplyReferralCode ¶
func (*Engine) CheckSufficientBalanceForCreateOrUpdateReferralSet ¶ added in v0.74.0
func (*Engine) CreateReferralSet ¶
func (*Engine) GetReferrer ¶
func (*Engine) HasProgramEnded ¶
func (*Engine) OnMinBalanceForApplyReferralCodeUpdated ¶
func (*Engine) OnMinBalanceForReferralProgramUpdated ¶ added in v0.74.0
func (*Engine) OnReferralProgramMaxPartyNotionalVolumeByQuantumPerEpochUpdate ¶
func (*Engine) OnReferralProgramMaxReferralRewardProportionUpdate ¶
func (*Engine) OnReferralProgramMinStakedVegaTokensUpdate ¶
func (*Engine) PartyOwnsReferralSet ¶ added in v0.75.2
func (*Engine) ReferralDiscountFactorsForParty ¶ added in v0.77.8
func (*Engine) RewardsFactorForParty ¶
func (*Engine) RewardsFactorsMultiplierAppliedForParty ¶ added in v0.77.8
func (*Engine) RewardsMultiplierForParty ¶
func (*Engine) UpdateProgram ¶
func (e *Engine) UpdateProgram(newProgram *types.ReferralProgram)
type EpochEngine ¶
type EpochEngine interface {
NotifyOnEpoch(func(context.Context, types.Epoch), func(context.Context, types.Epoch))
}
EpochEngine is used to know when to apply the team switches.
type MarketActivityTracker ¶
MarketActivityTracker is used to retrieve the trading statistics about a party to compute referral program related data.
type SnapshottedEngine ¶
type SnapshottedEngine struct { *Engine // contains filtered or unexported fields }
func NewSnapshottedEngine ¶
func NewSnapshottedEngine(broker Broker, timeSvc TimeService, mat MarketActivityTracker, staking StakingBalances) *SnapshottedEngine
func (*SnapshottedEngine) GetState ¶
func (e *SnapshottedEngine) GetState(k string) ([]byte, []types.StateProvider, error)
func (*SnapshottedEngine) Keys ¶
func (e *SnapshottedEngine) Keys() []string
func (*SnapshottedEngine) LoadState ¶
func (e *SnapshottedEngine) LoadState(_ context.Context, p *types.Payload) ([]types.StateProvider, error)
func (*SnapshottedEngine) Namespace ¶
func (e *SnapshottedEngine) Namespace() types.SnapshotNamespace
func (*SnapshottedEngine) StopSnapshots ¶
func (e *SnapshottedEngine) StopSnapshots()
func (*SnapshottedEngine) Stopped ¶
func (e *SnapshottedEngine) Stopped() bool
type StakingBalances ¶
type TimeService ¶
Click to show internal directories.
Click to hide internal directories.