Skip to content

Commit

Permalink
force withdraw from deposits to unbonding account
Browse files Browse the repository at this point in the history
  • Loading branch information
puneet2019 committed Dec 10, 2024
1 parent dd87095 commit b73d491
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions x/liquidstakeibc/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,14 @@ func (k msgServer) UpdateHostChain(
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))
if err != nil {
return nil, err
}
}
default:
return nil, fmt.Errorf("invalid or unexpected update key: %s", update.Key)
}
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 @@ -90,6 +90,7 @@ const (
KeyForceUnbond string = "force_unbond"
KeyForceICATransfer string = "force_ica_transfer"
KeyForceICATransferRewards string = "force_ica_transfer_rewards"
KeyForceTransferDeposits string = "force_transfer_deposits"
)

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 @@ -422,6 +422,11 @@ func (m *MsgUpdateHostChain) ValidateBasic() error {
if err != nil {
return err
}
case KeyForceTransferDeposits:
// expected nothing, ""
if update.Value != "" {
return fmt.Errorf("invalid force transfer deposits, expected \"\" ")
}
default:
return fmt.Errorf("invalid or unexpected update key: %s", update.Key)
}
Expand Down

0 comments on commit b73d491

Please sign in to comment.