From c8d4c02fb7e4df50ce73aff58112c82ae8e7074e Mon Sep 17 00:00:00 2001 From: Denali Marsh Date: Fri, 5 Feb 2021 12:45:37 +0100 Subject: [PATCH] Remove unused Hard module accounts (#796) * remove unused hard module accs * update tests * update migration for compile * maintain migration --- app/app.go | 2 -- x/hard/alias.go | 2 -- x/hard/genesis.go | 12 ------------ x/hard/keeper/querier.go | 4 ---- x/hard/keeper/timelock_test.go | 6 +++--- x/hard/types/keys.go | 6 ------ 6 files changed, 3 insertions(+), 29 deletions(-) diff --git a/app/app.go b/app/app.go index c62a7047..d4dc2228 100644 --- a/app/app.go +++ b/app/app.go @@ -102,8 +102,6 @@ var ( bep3.ModuleName: {supply.Minter, supply.Burner}, kavadist.ModuleName: {supply.Minter}, issuance.ModuleAccountName: {supply.Minter, supply.Burner}, - hard.LPAccount: {supply.Minter, supply.Burner}, - hard.DelegatorAccount: {supply.Minter, supply.Burner}, hard.ModuleAccountName: {supply.Minter, supply.Burner}, hard.LiquidatorAccount: {supply.Minter, supply.Burner}, } diff --git a/x/hard/alias.go b/x/hard/alias.go index e3e52e7e..31605563 100644 --- a/x/hard/alias.go +++ b/x/hard/alias.go @@ -21,7 +21,6 @@ const ( AttributeKeySender = types.AttributeKeySender AttributeValueCategory = types.AttributeValueCategory DefaultParamspace = types.DefaultParamspace - DelegatorAccount = types.DelegatorAccount EventTypeDeleteHardDeposit = types.EventTypeDeleteHardDeposit EventTypeHardLiquidation = types.EventTypeHardLiquidation EventTypeHardBorrow = types.EventTypeHardBorrow @@ -30,7 +29,6 @@ const ( EventTypeHardLPDistribution = types.EventTypeHardLPDistribution EventTypeHardRepay = types.EventTypeHardRepay EventTypeHardWithdrawal = types.EventTypeHardWithdrawal - LPAccount = types.LPAccount LiquidatorAccount = types.LiquidatorAccount ModuleAccountName = types.ModuleAccountName ModuleName = types.ModuleName diff --git a/x/hard/genesis.go b/x/hard/genesis.go index 5e7fff3f..61489c2b 100644 --- a/x/hard/genesis.go +++ b/x/hard/genesis.go @@ -38,18 +38,6 @@ func InitGenesis(ctx sdk.Context, k Keeper, supplyKeeper types.SupplyKeeper, gs k.SetBorrowedCoins(ctx, gs.TotalBorrowed) k.SetTotalReserves(ctx, gs.TotalReserves) - // check if the module account exists - LPModuleAcc := supplyKeeper.GetModuleAccount(ctx, LPAccount) - if LPModuleAcc == nil { - panic(fmt.Sprintf("%s module account has not been set", LPAccount)) - } - - // check if the module account exists - DelegatorModuleAcc := supplyKeeper.GetModuleAccount(ctx, DelegatorAccount) - if DelegatorModuleAcc == nil { - panic(fmt.Sprintf("%s module account has not been set", DelegatorAccount)) - } - // check if the module account exists DepositModuleAccount := supplyKeeper.GetModuleAccount(ctx, ModuleAccountName) if DepositModuleAccount == nil { diff --git a/x/hard/keeper/querier.go b/x/hard/keeper/querier.go index 5decb61c..c06db046 100644 --- a/x/hard/keeper/querier.go +++ b/x/hard/keeper/querier.go @@ -60,10 +60,6 @@ func queryGetModAccounts(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]by } else { acc := k.supplyKeeper.GetModuleAccount(ctx, types.ModuleAccountName) accs = append(accs, acc) - acc = k.supplyKeeper.GetModuleAccount(ctx, types.LPAccount) - accs = append(accs, acc) - acc = k.supplyKeeper.GetModuleAccount(ctx, types.DelegatorAccount) - accs = append(accs, acc) } bz, err := codec.MarshalJSONIndent(k.cdc, accs) diff --git a/x/hard/keeper/timelock_test.go b/x/hard/keeper/timelock_test.go index 47c413a7..8e043a35 100644 --- a/x/hard/keeper/timelock_test.go +++ b/x/hard/keeper/timelock_test.go @@ -300,19 +300,19 @@ func (suite *KeeperTestSuite) TestSendTimeLockedCoinsToAccount() { ak.SetAccount(ctx, pva) } supplyKeeper := tApp.GetSupplyKeeper() - supplyKeeper.MintCoins(ctx, types.LPAccount, sdk.NewCoins(sdk.NewCoin("hard", sdk.NewInt(1000)))) + supplyKeeper.MintCoins(ctx, types.LiquidatorAccount, sdk.NewCoins(sdk.NewCoin("hard", sdk.NewInt(1000)))) keeper := tApp.GetHardKeeper() suite.app = tApp suite.ctx = ctx suite.keeper = keeper - err := suite.keeper.SendTimeLockedCoinsToAccount(suite.ctx, types.LPAccount, tc.args.accArgs.addr, tc.args.period.Amount, tc.args.period.Length) + err := suite.keeper.SendTimeLockedCoinsToAccount(suite.ctx, types.LiquidatorAccount, tc.args.accArgs.addr, tc.args.period.Amount, tc.args.period.Length) if tc.errArgs.expectPass { suite.Require().NoError(err) acc := suite.getAccount(tc.args.accArgs.addr) suite.Require().Equal(tc.args.expectedAccountBalance, acc.GetCoins()) - mAcc := suite.getModuleAccount(types.LPAccount) + mAcc := suite.getModuleAccount(types.LiquidatorAccount) suite.Require().Equal(tc.args.expectedModAccountBalance, mAcc.GetCoins()) vacc, ok := acc.(*vesting.PeriodicVestingAccount) if tc.args.accArgs.vestingAccountAfter { diff --git a/x/hard/types/keys.go b/x/hard/types/keys.go index c9f8aed7..210a953b 100644 --- a/x/hard/types/keys.go +++ b/x/hard/types/keys.go @@ -8,12 +8,6 @@ const ( // ModuleName name that will be used throughout the module ModuleName = "hard" - // LPAccount LP distribution module account - LPAccount = "hard_lp_distribution" - - // DelegatorAccount delegator distribution module account - DelegatorAccount = "hard_delegator_distribution" - // LiquidatorAccount module account for liquidator LiquidatorAccount = "hard_liquidator"