Skip to content

Commit 69fc55c

Browse files
committed
fix: improve deleverage bot health status
1 parent 2b28f93 commit 69fc55c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/services/DeleverageService.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,16 @@ export interface BotParameters extends TBotParameters {
2222
address: Address;
2323
}
2424

25+
export interface DeleverageBotStatus {
26+
address: Address;
27+
status: StatusCode;
28+
minHealthFactor: number;
29+
maxHealthFactor: number;
30+
}
31+
2532
export interface DeleverageStatus {
2633
status: StatusCode;
27-
bots: Array<{ address: Address; status: StatusCode }>;
34+
bots: DeleverageBotStatus[];
2835
}
2936

3037
@DI.Injectable(DI.Deleverage)
@@ -74,8 +81,6 @@ export default class DeleverageService {
7481
if (this.config.optimistic) {
7582
return accounts_;
7683
}
77-
// TODO: support multiple bots
78-
const bot = this.#bots[0];
7984

8085
const accounts = accounts_.filter(ca => {
8186
const cm = this.caService.sdk.marketRegister.findCreditManager(
@@ -93,7 +98,7 @@ export default class DeleverageService {
9398
address: cm.creditFacade.botList,
9499
abi: iBotListV310Abi,
95100
functionName: "getBotStatus",
96-
args: [bot, ca.creditAccount],
101+
args: [this.bot.address, ca.creditAccount],
97102
} as const;
98103
}),
99104
allowFailure: true,
@@ -137,6 +142,8 @@ export default class DeleverageService {
137142
bots: this.bots.map(b => ({
138143
address: b.address,
139144
status: "healthy",
145+
minHealthFactor: b.minHealthFactor,
146+
maxHealthFactor: b.maxHealthFactor,
140147
})),
141148
};
142149
}

0 commit comments

Comments
 (0)