@gearbox-protocol/liquidator-v2-config 9.2.4 → 9.3.0-beta.10
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 +333 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -7
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -201,6 +201,7 @@ declare const CommonSchema: z.ZodObject<{
|
|
|
201
201
|
deleverage: "deleverage";
|
|
202
202
|
full: "full";
|
|
203
203
|
partial: "partial";
|
|
204
|
+
wallet: "wallet";
|
|
204
205
|
}>>;
|
|
205
206
|
optimistic: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<boolean, any>>>;
|
|
206
207
|
useProductionScanner: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<boolean, any>>>;
|
|
@@ -651,6 +652,109 @@ declare const ConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
651
652
|
outS3Prefix: z.ZodDefault<z.ZodString>;
|
|
652
653
|
outFileName: z.ZodOptional<z.ZodString>;
|
|
653
654
|
liquidationMode: z.ZodLiteral<"deleverage">;
|
|
655
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
656
|
+
network: z.ZodEnum<{
|
|
657
|
+
Arbitrum: "Arbitrum";
|
|
658
|
+
Avalanche: "Avalanche";
|
|
659
|
+
BNB: "BNB";
|
|
660
|
+
Base: "Base";
|
|
661
|
+
Berachain: "Berachain";
|
|
662
|
+
Etherlink: "Etherlink";
|
|
663
|
+
Hemi: "Hemi";
|
|
664
|
+
Lisk: "Lisk";
|
|
665
|
+
Mainnet: "Mainnet";
|
|
666
|
+
MegaETH: "MegaETH";
|
|
667
|
+
Monad: "Monad";
|
|
668
|
+
Optimism: "Optimism";
|
|
669
|
+
Plasma: "Plasma";
|
|
670
|
+
Somnia: "Somnia";
|
|
671
|
+
Sonic: "Sonic";
|
|
672
|
+
WorldChain: "WorldChain";
|
|
673
|
+
}>;
|
|
674
|
+
jsonRpcProviders: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>, z.ZodArray<z.ZodPipe<z.ZodURL, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredURL, string>>>>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredURL[] | undefined, import("@gearbox-protocol/cli-utils").CensoredURL[]>>>;
|
|
675
|
+
enabledProviders: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>, z.ZodArray<z.ZodEnum<{
|
|
676
|
+
alchemy: "alchemy";
|
|
677
|
+
ankr: "ankr";
|
|
678
|
+
custom: "custom";
|
|
679
|
+
drpc: "drpc";
|
|
680
|
+
erpc: "erpc";
|
|
681
|
+
thirdweb: "thirdweb";
|
|
682
|
+
}>>>>;
|
|
683
|
+
alchemyKeys: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>, z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string>>>>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>[] | undefined, import("@gearbox-protocol/cli-utils").CensoredString<string>[]>>>;
|
|
684
|
+
drpcKeys: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>, z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string>>>>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>[] | undefined, import("@gearbox-protocol/cli-utils").CensoredString<string>[]>>>;
|
|
685
|
+
ankrKeys: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>, z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string>>>>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>[] | undefined, import("@gearbox-protocol/cli-utils").CensoredString<string>[]>>>;
|
|
686
|
+
thirdwebKeys: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>, z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string>>>>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>[] | undefined, import("@gearbox-protocol/cli-utils").CensoredString<string>[]>>>;
|
|
687
|
+
erpcProjectId: z.ZodOptional<z.ZodString>;
|
|
688
|
+
erpcUrl: z.ZodDefault<z.ZodURL>;
|
|
689
|
+
jsonRpcTimeout: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
690
|
+
notifications: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
691
|
+
type: z.ZodLiteral<"slack">;
|
|
692
|
+
webhookUrl: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<import("@gearbox-protocol/cli-utils").CensoredString<string>, import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>;
|
|
693
|
+
alertsOnly: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<boolean, any>>>;
|
|
694
|
+
curator: z.ZodOptional<z.ZodCustom<import("@gearbox-protocol/sdk").Curator, import("@gearbox-protocol/sdk").Curator>>;
|
|
695
|
+
}, z.core.$strip> | z.ZodObject<{
|
|
696
|
+
type: z.ZodLiteral<"telegram">;
|
|
697
|
+
token: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<import("@gearbox-protocol/cli-utils").CensoredString<string>, import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>;
|
|
698
|
+
alertsChannel: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<import("@gearbox-protocol/cli-utils").CensoredString<string>, import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>;
|
|
699
|
+
notificationsChannel: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<import("@gearbox-protocol/cli-utils").CensoredString<string>, import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>>;
|
|
700
|
+
prefix: z.ZodOptional<z.ZodString>;
|
|
701
|
+
curator: z.ZodOptional<z.ZodCustom<import("@gearbox-protocol/sdk").Curator, import("@gearbox-protocol/sdk").Curator>>;
|
|
702
|
+
}, z.core.$strip>, ...(z.ZodObject<{
|
|
703
|
+
type: z.ZodLiteral<"slack">;
|
|
704
|
+
webhookUrl: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<import("@gearbox-protocol/cli-utils").CensoredString<string>, import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>;
|
|
705
|
+
alertsOnly: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<boolean, any>>>;
|
|
706
|
+
curator: z.ZodOptional<z.ZodCustom<import("@gearbox-protocol/sdk").Curator, import("@gearbox-protocol/sdk").Curator>>;
|
|
707
|
+
}, z.core.$strip> | z.ZodObject<{
|
|
708
|
+
type: z.ZodLiteral<"telegram">;
|
|
709
|
+
token: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<import("@gearbox-protocol/cli-utils").CensoredString<string>, import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>;
|
|
710
|
+
alertsChannel: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<import("@gearbox-protocol/cli-utils").CensoredString<string>, import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>;
|
|
711
|
+
notificationsChannel: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<import("@gearbox-protocol/cli-utils").CensoredString<string>, import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>>;
|
|
712
|
+
prefix: z.ZodOptional<z.ZodString>;
|
|
713
|
+
curator: z.ZodOptional<z.ZodCustom<import("@gearbox-protocol/sdk").Curator, import("@gearbox-protocol/sdk").Curator>>;
|
|
714
|
+
}, z.core.$strip>)[]], "type">>>>;
|
|
715
|
+
addressProvider: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
|
|
716
|
+
marketConfigurators: z.ZodPipe<z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>, z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>>, z.ZodTransform<`0x${string}`[] | undefined, `0x${string}`[] | undefined>>;
|
|
717
|
+
rwaFactories: z.ZodPipe<z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>, z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>>, z.ZodTransform<`0x${string}`[] | undefined, `0x${string}`[] | undefined>>;
|
|
718
|
+
appName: z.ZodDefault<z.ZodString>;
|
|
719
|
+
port: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
720
|
+
whitelistUrl: z.ZodOptional<z.ZodURL>;
|
|
721
|
+
hardWhitelist: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
722
|
+
address: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
723
|
+
reason: z.ZodDefault<z.ZodString>;
|
|
724
|
+
contractType: z.ZodOptional<z.ZodString>;
|
|
725
|
+
expiresAt: z.ZodOptional<z.ZodNumber>;
|
|
726
|
+
}, z.core.$strip>>>;
|
|
727
|
+
debugAccount: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
|
|
728
|
+
debugManager: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
|
|
729
|
+
castBin: z.ZodOptional<z.ZodString>;
|
|
730
|
+
castTimeout: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
731
|
+
staleBlockThreshold: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
732
|
+
logsPageSize: z.ZodOptional<z.ZodCoercedBigInt<unknown>>;
|
|
733
|
+
pollingInterval: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
734
|
+
privateKey: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<`0x${string}`>, `0x${string}`>>>;
|
|
735
|
+
liquidatorAddress: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
|
|
736
|
+
minBalanceGas: z.ZodDefault<z.ZodCoercedBigInt<unknown>>;
|
|
737
|
+
hfThreshold: z.ZodDefault<z.ZodCoercedBigInt<unknown>>;
|
|
738
|
+
numSplits: z.ZodDefault<z.ZodCoercedBigInt<unknown>>;
|
|
739
|
+
optimistic: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<boolean, any>>>;
|
|
740
|
+
useProductionScanner: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<boolean, any>>>;
|
|
741
|
+
optimisticTimestamp: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
742
|
+
failOnMissingFeeds: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<boolean, any>>>;
|
|
743
|
+
gasLimit: z.ZodOptional<z.ZodCoercedBigInt<unknown>>;
|
|
744
|
+
dryRun: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<boolean, any>>>;
|
|
745
|
+
redstoneGateways: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>, z.ZodArray<z.ZodURL>>, z.ZodTransform<string[] | undefined, string[]>>>;
|
|
746
|
+
compressorBatchSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
747
|
+
slippage: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
748
|
+
updateReservePrices: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<boolean, any>>>>;
|
|
749
|
+
keepAssets: z.ZodPipe<z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>, z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>>, z.ZodTransform<`0x${string}`[] | undefined, `0x${string}`[] | undefined>>;
|
|
750
|
+
premiumReceiver: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
|
|
751
|
+
outDir: z.ZodDefault<z.ZodString>;
|
|
752
|
+
outEndpoint: z.ZodOptional<z.ZodURL>;
|
|
753
|
+
outHeaders: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string>>;
|
|
754
|
+
outS3Bucket: z.ZodOptional<z.ZodString>;
|
|
755
|
+
outS3Prefix: z.ZodDefault<z.ZodString>;
|
|
756
|
+
outFileName: z.ZodOptional<z.ZodString>;
|
|
757
|
+
liquidationMode: z.ZodLiteral<"wallet">;
|
|
654
758
|
}, z.core.$strip>], "liquidationMode">;
|
|
655
759
|
type ConfigSchema = z.infer<typeof ConfigSchema>;
|
|
656
760
|
//#endregion
|
|
@@ -932,7 +1036,7 @@ type Numberish = number | string | bigint;
|
|
|
932
1036
|
* `none` is used when no strategy was applicable, or an error occurred before a
|
|
933
1037
|
* strategy could be selected.
|
|
934
1038
|
*/
|
|
935
|
-
type LiquidationStrategyKind = "full" | "loss-policy" | "rwa-via-stablecoins" | "partial" | "deleverage" | "none";
|
|
1039
|
+
type LiquidationStrategyKind = "full" | "loss-policy" | "rwa-via-stablecoins" | "partial" | "deleverage" | "wallet" | "none";
|
|
936
1040
|
/**
|
|
937
1041
|
* Preview data shared by full and loss-policy strategies (single full liquidation
|
|
938
1042
|
* routed through the pathfinder). Carries the execution-only fields (`calls`,
|
|
@@ -1017,6 +1121,98 @@ interface RwaStrategyPreview {
|
|
|
1017
1121
|
*/
|
|
1018
1122
|
skipOnFailure?: boolean;
|
|
1019
1123
|
}
|
|
1124
|
+
/**
|
|
1125
|
+
* ERC-20 approval the liquidator must grant before sending the liquidation
|
|
1126
|
+
* transaction when it pays from its own funds.
|
|
1127
|
+
*/
|
|
1128
|
+
interface Approval<N extends Numberish = Numberish> {
|
|
1129
|
+
/**
|
|
1130
|
+
* Credit manager, or the dedicated Midas/Securitize liquidator contract.
|
|
1131
|
+
*/
|
|
1132
|
+
spender: Address;
|
|
1133
|
+
/**
|
|
1134
|
+
* Credit manager underlying.
|
|
1135
|
+
*/
|
|
1136
|
+
token: Address;
|
|
1137
|
+
/**
|
|
1138
|
+
* Amount the liquidation pulls plus the SDK's headroom.
|
|
1139
|
+
*/
|
|
1140
|
+
amount: N;
|
|
1141
|
+
}
|
|
1142
|
+
/**
|
|
1143
|
+
* Delayed withdrawal position the liquidator takes ownership of during
|
|
1144
|
+
* liquidation. No tokens move: the redeemer contract changes owner.
|
|
1145
|
+
*/
|
|
1146
|
+
interface Redeemer<N extends Numberish = Numberish> {
|
|
1147
|
+
/**
|
|
1148
|
+
* Redeemer contract whose ownership moves to the liquidator.
|
|
1149
|
+
*/
|
|
1150
|
+
address?: Address;
|
|
1151
|
+
/**
|
|
1152
|
+
* Receivable token, e.g. the Securitize stablecoin.
|
|
1153
|
+
*/
|
|
1154
|
+
token: Address;
|
|
1155
|
+
/**
|
|
1156
|
+
* Amount of {@link token}: exact for claimable withdrawals, estimated for
|
|
1157
|
+
* pending ones.
|
|
1158
|
+
*/
|
|
1159
|
+
amount: N;
|
|
1160
|
+
/**
|
|
1161
|
+
* Estimated unix timestamp (seconds) when the redemption becomes claimable.
|
|
1162
|
+
*/
|
|
1163
|
+
claimableAt?: N;
|
|
1164
|
+
}
|
|
1165
|
+
/**
|
|
1166
|
+
* Preview data of the wallet strategy: a liquidation paid from the liquidator's
|
|
1167
|
+
* own funds, previewed by the liquidation compressor.
|
|
1168
|
+
*/
|
|
1169
|
+
interface WalletStrategyPreview<N extends Numberish = Numberish> {
|
|
1170
|
+
/**
|
|
1171
|
+
* Approval granted in the prepare step, absent when the liquidation path
|
|
1172
|
+
* needs no capital from the liquidator.
|
|
1173
|
+
*/
|
|
1174
|
+
approve?: Approval<N>;
|
|
1175
|
+
/**
|
|
1176
|
+
* Redemption positions the liquidation hands over to the liquidator.
|
|
1177
|
+
*/
|
|
1178
|
+
redeemers: Redeemer<N>[];
|
|
1179
|
+
/**
|
|
1180
|
+
* Top-level liquidation call built by the compressor, targeting either the
|
|
1181
|
+
* credit facade or a dedicated Midas/Securitize liquidator contract.
|
|
1182
|
+
*/
|
|
1183
|
+
calls: readonly MultiCall[];
|
|
1184
|
+
/**
|
|
1185
|
+
* Liquidation transaction built by the liquidation compressor.
|
|
1186
|
+
*/
|
|
1187
|
+
rawTx: RawTx;
|
|
1188
|
+
/**
|
|
1189
|
+
* If true, will not attempt to liquidate this account again.
|
|
1190
|
+
*/
|
|
1191
|
+
skipOnFailure?: boolean;
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* Token amount reported in an {@link OptimisticResult}.
|
|
1195
|
+
*/
|
|
1196
|
+
interface OptimisticAsset<N extends Numberish = Numberish> {
|
|
1197
|
+
token: Address;
|
|
1198
|
+
amount: N;
|
|
1199
|
+
}
|
|
1200
|
+
/**
|
|
1201
|
+
* What the liquidator got out of a wallet-funded liquidation.
|
|
1202
|
+
*/
|
|
1203
|
+
interface WalletStrategyOutcome<N extends Numberish = Numberish> {
|
|
1204
|
+
/**
|
|
1205
|
+
* Balance increases of the liquidator wallet across the liquidation,
|
|
1206
|
+
* measured with a `balanceOf` multicall before and after the transaction.
|
|
1207
|
+
* Includes phantom tokens such as Securitize pending redemptions.
|
|
1208
|
+
*/
|
|
1209
|
+
received: OptimisticAsset<N>[];
|
|
1210
|
+
/**
|
|
1211
|
+
* Redemption positions the liquidator now owns, from the compressor preview:
|
|
1212
|
+
* the redeemer addresses and claim timestamps that a balance cannot express.
|
|
1213
|
+
*/
|
|
1214
|
+
redeemers: Redeemer<N>[];
|
|
1215
|
+
}
|
|
1020
1216
|
interface LossPolicyStrategySetup<N extends Numberish = Numberish> {
|
|
1021
1217
|
/**
|
|
1022
1218
|
* Amount the account debt was artificially increased by.
|
|
@@ -1064,6 +1260,21 @@ interface StrategyPreviews<N extends Numberish = Numberish> {
|
|
|
1064
1260
|
partial: PartialStrategyPreview<N>;
|
|
1065
1261
|
deleverage: PartialStrategyPreview<N>;
|
|
1066
1262
|
"rwa-via-stablecoins": RwaStrategyPreview;
|
|
1263
|
+
wallet: WalletStrategyPreview<N>;
|
|
1264
|
+
none: never;
|
|
1265
|
+
}
|
|
1266
|
+
/**
|
|
1267
|
+
* Maps each {@link LiquidationStrategyKind} to its `outcome` shape (what the
|
|
1268
|
+
* liquidator got out of the liquidation). Only strategies that liquidate with
|
|
1269
|
+
* own capital report one.
|
|
1270
|
+
*/
|
|
1271
|
+
interface StrategyOutcomes<N extends Numberish = Numberish> {
|
|
1272
|
+
full: never;
|
|
1273
|
+
"loss-policy": never;
|
|
1274
|
+
partial: never;
|
|
1275
|
+
deleverage: never;
|
|
1276
|
+
"rwa-via-stablecoins": never;
|
|
1277
|
+
wallet: WalletStrategyOutcome<N>;
|
|
1067
1278
|
none: never;
|
|
1068
1279
|
}
|
|
1069
1280
|
/**
|
|
@@ -1076,6 +1287,7 @@ interface StrategySetups<N extends Numberish = Numberish> {
|
|
|
1076
1287
|
partial: PartialStrategySetup<N>;
|
|
1077
1288
|
deleverage: DeleverageStrategySetup<N>;
|
|
1078
1289
|
"rwa-via-stablecoins": RwaStrategySetup;
|
|
1290
|
+
wallet: never;
|
|
1079
1291
|
none: never;
|
|
1080
1292
|
}
|
|
1081
1293
|
/**
|
|
@@ -1178,6 +1390,10 @@ type OptimisticResultByKind<N extends Numberish = Numberish> = { [K in Liquidati
|
|
|
1178
1390
|
* Strategy-specific liquidation preview.
|
|
1179
1391
|
*/
|
|
1180
1392
|
preview?: StrategyPreviews<N>[K];
|
|
1393
|
+
/**
|
|
1394
|
+
* Strategy-specific result of the liquidation: what the liquidator got.
|
|
1395
|
+
*/
|
|
1396
|
+
outcome?: StrategyOutcomes<N>[K];
|
|
1181
1397
|
}; };
|
|
1182
1398
|
/**
|
|
1183
1399
|
* Optimistic liquidation result format, shared by all liquidators.
|
|
@@ -1303,6 +1519,10 @@ type TypedSDKState = GearboxState<{
|
|
|
1303
1519
|
readonly accounts: AccountsPlugin;
|
|
1304
1520
|
}>;
|
|
1305
1521
|
type WhitelistEntry = ClientWhitelistItem;
|
|
1522
|
+
/**
|
|
1523
|
+
* Human-readable labels for credit accounts, keyed by checksummed credit account address
|
|
1524
|
+
*/
|
|
1525
|
+
type AccountLabels = Record<Address, string>;
|
|
1306
1526
|
interface TrackReport {
|
|
1307
1527
|
id: string;
|
|
1308
1528
|
name: string;
|
|
@@ -1334,6 +1554,10 @@ interface ExecutionReport {
|
|
|
1334
1554
|
* Account/CM/Token addresses that we do not need to alert about, if they cannot be liquidated
|
|
1335
1555
|
*/
|
|
1336
1556
|
whitelist?: WhitelistEntry[];
|
|
1557
|
+
/**
|
|
1558
|
+
* Human-readable credit account labels, loaded from external file
|
|
1559
|
+
*/
|
|
1560
|
+
accountLabels?: AccountLabels;
|
|
1337
1561
|
/**
|
|
1338
1562
|
* Gearbox SDK state when it was attached
|
|
1339
1563
|
*/
|
|
@@ -1344,5 +1568,112 @@ interface ExecutionReport {
|
|
|
1344
1568
|
gasPrice: bigint;
|
|
1345
1569
|
}
|
|
1346
1570
|
//#endregion
|
|
1347
|
-
|
|
1571
|
+
//#region src/wallet-liquidator.d.ts
|
|
1572
|
+
declare const WalletLiquidatorSchema: z.ZodObject<{
|
|
1573
|
+
network: z.ZodEnum<{
|
|
1574
|
+
Arbitrum: "Arbitrum";
|
|
1575
|
+
Avalanche: "Avalanche";
|
|
1576
|
+
BNB: "BNB";
|
|
1577
|
+
Base: "Base";
|
|
1578
|
+
Berachain: "Berachain";
|
|
1579
|
+
Etherlink: "Etherlink";
|
|
1580
|
+
Hemi: "Hemi";
|
|
1581
|
+
Lisk: "Lisk";
|
|
1582
|
+
Mainnet: "Mainnet";
|
|
1583
|
+
MegaETH: "MegaETH";
|
|
1584
|
+
Monad: "Monad";
|
|
1585
|
+
Optimism: "Optimism";
|
|
1586
|
+
Plasma: "Plasma";
|
|
1587
|
+
Somnia: "Somnia";
|
|
1588
|
+
Sonic: "Sonic";
|
|
1589
|
+
WorldChain: "WorldChain";
|
|
1590
|
+
}>;
|
|
1591
|
+
jsonRpcProviders: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>, z.ZodArray<z.ZodPipe<z.ZodURL, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredURL, string>>>>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredURL[] | undefined, import("@gearbox-protocol/cli-utils").CensoredURL[]>>>;
|
|
1592
|
+
enabledProviders: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>, z.ZodArray<z.ZodEnum<{
|
|
1593
|
+
alchemy: "alchemy";
|
|
1594
|
+
ankr: "ankr";
|
|
1595
|
+
custom: "custom";
|
|
1596
|
+
drpc: "drpc";
|
|
1597
|
+
erpc: "erpc";
|
|
1598
|
+
thirdweb: "thirdweb";
|
|
1599
|
+
}>>>>;
|
|
1600
|
+
alchemyKeys: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>, z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string>>>>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>[] | undefined, import("@gearbox-protocol/cli-utils").CensoredString<string>[]>>>;
|
|
1601
|
+
drpcKeys: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>, z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string>>>>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>[] | undefined, import("@gearbox-protocol/cli-utils").CensoredString<string>[]>>>;
|
|
1602
|
+
ankrKeys: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>, z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string>>>>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>[] | undefined, import("@gearbox-protocol/cli-utils").CensoredString<string>[]>>>;
|
|
1603
|
+
thirdwebKeys: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>, z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string>>>>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>[] | undefined, import("@gearbox-protocol/cli-utils").CensoredString<string>[]>>>;
|
|
1604
|
+
erpcProjectId: z.ZodOptional<z.ZodString>;
|
|
1605
|
+
erpcUrl: z.ZodDefault<z.ZodURL>;
|
|
1606
|
+
jsonRpcTimeout: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
1607
|
+
notifications: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1608
|
+
type: z.ZodLiteral<"slack">;
|
|
1609
|
+
webhookUrl: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<import("@gearbox-protocol/cli-utils").CensoredString<string>, import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>;
|
|
1610
|
+
alertsOnly: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<boolean, any>>>;
|
|
1611
|
+
curator: z.ZodOptional<z.ZodCustom<import("@gearbox-protocol/sdk").Curator, import("@gearbox-protocol/sdk").Curator>>;
|
|
1612
|
+
}, z.core.$strip> | z.ZodObject<{
|
|
1613
|
+
type: z.ZodLiteral<"telegram">;
|
|
1614
|
+
token: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<import("@gearbox-protocol/cli-utils").CensoredString<string>, import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>;
|
|
1615
|
+
alertsChannel: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<import("@gearbox-protocol/cli-utils").CensoredString<string>, import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>;
|
|
1616
|
+
notificationsChannel: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<import("@gearbox-protocol/cli-utils").CensoredString<string>, import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>>;
|
|
1617
|
+
prefix: z.ZodOptional<z.ZodString>;
|
|
1618
|
+
curator: z.ZodOptional<z.ZodCustom<import("@gearbox-protocol/sdk").Curator, import("@gearbox-protocol/sdk").Curator>>;
|
|
1619
|
+
}, z.core.$strip>, ...(z.ZodObject<{
|
|
1620
|
+
type: z.ZodLiteral<"slack">;
|
|
1621
|
+
webhookUrl: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<import("@gearbox-protocol/cli-utils").CensoredString<string>, import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>;
|
|
1622
|
+
alertsOnly: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<boolean, any>>>;
|
|
1623
|
+
curator: z.ZodOptional<z.ZodCustom<import("@gearbox-protocol/sdk").Curator, import("@gearbox-protocol/sdk").Curator>>;
|
|
1624
|
+
}, z.core.$strip> | z.ZodObject<{
|
|
1625
|
+
type: z.ZodLiteral<"telegram">;
|
|
1626
|
+
token: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<import("@gearbox-protocol/cli-utils").CensoredString<string>, import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>;
|
|
1627
|
+
alertsChannel: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<import("@gearbox-protocol/cli-utils").CensoredString<string>, import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>;
|
|
1628
|
+
notificationsChannel: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<import("@gearbox-protocol/cli-utils").CensoredString<string>, import("@gearbox-protocol/cli-utils").CensoredString<string>>]>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string | import("@gearbox-protocol/cli-utils").CensoredString<string>>>>;
|
|
1629
|
+
prefix: z.ZodOptional<z.ZodString>;
|
|
1630
|
+
curator: z.ZodOptional<z.ZodCustom<import("@gearbox-protocol/sdk").Curator, import("@gearbox-protocol/sdk").Curator>>;
|
|
1631
|
+
}, z.core.$strip>)[]], "type">>>>;
|
|
1632
|
+
addressProvider: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
|
|
1633
|
+
marketConfigurators: z.ZodPipe<z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>, z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>>, z.ZodTransform<`0x${string}`[] | undefined, `0x${string}`[] | undefined>>;
|
|
1634
|
+
rwaFactories: z.ZodPipe<z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>, z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>>, z.ZodTransform<`0x${string}`[] | undefined, `0x${string}`[] | undefined>>;
|
|
1635
|
+
appName: z.ZodDefault<z.ZodString>;
|
|
1636
|
+
port: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
1637
|
+
whitelistUrl: z.ZodOptional<z.ZodURL>;
|
|
1638
|
+
hardWhitelist: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1639
|
+
address: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
1640
|
+
reason: z.ZodDefault<z.ZodString>;
|
|
1641
|
+
contractType: z.ZodOptional<z.ZodString>;
|
|
1642
|
+
expiresAt: z.ZodOptional<z.ZodNumber>;
|
|
1643
|
+
}, z.core.$strip>>>;
|
|
1644
|
+
debugAccount: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
|
|
1645
|
+
debugManager: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
|
|
1646
|
+
castBin: z.ZodOptional<z.ZodString>;
|
|
1647
|
+
castTimeout: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
1648
|
+
staleBlockThreshold: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
1649
|
+
logsPageSize: z.ZodOptional<z.ZodCoercedBigInt<unknown>>;
|
|
1650
|
+
pollingInterval: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
1651
|
+
privateKey: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<`0x${string}`>, `0x${string}`>>>;
|
|
1652
|
+
liquidatorAddress: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
|
|
1653
|
+
minBalanceGas: z.ZodDefault<z.ZodCoercedBigInt<unknown>>;
|
|
1654
|
+
hfThreshold: z.ZodDefault<z.ZodCoercedBigInt<unknown>>;
|
|
1655
|
+
numSplits: z.ZodDefault<z.ZodCoercedBigInt<unknown>>;
|
|
1656
|
+
optimistic: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<boolean, any>>>;
|
|
1657
|
+
useProductionScanner: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<boolean, any>>>;
|
|
1658
|
+
optimisticTimestamp: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
1659
|
+
failOnMissingFeeds: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<boolean, any>>>;
|
|
1660
|
+
gasLimit: z.ZodOptional<z.ZodCoercedBigInt<unknown>>;
|
|
1661
|
+
dryRun: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<boolean, any>>>;
|
|
1662
|
+
redstoneGateways: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>, z.ZodArray<z.ZodURL>>, z.ZodTransform<string[] | undefined, string[]>>>;
|
|
1663
|
+
compressorBatchSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
1664
|
+
slippage: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
1665
|
+
updateReservePrices: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<boolean, any>>>>;
|
|
1666
|
+
keepAssets: z.ZodPipe<z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>, z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>>, z.ZodTransform<`0x${string}`[] | undefined, `0x${string}`[] | undefined>>;
|
|
1667
|
+
premiumReceiver: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
|
|
1668
|
+
outDir: z.ZodDefault<z.ZodString>;
|
|
1669
|
+
outEndpoint: z.ZodOptional<z.ZodURL>;
|
|
1670
|
+
outHeaders: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<import("@gearbox-protocol/cli-utils").CensoredString<string>, string>>;
|
|
1671
|
+
outS3Bucket: z.ZodOptional<z.ZodString>;
|
|
1672
|
+
outS3Prefix: z.ZodDefault<z.ZodString>;
|
|
1673
|
+
outFileName: z.ZodOptional<z.ZodString>;
|
|
1674
|
+
liquidationMode: z.ZodLiteral<"wallet">;
|
|
1675
|
+
}, z.core.$strip>;
|
|
1676
|
+
type WalletLiquidatorSchema = z.infer<typeof WalletLiquidatorSchema>;
|
|
1677
|
+
//#endregion
|
|
1678
|
+
export { type AccountLabels, type Approval, type BatchLiquidatorSchema, type CommonSchema, Config, ConfigImplementation, ConfigSchema, type DeleverageLiquidatorSchema, type DeleverageStrategySetup, type ExecutionReport, type FullLiquidatorSchema, type FullStrategyPreview, LiqduiatorConfig, type LiquidationStrategyKind, type LossPolicyStrategySetup, NotificationsConfig, type Numberish, type OptimisticAsset, type OptimisticResult, type OptimisticResultBase, type PartialLiquidatorSchema, type PartialStrategyPreview, type PartialStrategySetup, type Redeemer, type RwaStrategyPreview, type RwaStrategySetup, type StrategyOutcomes, type StrategyPreviews, type StrategySetups, type TrackReport, type TypedSDKState, type WalletLiquidatorSchema, type WalletStrategyOutcome, type WalletStrategyPreview, type WhitelistEntry };
|
|
1348
1679
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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/optimist.ts","../src/partial-liquidator.ts","../src/report.ts"],"mappings":";;;;;;cAIa,uBAAqB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuBhC,EAAA,KAAA;KAEU,wBAAwB,EAAE,aAAa;;;cCdtC,cAAY,EAAA
|
|
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/optimist.ts","../src/partial-liquidator.ts","../src/report.ts","../src/wallet-liquidator.ts"],"mappings":";;;;;;cAIa,uBAAqB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuBhC,EAAA,KAAA;KAEU,wBAAwB,EAAE,aAAa;;;cCdtC,cAAY,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsZvB,EAAA,KAAA;KAEU,eAAe,EAAE,aAAa;;;cCha7B,cAAY,EAAA,uBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUjC,EAAA,KAAA;KAEU,yBAAyB,EAAE,aAAa"}
|
package/dist/index.js
CHANGED
|
@@ -204,10 +204,11 @@ const CommonSchema = z.object({
|
|
|
204
204
|
"full",
|
|
205
205
|
"partial",
|
|
206
206
|
"batch",
|
|
207
|
-
"deleverage"
|
|
207
|
+
"deleverage",
|
|
208
|
+
"wallet"
|
|
208
209
|
]).default("full").register(zommandRegistry, {
|
|
209
210
|
flags: "--liquidation-mode <mode>",
|
|
210
|
-
description: "Liquidator mode (full/partial/batch/deleverage)",
|
|
211
|
+
description: "Liquidator mode (full/partial/batch/deleverage/wallet)",
|
|
211
212
|
env: "LIQUIDATION_MODE"
|
|
212
213
|
}),
|
|
213
214
|
/**
|
|
@@ -375,7 +376,7 @@ const BatchLiquidatorSchema = z.object({
|
|
|
375
376
|
*/
|
|
376
377
|
liquidationMode: z.literal("batch").register(zommandRegistry, {
|
|
377
378
|
flags: "--liquidation-mode <mode>",
|
|
378
|
-
description: "Liquidator mode (full/partial/batch/deleverage)",
|
|
379
|
+
description: "Liquidator mode (full/partial/batch/deleverage/wallet)",
|
|
379
380
|
env: "LIQUIDATION_MODE"
|
|
380
381
|
}),
|
|
381
382
|
/**
|
|
@@ -396,7 +397,7 @@ const DeleverageLiquidatorSchema = z.object({
|
|
|
396
397
|
*/
|
|
397
398
|
liquidationMode: z.literal("deleverage").register(zommandRegistry, {
|
|
398
399
|
flags: "--liquidation-mode <mode>",
|
|
399
|
-
description: "Liquidator mode (full/partial/batch/deleverage)",
|
|
400
|
+
description: "Liquidator mode (full/partial/batch/deleverage/wallet)",
|
|
400
401
|
env: "LIQUIDATION_MODE"
|
|
401
402
|
})
|
|
402
403
|
});
|
|
@@ -409,7 +410,7 @@ const FullLiquidatorSchema = z.object({
|
|
|
409
410
|
*/
|
|
410
411
|
liquidationMode: z.literal("full").register(zommandRegistry, {
|
|
411
412
|
flags: "--liquidation-mode <mode>",
|
|
412
|
-
description: "Liquidator mode (full/partial/batch/deleverage)",
|
|
413
|
+
description: "Liquidator mode (full/partial/batch/deleverage/wallet)",
|
|
413
414
|
env: "LIQUIDATION_MODE"
|
|
414
415
|
}),
|
|
415
416
|
/**
|
|
@@ -466,7 +467,7 @@ const PartialLiquidatorSchema = z.object({
|
|
|
466
467
|
*/
|
|
467
468
|
liquidationMode: z.literal("partial").register(zommandRegistry, {
|
|
468
469
|
flags: "--liquidation-mode <mode>",
|
|
469
|
-
description: "Liquidator mode (full/partial/batch/deleverage)",
|
|
470
|
+
description: "Liquidator mode (full/partial/batch/deleverage/wallet)",
|
|
470
471
|
env: "LIQUIDATION_MODE"
|
|
471
472
|
}),
|
|
472
473
|
/**
|
|
@@ -496,12 +497,26 @@ const PartialLiquidatorSchema = z.object({
|
|
|
496
497
|
})
|
|
497
498
|
}).refine((data) => !(data.optimistic === true && data.partialFallback === true), { message: "partialFallback=true is not allowed in optimistic mode" });
|
|
498
499
|
//#endregion
|
|
500
|
+
//#region src/wallet-liquidator.ts
|
|
501
|
+
const WalletLiquidatorSchema = z.object({
|
|
502
|
+
...CommonSchema.shape,
|
|
503
|
+
/**
|
|
504
|
+
* Liquidator mode
|
|
505
|
+
*/
|
|
506
|
+
liquidationMode: z.literal("wallet").register(zommandRegistry, {
|
|
507
|
+
flags: "--liquidation-mode <mode>",
|
|
508
|
+
description: "Liquidator mode (full/partial/batch/deleverage/wallet)",
|
|
509
|
+
env: "LIQUIDATION_MODE"
|
|
510
|
+
})
|
|
511
|
+
});
|
|
512
|
+
//#endregion
|
|
499
513
|
//#region src/schema.ts
|
|
500
514
|
const ConfigSchema = z.discriminatedUnion("liquidationMode", [
|
|
501
515
|
FullLiquidatorSchema,
|
|
502
516
|
PartialLiquidatorSchema,
|
|
503
517
|
BatchLiquidatorSchema,
|
|
504
|
-
DeleverageLiquidatorSchema
|
|
518
|
+
DeleverageLiquidatorSchema,
|
|
519
|
+
WalletLiquidatorSchema
|
|
505
520
|
]);
|
|
506
521
|
//#endregion
|
|
507
522
|
export { ConfigImplementation, ConfigSchema, NotificationsConfig };
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["#startBlock","#chainId"],"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/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 { Curator } from \"@gearbox-protocol/sdk\";\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<Curator>(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 stringArrayLike,\n zommandRegistry,\n} from \"@gearbox-protocol/cli-utils\";\nimport { MAX_UINT256, WAD } from \"@gearbox-protocol/sdk\";\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\"])\n .default(\"full\")\n .register(zommandRegistry, {\n flags: \"--liquidation-mode <mode>\",\n description: \"Liquidator mode (full/partial/batch/deleverage)\",\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 * Optimistic timestamp to pass from external runner, in ms\n */\n optimisticTimestamp: z.coerce\n .number()\n .int()\n .positive()\n .nullish()\n .register(zommandRegistry, {\n flags: \"--optimistic-timestamp <timestamp>\",\n description: \"Optimistic timestamp to pass from external runner, in ms\",\n env: \"OPTIMISTIC_TIMESTAMP\",\n }),\n /**\n * Fail on missing feeds (redstone and pyth)\n */\n failOnMissingFeeds: boolLike().optional().register(zommandRegistry, {\n flags: \"--fail-on-missing-feeds\",\n description: \"Fail on missing feeds (redstone and pyth)\",\n env: \"FAIL_ON_MISSING_FEEDS\",\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 * Redstone gateways override\n * Set local caching proxies to avoid rate limiting in test environment\n */\n redstoneGateways: stringArrayLike()\n .pipe(z.array(z.url()))\n .transform(a => (a.length ? a : undefined))\n .optional()\n .register(zommandRegistry, {\n flags: \"--redstone-gateways <urls...>\",\n description: \"Redstone gateways to use, comma separated\",\n env: \"REDSTONE_GATEWAYS\",\n }),\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)\",\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)\",\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)\",\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)\",\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 { 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\";\n\nexport const ConfigSchema = z.discriminatedUnion(\"liquidationMode\", [\n FullLiquidatorSchema,\n PartialLiquidatorSchema,\n BatchLiquidatorSchema,\n DeleverageLiquidatorSchema,\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,M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,KAAK,eAAe,QAAQ,KAAK,oBAAoB,OAC/D,EAAE,SAAS,yDAAyD,CACtE;;;AClDF,MAAa,eAAe,EAAE,mBAAmB,mBAAmB;CAClE;CACA;CACA;CACA;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["#startBlock","#chainId"],"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 { Curator } from \"@gearbox-protocol/sdk\";\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<Curator>(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 stringArrayLike,\n zommandRegistry,\n} from \"@gearbox-protocol/cli-utils\";\nimport { MAX_UINT256, WAD } from \"@gearbox-protocol/sdk\";\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 * Optimistic timestamp to pass from external runner, in ms\n */\n optimisticTimestamp: z.coerce\n .number()\n .int()\n .positive()\n .nullish()\n .register(zommandRegistry, {\n flags: \"--optimistic-timestamp <timestamp>\",\n description: \"Optimistic timestamp to pass from external runner, in ms\",\n env: \"OPTIMISTIC_TIMESTAMP\",\n }),\n /**\n * Fail on missing feeds (redstone and pyth)\n */\n failOnMissingFeeds: boolLike().optional().register(zommandRegistry, {\n flags: \"--fail-on-missing-feeds\",\n description: \"Fail on missing feeds (redstone and pyth)\",\n env: \"FAIL_ON_MISSING_FEEDS\",\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 * Redstone gateways override\n * Set local caching proxies to avoid rate limiting in test environment\n */\n redstoneGateways: stringArrayLike()\n .pipe(z.array(z.url()))\n .transform(a => (a.length ? a : undefined))\n .optional()\n .register(zommandRegistry, {\n flags: \"--redstone-gateways <urls...>\",\n description: \"Redstone gateways to use, comma separated\",\n env: \"REDSTONE_GATEWAYS\",\n }),\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,KAAKA,cAAc;EACnB,KAAKC,WAAW;CAClB;CAEA,IAAW,aAAqB;EAC9B,IAAI,KAAKD,gBAAgB,KAAA,GACvB,MAAM,IAAI,MAAM,wBAAwB;EAE1C,OAAO,KAAKA;CACd;CAEA,IAAW,UAAkB;EAC3B,IAAI,KAAKC,aAAa,KAAA,GACpB,MAAM,IAAI,MAAM,wBAAwB;EAE1C,OAAO,KAAKA;CACd;AACF;;;AC9CA,MAAM,kBAAkB,mBAAmB,QAAQ,KAAI,MACrD,EAAE,OAAO;;;;AAIP,SAAS,EAAE,QAAgB,MAAK,OAAO,MAAM,QAAQ,CAAC,CAAC,SAAS,EAClE,CAAC,CACH;AAEA,MAAa,sBAAsB,EAAE,OAAO,EAC1C,eAAe,EACZ,MACC,EAAE,mBACA,mBAAmB,IAAI,eACvB,eAIF,CACF,CAAC,CACA,SAAS,CAAC,CACV,QAAQ,CAAC,CAAC,EACf,CAAC;;;ACXD,MAAa,eAAe,EAAE,OAAO;CACnC,GAAG,gBAAgB;;;;;CAKnB,iBAAiB,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,iBAAiB;EAClE,OAAO;EACP,aACE;EACF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9D,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/liquidator-v2-config",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.3.0-beta.10",
|
|
4
4
|
"description": "Configuration schemas and optimistic result types for Gearbox liquidator v2",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
"dist"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@gearbox-protocol/sdk": "
|
|
21
|
-
"viem": "^2.55.
|
|
20
|
+
"@gearbox-protocol/sdk": "14.12.0-next.58",
|
|
21
|
+
"viem": "^2.55.10",
|
|
22
22
|
"zod": "^4.4.3",
|
|
23
|
-
"@gearbox-protocol/cli-utils": "9.
|
|
23
|
+
"@gearbox-protocol/cli-utils": "9.3.0-beta.10"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"tsdown": "^0.22.
|
|
26
|
+
"tsdown": "^0.22.14",
|
|
27
27
|
"typescript": "^7.0.2"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|