Skip to content

Commit

Permalink
refactor name
Browse files Browse the repository at this point in the history
  • Loading branch information
puneet2019 committed Dec 21, 2023
1 parent 0f96568 commit e4eb7c1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions x/liquidstakeibc/keeper/deposit.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,23 @@ func (k *Keeper) GetTransactionSequenceID(channelID string, sequence uint64) str
func (k *Keeper) AdjustDepositsForRedemption(
ctx sdk.Context,
hc *liquidstakeibctypes.HostChain,
redeemableAmount sdk.Coin,
redeemAmount sdk.Coin,
) error {
redeemableDeposits, depositsAmount := k.GetRedeemableDepositsForHostChain(ctx, hc)
if depositsAmount.LT(redeemableAmount.Amount) {
return errorsmod.Wrapf(liquidstakeibctypes.ErrInsufficientDeposits, "deposits are lesser than amount to be redeemed, deposits present %s, required %s", depositsAmount.String(), redeemableAmount.Amount.String())
if depositsAmount.LT(redeemAmount.Amount) {
return errorsmod.Wrapf(liquidstakeibctypes.ErrInsufficientDeposits, "deposits are lesser than amount to be redeemed, deposits present %s, required %s", depositsAmount.String(), redeemAmount.Amount.String())
}

for _, deposit := range redeemableDeposits {
// there is enough tokens in this deposit to fulfill the redeem request
if deposit.Amount.Amount.GT(redeemableAmount.Amount) || redeemableAmount.IsZero() {
deposit.Amount = deposit.Amount.Sub(redeemableAmount)
if deposit.Amount.Amount.GT(redeemAmount.Amount) || redeemAmount.IsZero() {
deposit.Amount = deposit.Amount.Sub(redeemAmount)
k.SetDeposit(ctx, deposit)
return nil
}

// the deposit is not enough to fulfill the redeem request, use it and remove it
redeemableAmount = redeemableAmount.Sub(deposit.Amount)
redeemAmount = redeemAmount.Sub(deposit.Amount)
k.DeleteDeposit(ctx, deposit)
}

Expand Down

0 comments on commit e4eb7c1

Please sign in to comment.