autoborrow: use debt instead of using b.Borrowed

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

View File

@ -213,9 +213,9 @@ func (s *Strategy) reBalanceDebt(ctx context.Context) {
log.Infof("checking repayable balance: %+v", b)
toRepay := b.Borrowed
toRepay := debt
if !b.Available.IsZero() {
toRepay = fixedpoint.Min(b.Borrowed, b.Available)
toRepay = fixedpoint.Min(toRepay, b.Available)
} else {
log.Errorf("available balance is 0: %#v", b)
}