Skip to content

Commit

Permalink
fix: ensure tiers are set by core, fix gqlgen for yaml linter
Browse files Browse the repository at this point in the history
Signed-off-by: Elias Van Ootegem <elias@vega.xyz>
  • Loading branch information
EVODelavega committed Aug 20, 2024
1 parent 6803e6a commit a59c294
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion core/types/rebate_program.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"time"

"code.vegaprotocol.io/vega/libs/num"
"code.vegaprotocol.io/vega/libs/ptr"
vegapb "code.vegaprotocol.io/vega/protos/vega"
)

Expand All @@ -42,10 +43,11 @@ type VolumeRebateBenefitTier struct {

func (v VolumeRebateProgram) IntoProto() *vegapb.VolumeRebateProgram {
benefitTiers := make([]*vegapb.VolumeRebateBenefitTier, 0, len(v.VolumeRebateBenefitTiers))
for _, tier := range v.VolumeRebateBenefitTiers {
for i, tier := range v.VolumeRebateBenefitTiers {
benefitTiers = append(benefitTiers, &vegapb.VolumeRebateBenefitTier{
MinimumPartyMakerVolumeFraction: tier.MinimumPartyMakerVolumeFraction.String(),
AdditionalMakerRebate: tier.AdditionalMakerRebate.String(),
TierNumber: ptr.From(uint64(i + 1)),
})
}

Expand Down
4 changes: 3 additions & 1 deletion core/types/referral_program.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"time"

"code.vegaprotocol.io/vega/libs/num"
"code.vegaprotocol.io/vega/libs/ptr"
vegapb "code.vegaprotocol.io/vega/protos/vega"
)

Expand Down Expand Up @@ -172,12 +173,13 @@ func (c ReferralProgram) String() string {

func (c ReferralProgram) IntoProto() *vegapb.ReferralProgram {
benefitTiers := make([]*vegapb.BenefitTier, 0, len(c.BenefitTiers))
for _, tier := range c.BenefitTiers {
for i, tier := range c.BenefitTiers {
benefitTiers = append(benefitTiers, &vegapb.BenefitTier{
MinimumEpochs: tier.MinimumEpochs.String(),
MinimumRunningNotionalTakerVolume: tier.MinimumRunningNotionalTakerVolume.String(),
ReferralRewardFactors: tier.ReferralRewardFactors.IntoRewardFactorsProto(),
ReferralDiscountFactors: tier.ReferralDiscountFactors.IntoDiscountFactorsProto(),
TierNumber: ptr.From(uint64(i + 1)),
})
}

Expand Down
4 changes: 3 additions & 1 deletion core/types/volume_discount_program.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"time"

"code.vegaprotocol.io/vega/libs/num"
"code.vegaprotocol.io/vega/libs/ptr"
vegapb "code.vegaprotocol.io/vega/protos/vega"
)

Expand All @@ -42,10 +43,11 @@ type VolumeBenefitTier struct {

func (v VolumeDiscountProgram) IntoProto() *vegapb.VolumeDiscountProgram {
benefitTiers := make([]*vegapb.VolumeBenefitTier, 0, len(v.VolumeBenefitTiers))
for _, tier := range v.VolumeBenefitTiers {
for i, tier := range v.VolumeBenefitTiers {
benefitTiers = append(benefitTiers, &vegapb.VolumeBenefitTier{
MinimumRunningNotionalTakerVolume: tier.MinimumRunningNotionalTakerVolume.String(),
VolumeDiscountFactors: tier.VolumeDiscountFactors.IntoDiscountFactorsProto(),
TierNumber: ptr.From(uint64(i + 1)),
})
}

Expand Down
1 change: 0 additions & 1 deletion datanode/gateway/graphql/gqlgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -848,4 +848,3 @@ models:
model: code.vegaprotocol.io/vega/protos/data-node/api/v2.GetPartyDiscountStatsResponse
MarketFees:
model: code.vegaprotocol.io/vega/protos/data-node/api/v2.MarketFees

0 comments on commit a59c294

Please sign in to comment.