mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-24 23:35:19 +00:00
Remove unused Hard module accounts (#796)
* remove unused hard module accs * update tests * update migration for compile * maintain migration
This commit is contained in:
parent
0343edf0d0
commit
c8d4c02fb7
@ -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},
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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)
|
||||
|
@ -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 {
|
||||
|
@ -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"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user