mirror of
https://github.com/0glabs/0g-chain.git
synced 2025-01-12 16:25:17 +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},
|
bep3.ModuleName: {supply.Minter, supply.Burner},
|
||||||
kavadist.ModuleName: {supply.Minter},
|
kavadist.ModuleName: {supply.Minter},
|
||||||
issuance.ModuleAccountName: {supply.Minter, supply.Burner},
|
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.ModuleAccountName: {supply.Minter, supply.Burner},
|
||||||
hard.LiquidatorAccount: {supply.Minter, supply.Burner},
|
hard.LiquidatorAccount: {supply.Minter, supply.Burner},
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@ const (
|
|||||||
AttributeKeySender = types.AttributeKeySender
|
AttributeKeySender = types.AttributeKeySender
|
||||||
AttributeValueCategory = types.AttributeValueCategory
|
AttributeValueCategory = types.AttributeValueCategory
|
||||||
DefaultParamspace = types.DefaultParamspace
|
DefaultParamspace = types.DefaultParamspace
|
||||||
DelegatorAccount = types.DelegatorAccount
|
|
||||||
EventTypeDeleteHardDeposit = types.EventTypeDeleteHardDeposit
|
EventTypeDeleteHardDeposit = types.EventTypeDeleteHardDeposit
|
||||||
EventTypeHardLiquidation = types.EventTypeHardLiquidation
|
EventTypeHardLiquidation = types.EventTypeHardLiquidation
|
||||||
EventTypeHardBorrow = types.EventTypeHardBorrow
|
EventTypeHardBorrow = types.EventTypeHardBorrow
|
||||||
@ -30,7 +29,6 @@ const (
|
|||||||
EventTypeHardLPDistribution = types.EventTypeHardLPDistribution
|
EventTypeHardLPDistribution = types.EventTypeHardLPDistribution
|
||||||
EventTypeHardRepay = types.EventTypeHardRepay
|
EventTypeHardRepay = types.EventTypeHardRepay
|
||||||
EventTypeHardWithdrawal = types.EventTypeHardWithdrawal
|
EventTypeHardWithdrawal = types.EventTypeHardWithdrawal
|
||||||
LPAccount = types.LPAccount
|
|
||||||
LiquidatorAccount = types.LiquidatorAccount
|
LiquidatorAccount = types.LiquidatorAccount
|
||||||
ModuleAccountName = types.ModuleAccountName
|
ModuleAccountName = types.ModuleAccountName
|
||||||
ModuleName = types.ModuleName
|
ModuleName = types.ModuleName
|
||||||
|
@ -38,18 +38,6 @@ func InitGenesis(ctx sdk.Context, k Keeper, supplyKeeper types.SupplyKeeper, gs
|
|||||||
k.SetBorrowedCoins(ctx, gs.TotalBorrowed)
|
k.SetBorrowedCoins(ctx, gs.TotalBorrowed)
|
||||||
k.SetTotalReserves(ctx, gs.TotalReserves)
|
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
|
// check if the module account exists
|
||||||
DepositModuleAccount := supplyKeeper.GetModuleAccount(ctx, ModuleAccountName)
|
DepositModuleAccount := supplyKeeper.GetModuleAccount(ctx, ModuleAccountName)
|
||||||
if DepositModuleAccount == nil {
|
if DepositModuleAccount == nil {
|
||||||
|
@ -60,10 +60,6 @@ func queryGetModAccounts(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]by
|
|||||||
} else {
|
} else {
|
||||||
acc := k.supplyKeeper.GetModuleAccount(ctx, types.ModuleAccountName)
|
acc := k.supplyKeeper.GetModuleAccount(ctx, types.ModuleAccountName)
|
||||||
accs = append(accs, acc)
|
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)
|
bz, err := codec.MarshalJSONIndent(k.cdc, accs)
|
||||||
|
@ -300,19 +300,19 @@ func (suite *KeeperTestSuite) TestSendTimeLockedCoinsToAccount() {
|
|||||||
ak.SetAccount(ctx, pva)
|
ak.SetAccount(ctx, pva)
|
||||||
}
|
}
|
||||||
supplyKeeper := tApp.GetSupplyKeeper()
|
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()
|
keeper := tApp.GetHardKeeper()
|
||||||
suite.app = tApp
|
suite.app = tApp
|
||||||
suite.ctx = ctx
|
suite.ctx = ctx
|
||||||
suite.keeper = keeper
|
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 {
|
if tc.errArgs.expectPass {
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
acc := suite.getAccount(tc.args.accArgs.addr)
|
acc := suite.getAccount(tc.args.accArgs.addr)
|
||||||
suite.Require().Equal(tc.args.expectedAccountBalance, acc.GetCoins())
|
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())
|
suite.Require().Equal(tc.args.expectedModAccountBalance, mAcc.GetCoins())
|
||||||
vacc, ok := acc.(*vesting.PeriodicVestingAccount)
|
vacc, ok := acc.(*vesting.PeriodicVestingAccount)
|
||||||
if tc.args.accArgs.vestingAccountAfter {
|
if tc.args.accArgs.vestingAccountAfter {
|
||||||
|
@ -8,12 +8,6 @@ const (
|
|||||||
// ModuleName name that will be used throughout the module
|
// ModuleName name that will be used throughout the module
|
||||||
ModuleName = "hard"
|
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 module account for liquidator
|
||||||
LiquidatorAccount = "hard_liquidator"
|
LiquidatorAccount = "hard_liquidator"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user