diff --git a/x/protorev/keeper/epoch_hook.go b/x/protorev/keeper/epoch_hook.go index f19334d4b26..fee205b059c 100644 --- a/x/protorev/keeper/epoch_hook.go +++ b/x/protorev/keeper/epoch_hook.go @@ -33,10 +33,6 @@ func (h EpochHooks) BeforeEpochStart(ctx sdk.Context, epochIdentifier string, ep func (h EpochHooks) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNumber int64) error { if h.k.GetProtoRevEnabled(ctx) { switch epochIdentifier { - case "week": - // Distribute developer fees to the developer account. We do not error check because the developer account - // may not have been set by this point (gets set by the admin account after module genesis) - _ = h.k.SendDeveloperFeesToDeveloperAccount(ctx) case "day": // 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 { diff --git a/x/protorev/keeper/posthandler_test.go b/x/protorev/keeper/posthandler_test.go index 1e07cd1bef2..ae5dd5d44ea 100644 --- a/x/protorev/keeper/posthandler_test.go +++ b/x/protorev/keeper/posthandler_test.go @@ -11,6 +11,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" + "github.com/osmosis-labs/osmosis/v15/app/apptesting" gammtypes "github.com/osmosis-labs/osmosis/v15/x/gamm/types" poolmanagertypes "github.com/osmosis-labs/osmosis/v15/x/poolmanager/types" "github.com/osmosis-labs/osmosis/v15/x/protorev/keeper" @@ -89,6 +90,10 @@ func (suite *KeeperTestSuite) TestAnteHandle() { acc1 := suite.App.AccountKeeper.NewAccountWithAddress(suite.Ctx, addr0) suite.App.AccountKeeper.SetAccount(suite.Ctx, acc1) + // Set protorev developer account + devAccount := apptesting.CreateRandomAccounts(1)[0] + suite.App.ProtoRevKeeper.SetDeveloperAccount(suite.Ctx, devAccount) + // Keep testing order consistent to make adding tests easier // Add all tests that are not expected to execute a trade first // Then track number of trades and profits for the rest of the tests diff --git a/x/protorev/keeper/rebalance.go b/x/protorev/keeper/rebalance.go index a0cc071b01e..fa3bc2b7b71 100644 --- a/x/protorev/keeper/rebalance.go +++ b/x/protorev/keeper/rebalance.go @@ -220,6 +220,11 @@ func (k Keeper) ExecuteTrade(ctx sdk.Context, route poolmanagertypes.SwapAmountI return err } + // Send the developer fees to the developer + if err = k.SendDeveloperFeesToDeveloperAccount(ctx); err != nil { + return err + } + return nil } diff --git a/x/protorev/keeper/rebalance_test.go b/x/protorev/keeper/rebalance_test.go index 0dc6faaf2e6..b72e39106e8 100644 --- a/x/protorev/keeper/rebalance_test.go +++ b/x/protorev/keeper/rebalance_test.go @@ -3,6 +3,7 @@ package keeper_test import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/osmosis-labs/osmosis/v15/app/apptesting" poolmanagertypes "github.com/osmosis-labs/osmosis/v15/x/poolmanager/types" protorevtypes "github.com/osmosis-labs/osmosis/v15/x/protorev/keeper" "github.com/osmosis-labs/osmosis/v15/x/protorev/types" @@ -324,6 +325,10 @@ func (suite *KeeperTestSuite) TestExecuteTrade() { expectedProfit sdk.Int } + // Set protorev developer account + devAccount := apptesting.CreateRandomAccounts(1)[0] + suite.App.ProtoRevKeeper.SetDeveloperAccount(suite.Ctx, devAccount) + tests := []struct { name string param param