Skip to content

Commit

Permalink
deposit2transfer: try to repay with the maximum available balance
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Dec 31, 2024
1 parent 680d08d commit 31069e5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/strategy/deposit2transfer/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@ func (s *Strategy) repay(ctx context.Context, d types.Deposit, amount fixedpoint

s.logger.Infof("found %s balance debt: %s", d.Asset, bal.Debt().String())

amount = fixedpoint.Min(bal.Debt(), amount)
amount = fixedpoint.Min(bal.Debt(),
fixedpoint.Max(amount, bal.Available))

if amount.Sign() <= 0 {
s.logger.Infof("%s has no debt to repay", d.Asset)
Expand Down

0 comments on commit 31069e5

Please sign in to comment.