Skip to content

Commit 6b819b7

Browse files
committed
fix: maxHealthFactor in optimistic mode
1 parent 9837629 commit 6b819b7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/services/Scanner.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type {
33
CreditAccountsService,
44
NetworkType,
55
} from "@gearbox-protocol/sdk";
6-
import { PERCENTAGE_FACTOR } from "@gearbox-protocol/sdk";
6+
import { MAX_UINT16, PERCENTAGE_FACTOR } from "@gearbox-protocol/sdk";
77
import { iCreditManagerV3Abi } from "@gearbox-protocol/types/abi";
88
import type { Address, Block } from "viem";
99
import { getContract } from "viem";
@@ -102,10 +102,14 @@ export class Scanner {
102102
);
103103
accounts = acc ? [acc] : [];
104104
} else {
105+
let maxHealthFactor = Number(this.config.hfThreshold);
106+
if (this.config.optimistic && this.config.isPartial) {
107+
maxHealthFactor = Number(MAX_UINT16);
108+
}
105109
accounts = await this.caService.getCreditAccounts(
106110
{
107111
minHealthFactor: 0,
108-
maxHealthFactor: Number(this.config.hfThreshold),
112+
maxHealthFactor,
109113
includeZeroDebt: false,
110114
creditManager: this.config.debugManager,
111115
},

0 commit comments

Comments
 (0)