Skip to content

Commit

Permalink
move funds from unbonded to admin
Browse files Browse the repository at this point in the history
  • Loading branch information
puneet2019 committed Dec 17, 2024
1 parent 05e2d88 commit fcc3703
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
14 changes: 11 additions & 3 deletions x/liquidstakeibc/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ func (k msgServer) UpdateHostChain(
if err != nil {
return nil, err
}
_, err = k.SendICATransfer(ctx, hc, amount, hc.DelegationAccount.Address, k.GetUndelegationModuleAccount(ctx).GetAddress().String(), hc.DelegationAccount.Owner)
_, err = k.SendICATransfer(ctx, hc, amount, hc.DelegationAccount.Address, k.GetParams(ctx).AdminAddress, hc.DelegationAccount.Owner)
if err != nil {
return nil, err
}
Expand All @@ -372,14 +372,22 @@ func (k msgServer) UpdateHostChain(
if err != nil {
return nil, err
}
_, err = k.SendICATransfer(ctx, hc, amount, hc.RewardsAccount.Address, k.GetUndelegationModuleAccount(ctx).GetAddress().String(), hc.RewardsAccount.Owner)
_, err = k.SendICATransfer(ctx, hc, amount, hc.RewardsAccount.Address, k.GetParams(ctx).AdminAddress, hc.RewardsAccount.Owner)
if err != nil {
return nil, err
}
case types.KeyForceTransferDeposits:
amount := k.bankKeeper.GetBalance(ctx, k.GetDepositModuleAccount(ctx).GetAddress(), hc.IBCDenom())
if amount.IsPositive() {
err := k.bankKeeper.SendCoins(ctx, k.GetDepositModuleAccount(ctx).GetAddress(), k.GetUndelegationModuleAccount(ctx).GetAddress(), sdktypes.NewCoins(amount))
err := k.bankKeeper.SendCoins(ctx, k.GetDepositModuleAccount(ctx).GetAddress(), sdktypes.MustAccAddressFromBech32(k.GetParams(ctx).AdminAddress), sdktypes.NewCoins(amount))
if err != nil {
return nil, err
}
}
case types.KeyForceTransferUnbonded:
amount := k.bankKeeper.GetBalance(ctx, k.GetUndelegationModuleAccount(ctx).GetAddress(), hc.IBCDenom())
if amount.IsPositive() {
err := k.bankKeeper.SendCoins(ctx, k.GetUndelegationModuleAccount(ctx).GetAddress(), sdktypes.MustAccAddressFromBech32(k.GetParams(ctx).AdminAddress), sdktypes.NewCoins(amount))
if err != nil {
return nil, err
}
Expand Down
1 change: 1 addition & 0 deletions x/liquidstakeibc/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ const (
KeyForceICATransfer string = "force_ica_transfer"
KeyForceICATransferRewards string = "force_ica_transfer_rewards"
KeyForceTransferDeposits string = "force_transfer_deposits"
KeyForceTransferUnbonded string = "force_transfer_unbonded"
)

var (
Expand Down
5 changes: 5 additions & 0 deletions x/liquidstakeibc/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,11 @@ func (m *MsgUpdateHostChain) ValidateBasic() error {
if update.Value != "" {
return fmt.Errorf("invalid force transfer deposits, expected \"\" ")
}
case KeyForceTransferUnbonded:
// expected nothing, ""
if update.Value != "" {
return fmt.Errorf("invalid force transfer unbonded, expected \"\" ")
}
default:
return fmt.Errorf("invalid or unexpected update key: %s", update.Key)
}
Expand Down

0 comments on commit fcc3703

Please sign in to comment.