Skip to content

Commit

Permalink
feat: include party information in estimate fee to calculate the disc…
Browse files Browse the repository at this point in the history
…ounts correctly
  • Loading branch information
ze97286 committed Aug 15, 2024
1 parent 678c909 commit 7182e88
Show file tree
Hide file tree
Showing 9 changed files with 3,278 additions and 2,852 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
- [11562](https://github.com/vegaprotocol/vega/issues/11562) - Update average notional metric with mark price at the end of the epoch and when calculating live score.
- [11570](https://github.com/vegaprotocol/vega/issues/11570) - Include the required set of parties for evaluation for eligible entities reward.
- [11576](https://github.com/vegaprotocol/vega/issues/11576) - Replace additional rebate validation with a cap.

- [11533](https://github.com/vegaprotocol/vega/issues/11533) - Suppose per party fee discounts in fee estimation.

### 🐛 Fixes

Expand Down
96 changes: 96 additions & 0 deletions datanode/api/mocks/epoch_service_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 52 additions & 0 deletions datanode/api/mocks/volume_service_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 26 additions & 3 deletions datanode/api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,29 @@ import (
"google.golang.org/grpc/status"
)

// VolumeDiscountService ...
//
//go:generate go run github.com/golang/mock/mockgen -destination mocks/volume_service_mock.go -package mocks code.vegaprotocol.io/vega/datanode/api VolumeDiscountService
type VolumeDiscountService interface {
Stats(ctx context.Context, atEpoch *uint64, partyID *string, pagination entities.CursorPagination) ([]entities.FlattenVolumeDiscountStats, entities.PageInfo, error)
}

// EpochService
//
//go:generate go run github.com/golang/mock/mockgen -destination mocks/epoch_service_mock.go -package mocks code.vegaprotocol.io/vega/datanode/api EpochService
type EpochService interface {
GetCurrent(ctx context.Context) (entities.Epoch, error)
GetByBlock(ctx context.Context, height uint64) (entities.Epoch, error)
Get(ctx context.Context, ID uint64) (entities.Epoch, error)
GetAll(ctx context.Context) ([]entities.Epoch, error)
}

type ReferralSetService interface {
GetReferralSetStats(ctx context.Context, setID *entities.ReferralSetID, atEpoch *uint64, referee *entities.PartyID, pagination entities.CursorPagination) ([]entities.FlattenReferralSetStats, entities.PageInfo, error)
ListReferralSets(ctx context.Context, referralSetID *entities.ReferralSetID, referrer, referee *entities.PartyID, pagination entities.CursorPagination) ([]entities.ReferralSet, entities.PageInfo, error)
ListReferralSetReferees(ctx context.Context, referralSetID *entities.ReferralSetID, referrer, referee *entities.PartyID, pagination entities.CursorPagination, aggregationEpochs uint32) ([]entities.ReferralSetRefereeStats, entities.PageInfo, error)
}

// EventService ...
//
//go:generate go run github.com/golang/mock/mockgen -destination mocks/event_service_mock.go -package mocks code.vegaprotocol.io/vega/datanode/api EventService
Expand Down Expand Up @@ -550,7 +573,7 @@ func (g *GRPCServer) Start(ctx context.Context, lis net.Listener) error {
delegationService: g.delegationService,
marketDepthService: g.marketDepthService,
nodeService: g.nodeService,
epochService: g.epochService,
EpochService: g.epochService,
RiskFactorService: g.riskFactorService,
networkParameterService: g.networkParameterService,
checkpointService: g.checkpointService,
Expand All @@ -567,11 +590,11 @@ func (g *GRPCServer) Start(ctx context.Context, lis net.Listener) error {
fundingPeriodService: g.fundingPeriodService,
partyActivityStreak: g.partyActivityStreak,
referralProgramService: g.referralProgramService,
referralSetsService: g.referralSetsService,
ReferralSetsService: g.referralSetsService,
teamsService: g.teamsService,
feesStatsService: g.FeesStatsService,
fundingPaymentService: g.fundingPaymentService,
volumeDiscountStatsService: g.volumeDiscountStatsService,
VolumeDiscountStatsService: g.volumeDiscountStatsService,
volumeDiscountProgramService: g.volumeDiscountProgramService,
paidLiquidityFeesStatsService: g.paidLiquidityFeesStatsService,
partyLockedBalances: g.partyLockedBalances,
Expand Down
Loading

0 comments on commit 7182e88

Please sign in to comment.