@gearbox-protocol/liquidator-v2-config 11.1.0-beta.5 → 11.1.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -199,7 +199,8 @@ declare const CommonSchema: z.ZodObject<{
199
199
  deleverage: "deleverage";
200
200
  full: "full";
201
201
  partial: "partial";
202
- wallet: "wallet";
202
+ "wallet-full": "wallet-full";
203
+ "wallet-partial": "wallet-partial";
203
204
  }>>;
204
205
  optimistic: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<boolean, any>>>;
205
206
  useProductionScanner: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<boolean, any>>>;
@@ -734,7 +735,10 @@ export declare const ConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
734
735
  outS3Bucket: z.ZodOptional<z.ZodString>;
735
736
  outS3Prefix: z.ZodDefault<z.ZodString>;
736
737
  outFileName: z.ZodOptional<z.ZodString>;
737
- liquidationMode: z.ZodLiteral<"wallet">;
738
+ liquidationMode: z.ZodEnum<{
739
+ "wallet-full": "wallet-full";
740
+ "wallet-partial": "wallet-partial";
741
+ }>;
738
742
  }, z.core.$strip>], "liquidationMode">;
739
743
  export type ConfigSchema = z.infer<typeof ConfigSchema>;
740
744
  //#endregion
@@ -974,35 +978,6 @@ declare const FullLiquidatorSchema: z.ZodObject<{
974
978
  }, z.core.$strip>;
975
979
  type FullLiquidatorSchema = z.infer<typeof FullLiquidatorSchema>;
976
980
  //#endregion
977
- //#region src/notifications.d.ts
978
- export declare const NotificationsConfig: z.ZodObject<{
979
- notifications: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
980
- type: z.ZodLiteral<"slack">;
981
- webhookUrl: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodInstanceOf<import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>;
982
- alertsOnly: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<boolean, any>>>;
983
- curator: z.ZodOptional<z.ZodCustom<CuratorName, CuratorName>>;
984
- }, z.core.$strip> | z.ZodObject<{
985
- type: z.ZodLiteral<"telegram">;
986
- token: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodInstanceOf<import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>;
987
- alertsChannel: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodInstanceOf<import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>;
988
- notificationsChannel: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodInstanceOf<import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>>;
989
- prefix: z.ZodOptional<z.ZodString>;
990
- curator: z.ZodOptional<z.ZodCustom<CuratorName, CuratorName>>;
991
- }, z.core.$strip>, ...(z.ZodObject<{
992
- type: z.ZodLiteral<"slack">;
993
- webhookUrl: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodInstanceOf<import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>;
994
- alertsOnly: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<boolean, any>>>;
995
- curator: z.ZodOptional<z.ZodCustom<CuratorName, CuratorName>>;
996
- }, z.core.$strip> | z.ZodObject<{
997
- type: z.ZodLiteral<"telegram">;
998
- token: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodInstanceOf<import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>;
999
- alertsChannel: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodInstanceOf<import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>;
1000
- notificationsChannel: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodInstanceOf<import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>>;
1001
- prefix: z.ZodOptional<z.ZodString>;
1002
- curator: z.ZodOptional<z.ZodCustom<CuratorName, CuratorName>>;
1003
- }, z.core.$strip>)[]], "type">>>>;
1004
- }, z.core.$strip>;
1005
- //#endregion
1006
981
  //#region src/optimist.d.ts
1007
982
  type Numberish = number | string | bigint;
1008
983
  /**
@@ -1010,7 +985,7 @@ type Numberish = number | string | bigint;
1010
985
  * `none` is used when no strategy was applicable, or an error occurred before a
1011
986
  * strategy could be selected.
1012
987
  */
1013
- type LiquidationStrategyKind = "full" | "loss-policy" | "rwa-via-stablecoins" | "partial" | "deleverage" | "wallet" | "none";
988
+ type LiquidationStrategyKind = "full" | "loss-policy" | "rwa-via-stablecoins" | "partial" | "deleverage" | "wallet-full" | "wallet-partial" | "none";
1014
989
  /**
1015
990
  * Preview data shared by full and loss-policy strategies (single full liquidation
1016
991
  * routed through the pathfinder). Carries the execution-only fields (`calls`,
@@ -1137,8 +1112,8 @@ interface Redeemer<N extends Numberish = Numberish> {
1137
1112
  claimableAt?: number;
1138
1113
  }
1139
1114
  /**
1140
- * Preview data of the wallet strategy: a liquidation paid from the liquidator's
1141
- * own funds, previewed by the liquidation compressor.
1115
+ * Preview data of the wallet strategies: a liquidation paid from the liquidator's
1116
+ * own funds, previewed by the sdk.
1142
1117
  */
1143
1118
  interface WalletStrategyPreview<N extends Numberish = Numberish> {
1144
1119
  /**
@@ -1151,12 +1126,12 @@ interface WalletStrategyPreview<N extends Numberish = Numberish> {
1151
1126
  */
1152
1127
  redeemers: Redeemer<N>[];
1153
1128
  /**
1154
- * Top-level liquidation call built by the compressor, targeting either the
1155
- * credit facade or a dedicated Midas/Securitize liquidator contract.
1129
+ * Top-level liquidation call, targeting either the credit facade or a
1130
+ * dedicated Midas/Securitize liquidator contract.
1156
1131
  */
1157
1132
  calls: readonly MultiCall[];
1158
1133
  /**
1159
- * Liquidation transaction built by the liquidation compressor.
1134
+ * Liquidation transaction built by the sdk.
1160
1135
  */
1161
1136
  rawTx: RawTx;
1162
1137
  /**
@@ -1164,6 +1139,28 @@ interface WalletStrategyPreview<N extends Numberish = Numberish> {
1164
1139
  */
1165
1140
  skipOnFailure?: boolean;
1166
1141
  }
1142
+ /**
1143
+ * Preview data of the partial wallet strategy: part of the debt is repaid from
1144
+ * the liquidator's own funds in exchange for discounted collateral.
1145
+ */
1146
+ interface WalletPartialStrategyPreview<N extends Numberish = Numberish> extends WalletStrategyPreview<N> {
1147
+ /**
1148
+ * Collateral token seized from the account.
1149
+ */
1150
+ assetOut: Address;
1151
+ /**
1152
+ * Estimated amount of {@link assetOut} received by the liquidator.
1153
+ */
1154
+ amountOut: N;
1155
+ /**
1156
+ * Underlying paid by the liquidator.
1157
+ */
1158
+ repaidAmount: N;
1159
+ /**
1160
+ * Sdk's estimate of the liquidator's profit, in underlying.
1161
+ */
1162
+ estimatedProfit: N;
1163
+ }
1167
1164
  /**
1168
1165
  * Token amount reported in an {@link OptimisticResult}.
1169
1166
  */
@@ -1234,7 +1231,8 @@ interface StrategyPreviews<N extends Numberish = Numberish> {
1234
1231
  partial: PartialStrategyPreview<N>;
1235
1232
  deleverage: PartialStrategyPreview<N>;
1236
1233
  "rwa-via-stablecoins": RwaStrategyPreview;
1237
- wallet: WalletStrategyPreview<N>;
1234
+ "wallet-full": WalletStrategyPreview<N>;
1235
+ "wallet-partial": WalletPartialStrategyPreview<N>;
1238
1236
  none: never;
1239
1237
  }
1240
1238
  /**
@@ -1248,7 +1246,8 @@ interface StrategyOutcomes<N extends Numberish = Numberish> {
1248
1246
  partial: never;
1249
1247
  deleverage: never;
1250
1248
  "rwa-via-stablecoins": never;
1251
- wallet: WalletStrategyOutcome<N>;
1249
+ "wallet-full": WalletStrategyOutcome<N>;
1250
+ "wallet-partial": WalletStrategyOutcome<N>;
1252
1251
  none: never;
1253
1252
  }
1254
1253
  /**
@@ -1261,7 +1260,8 @@ interface StrategySetups<N extends Numberish = Numberish> {
1261
1260
  partial: PartialStrategySetup<N>;
1262
1261
  deleverage: DeleverageStrategySetup<N>;
1263
1262
  "rwa-via-stablecoins": RwaStrategySetup;
1264
- wallet: never;
1263
+ "wallet-full": never;
1264
+ "wallet-partial": PartialStrategySetup<N>;
1265
1265
  none: never;
1266
1266
  }
1267
1267
  /**
@@ -1378,6 +1378,58 @@ type OptimisticResultByKind<N extends Numberish = Numberish> = { [K in Liquidati
1378
1378
  */
1379
1379
  type OptimisticResult<N extends Numberish = Numberish, K extends LiquidationStrategyKind = LiquidationStrategyKind> = OptimisticResultByKind<N>[K];
1380
1380
  //#endregion
1381
+ //#region src/liquidationStatus.d.ts
1382
+ export type LiquidationStatus = "success" | "warning" | "error";
1383
+ export type StatusInput = Pick<OptimisticResult, "isError" | "error">;
1384
+ export interface AccountStatusOptions {
1385
+ /**
1386
+ * Whitelisted accounts are always `success`
1387
+ */
1388
+ whitelisted?: boolean;
1389
+ }
1390
+ /**
1391
+ * Status of a single liquidation result.
1392
+ * An error that contains `warning:` means the track did not attempt the liquidation.
1393
+ */
1394
+ export declare function resultStatus(result: StatusInput): LiquidationStatus;
1395
+ /**
1396
+ * Status of one credit account given its results across the tracks of one role.
1397
+ *
1398
+ * Returns the best status, not the worst: the account is `success` if any track
1399
+ * liquidated it, `error` if none did and at least one failed outright, and
1400
+ * `warning` otherwise (including when there are no results at all).
1401
+ */
1402
+ export declare function accountStatus(results: readonly StatusInput[], options?: AccountStatusOptions): LiquidationStatus;
1403
+ //#endregion
1404
+ //#region src/notifications.d.ts
1405
+ export declare const NotificationsConfig: z.ZodObject<{
1406
+ notifications: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1407
+ type: z.ZodLiteral<"slack">;
1408
+ webhookUrl: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodInstanceOf<import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>;
1409
+ alertsOnly: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<boolean, any>>>;
1410
+ curator: z.ZodOptional<z.ZodCustom<CuratorName, CuratorName>>;
1411
+ }, z.core.$strip> | z.ZodObject<{
1412
+ type: z.ZodLiteral<"telegram">;
1413
+ token: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodInstanceOf<import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>;
1414
+ alertsChannel: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodInstanceOf<import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>;
1415
+ notificationsChannel: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodInstanceOf<import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>>;
1416
+ prefix: z.ZodOptional<z.ZodString>;
1417
+ curator: z.ZodOptional<z.ZodCustom<CuratorName, CuratorName>>;
1418
+ }, z.core.$strip>, ...(z.ZodObject<{
1419
+ type: z.ZodLiteral<"slack">;
1420
+ webhookUrl: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodInstanceOf<import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>;
1421
+ alertsOnly: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<boolean, any>>>;
1422
+ curator: z.ZodOptional<z.ZodCustom<CuratorName, CuratorName>>;
1423
+ }, z.core.$strip> | z.ZodObject<{
1424
+ type: z.ZodLiteral<"telegram">;
1425
+ token: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodInstanceOf<import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>;
1426
+ alertsChannel: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodInstanceOf<import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>;
1427
+ notificationsChannel: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodInstanceOf<import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>>;
1428
+ prefix: z.ZodOptional<z.ZodString>;
1429
+ curator: z.ZodOptional<z.ZodCustom<CuratorName, CuratorName>>;
1430
+ }, z.core.$strip>)[]], "type">>>>;
1431
+ }, z.core.$strip>;
1432
+ //#endregion
1381
1433
  //#region src/partial-liquidator.d.ts
1382
1434
  declare const PartialLiquidatorSchema: z.ZodObject<{
1383
1435
  network: z.ZodEnum<{
@@ -1494,6 +1546,12 @@ type WhitelistEntry = ClientWhitelistItem;
1494
1546
  * Human-readable labels for credit accounts, keyed by checksummed credit account address
1495
1547
  */
1496
1548
  type AccountLabels = Record<Address, string>;
1549
+ /**
1550
+ * Who a track stands for:
1551
+ * - `service` is a liquidation service that runs in production;
1552
+ * - `manual` is a liquidation that someone performs by hand, e.g. from their wallet.
1553
+ */
1554
+ type TrackRole = "service" | "manual";
1497
1555
  interface TrackReport {
1498
1556
  id: string;
1499
1557
  name: string;
@@ -1501,6 +1559,10 @@ interface TrackReport {
1501
1559
  end: Date;
1502
1560
  version: string;
1503
1561
  emergency: boolean;
1562
+ /**
1563
+ * Missing in reports produced before roles were introduced, which means `service`
1564
+ */
1565
+ role?: TrackRole;
1504
1566
  }
1505
1567
  interface ExecutionReport {
1506
1568
  /**
@@ -1539,6 +1601,18 @@ interface ExecutionReport {
1539
1601
  gasPrice: bigint;
1540
1602
  }
1541
1603
  //#endregion
1604
+ //#region src/trackRoles.d.ts
1605
+ export declare const TRACK_ROLES: readonly ["service", "manual"];
1606
+ export declare function getTrackRole(track: Pick<TrackReport, "role">): TrackRole;
1607
+ /**
1608
+ * Returns a report that contains only the tracks of the given role and their results
1609
+ */
1610
+ export declare function filterReportByRole(report: ExecutionReport, role: TrackRole): ExecutionReport;
1611
+ /**
1612
+ * Returns the roles that have at least one track in the report, in {@link TRACK_ROLES} order
1613
+ */
1614
+ export declare function reportRoles(report: Pick<ExecutionReport, "tracks">): TrackRole[];
1615
+ //#endregion
1542
1616
  //#region src/wallet-liquidator.d.ts
1543
1617
  declare const WalletLiquidatorSchema: z.ZodObject<{
1544
1618
  network: z.ZodEnum<{
@@ -1639,9 +1713,12 @@ declare const WalletLiquidatorSchema: z.ZodObject<{
1639
1713
  outS3Bucket: z.ZodOptional<z.ZodString>;
1640
1714
  outS3Prefix: z.ZodDefault<z.ZodString>;
1641
1715
  outFileName: z.ZodOptional<z.ZodString>;
1642
- liquidationMode: z.ZodLiteral<"wallet">;
1716
+ liquidationMode: z.ZodEnum<{
1717
+ "wallet-full": "wallet-full";
1718
+ "wallet-partial": "wallet-partial";
1719
+ }>;
1643
1720
  }, z.core.$strip>;
1644
1721
  type WalletLiquidatorSchema = z.infer<typeof WalletLiquidatorSchema>;
1645
1722
  //#endregion
1646
- export type { AccountLabels, Approval, BatchLiquidatorSchema, CommonSchema, DeleverageLiquidatorSchema, DeleverageStrategySetup, ExecutionReport, FullLiquidatorSchema, FullStrategyPreview, LiquidationStrategyKind, LossPolicyStrategySetup, Numberish, OptimisticAsset, OptimisticResult, OptimisticResultBase, PartialLiquidatorSchema, PartialStrategyPreview, PartialStrategySetup, Redeemer, RwaStrategyPreview, RwaStrategySetup, StrategyOutcomes, StrategyPreviews, StrategySetups, TrackReport, TypedSDKState, WalletLiquidatorSchema, WalletStrategyOutcome, WalletStrategyPreview, WhitelistEntry };
1723
+ export type { AccountLabels, Approval, BatchLiquidatorSchema, CommonSchema, DeleverageLiquidatorSchema, DeleverageStrategySetup, ExecutionReport, FullLiquidatorSchema, FullStrategyPreview, LiquidationStrategyKind, LossPolicyStrategySetup, Numberish, OptimisticAsset, OptimisticResult, OptimisticResultBase, PartialLiquidatorSchema, PartialStrategyPreview, PartialStrategySetup, Redeemer, RwaStrategyPreview, RwaStrategySetup, StrategyOutcomes, StrategyPreviews, StrategySetups, TrackReport, TrackRole, TypedSDKState, WalletLiquidatorSchema, WalletPartialStrategyPreview, WalletStrategyOutcome, WalletStrategyPreview, WhitelistEntry };
1647
1724
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/batch-liquidator.ts","../src/common.ts","../src/schema.ts","../src/config.ts","../src/deleverage-liquidator.ts","../src/full-liquidator.ts","../src/notifications.ts","../src/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AClC,uBAAuB,GAAG;;;cCnZjB,yBAAuB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDjC,EAAA,KAAA;KAES,0BAA0B,EAAE,aAAa;;;KCnDzC,gBAAgB;WACjB,UAAU;;KAGT,iBAAiB;;;;KAKjB,gBAAgB,OAAO;UAElB;EACf;EACA;EACA,OAAO;EACP,KAAK;EACL;EACA;;UAGe;;;;EAIf;EACA,OAAO;EACP,KAAK;;;;EAIL;;;;EAIA,QAAQ;;;;EAIR,SAAS;;;;EAIT,YAAY;;;;EAIZ,gBAAgB;;;;EAIhB,UAAU;;;;EAIV;;;;cCzDW,wBAAsB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUjC,EAAA,KAAA;KAEU,yBAAyB,EAAE,aAAa"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/batch-liquidator.ts","../src/common.ts","../src/schema.ts","../src/config.ts","../src/deleverage-liquidator.ts","../src/full-liquidator.ts","../src/optimist.ts","../src/liquidationStatus.ts","../src/notifications.ts","../src/partial-liquidator.ts","../src/report.ts","../src/trackRoles.ts","../src/wallet-liquidator.ts"],"mappings":";;;;;;;cAIa,uBAAqB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwBhC,EAAA,KAAA;KAEU,wBAAwB,EAAE,aAAa;;;cChBtC,cAAY,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDjC,EAAA,KAAA;KAES,0BAA0B,EAAE,aAAa;;;KCpDzC,gBAAgB;WACjB,UAAU;;KAGT,iBAAiB;;;;KAKjB,gBAAgB,OAAO;;;;;;KAOvB;UAEK;EACf;EACA;EACA,OAAO;EACP,KAAK;EACL;EACA;;;;EAIA,OAAO;;UAGQ;;;;EAIf;EACA,OAAO;EACP,KAAK;;;;EAIL;;;;EAIA,QAAQ;;;;EAIR,SAAS;;;;EAIT,YAAY;;;;EAIZ,gBAAgB;;;;EAIhB,UAAU;;;;EAIV;;;;qBCtEW;wBAKG,aAAa,OAAO,KAAK,uBAAuB;;;;wBAOhD,mBACd,QAAQ,iBACR,MAAM,YACL;;;;wBAaa,YACd,QAAQ,KAAK,6BACZ;;;cC5BU,wBAAsB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAajC,EAAA,KAAA;KAEU,yBAAyB,EAAE,aAAa"}
package/dist/index.js CHANGED
@@ -28,6 +28,30 @@ var ConfigImplementation = class {
28
28
  }
29
29
  };
30
30
  //#endregion
31
+ //#region src/liquidationStatus.ts
32
+ /**
33
+ * Status of a single liquidation result.
34
+ * An error that contains `warning:` means the track did not attempt the liquidation.
35
+ */
36
+ function resultStatus(result) {
37
+ if (!result.isError) return "success";
38
+ return result.error?.includes("warning:") ? "warning" : "error";
39
+ }
40
+ /**
41
+ * Status of one credit account given its results across the tracks of one role.
42
+ *
43
+ * Returns the best status, not the worst: the account is `success` if any track
44
+ * liquidated it, `error` if none did and at least one failed outright, and
45
+ * `warning` otherwise (including when there are no results at all).
46
+ */
47
+ function accountStatus(results, options = {}) {
48
+ if (options.whitelisted) return "success";
49
+ const statuses = new Set(results.map(resultStatus));
50
+ if (statuses.has("success")) return "success";
51
+ if (statuses.has("error")) return "error";
52
+ return "warning";
53
+ }
54
+ //#endregion
31
55
  //#region src/notifications.ts
32
56
  const extendedOptions = NotificationConfig.options.map((o) => o.extend({
33
57
  /**
@@ -205,10 +229,11 @@ const CommonSchema = z.object({
205
229
  "partial",
206
230
  "batch",
207
231
  "deleverage",
208
- "wallet"
232
+ "wallet-full",
233
+ "wallet-partial"
209
234
  ]).default("full").register(zommandRegistry, {
210
235
  flags: "--liquidation-mode <mode>",
211
- description: "Liquidator mode (full/partial/batch/deleverage/wallet)",
236
+ description: "Liquidator mode (full/partial/batch/deleverage/wallet-full/wallet-partial)",
212
237
  env: "LIQUIDATION_MODE"
213
238
  }),
214
239
  /**
@@ -351,7 +376,7 @@ const BatchLiquidatorSchema = z.object({
351
376
  */
352
377
  liquidationMode: z.literal("batch").register(zommandRegistry, {
353
378
  flags: "--liquidation-mode <mode>",
354
- description: "Liquidator mode (full/partial/batch/deleverage/wallet)",
379
+ description: "Liquidator mode (full/partial/batch/deleverage/wallet-full/wallet-partial)",
355
380
  env: "LIQUIDATION_MODE"
356
381
  }),
357
382
  /**
@@ -372,7 +397,7 @@ const DeleverageLiquidatorSchema = z.object({
372
397
  */
373
398
  liquidationMode: z.literal("deleverage").register(zommandRegistry, {
374
399
  flags: "--liquidation-mode <mode>",
375
- description: "Liquidator mode (full/partial/batch/deleverage/wallet)",
400
+ description: "Liquidator mode (full/partial/batch/deleverage/wallet-full/wallet-partial)",
376
401
  env: "LIQUIDATION_MODE"
377
402
  })
378
403
  });
@@ -385,7 +410,7 @@ const FullLiquidatorSchema = z.object({
385
410
  */
386
411
  liquidationMode: z.literal("full").register(zommandRegistry, {
387
412
  flags: "--liquidation-mode <mode>",
388
- description: "Liquidator mode (full/partial/batch/deleverage/wallet)",
413
+ description: "Liquidator mode (full/partial/batch/deleverage/wallet-full/wallet-partial)",
389
414
  env: "LIQUIDATION_MODE"
390
415
  }),
391
416
  /**
@@ -442,7 +467,7 @@ const PartialLiquidatorSchema = z.object({
442
467
  */
443
468
  liquidationMode: z.literal("partial").register(zommandRegistry, {
444
469
  flags: "--liquidation-mode <mode>",
445
- description: "Liquidator mode (full/partial/batch/deleverage/wallet)",
470
+ description: "Liquidator mode (full/partial/batch/deleverage/wallet-full/wallet-partial)",
446
471
  env: "LIQUIDATION_MODE"
447
472
  }),
448
473
  /**
@@ -478,9 +503,9 @@ const WalletLiquidatorSchema = z.object({
478
503
  /**
479
504
  * Liquidator mode
480
505
  */
481
- liquidationMode: z.literal("wallet").register(zommandRegistry, {
506
+ liquidationMode: z.enum(["wallet-full", "wallet-partial"]).register(zommandRegistry, {
482
507
  flags: "--liquidation-mode <mode>",
483
- description: "Liquidator mode (full/partial/batch/deleverage/wallet)",
508
+ description: "Liquidator mode (full/partial/batch/deleverage/wallet-full/wallet-partial)",
484
509
  env: "LIQUIDATION_MODE"
485
510
  })
486
511
  });
@@ -494,6 +519,31 @@ const ConfigSchema = z.discriminatedUnion("liquidationMode", [
494
519
  WalletLiquidatorSchema
495
520
  ]);
496
521
  //#endregion
497
- export { ConfigImplementation, ConfigSchema, NotificationsConfig };
522
+ //#region src/trackRoles.ts
523
+ const TRACK_ROLES = ["service", "manual"];
524
+ function getTrackRole(track) {
525
+ return track.role ?? "service";
526
+ }
527
+ /**
528
+ * Returns a report that contains only the tracks of the given role and their results
529
+ */
530
+ function filterReportByRole(report, role) {
531
+ const tracks = report.tracks.filter((t) => getTrackRole(t) === role);
532
+ const trackIds = new Set(tracks.map((t) => t.id));
533
+ return {
534
+ ...report,
535
+ tracks,
536
+ results: report.results.filter((r) => trackIds.has(r.trackId))
537
+ };
538
+ }
539
+ /**
540
+ * Returns the roles that have at least one track in the report, in {@link TRACK_ROLES} order
541
+ */
542
+ function reportRoles(report) {
543
+ const present = new Set(report.tracks.map(getTrackRole));
544
+ return TRACK_ROLES.filter((r) => present.has(r));
545
+ }
546
+ //#endregion
547
+ export { ConfigImplementation, ConfigSchema, NotificationsConfig, TRACK_ROLES, accountStatus, filterReportByRole, getTrackRole, reportRoles, resultStatus };
498
548
 
499
549
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/config.ts","../src/notifications.ts","../src/common.ts","../src/batch-liquidator.ts","../src/deleverage-liquidator.ts","../src/full-liquidator.ts","../src/partial-liquidator.ts","../src/wallet-liquidator.ts","../src/schema.ts"],"sourcesContent":["import { createPublicClient, type Transport } from \"viem\";\nimport type { CommonSchema } from \"./common.js\";\nimport type { ConfigSchema } from \"./schema.js\";\n\nexport type Config = ConfigSchema & {\n readonly chainId: number;\n readonly startBlock: bigint;\n};\n\nexport type LiqduiatorConfig<TSchema extends CommonSchema> = TSchema & {\n readonly chainId: number;\n readonly startBlock: bigint;\n};\n\nexport class ConfigImplementation {\n #startBlock?: bigint;\n #chainId?: number;\n\n constructor(schema: ConfigSchema) {\n Object.assign(this, schema);\n }\n\n public async initialize(transport: Transport): Promise<void> {\n const client = createPublicClient({\n transport,\n name: \"preload client\",\n });\n\n const [startBlock, chainId] = await Promise.all([\n client.getBlockNumber(),\n client.getChainId(),\n ]);\n\n this.#startBlock = startBlock;\n this.#chainId = chainId;\n }\n\n public get startBlock(): bigint {\n if (this.#startBlock === undefined) {\n throw new Error(\"config not initialized\");\n }\n return this.#startBlock;\n }\n\n public get chainId(): number {\n if (this.#chainId === undefined) {\n throw new Error(\"config not initialized\");\n }\n return this.#chainId;\n }\n}\n","import { NotificationConfig } from \"@gearbox-protocol/cli-utils\";\nimport type { CuratorName } from \"@gearbox-protocol/sdk/model\";\nimport { z } from \"zod/v4\";\n\nconst extendedOptions = NotificationConfig.options.map(o =>\n o.extend({\n /**\n * When undefined, defaults to all curators together (aka Gearbox internal)\n */\n curator: z.custom<CuratorName>(s => typeof s === \"string\").optional(),\n }),\n);\n\nexport const NotificationsConfig = z.object({\n notifications: z\n .array(\n z.discriminatedUnion(\n NotificationConfig.def.discriminator,\n extendedOptions as [\n (typeof extendedOptions)[0],\n ...(typeof extendedOptions)[number][],\n ],\n ),\n )\n .optional()\n .default([]),\n});\n","import {\n addressLike,\n boolLike,\n CensoredString,\n clientWhitelistItemSchema,\n optionalAddressArrayLike,\n ProvidersSchema,\n zommandRegistry,\n} from \"@gearbox-protocol/cli-utils\";\nimport { MAX_UINT256, WAD } from \"@gearbox-protocol/sdk/onchain\";\nimport { type Hex, isHex } from \"viem\";\nimport { z } from \"zod/v4\";\nimport { NotificationsConfig } from \"./notifications.js\";\n\nexport const CommonSchema = z.object({\n ...ProvidersSchema.shape,\n /**\n * By default uses address provider from @gearbox-protocol/sdk\n * Use this option to override address provider\n */\n addressProvider: addressLike().optional().register(zommandRegistry, {\n flags: \"--address-provider <address>\",\n description:\n \"Address provider override, uses default value from SDK otherwise\",\n env: \"ADDRESS_PROVIDER\",\n }),\n /**\n * Market configurators addresses to attach SDK\n */\n marketConfigurators: optionalAddressArrayLike().register(zommandRegistry, {\n flags: \"--market-configurators <addresses...>\",\n description:\n \"Market configurators to use for the process, comma separated. Uses default value from SDK if not specified\",\n env: \"MARKET_CONFIGURATORS\",\n }),\n /**\n * RWA factories addresses to attach SDK\n */\n rwaFactories: optionalAddressArrayLike().register(zommandRegistry, {\n flags: \"--rwa-factories <addresses...>\",\n description:\n \"RWA factories to use for the process, comma separated. Uses default value from SDK if not specified\",\n env: \"RWA_FACTORIES\",\n }),\n /**\n * App name used in various messages to distinguish instances\n */\n appName: z.string().default(\"liquidator-ts\").register(zommandRegistry, {\n flags: \"--app-name <name>\",\n description: \"App name used in various messages to distinguish instances\",\n env: \"APP_NAME\",\n }),\n /**\n * Port to expose some vital signals and metrics\n */\n port: z.coerce.number().default(4000).register(zommandRegistry, {\n flags: \"--port <port>\",\n description: \"Port to expose some vital signals and metrics\",\n env: \"PORT\",\n }),\n /**\n * Full URL of the whitelist endpoint. Entries can be credit account\n * addresses or credit manager addresses. Only applied in non-optimistic mode.\n */\n whitelistUrl: z.url().optional().register(zommandRegistry, {\n flags: \"--whitelist-url <url>\",\n description:\n \"Full URL of the liquidator soft whitelist endpoint. Entries are credit account or credit manager addresses. Does not prevent liquidation, but annotates failure notifications. Only applied in non-optimistic mode.\",\n env: \"WHITELIST_URL\",\n }),\n /**\n * Static (hard) whitelist that prevents liquidation entirely.\n * Entries can be credit account, credit manager or token addresses.\n */\n hardWhitelist: z.array(clientWhitelistItemSchema).optional(),\n /**\n * Only check this account during local debug session\n */\n debugAccount: addressLike().optional().register(zommandRegistry, {\n flags: \"--debug-account <address>\",\n description: \"Only check this account during local debug session\",\n env: \"DEBUG_ACCOUNT\",\n }),\n /**\n * Only check this credit manager during local debug session\n */\n debugManager: addressLike().optional().register(zommandRegistry, {\n flags: \"--debug-manager <address>\",\n description: \"Only check this credit manager during local debug session\",\n env: \"DEBUG_MANAGER\",\n }),\n /**\n * Path to foundry/cast binary, so that we can create tree-like traces in case of errors\n * Used during optimistic liquidations\n */\n castBin: z.string().optional().register(zommandRegistry, {\n flags: \"--cast-bin <path>\",\n description:\n \"Path to foundry/cast binary, so that we can create tree-like traces in case of errors\",\n env: \"CAST_BIN\",\n }),\n /**\n * Timeout duration passed to `timeout` utility when running cast.\n * If unset, cast runs without a timeout. Accepts any value understood by `timeout(1)` (e.g. `30s`, `1m`).\n */\n castTimeout: z.string().optional().default(\"1m\").register(zommandRegistry, {\n flags: \"--cast-timeout <duration>\",\n description:\n \"Timeout duration for cast invocations (e.g. 30s, 1m). If unset, cast runs without a timeout.\",\n env: \"CAST_TIMEOUT\",\n }),\n /**\n * Stale block threshold in seconds, to notify and try to rotate rpc provider. 0 means no monitoring\n */\n staleBlockThreshold: z.coerce\n .number()\n .nonnegative()\n .default(120)\n .register(zommandRegistry, {\n flags: \"--stale-block-threshold <threshold>\",\n description:\n \"Stale block threshold in seconds, to notify and try to rotate rpc provider. 0 means no monitoring\",\n env: \"STALE_BLOCK_THRESHOLD\",\n }),\n /**\n * Max block range size for eth_getLogs\n */\n logsPageSize: z.coerce\n .bigint()\n .nonnegative()\n .optional()\n .register(zommandRegistry, {\n flags: \"--logs-page-size <size>\",\n description: \"Max block range size for eth_getLogs\",\n env: \"LOGS_PAGE_SIZE\",\n }),\n /**\n * Polling interval in milliseconds, default to what's default in viem\n */\n pollingInterval: z.coerce\n .number()\n .nonnegative()\n .optional()\n .register(zommandRegistry, {\n flags: \"--polling-interval <interval>\",\n description:\n \"Polling interval in milliseconds, default to what's default in viem\",\n env: \"POLLING_INTERVAL\",\n }),\n /**\n * Private key used to send liquidation transactions\n * Required in non-optimistic mode, must not be set in optimistic mode\n */\n privateKey: z\n .string()\n .min(1)\n .transform((s): Hex => {\n return isHex(s) ? s : `0x${s}`;\n })\n .transform(CensoredString.transform<Hex>)\n .optional()\n .register(zommandRegistry, {\n flags: \"--private-key <key>\",\n description:\n \"Private key used to send liquidation transactions. Required in non-optimistic mode, must not be set in optimistic mode\",\n env: \"PRIVATE_KEY\",\n }),\n /**\n * Address to impersonate as transaction sender on anvil fork\n * Required in optimistic mode, must not be set in non-optimistic mode\n */\n liquidatorAddress: addressLike().optional().register(zommandRegistry, {\n flags: \"--liquidator-address <address>\",\n description:\n \"Address to impersonate as transaction sender on anvil fork. Required in optimistic mode, must not be set in non-optimistic mode\",\n env: \"LIQUIDATOR_ADDRESS\",\n }),\n /**\n * Minimum executor gas budget, in gas units. The required balance to send a\n * notification is computed as `minBalanceGas * currentGasPrice`.\n */\n minBalanceGas: z.coerce\n .bigint()\n .positive()\n // At some point on Mainnet there were 40 accounts\n // It costed ~80M gas to deleverage all of them, deleverage being the most expensive operation\n .default(85_000_000n)\n .register(zommandRegistry, {\n flags: \"--min-balance-gas <gas>\",\n description:\n \"Minimum executor gas budget (in gas units); required balance = this * current gas price\",\n env: \"MIN_BALANCE_GAS\",\n }),\n /**\n * Filter out all accounts with HF >= threshold during scan stage\n */\n hfThreshold: z.coerce\n .bigint()\n .nonnegative()\n .max(MAX_UINT256)\n .default(WAD - 1n) // 100% accounts are healthy, and credit account compressors filters by HF <= threshold\n .register(zommandRegistry, {\n flags: \"--hf-threshold <threshold>\",\n description:\n \"Filter out all accounts with HF >= threshold during scan stage\",\n env: \"HF_THRESHOLD\",\n }),\n /**\n * Default numSplits for router v3.1 contract\n */\n numSplits: z.coerce\n .bigint()\n .positive()\n .default(10n)\n .register(zommandRegistry, {\n flags: \"--num-splits <splits>\",\n description: \"Default numSplits for router v3.1 contract\",\n env: \"NUM_SPLITS\",\n }),\n /**\n * Liquidator mode\n */\n liquidationMode: z\n .enum([\"full\", \"partial\", \"batch\", \"deleverage\", \"wallet\"])\n .default(\"full\")\n .register(zommandRegistry, {\n flags: \"--liquidation-mode <mode>\",\n description: \"Liquidator mode (full/partial/batch/deleverage/wallet)\",\n env: \"LIQUIDATION_MODE\",\n }),\n /**\n * Enable optimistic liquidations\n */\n optimistic: boolLike().optional().register(zommandRegistry, {\n flags: \"--optimistic\",\n description: \"Enable optimistic liquidations\",\n env: \"OPTIMISTIC\",\n }),\n /**\n * In optimistic mode, use real health factor range to scan for accounts\n * and do not force-enable deleverage bot on accounts.\n *\n * This mode can be used to test that deleverage bot is able to detect accounts correctly\n */\n useProductionScanner: boolLike().optional().register(zommandRegistry, {\n flags: \"--use-production-scanner\",\n description:\n \"In optimistic mode, use real health factor range to scan for accounts and do not force-enable deleverage bot on accounts\",\n env: \"USE_PRODUCTION_SCANNER\",\n }),\n /**\n * Explicitly set gas limit for SDK\n * -1 to disable explicitly setting gas limit in SDK\n * If not set, SDK will use default gas limit\n */\n gasLimit: z.coerce.bigint().optional().register(zommandRegistry, {\n flags: \"--gas-limit <limit>\",\n description: \"Set gas limit for SDK\",\n env: \"GAS_LIMIT\",\n }),\n /**\n * Do not send transactions in non-optimistic mode, just log them\n */\n dryRun: boolLike().optional().register(zommandRegistry, {\n flags: \"--dry-run\",\n description:\n \"Do not send transactions in non-optimistic mode, just log them\",\n env: \"DRY_RUN\",\n }),\n /**\n * Limit number of accounts to load from compressor. 0 = unlimited, let compressor decide\n */\n compressorBatchSize: z.coerce\n .number()\n .nonnegative()\n .default(0)\n .register(zommandRegistry, {\n flags: \"--compressor-batch-size <size>\",\n description:\n \"Limit number of accounts to load from compressor. 0 = unlimited, let compressor decide\",\n env: \"COMPRESSOR_BATCH_SIZE\",\n }),\n /**\n * Slippage value for pathfined\n */\n slippage: z.coerce\n .number()\n .min(0)\n .max(10000)\n .int()\n .default(50)\n .register(zommandRegistry, {\n flags: \"--slippage <value>\",\n description: \"Slippage value for pathfinder\",\n env: \"SLIPPAGE\",\n }),\n /**\n * By default, reserve prices are not updated (except for deleverage mode)\n */\n updateReservePrices: boolLike()\n .optional()\n .default(false)\n .register(zommandRegistry, {\n flags: \"--update-reserve-prices\",\n description: \"Update reserve prices\",\n env: \"UPDATE_RESERVE_PRICES\",\n }),\n /**\n * List of assets to keep on account after liquidation\n */\n keepAssets: optionalAddressArrayLike().register(zommandRegistry, {\n flags: \"--keep-assets <assets...>\",\n description: \"List of assets to keep on account after liquidation\",\n env: \"KEEP_ASSETS\",\n }),\n /**\n * Address that receives the liquidation premium and leftover underlying.\n * Defaults to the executor address when unset.\n */\n premiumReceiver: addressLike().optional().register(zommandRegistry, {\n flags: \"--premium-receiver <address>\",\n description:\n \"Address that receives the liquidation premium and leftover underlying (defaults to executor address)\",\n env: \"PREMIUM_RECEIVER\",\n }),\n\n /**\n * Directory to save json with optimistic liquidation results\n */\n outDir: z.string().default(\".\").register(zommandRegistry, {\n flags: \"--out-dir <dir>\",\n description: \"Directory to save json with optimistic liquidation results\",\n env: \"OUT_DIR\",\n }),\n /**\n * REST endpoint to POST json with optimistic liquidation results\n */\n outEndpoint: z.url().optional().register(zommandRegistry, {\n flags: \"--out-endpoint <url>\",\n description:\n \"REST endpoint to POST json with optimistic liquidation results\",\n env: \"OUT_ENDPOINT\",\n }),\n /**\n * Headers for REST endpoint\n */\n outHeaders: z\n .string()\n .default(\"{}\")\n .transform(CensoredString.transform)\n .register(zommandRegistry, {\n flags: \"--out-headers <headers>\",\n description: \"Headers for REST endpoint\",\n env: \"OUT_HEADERS\",\n }),\n /**\n * s3 bucket to upload json with optimistic liquidation results\n */\n outS3Bucket: z.string().optional().register(zommandRegistry, {\n flags: \"--out-s3-bucket <bucket>\",\n description: \"S3 bucket to upload json with optimistic liquidation results\",\n env: \"OUT_S3_BUCKET\",\n }),\n /**\n * s3 bucket path prefix\n */\n outS3Prefix: z.string().default(\"\").register(zommandRegistry, {\n flags: \"--out-s3-prefix <prefix>\",\n description: \"S3 bucket path prefix\",\n env: \"OUT_S3_PREFIX\",\n }),\n /**\n * Filename of json with optimistic liquidation results for s3 or dir output\n */\n outFileName: z.string().optional().register(zommandRegistry, {\n flags: \"--out-file-name <name>\",\n description:\n \"Filename of json with optimistic liquidation results for s3 or dir output\",\n env: \"OUT_FILE_NAME\",\n }),\n\n /**\n * Notifications, global and per-curator\n */\n ...NotificationsConfig.shape,\n});\n\nexport type CommonSchema = z.infer<typeof CommonSchema>;\n","import { zommandRegistry } from \"@gearbox-protocol/cli-utils\";\nimport { z } from \"zod/v4\";\nimport { CommonSchema } from \"./common.js\";\n\nexport const BatchLiquidatorSchema = z.object({\n ...CommonSchema.shape,\n /**\n * Liquidator mode\n */\n liquidationMode: z.literal(\"batch\").register(zommandRegistry, {\n flags: \"--liquidation-mode <mode>\",\n description: \"Liquidator mode (full/partial/batch/deleverage/wallet)\",\n env: \"LIQUIDATION_MODE\",\n }),\n /**\n * Number of accounts to liquidate at once using batch liquidator\n */\n batchSize: z.coerce\n .number()\n .nonnegative()\n .default(10)\n .register(zommandRegistry, {\n flags: \"--batch-size <size>\",\n description:\n \"Number of accounts to liquidate at once using batch liquidator\",\n env: \"BATCH_SIZE\",\n }),\n});\n\nexport type BatchLiquidatorSchema = z.infer<typeof BatchLiquidatorSchema>;\n","import { zommandRegistry } from \"@gearbox-protocol/cli-utils\";\nimport { z } from \"zod/v4\";\nimport { CommonSchema } from \"./common.js\";\n\nexport const DeleverageLiquidatorSchema = z.object({\n ...CommonSchema.shape,\n /**\n * Liquidator mode\n */\n liquidationMode: z.literal(\"deleverage\").register(zommandRegistry, {\n flags: \"--liquidation-mode <mode>\",\n description: \"Liquidator mode (full/partial/batch/deleverage/wallet)\",\n env: \"LIQUIDATION_MODE\",\n }),\n});\n\nexport type DeleverageLiquidatorSchema = z.infer<\n typeof DeleverageLiquidatorSchema\n>;\n","import { zommandRegistry } from \"@gearbox-protocol/cli-utils\";\nimport { z } from \"zod/v4\";\nimport { CommonSchema } from \"./common.js\";\n\nexport const FullLiquidatorSchema = z\n .object({\n ...CommonSchema.shape,\n /**\n * Liquidator mode\n */\n liquidationMode: z.literal(\"full\").register(zommandRegistry, {\n flags: \"--liquidation-mode <mode>\",\n description: \"Liquidator mode (full/partial/batch/deleverage/wallet)\",\n env: \"LIQUIDATION_MODE\",\n }),\n /**\n * Debt policy\n * full - liquidate fully\n * debt-only - try to liquidate only debt\n * debt-expired - try to liquidate only debt for expired accounts\n */\n debtPolicy: z\n .enum([\"full\", \"debt-only\", \"debt-expired\"])\n .default(\"full\")\n .register(zommandRegistry, {\n flags: \"--debt-policy <policy>\",\n description: \"Liquidate fully/debt only/debt only for expired accounts\",\n env: \"DEBT_POLICY\",\n }),\n /**\n * Full-mode liquidation strategy set for this process.\n *\n * Values:\n * - `auto`: production default. Includes loss-policy, normal full, and RWA\n * stablecoin strategies. Routing is decided by account type and\n * per-strategy `isApplicable`: non-RWA accounts use loss policy when they\n * have bad debt and fall back to normal full liquidation otherwise, while\n * RWA accounts use only the RWA stablecoin strategy.\n * - `rwa`: include only `LiquidationStrategyRWAViaStablecoins`\n * Intended for optimistic RWA tracks.\n * - `loss`: include only `LiquidationStrategyLossPolicy`\n * Intended for optimistic loss-policy tracks.\n * - `full`: include only `LiquidationStrategyFull`\n * Intended for optimistic normal-full tracks.\n *\n * Optimistic mode rejects `auto`, so the external runner must invoke\n * explicit tracks: `rwa`, `loss`, and `full`.\n */\n strategy: z\n .enum([\"auto\", \"rwa\", \"loss\", \"full\"])\n .default(\"auto\")\n .register(zommandRegistry, {\n flags: \"--strategy <strategy>\",\n description:\n \"Full-mode liquidation strategy set (auto/rwa/loss/full). Optimistic mode requires an explicit track.\",\n env: \"STRATEGY\",\n }),\n })\n .refine(data => !(data.optimistic === true && data.strategy === \"auto\"), {\n message:\n \"strategy=auto is not allowed in optimistic mode; pick one of rwa/loss/full\",\n });\n\nexport type FullLiquidatorSchema = z.infer<typeof FullLiquidatorSchema>;\n","import {\n boolLike,\n optionalAddressArrayLike,\n zommandRegistry,\n} from \"@gearbox-protocol/cli-utils\";\nimport { z } from \"zod/v4\";\nimport { CommonSchema } from \"./common.js\";\n\nexport const PartialLiquidatorSchema = z\n .object({\n ...CommonSchema.shape,\n /**\n * Liquidator mode\n */\n liquidationMode: z.literal(\"partial\").register(zommandRegistry, {\n flags: \"--liquidation-mode <mode>\",\n description: \"Liquidator mode (full/partial/batch/deleverage/wallet)\",\n env: \"LIQUIDATION_MODE\",\n }),\n\n /**\n * Fallback to use full liquidator when partial liquidator fails\n */\n partialFallback: boolLike().optional().register(zommandRegistry, {\n flags: \"--partial-fallback\",\n description:\n \"Fallback to use full liquidator when partial liquidator fails\",\n env: \"PARTIAL_FALLBACK\",\n }),\n\n /**\n * Desired HF after partial liquidation, with 4 decimals (100% = 10000)\n */\n targetPartialHF: z.coerce\n .bigint()\n .default(10100n)\n .register(zommandRegistry, {\n flags: \"--target-partial-hf <hf>\",\n description:\n \"Desired HF after partial liquidation, with 4 decimals (100% = 10000)\",\n env: \"TARGET_PARTIAL_HF\",\n }),\n /**\n * Optimal HF for partial liquidation will be calculated for accounts with following underlying tokens\n * Takes precedence over targetPartialHF\n */\n calculatePartialHF: optionalAddressArrayLike().register(zommandRegistry, {\n flags: \"--calculate-partial-hf <tokens>\",\n description:\n \"Optimal HF for partial liquidation will be calculated for accounts with following underlying tokens\",\n env: \"CALCULATE_PARTIAL_HF\",\n }),\n })\n .refine(\n data => !(data.optimistic === true && data.partialFallback === true),\n { message: \"partialFallback=true is not allowed in optimistic mode\" },\n );\n\nexport type PartialLiquidatorSchema = z.infer<typeof PartialLiquidatorSchema>;\n","import { zommandRegistry } from \"@gearbox-protocol/cli-utils\";\nimport { z } from \"zod/v4\";\nimport { CommonSchema } from \"./common.js\";\n\nexport const WalletLiquidatorSchema = z.object({\n ...CommonSchema.shape,\n /**\n * Liquidator mode\n */\n liquidationMode: z.literal(\"wallet\").register(zommandRegistry, {\n flags: \"--liquidation-mode <mode>\",\n description: \"Liquidator mode (full/partial/batch/deleverage/wallet)\",\n env: \"LIQUIDATION_MODE\",\n }),\n});\n\nexport type WalletLiquidatorSchema = z.infer<typeof WalletLiquidatorSchema>;\n","import { z } from \"zod/v4\";\nimport { BatchLiquidatorSchema } from \"./batch-liquidator.js\";\nimport { DeleverageLiquidatorSchema } from \"./deleverage-liquidator.js\";\nimport { FullLiquidatorSchema } from \"./full-liquidator.js\";\nimport { PartialLiquidatorSchema } from \"./partial-liquidator.js\";\nimport { WalletLiquidatorSchema } from \"./wallet-liquidator.js\";\n\nexport const ConfigSchema = z.discriminatedUnion(\"liquidationMode\", [\n FullLiquidatorSchema,\n PartialLiquidatorSchema,\n BatchLiquidatorSchema,\n DeleverageLiquidatorSchema,\n WalletLiquidatorSchema,\n]);\n\nexport type ConfigSchema = z.infer<typeof ConfigSchema>;\n"],"mappings":";;;;;AAcA,IAAa,uBAAb,MAAkC;CAChC;CACA;CAEA,YAAY,QAAsB;EAChC,OAAO,OAAO,MAAM,MAAM;CAC5B;CAEA,MAAa,WAAW,WAAqC;EAC3D,MAAM,SAAS,mBAAmB;GAChC;GACA,MAAM;EACR,CAAC;EAED,MAAM,CAAC,YAAY,WAAW,MAAM,QAAQ,IAAI,CAC9C,OAAO,eAAe,GACtB,OAAO,WAAW,CACpB,CAAC;EAED,KAAK,cAAc;EACnB,KAAK,WAAW;CAClB;CAEA,IAAW,aAAqB;EAC9B,IAAI,KAAK,gBAAgB,KAAA,GACvB,MAAM,IAAI,MAAM,wBAAwB;EAE1C,OAAO,KAAK;CACd;CA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AAa;;;;CAIhB,iBAAiB,EAAE,QAAQ,SAAS,CAAC,CAAC,SAAS,iBAAiB;EAC9D,OAAO;EACP,aAAa;EACb,KAAK;CACP,CAAC;;;;CAKD,iBAAiB,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,iBAAiB;EAC/D,OAAO;EACP,aACE;EACF,KAAK;CACP,CAAC;;;;CAKD,iBAAiB,EAAE,OAChB,OAAO,CAAC,CACR,QAAQ,MAAM,CAAC,CACf,SAAS,iBAAiB;EACzB,OAAO;EACP,aACE;EACF,KAAK;CACP,CAAC;;;;;CAKH,oBAAoB,yBAAyB,CAAC,CAAC,SAAS,iBAAiB;EACvE,OAAO;EACP,aACE;EACF,KAAK;CACP,CAAC;AACH,CAAC,CAAC,CACD,QACC,SAAQ,EAAE,KAAK,eAAe,QAAQ,KAAK,oBAAoB,OAC/D,EAAE,SAAS,yDAAyD,CACtE;;;ACpDF,MAAa,yBAAyB,EAAE,OAAO;CAC7C,GAAG,aAAa;;;;CAIhB,iBAAiB,EAAE,QAAQ,QAAQ,CAAC,CAAC,SAAS,iBAAiB;EAC7D,OAAO;EACP,aAAa;EACb,KAAK;CACP,CAAC;AACH,CAAC;;;ACPD,MAAa,eAAe,EAAE,mBAAmB,mBAAmB;CAClE;CACA;CACA;CACA;CACA;AACF,CAAC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/config.ts","../src/liquidationStatus.ts","../src/notifications.ts","../src/common.ts","../src/batch-liquidator.ts","../src/deleverage-liquidator.ts","../src/full-liquidator.ts","../src/partial-liquidator.ts","../src/wallet-liquidator.ts","../src/schema.ts","../src/trackRoles.ts"],"sourcesContent":["import { createPublicClient, type Transport } from \"viem\";\nimport type { CommonSchema } from \"./common.js\";\nimport type { ConfigSchema } from \"./schema.js\";\n\nexport type Config = ConfigSchema & {\n readonly chainId: number;\n readonly startBlock: bigint;\n};\n\nexport type LiqduiatorConfig<TSchema extends CommonSchema> = TSchema & {\n readonly chainId: number;\n readonly startBlock: bigint;\n};\n\nexport class ConfigImplementation {\n #startBlock?: bigint;\n #chainId?: number;\n\n constructor(schema: ConfigSchema) {\n Object.assign(this, schema);\n }\n\n public async initialize(transport: Transport): Promise<void> {\n const client = createPublicClient({\n transport,\n name: \"preload client\",\n });\n\n const [startBlock, chainId] = await Promise.all([\n client.getBlockNumber(),\n client.getChainId(),\n ]);\n\n this.#startBlock = startBlock;\n this.#chainId = chainId;\n }\n\n public get startBlock(): bigint {\n if (this.#startBlock === undefined) {\n throw new Error(\"config not initialized\");\n }\n return this.#startBlock;\n }\n\n public get chainId(): number {\n if (this.#chainId === undefined) {\n throw new Error(\"config not initialized\");\n }\n return this.#chainId;\n }\n}\n","import type { OptimisticResult } from \"./optimist.js\";\n\nexport type LiquidationStatus = \"success\" | \"warning\" | \"error\";\n\nexport type StatusInput = Pick<OptimisticResult, \"isError\" | \"error\">;\n\nexport interface AccountStatusOptions {\n /**\n * Whitelisted accounts are always `success`\n */\n whitelisted?: boolean;\n}\n\n/**\n * Status of a single liquidation result.\n * An error that contains `warning:` means the track did not attempt the liquidation.\n */\nexport function resultStatus(result: StatusInput): LiquidationStatus {\n if (!result.isError) {\n return \"success\";\n }\n return result.error?.includes(\"warning:\") ? \"warning\" : \"error\";\n}\n\n/**\n * Status of one credit account given its results across the tracks of one role.\n *\n * Returns the best status, not the worst: the account is `success` if any track\n * liquidated it, `error` if none did and at least one failed outright, and\n * `warning` otherwise (including when there are no results at all).\n */\nexport function accountStatus(\n results: readonly StatusInput[],\n options: AccountStatusOptions = {},\n): LiquidationStatus {\n if (options.whitelisted) {\n return \"success\";\n }\n const statuses = new Set(results.map(resultStatus));\n if (statuses.has(\"success\")) {\n return \"success\";\n }\n if (statuses.has(\"error\")) {\n return \"error\";\n }\n return \"warning\";\n}\n","import { NotificationConfig } from \"@gearbox-protocol/cli-utils\";\nimport type { CuratorName } from \"@gearbox-protocol/sdk/model\";\nimport { z } from \"zod/v4\";\n\nconst extendedOptions = NotificationConfig.options.map(o =>\n o.extend({\n /**\n * When undefined, defaults to all curators together (aka Gearbox internal)\n */\n curator: z.custom<CuratorName>(s => typeof s === \"string\").optional(),\n }),\n);\n\nexport const NotificationsConfig = z.object({\n notifications: z\n .array(\n z.discriminatedUnion(\n NotificationConfig.def.discriminator,\n extendedOptions as [\n (typeof extendedOptions)[0],\n ...(typeof extendedOptions)[number][],\n ],\n ),\n )\n .optional()\n .default([]),\n});\n","import {\n addressLike,\n boolLike,\n CensoredString,\n clientWhitelistItemSchema,\n optionalAddressArrayLike,\n ProvidersSchema,\n zommandRegistry,\n} from \"@gearbox-protocol/cli-utils\";\nimport { MAX_UINT256, WAD } from \"@gearbox-protocol/sdk/onchain\";\nimport { type Hex, isHex } from \"viem\";\nimport { z } from \"zod/v4\";\nimport { NotificationsConfig } from \"./notifications.js\";\n\nexport const CommonSchema = z.object({\n ...ProvidersSchema.shape,\n /**\n * By default uses address provider from @gearbox-protocol/sdk\n * Use this option to override address provider\n */\n addressProvider: addressLike().optional().register(zommandRegistry, {\n flags: \"--address-provider <address>\",\n description:\n \"Address provider override, uses default value from SDK otherwise\",\n env: \"ADDRESS_PROVIDER\",\n }),\n /**\n * Market configurators addresses to attach SDK\n */\n marketConfigurators: optionalAddressArrayLike().register(zommandRegistry, {\n flags: \"--market-configurators <addresses...>\",\n description:\n \"Market configurators to use for the process, comma separated. Uses default value from SDK if not specified\",\n env: \"MARKET_CONFIGURATORS\",\n }),\n /**\n * RWA factories addresses to attach SDK\n */\n rwaFactories: optionalAddressArrayLike().register(zommandRegistry, {\n flags: \"--rwa-factories <addresses...>\",\n description:\n \"RWA factories to use for the process, comma separated. Uses default value from SDK if not specified\",\n env: \"RWA_FACTORIES\",\n }),\n /**\n * App name used in various messages to distinguish instances\n */\n appName: z.string().default(\"liquidator-ts\").register(zommandRegistry, {\n flags: \"--app-name <name>\",\n description: \"App name used in various messages to distinguish instances\",\n env: \"APP_NAME\",\n }),\n /**\n * Port to expose some vital signals and metrics\n */\n port: z.coerce.number().default(4000).register(zommandRegistry, {\n flags: \"--port <port>\",\n description: \"Port to expose some vital signals and metrics\",\n env: \"PORT\",\n }),\n /**\n * Full URL of the whitelist endpoint. Entries can be credit account\n * addresses or credit manager addresses. Only applied in non-optimistic mode.\n */\n whitelistUrl: z.url().optional().register(zommandRegistry, {\n flags: \"--whitelist-url <url>\",\n description:\n \"Full URL of the liquidator soft whitelist endpoint. Entries are credit account or credit manager addresses. Does not prevent liquidation, but annotates failure notifications. Only applied in non-optimistic mode.\",\n env: \"WHITELIST_URL\",\n }),\n /**\n * Static (hard) whitelist that prevents liquidation entirely.\n * Entries can be credit account, credit manager or token addresses.\n */\n hardWhitelist: z.array(clientWhitelistItemSchema).optional(),\n /**\n * Only check this account during local debug session\n */\n debugAccount: addressLike().optional().register(zommandRegistry, {\n flags: \"--debug-account <address>\",\n description: \"Only check this account during local debug session\",\n env: \"DEBUG_ACCOUNT\",\n }),\n /**\n * Only check this credit manager during local debug session\n */\n debugManager: addressLike().optional().register(zommandRegistry, {\n flags: \"--debug-manager <address>\",\n description: \"Only check this credit manager during local debug session\",\n env: \"DEBUG_MANAGER\",\n }),\n /**\n * Path to foundry/cast binary, so that we can create tree-like traces in case of errors\n * Used during optimistic liquidations\n */\n castBin: z.string().optional().register(zommandRegistry, {\n flags: \"--cast-bin <path>\",\n description:\n \"Path to foundry/cast binary, so that we can create tree-like traces in case of errors\",\n env: \"CAST_BIN\",\n }),\n /**\n * Timeout duration passed to `timeout` utility when running cast.\n * If unset, cast runs without a timeout. Accepts any value understood by `timeout(1)` (e.g. `30s`, `1m`).\n */\n castTimeout: z.string().optional().default(\"1m\").register(zommandRegistry, {\n flags: \"--cast-timeout <duration>\",\n description:\n \"Timeout duration for cast invocations (e.g. 30s, 1m). If unset, cast runs without a timeout.\",\n env: \"CAST_TIMEOUT\",\n }),\n /**\n * Stale block threshold in seconds, to notify and try to rotate rpc provider. 0 means no monitoring\n */\n staleBlockThreshold: z.coerce\n .number()\n .nonnegative()\n .default(120)\n .register(zommandRegistry, {\n flags: \"--stale-block-threshold <threshold>\",\n description:\n \"Stale block threshold in seconds, to notify and try to rotate rpc provider. 0 means no monitoring\",\n env: \"STALE_BLOCK_THRESHOLD\",\n }),\n /**\n * Max block range size for eth_getLogs\n */\n logsPageSize: z.coerce\n .bigint()\n .nonnegative()\n .optional()\n .register(zommandRegistry, {\n flags: \"--logs-page-size <size>\",\n description: \"Max block range size for eth_getLogs\",\n env: \"LOGS_PAGE_SIZE\",\n }),\n /**\n * Polling interval in milliseconds, default to what's default in viem\n */\n pollingInterval: z.coerce\n .number()\n .nonnegative()\n .optional()\n .register(zommandRegistry, {\n flags: \"--polling-interval <interval>\",\n description:\n \"Polling interval in milliseconds, default to what's default in viem\",\n env: \"POLLING_INTERVAL\",\n }),\n /**\n * Private key used to send liquidation transactions\n * Required in non-optimistic mode, must not be set in optimistic mode\n */\n privateKey: z\n .string()\n .min(1)\n .transform((s): Hex => {\n return isHex(s) ? s : `0x${s}`;\n })\n .transform(CensoredString.transform<Hex>)\n .optional()\n .register(zommandRegistry, {\n flags: \"--private-key <key>\",\n description:\n \"Private key used to send liquidation transactions. Required in non-optimistic mode, must not be set in optimistic mode\",\n env: \"PRIVATE_KEY\",\n }),\n /**\n * Address to impersonate as transaction sender on anvil fork\n * Required in optimistic mode, must not be set in non-optimistic mode\n */\n liquidatorAddress: addressLike().optional().register(zommandRegistry, {\n flags: \"--liquidator-address <address>\",\n description:\n \"Address to impersonate as transaction sender on anvil fork. Required in optimistic mode, must not be set in non-optimistic mode\",\n env: \"LIQUIDATOR_ADDRESS\",\n }),\n /**\n * Minimum executor gas budget, in gas units. The required balance to send a\n * notification is computed as `minBalanceGas * currentGasPrice`.\n */\n minBalanceGas: z.coerce\n .bigint()\n .positive()\n // At some point on Mainnet there were 40 accounts\n // It costed ~80M gas to deleverage all of them, deleverage being the most expensive operation\n .default(85_000_000n)\n .register(zommandRegistry, {\n flags: \"--min-balance-gas <gas>\",\n description:\n \"Minimum executor gas budget (in gas units); required balance = this * current gas price\",\n env: \"MIN_BALANCE_GAS\",\n }),\n /**\n * Filter out all accounts with HF >= threshold during scan stage\n */\n hfThreshold: z.coerce\n .bigint()\n .nonnegative()\n .max(MAX_UINT256)\n .default(WAD - 1n) // 100% accounts are healthy, and credit account compressors filters by HF <= threshold\n .register(zommandRegistry, {\n flags: \"--hf-threshold <threshold>\",\n description:\n \"Filter out all accounts with HF >= threshold during scan stage\",\n env: \"HF_THRESHOLD\",\n }),\n /**\n * Default numSplits for router v3.1 contract\n */\n numSplits: z.coerce\n .bigint()\n .positive()\n .default(10n)\n .register(zommandRegistry, {\n flags: \"--num-splits <splits>\",\n description: \"Default numSplits for router v3.1 contract\",\n env: \"NUM_SPLITS\",\n }),\n /**\n * Liquidator mode\n */\n liquidationMode: z\n .enum([\n \"full\",\n \"partial\",\n \"batch\",\n \"deleverage\",\n \"wallet-full\",\n \"wallet-partial\",\n ])\n .default(\"full\")\n .register(zommandRegistry, {\n flags: \"--liquidation-mode <mode>\",\n description:\n \"Liquidator mode (full/partial/batch/deleverage/wallet-full/wallet-partial)\",\n env: \"LIQUIDATION_MODE\",\n }),\n /**\n * Enable optimistic liquidations\n */\n optimistic: boolLike().optional().register(zommandRegistry, {\n flags: \"--optimistic\",\n description: \"Enable optimistic liquidations\",\n env: \"OPTIMISTIC\",\n }),\n /**\n * In optimistic mode, use real health factor range to scan for accounts\n * and do not force-enable deleverage bot on accounts.\n *\n * This mode can be used to test that deleverage bot is able to detect accounts correctly\n */\n useProductionScanner: boolLike().optional().register(zommandRegistry, {\n flags: \"--use-production-scanner\",\n description:\n \"In optimistic mode, use real health factor range to scan for accounts and do not force-enable deleverage bot on accounts\",\n env: \"USE_PRODUCTION_SCANNER\",\n }),\n /**\n * Explicitly set gas limit for SDK\n * -1 to disable explicitly setting gas limit in SDK\n * If not set, SDK will use default gas limit\n */\n gasLimit: z.coerce.bigint().optional().register(zommandRegistry, {\n flags: \"--gas-limit <limit>\",\n description: \"Set gas limit for SDK\",\n env: \"GAS_LIMIT\",\n }),\n /**\n * Do not send transactions in non-optimistic mode, just log them\n */\n dryRun: boolLike().optional().register(zommandRegistry, {\n flags: \"--dry-run\",\n description:\n \"Do not send transactions in non-optimistic mode, just log them\",\n env: \"DRY_RUN\",\n }),\n /**\n * Limit number of accounts to load from compressor. 0 = unlimited, let compressor decide\n */\n compressorBatchSize: z.coerce\n .number()\n .nonnegative()\n .default(0)\n .register(zommandRegistry, {\n flags: \"--compressor-batch-size <size>\",\n description:\n \"Limit number of accounts to load from compressor. 0 = unlimited, let compressor decide\",\n env: \"COMPRESSOR_BATCH_SIZE\",\n }),\n /**\n * Slippage value for pathfined\n */\n slippage: z.coerce\n .number()\n .min(0)\n .max(10000)\n .int()\n .default(50)\n .register(zommandRegistry, {\n flags: \"--slippage <value>\",\n description: \"Slippage value for pathfinder\",\n env: \"SLIPPAGE\",\n }),\n /**\n * By default, reserve prices are not updated (except for deleverage mode)\n */\n updateReservePrices: boolLike()\n .optional()\n .default(false)\n .register(zommandRegistry, {\n flags: \"--update-reserve-prices\",\n description: \"Update reserve prices\",\n env: \"UPDATE_RESERVE_PRICES\",\n }),\n /**\n * List of assets to keep on account after liquidation\n */\n keepAssets: optionalAddressArrayLike().register(zommandRegistry, {\n flags: \"--keep-assets <assets...>\",\n description: \"List of assets to keep on account after liquidation\",\n env: \"KEEP_ASSETS\",\n }),\n /**\n * Address that receives the liquidation premium and leftover underlying.\n * Defaults to the executor address when unset.\n */\n premiumReceiver: addressLike().optional().register(zommandRegistry, {\n flags: \"--premium-receiver <address>\",\n description:\n \"Address that receives the liquidation premium and leftover underlying (defaults to executor address)\",\n env: \"PREMIUM_RECEIVER\",\n }),\n\n /**\n * Directory to save json with optimistic liquidation results\n */\n outDir: z.string().default(\".\").register(zommandRegistry, {\n flags: \"--out-dir <dir>\",\n description: \"Directory to save json with optimistic liquidation results\",\n env: \"OUT_DIR\",\n }),\n /**\n * REST endpoint to POST json with optimistic liquidation results\n */\n outEndpoint: z.url().optional().register(zommandRegistry, {\n flags: \"--out-endpoint <url>\",\n description:\n \"REST endpoint to POST json with optimistic liquidation results\",\n env: \"OUT_ENDPOINT\",\n }),\n /**\n * Headers for REST endpoint\n */\n outHeaders: z\n .string()\n .default(\"{}\")\n .transform(CensoredString.transform)\n .register(zommandRegistry, {\n flags: \"--out-headers <headers>\",\n description: \"Headers for REST endpoint\",\n env: \"OUT_HEADERS\",\n }),\n /**\n * s3 bucket to upload json with optimistic liquidation results\n */\n outS3Bucket: z.string().optional().register(zommandRegistry, {\n flags: \"--out-s3-bucket <bucket>\",\n description: \"S3 bucket to upload json with optimistic liquidation results\",\n env: \"OUT_S3_BUCKET\",\n }),\n /**\n * s3 bucket path prefix\n */\n outS3Prefix: z.string().default(\"\").register(zommandRegistry, {\n flags: \"--out-s3-prefix <prefix>\",\n description: \"S3 bucket path prefix\",\n env: \"OUT_S3_PREFIX\",\n }),\n /**\n * Filename of json with optimistic liquidation results for s3 or dir output\n */\n outFileName: z.string().optional().register(zommandRegistry, {\n flags: \"--out-file-name <name>\",\n description:\n \"Filename of json with optimistic liquidation results for s3 or dir output\",\n env: \"OUT_FILE_NAME\",\n }),\n\n /**\n * Notifications, global and per-curator\n */\n ...NotificationsConfig.shape,\n});\n\nexport type CommonSchema = z.infer<typeof CommonSchema>;\n","import { zommandRegistry } from \"@gearbox-protocol/cli-utils\";\nimport { z } from \"zod/v4\";\nimport { CommonSchema } from \"./common.js\";\n\nexport const BatchLiquidatorSchema = z.object({\n ...CommonSchema.shape,\n /**\n * Liquidator mode\n */\n liquidationMode: z.literal(\"batch\").register(zommandRegistry, {\n flags: \"--liquidation-mode <mode>\",\n description:\n \"Liquidator mode (full/partial/batch/deleverage/wallet-full/wallet-partial)\",\n env: \"LIQUIDATION_MODE\",\n }),\n /**\n * Number of accounts to liquidate at once using batch liquidator\n */\n batchSize: z.coerce\n .number()\n .nonnegative()\n .default(10)\n .register(zommandRegistry, {\n flags: \"--batch-size <size>\",\n description:\n \"Number of accounts to liquidate at once using batch liquidator\",\n env: \"BATCH_SIZE\",\n }),\n});\n\nexport type BatchLiquidatorSchema = z.infer<typeof BatchLiquidatorSchema>;\n","import { zommandRegistry } from \"@gearbox-protocol/cli-utils\";\nimport { z } from \"zod/v4\";\nimport { CommonSchema } from \"./common.js\";\n\nexport const DeleverageLiquidatorSchema = z.object({\n ...CommonSchema.shape,\n /**\n * Liquidator mode\n */\n liquidationMode: z.literal(\"deleverage\").register(zommandRegistry, {\n flags: \"--liquidation-mode <mode>\",\n description:\n \"Liquidator mode (full/partial/batch/deleverage/wallet-full/wallet-partial)\",\n env: \"LIQUIDATION_MODE\",\n }),\n});\n\nexport type DeleverageLiquidatorSchema = z.infer<\n typeof DeleverageLiquidatorSchema\n>;\n","import { zommandRegistry } from \"@gearbox-protocol/cli-utils\";\nimport { z } from \"zod/v4\";\nimport { CommonSchema } from \"./common.js\";\n\nexport const FullLiquidatorSchema = z\n .object({\n ...CommonSchema.shape,\n /**\n * Liquidator mode\n */\n liquidationMode: z.literal(\"full\").register(zommandRegistry, {\n flags: \"--liquidation-mode <mode>\",\n description:\n \"Liquidator mode (full/partial/batch/deleverage/wallet-full/wallet-partial)\",\n env: \"LIQUIDATION_MODE\",\n }),\n /**\n * Debt policy\n * full - liquidate fully\n * debt-only - try to liquidate only debt\n * debt-expired - try to liquidate only debt for expired accounts\n */\n debtPolicy: z\n .enum([\"full\", \"debt-only\", \"debt-expired\"])\n .default(\"full\")\n .register(zommandRegistry, {\n flags: \"--debt-policy <policy>\",\n description: \"Liquidate fully/debt only/debt only for expired accounts\",\n env: \"DEBT_POLICY\",\n }),\n /**\n * Full-mode liquidation strategy set for this process.\n *\n * Values:\n * - `auto`: production default. Includes loss-policy, normal full, and RWA\n * stablecoin strategies. Routing is decided by account type and\n * per-strategy `isApplicable`: non-RWA accounts use loss policy when they\n * have bad debt and fall back to normal full liquidation otherwise, while\n * RWA accounts use only the RWA stablecoin strategy.\n * - `rwa`: include only `LiquidationStrategyRWAViaStablecoins`\n * Intended for optimistic RWA tracks.\n * - `loss`: include only `LiquidationStrategyLossPolicy`\n * Intended for optimistic loss-policy tracks.\n * - `full`: include only `LiquidationStrategyFull`\n * Intended for optimistic normal-full tracks.\n *\n * Optimistic mode rejects `auto`, so the external runner must invoke\n * explicit tracks: `rwa`, `loss`, and `full`.\n */\n strategy: z\n .enum([\"auto\", \"rwa\", \"loss\", \"full\"])\n .default(\"auto\")\n .register(zommandRegistry, {\n flags: \"--strategy <strategy>\",\n description:\n \"Full-mode liquidation strategy set (auto/rwa/loss/full). Optimistic mode requires an explicit track.\",\n env: \"STRATEGY\",\n }),\n })\n .refine(data => !(data.optimistic === true && data.strategy === \"auto\"), {\n message:\n \"strategy=auto is not allowed in optimistic mode; pick one of rwa/loss/full\",\n });\n\nexport type FullLiquidatorSchema = z.infer<typeof FullLiquidatorSchema>;\n","import {\n boolLike,\n optionalAddressArrayLike,\n zommandRegistry,\n} from \"@gearbox-protocol/cli-utils\";\nimport { z } from \"zod/v4\";\nimport { CommonSchema } from \"./common.js\";\n\nexport const PartialLiquidatorSchema = z\n .object({\n ...CommonSchema.shape,\n /**\n * Liquidator mode\n */\n liquidationMode: z.literal(\"partial\").register(zommandRegistry, {\n flags: \"--liquidation-mode <mode>\",\n description:\n \"Liquidator mode (full/partial/batch/deleverage/wallet-full/wallet-partial)\",\n env: \"LIQUIDATION_MODE\",\n }),\n\n /**\n * Fallback to use full liquidator when partial liquidator fails\n */\n partialFallback: boolLike().optional().register(zommandRegistry, {\n flags: \"--partial-fallback\",\n description:\n \"Fallback to use full liquidator when partial liquidator fails\",\n env: \"PARTIAL_FALLBACK\",\n }),\n\n /**\n * Desired HF after partial liquidation, with 4 decimals (100% = 10000)\n */\n targetPartialHF: z.coerce\n .bigint()\n .default(10100n)\n .register(zommandRegistry, {\n flags: \"--target-partial-hf <hf>\",\n description:\n \"Desired HF after partial liquidation, with 4 decimals (100% = 10000)\",\n env: \"TARGET_PARTIAL_HF\",\n }),\n /**\n * Optimal HF for partial liquidation will be calculated for accounts with following underlying tokens\n * Takes precedence over targetPartialHF\n */\n calculatePartialHF: optionalAddressArrayLike().register(zommandRegistry, {\n flags: \"--calculate-partial-hf <tokens>\",\n description:\n \"Optimal HF for partial liquidation will be calculated for accounts with following underlying tokens\",\n env: \"CALCULATE_PARTIAL_HF\",\n }),\n })\n .refine(\n data => !(data.optimistic === true && data.partialFallback === true),\n { message: \"partialFallback=true is not allowed in optimistic mode\" },\n );\n\nexport type PartialLiquidatorSchema = z.infer<typeof PartialLiquidatorSchema>;\n","import { zommandRegistry } from \"@gearbox-protocol/cli-utils\";\nimport { z } from \"zod/v4\";\nimport { CommonSchema } from \"./common.js\";\n\nexport const WalletLiquidatorSchema = z.object({\n ...CommonSchema.shape,\n /**\n * Liquidator mode\n */\n liquidationMode: z\n .enum([\"wallet-full\", \"wallet-partial\"])\n .register(zommandRegistry, {\n flags: \"--liquidation-mode <mode>\",\n description:\n \"Liquidator mode (full/partial/batch/deleverage/wallet-full/wallet-partial)\",\n env: \"LIQUIDATION_MODE\",\n }),\n});\n\nexport type WalletLiquidatorSchema = z.infer<typeof WalletLiquidatorSchema>;\n","import { z } from \"zod/v4\";\nimport { BatchLiquidatorSchema } from \"./batch-liquidator.js\";\nimport { DeleverageLiquidatorSchema } from \"./deleverage-liquidator.js\";\nimport { FullLiquidatorSchema } from \"./full-liquidator.js\";\nimport { PartialLiquidatorSchema } from \"./partial-liquidator.js\";\nimport { WalletLiquidatorSchema } from \"./wallet-liquidator.js\";\n\nexport const ConfigSchema = z.discriminatedUnion(\"liquidationMode\", [\n FullLiquidatorSchema,\n PartialLiquidatorSchema,\n BatchLiquidatorSchema,\n DeleverageLiquidatorSchema,\n WalletLiquidatorSchema,\n]);\n\nexport type ConfigSchema = z.infer<typeof ConfigSchema>;\n","import type { ExecutionReport, TrackReport, TrackRole } from \"./report.js\";\n\nexport const TRACK_ROLES = [\n \"service\",\n \"manual\",\n] as const satisfies readonly TrackRole[];\n\nexport function getTrackRole(track: Pick<TrackReport, \"role\">): TrackRole {\n return track.role ?? \"service\";\n}\n\n/**\n * Returns a report that contains only the tracks of the given role and their results\n */\nexport function filterReportByRole(\n report: ExecutionReport,\n role: TrackRole,\n): ExecutionReport {\n const tracks = report.tracks.filter(t => getTrackRole(t) === role);\n const trackIds = new Set(tracks.map(t => t.id));\n return {\n ...report,\n tracks,\n results: report.results.filter(r => trackIds.has(r.trackId)),\n };\n}\n\n/**\n * Returns the roles that have at least one track in the report, in {@link TRACK_ROLES} order\n */\nexport function reportRoles(\n report: Pick<ExecutionReport, \"tracks\">,\n): TrackRole[] {\n const present = new Set(report.tracks.map(getTrackRole));\n return TRACK_ROLES.filter(r => present.has(r));\n}\n"],"mappings":";;;;;AAcA,IAAa,uBAAb,MAAkC;CAChC;CACA;CAEA,YAAY,QAAsB;EAChC,OAAO,OAAO,MAAM,MAAM;CAC5B;CAEA,MAAa,WAAW,WAAqC;EAC3D,MAAM,SAAS,mBAAmB;GAChC;GACA,MAAM;EACR,CAAC;EAED,MAAM,CAAC,YAAY,WAAW,MAAM,QAAQ,IAAI,CAC9C,OAAO,eAAe,GACtB,OAAO,WAAW,CACpB,CAAC;EAED,KAAK,cAAc;EACnB,KAAK,WAAW;CAClB;CAEA,IAAW,aAAqB;EAC9B,IAAI,KAAK,gBAAgB,KAAA,GACvB,MAAM,IAAI,MAAM,wBAAwB;EAE1C,OAAO,KAAK;CACd;CAEA,IAAW,UAAkB;EAC3B,IAAI,KAAK,aAAa,KAAA,GACpB,MAAM,IAAI,MAAM,wBAAwB;EAE1C,OAAO,KAAK;CACd;AACF;;;;;;;ACjCA,SAAgB,aAAa,QAAwC;CACnE,IAAI,CAAC,OAAO,SACV,OAAO;CAET,OAAO,OAAO,OAAO,SAAS,UAAU,IAAI,YAAY;AAC1D;;;;;;;;AASA,SAAgB,cACd,SACA,UAAgC,CAAC,GACd;CACnB,IAAI,QAAQ,aACV,OAAO;CAET,MAAM,WAAW,IAAI,IAAI,QAAQ,I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UAAU,IAAI,IAAI,OAAO,OAAO,IAAI,YAAY,CAAC;CACvD,OAAO,YAAY,QAAO,MAAK,QAAQ,IAAI,CAAC,CAAC;AAC/C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/liquidator-v2-config",
3
- "version": "11.1.0-beta.5",
3
+ "version": "11.1.0-beta.7",
4
4
  "description": "Configuration schemas and optimistic result types for Gearbox liquidator v2",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,17 +17,19 @@
17
17
  "dist"
18
18
  ],
19
19
  "dependencies": {
20
- "@gearbox-protocol/cli-utils": "11.1.0-beta.5",
21
- "@gearbox-protocol/sdk": "17.13.0-next.2",
20
+ "@gearbox-protocol/cli-utils": "11.1.0-beta.7",
21
+ "@gearbox-protocol/sdk": "17.13.0-next.10",
22
22
  "viem": "^2.57.4",
23
- "zod": "^4.6.5"
23
+ "zod": "^4.6.7"
24
24
  },
25
25
  "devDependencies": {
26
26
  "tsdown": "^0.23.0",
27
- "typescript": "^7.0.2"
27
+ "typescript": "^7.0.2",
28
+ "vitest": "^5.0.3"
28
29
  },
29
30
  "scripts": {
30
31
  "build": "tsdown",
31
- "typecheck:ci": "tsc --noEmit"
32
+ "typecheck:ci": "tsc --noEmit",
33
+ "test": "vitest run"
32
34
  }
33
35
  }