Skip to content

Commit

Permalink
Merge pull request #11657 from vegaprotocol/bb_auctions
Browse files Browse the repository at this point in the history
fix: set the tier number in party stats tiers
  • Loading branch information
ze97286 authored Sep 4, 2024
2 parents 1db541f + 9d1258c commit 2fb98a5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions datanode/service/party_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,12 @@ func (s *PSvc) getReferralTier(ctx context.Context, stats entities.FlattenReferr
if err != nil {
return nil, err
}
for _, bt := range current.BenefitTiers {
for i, bt := range current.BenefitTiers {
if bt.ReferralRewardFactors.InfrastructureRewardFactor == stats.RewardFactors.InfrastructureRewardFactor &&
bt.ReferralRewardFactors.LiquidityRewardFactor == stats.RewardFactors.LiquidityRewardFactor &&
bt.ReferralRewardFactors.MakerRewardFactor == stats.RewardFactors.MakerRewardFactor {
tierNumber := uint64(i)
bt.TierNumber = &tierNumber
return bt, nil
}
}
Expand All @@ -279,10 +281,11 @@ func (s *PSvc) getVolumeDiscountTier(ctx context.Context, stats entities.Flatten
if err != nil {
return nil, err
}
for i := len(current.BenefitTiers) - 1; i >= 0; i-- {
for i := uint64(len(current.BenefitTiers)) - 1; i >= uint64(0); i-- {
dt := current.BenefitTiers[i]
minV, _ := num.DecimalFromString(dt.MinimumRunningNotionalTakerVolume)
if vol.GreaterThanOrEqual(minV) {
dt.TierNumber = &i
return dt, nil
}
}
Expand All @@ -298,10 +301,11 @@ func (s *PSvc) getVolumeRebateTier(ctx context.Context, stats entities.FlattenVo
if err != nil {
return nil, err
}
for i := len(current.BenefitTiers) - 1; i >= 0; i-- {
for i := uint64(len(current.BenefitTiers)) - 1; i >= uint64(0); i-- {
bt := current.BenefitTiers[i]
minF, _ := num.DecimalFromString(bt.MinimumPartyMakerVolumeFraction)
if vf.GreaterThanOrEqual(minF) {
bt.TierNumber = &i
return bt, nil
}
}
Expand Down

0 comments on commit 2fb98a5

Please sign in to comment.