Skip to content

Commit

Permalink
fix: only run protorev distro on the day epoch
Browse files Browse the repository at this point in the history
  • Loading branch information
PaddyMc committed Apr 19, 2024
1 parent 38955eb commit edf6da8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions x/protorev/keeper/epoch_hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@ func (h EpochHooks) BeforeEpochStart(ctx sdk.Context, epochIdentifier string, ep
// AfterEpochEnd is the epoch end hook.
func (h EpochHooks) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNumber int64) error {
if h.k.GetProtoRevEnabled(ctx) {
// Calculate and distribute protorev profits
err := h.CalculateDistributeProfits(ctx)
if err != nil {
return err
}
switch epochIdentifier {
case "day":
// Calculate and distribute protorev profits
err := h.CalculateDistributeProfits(ctx)
if err != nil {
return err
}

// Increment number of days since module genesis to properly calculate developer fees after cyclic arbitrage trades
if daysSinceGenesis, err := h.k.GetDaysSinceModuleGenesis(ctx); err != nil {
h.k.SetDaysSinceModuleGenesis(ctx, 1)
Expand Down

0 comments on commit edf6da8

Please sign in to comment.