11import { createServer } from "node:http" ;
2-
2+ import type { GearboxSDK , ICreditAccountsService } from "@gearbox-protocol/sdk" ;
33import { customAlphabet } from "nanoid" ;
4-
54import type { Config } from "../config/index.js" ;
65import { DI } from "../di.js" ;
76import type { ILogger } from "../log/index.js" ;
@@ -22,6 +21,9 @@ export default class HealthCheckerService {
2221 @DI . Inject ( DI . Config )
2322 config ! : Config ;
2423
24+ @DI . Inject ( DI . CreditAccountService )
25+ caService ! : ICreditAccountsService ;
26+
2527 #start = Math . round ( Date . now ( ) / 1000 ) ;
2628 #id = nanoid ( ) ;
2729
@@ -39,9 +41,20 @@ export default class HealthCheckerService {
3941 res . writeHead ( 200 , { "Content-Type" : "application/json" } ) ;
4042 res . end (
4143 JSON . stringify ( {
42- start_time : this . #start,
43- block_number : this . scanner . lastUpdated ,
44+ startTime : this . #start,
4445 version,
46+ network : this . config . network ,
47+ family : "liquidators" ,
48+ liquidationMode : this . config . liquidationMode ,
49+
50+ currentBlock : Number ( this . sdk . currentBlock ) ,
51+ timestamp : Number ( this . sdk . timestamp ) ,
52+ marketsConfigurators :
53+ this . sdk . marketRegister . marketConfigurators . map ( mc => mc . address ) ,
54+ pools : this . sdk . marketRegister . pools . map ( p => p . pool . address ) ,
55+ creditManagers : this . sdk . marketRegister . creditManagers . map (
56+ cm => cm . creditManager . address ,
57+ ) ,
4558 } ) ,
4659 ) ;
4760 } else if ( req . url === "/metrics" ) {
@@ -101,4 +114,8 @@ block_number{${labels}} ${this.scanner.lastUpdated}
101114
102115` ;
103116 }
117+
118+ private get sdk ( ) : GearboxSDK {
119+ return this . caService . sdk ;
120+ }
104121}
0 commit comments