autoborrow: fix debt checking condition

This commit is contained in:
c9s 2023-07-24 23:01:22 +08:00
parent a2a062e95b
commit bfb1165304
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -126,7 +126,9 @@ func (s *Strategy) tryToRepayAnyDebt(ctx context.Context) {
balances := account.Balances()
for _, b := range balances {
if b.Borrowed.Sign() <= 0 {
debt := b.Debt()
if debt.Sign() <= 0 {
continue
}
@ -134,7 +136,7 @@ func (s *Strategy) tryToRepayAnyDebt(ctx context.Context) {
continue
}
toRepay := fixedpoint.Min(b.Available, b.Debt())
toRepay := fixedpoint.Min(b.Available, debt)
if toRepay.IsZero() {
continue
}