@gearbox-protocol/liquidator-v2-config 0.0.0
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 +1067 -0
- package/dist/index.mjs +497 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +40 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
// src/config.ts
|
|
2
|
+
import { createPublicClient } from "viem";
|
|
3
|
+
var ConfigImplementation = class {
|
|
4
|
+
#startBlock;
|
|
5
|
+
#chainId;
|
|
6
|
+
constructor(schema) {
|
|
7
|
+
Object.assign(this, schema);
|
|
8
|
+
}
|
|
9
|
+
async initialize(transport) {
|
|
10
|
+
const client = createPublicClient({
|
|
11
|
+
transport,
|
|
12
|
+
name: "preload client"
|
|
13
|
+
});
|
|
14
|
+
const [startBlock, chainId] = await Promise.all([
|
|
15
|
+
client.getBlockNumber(),
|
|
16
|
+
client.getChainId()
|
|
17
|
+
]);
|
|
18
|
+
this.#startBlock = startBlock;
|
|
19
|
+
this.#chainId = chainId;
|
|
20
|
+
}
|
|
21
|
+
get startBlock() {
|
|
22
|
+
if (this.#startBlock === void 0) {
|
|
23
|
+
throw new Error("config not initialized");
|
|
24
|
+
}
|
|
25
|
+
return this.#startBlock;
|
|
26
|
+
}
|
|
27
|
+
get chainId() {
|
|
28
|
+
if (this.#chainId === void 0) {
|
|
29
|
+
throw new Error("config not initialized");
|
|
30
|
+
}
|
|
31
|
+
return this.#chainId;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// src/notifications.ts
|
|
36
|
+
import { NotificationConfig } from "@gearbox-protocol/cli-utils";
|
|
37
|
+
import { z } from "zod/v4";
|
|
38
|
+
var extendedOptions = NotificationConfig.options.map(
|
|
39
|
+
(o) => o.extend({
|
|
40
|
+
/**
|
|
41
|
+
* When undefined, defaults to all curators together (aka Gearbox internal)
|
|
42
|
+
*/
|
|
43
|
+
curator: z.custom((s) => typeof s === "string").optional()
|
|
44
|
+
})
|
|
45
|
+
);
|
|
46
|
+
var NotificationsConfig = z.object({
|
|
47
|
+
notifications: z.array(
|
|
48
|
+
z.discriminatedUnion(
|
|
49
|
+
NotificationConfig.def.discriminator,
|
|
50
|
+
extendedOptions
|
|
51
|
+
)
|
|
52
|
+
).optional().default([])
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// src/schema.ts
|
|
56
|
+
import { z as z7 } from "zod/v4";
|
|
57
|
+
|
|
58
|
+
// src/batch-liquidator.ts
|
|
59
|
+
import { zommandRegistry as zommandRegistry2 } from "@gearbox-protocol/cli-utils";
|
|
60
|
+
import { z as z3 } from "zod/v4";
|
|
61
|
+
|
|
62
|
+
// src/common.ts
|
|
63
|
+
import {
|
|
64
|
+
addressLike,
|
|
65
|
+
boolLike,
|
|
66
|
+
CensoredString,
|
|
67
|
+
optionalAddressArrayLike,
|
|
68
|
+
ProvidersSchema,
|
|
69
|
+
stringArrayLike,
|
|
70
|
+
zommandRegistry
|
|
71
|
+
} from "@gearbox-protocol/cli-utils";
|
|
72
|
+
import { MAX_UINT256, WAD } from "@gearbox-protocol/sdk";
|
|
73
|
+
import { isHex } from "viem";
|
|
74
|
+
import { z as z2 } from "zod/v4";
|
|
75
|
+
var CommonSchema = z2.object({
|
|
76
|
+
...ProvidersSchema.shape,
|
|
77
|
+
/**
|
|
78
|
+
* By default uses address provider from @gearbox-protocol/sdk
|
|
79
|
+
* Use this option to override address provider
|
|
80
|
+
*/
|
|
81
|
+
addressProvider: addressLike().optional().register(zommandRegistry, {
|
|
82
|
+
flags: "--address-provider <address>",
|
|
83
|
+
description: "Address provider override, uses default value from SDK otherwise",
|
|
84
|
+
env: "ADDRESS_PROVIDER"
|
|
85
|
+
}),
|
|
86
|
+
/**
|
|
87
|
+
* Market configurators addresses to attach SDK
|
|
88
|
+
*/
|
|
89
|
+
marketConfigurators: optionalAddressArrayLike().register(zommandRegistry, {
|
|
90
|
+
flags: "--market-configurators <addresses...>",
|
|
91
|
+
description: "Market configurators to use for the process, comma separated. Uses default value from SDK if not specified",
|
|
92
|
+
env: "MARKET_CONFIGURATORS"
|
|
93
|
+
}),
|
|
94
|
+
/**
|
|
95
|
+
* RWA factories addresses to attach SDK
|
|
96
|
+
*/
|
|
97
|
+
rwaFactories: optionalAddressArrayLike().register(zommandRegistry, {
|
|
98
|
+
flags: "--rwa-factories <addresses...>",
|
|
99
|
+
description: "RWA factories to use for the process, comma separated. Uses default value from SDK if not specified",
|
|
100
|
+
env: "RWA_FACTORIES"
|
|
101
|
+
}),
|
|
102
|
+
/**
|
|
103
|
+
* App name used in various messages to distinguish instances
|
|
104
|
+
*/
|
|
105
|
+
appName: z2.string().default("liquidator-ts").register(zommandRegistry, {
|
|
106
|
+
flags: "--app-name <name>",
|
|
107
|
+
description: "App name used in various messages to distinguish instances",
|
|
108
|
+
env: "APP_NAME"
|
|
109
|
+
}),
|
|
110
|
+
/**
|
|
111
|
+
* Port to expose some vital signals and metrics
|
|
112
|
+
*/
|
|
113
|
+
port: z2.coerce.number().default(4e3).register(zommandRegistry, {
|
|
114
|
+
flags: "--port <port>",
|
|
115
|
+
description: "Port to expose some vital signals and metrics",
|
|
116
|
+
env: "PORT"
|
|
117
|
+
}),
|
|
118
|
+
/**
|
|
119
|
+
* These accounts will not be liquidated
|
|
120
|
+
*/
|
|
121
|
+
ignoreAccounts: optionalAddressArrayLike().register(zommandRegistry, {
|
|
122
|
+
flags: "--ignore-accounts <addresses...>",
|
|
123
|
+
description: "These accounts will not be liquidated",
|
|
124
|
+
env: "IGNORE_ACCOUNTS"
|
|
125
|
+
}),
|
|
126
|
+
/**
|
|
127
|
+
* Only check this account during local debug session
|
|
128
|
+
*/
|
|
129
|
+
debugAccount: addressLike().optional().register(zommandRegistry, {
|
|
130
|
+
flags: "--debug-account <address>",
|
|
131
|
+
description: "Only check this account during local debug session",
|
|
132
|
+
env: "DEBUG_ACCOUNT"
|
|
133
|
+
}),
|
|
134
|
+
/**
|
|
135
|
+
* Only check this credit manager during local debug session
|
|
136
|
+
*/
|
|
137
|
+
debugManager: addressLike().optional().register(zommandRegistry, {
|
|
138
|
+
flags: "--debug-manager <address>",
|
|
139
|
+
description: "Only check this credit manager during local debug session",
|
|
140
|
+
env: "DEBUG_MANAGER"
|
|
141
|
+
}),
|
|
142
|
+
/**
|
|
143
|
+
* Path to foundry/cast binary, so that we can create tree-like traces in case of errors
|
|
144
|
+
* Used during optimistic liquidations
|
|
145
|
+
*/
|
|
146
|
+
castBin: z2.string().optional().register(zommandRegistry, {
|
|
147
|
+
flags: "--cast-bin <path>",
|
|
148
|
+
description: "Path to foundry/cast binary, so that we can create tree-like traces in case of errors",
|
|
149
|
+
env: "CAST_BIN"
|
|
150
|
+
}),
|
|
151
|
+
/**
|
|
152
|
+
* Stale block threshold in seconds, to notify and try to rotate rpc provider. 0 means no monitoring
|
|
153
|
+
*/
|
|
154
|
+
staleBlockThreshold: z2.coerce.number().nonnegative().default(120).register(zommandRegistry, {
|
|
155
|
+
flags: "--stale-block-threshold <threshold>",
|
|
156
|
+
description: "Stale block threshold in seconds, to notify and try to rotate rpc provider. 0 means no monitoring",
|
|
157
|
+
env: "STALE_BLOCK_THRESHOLD"
|
|
158
|
+
}),
|
|
159
|
+
/**
|
|
160
|
+
* Max block range size for eth_getLogs
|
|
161
|
+
*/
|
|
162
|
+
logsPageSize: z2.coerce.bigint().nonnegative().optional().register(zommandRegistry, {
|
|
163
|
+
flags: "--logs-page-size <size>",
|
|
164
|
+
description: "Max block range size for eth_getLogs",
|
|
165
|
+
env: "LOGS_PAGE_SIZE"
|
|
166
|
+
}),
|
|
167
|
+
/**
|
|
168
|
+
* Polling interval in milliseconds, default to what's default in viem
|
|
169
|
+
*/
|
|
170
|
+
pollingInterval: z2.coerce.number().nonnegative().optional().register(zommandRegistry, {
|
|
171
|
+
flags: "--polling-interval <interval>",
|
|
172
|
+
description: "Polling interval in milliseconds, default to what's default in viem",
|
|
173
|
+
env: "POLLING_INTERVAL"
|
|
174
|
+
}),
|
|
175
|
+
/**
|
|
176
|
+
* Private key used to send liquidation transactions
|
|
177
|
+
*/
|
|
178
|
+
privateKey: z2.string().min(1).transform((s) => {
|
|
179
|
+
return isHex(s) ? s : `0x${s}`;
|
|
180
|
+
}).transform(CensoredString.transform).register(zommandRegistry, {
|
|
181
|
+
flags: "--private-key <key>",
|
|
182
|
+
description: "Private key used to send liquidation transactions",
|
|
183
|
+
env: "PRIVATE_KEY"
|
|
184
|
+
}),
|
|
185
|
+
/**
|
|
186
|
+
* If balance drops before this value - we should send notification
|
|
187
|
+
*/
|
|
188
|
+
minBalance: z2.coerce.bigint().positive().default(500000000000000000n).register(zommandRegistry, {
|
|
189
|
+
flags: "--min-balance <balance>",
|
|
190
|
+
description: "Minimum balance to liquidate",
|
|
191
|
+
env: "MIN_BALANCE"
|
|
192
|
+
}),
|
|
193
|
+
/**
|
|
194
|
+
* Filter out all accounts with HF >= threshold during scan stage
|
|
195
|
+
*/
|
|
196
|
+
hfThreshold: z2.coerce.bigint().nonnegative().max(MAX_UINT256).default(WAD - 1n).register(zommandRegistry, {
|
|
197
|
+
flags: "--hf-threshold <threshold>",
|
|
198
|
+
description: "Filter out all accounts with HF >= threshold during scan stage",
|
|
199
|
+
env: "HF_THRESHOLD"
|
|
200
|
+
}),
|
|
201
|
+
/**
|
|
202
|
+
* Default numSplits for router v3.1 contract
|
|
203
|
+
*/
|
|
204
|
+
numSplits: z2.coerce.bigint().positive().default(10n).register(zommandRegistry, {
|
|
205
|
+
flags: "--num-splits <splits>",
|
|
206
|
+
description: "Default numSplits for router v3.1 contract",
|
|
207
|
+
env: "NUM_SPLITS"
|
|
208
|
+
}),
|
|
209
|
+
/**
|
|
210
|
+
* Liquidator mode
|
|
211
|
+
*/
|
|
212
|
+
liquidationMode: z2.enum(["full", "partial", "batch", "deleverage"]).default("full").register(zommandRegistry, {
|
|
213
|
+
flags: "--liquidation-mode <mode>",
|
|
214
|
+
description: "Liquidator mode (full/partial/batch/deleverage)",
|
|
215
|
+
env: "LIQUIDATION_MODE"
|
|
216
|
+
}),
|
|
217
|
+
/**
|
|
218
|
+
* Enable optimistic liquidations
|
|
219
|
+
*/
|
|
220
|
+
optimistic: boolLike().optional().register(zommandRegistry, {
|
|
221
|
+
flags: "--optimistic",
|
|
222
|
+
description: "Enable optimistic liquidations",
|
|
223
|
+
env: "OPTIMISTIC"
|
|
224
|
+
}),
|
|
225
|
+
/**
|
|
226
|
+
* In optimistic mode, use real health factor range to scan for accounts
|
|
227
|
+
* and do not force-enable deleverage bot on accounts.
|
|
228
|
+
*
|
|
229
|
+
* This mode can be used to test that deleverage bot is able to detect accounts correctly
|
|
230
|
+
*/
|
|
231
|
+
useProductionScanner: boolLike().optional().register(zommandRegistry, {
|
|
232
|
+
flags: "--use-production-scanner",
|
|
233
|
+
description: "In optimistic mode, use real health factor range to scan for accounts and do not force-enable deleverage bot on accounts",
|
|
234
|
+
env: "USE_PRODUCTION_SCANNER"
|
|
235
|
+
}),
|
|
236
|
+
/**
|
|
237
|
+
* Optimistic timestamp to pass from external runner, in ms
|
|
238
|
+
*/
|
|
239
|
+
optimisticTimestamp: z2.coerce.number().int().positive().nullish().register(zommandRegistry, {
|
|
240
|
+
flags: "--optimistic-timestamp <timestamp>",
|
|
241
|
+
description: "Optimistic timestamp to pass from external runner, in ms",
|
|
242
|
+
env: "OPTIMISTIC_TIMESTAMP"
|
|
243
|
+
}),
|
|
244
|
+
/**
|
|
245
|
+
* Fail on missing feeds (redstone and pyth)
|
|
246
|
+
*/
|
|
247
|
+
failOnMissingFeeds: boolLike().optional().register(zommandRegistry, {
|
|
248
|
+
flags: "--fail-on-missing-feeds",
|
|
249
|
+
description: "Fail on missing feeds (redstone and pyth)",
|
|
250
|
+
env: "FAIL_ON_MISSING_FEEDS"
|
|
251
|
+
}),
|
|
252
|
+
/**
|
|
253
|
+
* Explicitly set gas limit for SDK
|
|
254
|
+
* -1 to disable explicitly setting gas limit in SDK
|
|
255
|
+
* If not set, SDK will use default gas limit
|
|
256
|
+
*/
|
|
257
|
+
gasLimit: z2.coerce.bigint().optional().register(zommandRegistry, {
|
|
258
|
+
flags: "--gas-limit <limit>",
|
|
259
|
+
description: "Set gas limit for SDK",
|
|
260
|
+
env: "GAS_LIMIT"
|
|
261
|
+
}),
|
|
262
|
+
/**
|
|
263
|
+
* Do not send transactions in non-optimistic mode, just log them
|
|
264
|
+
*/
|
|
265
|
+
dryRun: boolLike().optional().register(zommandRegistry, {
|
|
266
|
+
flags: "--dry-run",
|
|
267
|
+
description: "Do not send transactions in non-optimistic mode, just log them",
|
|
268
|
+
env: "DRY_RUN"
|
|
269
|
+
}),
|
|
270
|
+
/**
|
|
271
|
+
* Redstone gateways override
|
|
272
|
+
* Set local caching proxies to avoid rate limiting in test environment
|
|
273
|
+
*/
|
|
274
|
+
redstoneGateways: stringArrayLike().pipe(z2.array(z2.url())).transform((a) => a.length ? a : void 0).optional().register(zommandRegistry, {
|
|
275
|
+
flags: "--redstone-gateways <urls...>",
|
|
276
|
+
description: "Redstone gateways to use, comma separated",
|
|
277
|
+
env: "REDSTONE_GATEWAYS"
|
|
278
|
+
}),
|
|
279
|
+
/**
|
|
280
|
+
* Limit number of accounts to load from compressor. 0 = unlimited, let compressor decide
|
|
281
|
+
*/
|
|
282
|
+
compressorBatchSize: z2.coerce.number().nonnegative().default(0).register(zommandRegistry, {
|
|
283
|
+
flags: "--compressor-batch-size <size>",
|
|
284
|
+
description: "Limit number of accounts to load from compressor. 0 = unlimited, let compressor decide",
|
|
285
|
+
env: "COMPRESSOR_BATCH_SIZE"
|
|
286
|
+
}),
|
|
287
|
+
/**
|
|
288
|
+
* Slippage value for pathfined
|
|
289
|
+
*/
|
|
290
|
+
slippage: z2.coerce.number().min(0).max(1e4).int().default(50).register(zommandRegistry, {
|
|
291
|
+
flags: "--slippage <value>",
|
|
292
|
+
description: "Slippage value for pathfinder",
|
|
293
|
+
env: "SLIPPAGE"
|
|
294
|
+
}),
|
|
295
|
+
/**
|
|
296
|
+
* By default, reserve prices are not updated (except for deleverage mode)
|
|
297
|
+
*/
|
|
298
|
+
updateReservePrices: boolLike().optional().default(false).register(zommandRegistry, {
|
|
299
|
+
flags: "--update-reserve-prices",
|
|
300
|
+
description: "Update reserve prices",
|
|
301
|
+
env: "UPDATE_RESERVE_PRICES"
|
|
302
|
+
}),
|
|
303
|
+
/**
|
|
304
|
+
* List of assets to keep on account after liquidation
|
|
305
|
+
*/
|
|
306
|
+
keepAssets: optionalAddressArrayLike().register(zommandRegistry, {
|
|
307
|
+
flags: "--keep-assets <assets...>",
|
|
308
|
+
description: "List of assets to keep on account after liquidation",
|
|
309
|
+
env: "KEEP_ASSETS"
|
|
310
|
+
}),
|
|
311
|
+
/**
|
|
312
|
+
* Directory to save json with optimistic liquidation results
|
|
313
|
+
*/
|
|
314
|
+
outDir: z2.string().default(".").register(zommandRegistry, {
|
|
315
|
+
flags: "--out-dir <dir>",
|
|
316
|
+
description: "Directory to save json with optimistic liquidation results",
|
|
317
|
+
env: "OUT_DIR"
|
|
318
|
+
}),
|
|
319
|
+
/**
|
|
320
|
+
* REST endpoint to POST json with optimistic liquidation results
|
|
321
|
+
*/
|
|
322
|
+
outEndpoint: z2.url().optional().register(zommandRegistry, {
|
|
323
|
+
flags: "--out-endpoint <url>",
|
|
324
|
+
description: "REST endpoint to POST json with optimistic liquidation results",
|
|
325
|
+
env: "OUT_ENDPOINT"
|
|
326
|
+
}),
|
|
327
|
+
/**
|
|
328
|
+
* Headers for REST endpoint
|
|
329
|
+
*/
|
|
330
|
+
outHeaders: z2.string().default("{}").transform(CensoredString.transform).register(zommandRegistry, {
|
|
331
|
+
flags: "--out-headers <headers>",
|
|
332
|
+
description: "Headers for REST endpoint",
|
|
333
|
+
env: "OUT_HEADERS"
|
|
334
|
+
}),
|
|
335
|
+
/**
|
|
336
|
+
* s3 bucket to upload json with optimistic liquidation results
|
|
337
|
+
*/
|
|
338
|
+
outS3Bucket: z2.string().optional().register(zommandRegistry, {
|
|
339
|
+
flags: "--out-s3-bucket <bucket>",
|
|
340
|
+
description: "S3 bucket to upload json with optimistic liquidation results",
|
|
341
|
+
env: "OUT_S3_BUCKET"
|
|
342
|
+
}),
|
|
343
|
+
/**
|
|
344
|
+
* s3 bucket path prefix
|
|
345
|
+
*/
|
|
346
|
+
outS3Prefix: z2.string().default("").register(zommandRegistry, {
|
|
347
|
+
flags: "--out-s3-prefix <prefix>",
|
|
348
|
+
description: "S3 bucket path prefix",
|
|
349
|
+
env: "OUT_S3_PREFIX"
|
|
350
|
+
}),
|
|
351
|
+
/**
|
|
352
|
+
* Filename of json with optimistic liquidation results for s3 or dir output
|
|
353
|
+
*/
|
|
354
|
+
outFileName: z2.string().optional().register(zommandRegistry, {
|
|
355
|
+
flags: "--out-file-name <name>",
|
|
356
|
+
description: "Filename of json with optimistic liquidation results for s3 or dir output",
|
|
357
|
+
env: "OUT_FILE_NAME"
|
|
358
|
+
}),
|
|
359
|
+
/**
|
|
360
|
+
* Notifications, global and per-curator
|
|
361
|
+
*/
|
|
362
|
+
...NotificationsConfig.shape
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
// src/batch-liquidator.ts
|
|
366
|
+
var BatchLiquidatorSchema = z3.object({
|
|
367
|
+
...CommonSchema.shape,
|
|
368
|
+
/**
|
|
369
|
+
* Liquidator mode
|
|
370
|
+
*/
|
|
371
|
+
liquidationMode: z3.literal("batch").register(zommandRegistry2, {
|
|
372
|
+
flags: "--liquidation-mode <mode>",
|
|
373
|
+
description: "Liquidator mode (full/partial/batch/deleverage)",
|
|
374
|
+
env: "LIQUIDATION_MODE"
|
|
375
|
+
}),
|
|
376
|
+
/**
|
|
377
|
+
* Number of accounts to liquidate at once using batch liquidator
|
|
378
|
+
*/
|
|
379
|
+
batchSize: z3.coerce.number().nonnegative().default(10).register(zommandRegistry2, {
|
|
380
|
+
flags: "--batch-size <size>",
|
|
381
|
+
description: "Number of accounts to liquidate at once using batch liquidator",
|
|
382
|
+
env: "BATCH_SIZE"
|
|
383
|
+
})
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
// src/deleverage-liquidator.ts
|
|
387
|
+
import { zommandRegistry as zommandRegistry3 } from "@gearbox-protocol/cli-utils";
|
|
388
|
+
import { z as z4 } from "zod/v4";
|
|
389
|
+
var DeleverageLiquidatorSchema = z4.object({
|
|
390
|
+
...CommonSchema.shape,
|
|
391
|
+
/**
|
|
392
|
+
* Liquidator mode
|
|
393
|
+
*/
|
|
394
|
+
liquidationMode: z4.literal("deleverage").register(zommandRegistry3, {
|
|
395
|
+
flags: "--liquidation-mode <mode>",
|
|
396
|
+
description: "Liquidator mode (full/partial/batch/deleverage)",
|
|
397
|
+
env: "LIQUIDATION_MODE"
|
|
398
|
+
})
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
// src/full-liquidator.ts
|
|
402
|
+
import { zommandRegistry as zommandRegistry4 } from "@gearbox-protocol/cli-utils";
|
|
403
|
+
import { z as z5 } from "zod/v4";
|
|
404
|
+
var FullLiquidatorSchema = z5.object({
|
|
405
|
+
...CommonSchema.shape,
|
|
406
|
+
/**
|
|
407
|
+
* Liquidator mode
|
|
408
|
+
*/
|
|
409
|
+
liquidationMode: z5.literal("full").register(zommandRegistry4, {
|
|
410
|
+
flags: "--liquidation-mode <mode>",
|
|
411
|
+
description: "Liquidator mode (full/partial/batch/deleverage)",
|
|
412
|
+
env: "LIQUIDATION_MODE"
|
|
413
|
+
}),
|
|
414
|
+
/**
|
|
415
|
+
* Debt policy
|
|
416
|
+
* full - liquidate fully
|
|
417
|
+
* debt-only - try to liquidate only debt
|
|
418
|
+
* debt-expired - try to liquidate only debt for expired accounts
|
|
419
|
+
*/
|
|
420
|
+
debtPolicy: z5.enum(["full", "debt-only", "debt-expired"]).default("full").register(zommandRegistry4, {
|
|
421
|
+
flags: "--debt-policy <policy>",
|
|
422
|
+
description: "Liquidate fully/debt only/debt only for expired accounts",
|
|
423
|
+
env: "DEBT_POLICY"
|
|
424
|
+
}),
|
|
425
|
+
/**
|
|
426
|
+
* Whether we should apply loss policy on full liquidation of accounts with bad debt
|
|
427
|
+
*/
|
|
428
|
+
lossPolicy: z5.enum(["only", "never", "fallback"]).default("never").register(zommandRegistry4, {
|
|
429
|
+
flags: "--loss-policy <when>",
|
|
430
|
+
description: "Whether we should apply loss policy on full liquidation of accounts with bad debt",
|
|
431
|
+
env: "LOSS_POLICY"
|
|
432
|
+
})
|
|
433
|
+
}).refine(
|
|
434
|
+
(data) => !(data.optimistic === true && data.lossPolicy === "fallback"),
|
|
435
|
+
{ message: "lossPolicy=fallback is not allowed in optimistic mode" }
|
|
436
|
+
);
|
|
437
|
+
|
|
438
|
+
// src/partial-liquidator.ts
|
|
439
|
+
import {
|
|
440
|
+
boolLike as boolLike2,
|
|
441
|
+
optionalAddressArrayLike as optionalAddressArrayLike2,
|
|
442
|
+
zommandRegistry as zommandRegistry5
|
|
443
|
+
} from "@gearbox-protocol/cli-utils";
|
|
444
|
+
import { z as z6 } from "zod/v4";
|
|
445
|
+
var PartialLiquidatorSchema = z6.object({
|
|
446
|
+
...CommonSchema.shape,
|
|
447
|
+
/**
|
|
448
|
+
* Liquidator mode
|
|
449
|
+
*/
|
|
450
|
+
liquidationMode: z6.literal("partial").register(zommandRegistry5, {
|
|
451
|
+
flags: "--liquidation-mode <mode>",
|
|
452
|
+
description: "Liquidator mode (full/partial/batch/deleverage)",
|
|
453
|
+
env: "LIQUIDATION_MODE"
|
|
454
|
+
}),
|
|
455
|
+
/**
|
|
456
|
+
* Fallback to use full liquidator when partial liquidator fails
|
|
457
|
+
*/
|
|
458
|
+
partialFallback: boolLike2().optional().register(zommandRegistry5, {
|
|
459
|
+
flags: "--partial-fallback",
|
|
460
|
+
description: "Fallback to use full liquidator when partial liquidator fails",
|
|
461
|
+
env: "PARTIAL_FALLBACK"
|
|
462
|
+
}),
|
|
463
|
+
/**
|
|
464
|
+
* Desired HF after partial liquidation, with 4 decimals (100% = 10000)
|
|
465
|
+
*/
|
|
466
|
+
targetPartialHF: z6.coerce.bigint().default(10100n).register(zommandRegistry5, {
|
|
467
|
+
flags: "--target-partial-hf <hf>",
|
|
468
|
+
description: "Desired HF after partial liquidation, with 4 decimals (100% = 10000)",
|
|
469
|
+
env: "TARGET_PARTIAL_HF"
|
|
470
|
+
}),
|
|
471
|
+
/**
|
|
472
|
+
* Optimal HF for partial liquidation will be calculated for accounts with following underlying tokens
|
|
473
|
+
* Takes precedence over targetPartialHF
|
|
474
|
+
*/
|
|
475
|
+
calculatePartialHF: optionalAddressArrayLike2().register(zommandRegistry5, {
|
|
476
|
+
flags: "--calculate-partial-hf <tokens>",
|
|
477
|
+
description: "Optimal HF for partial liquidation will be calculated for accounts with following underlying tokens",
|
|
478
|
+
env: "CALCULATE_PARTIAL_HF"
|
|
479
|
+
})
|
|
480
|
+
}).refine(
|
|
481
|
+
(data) => !(data.optimistic === true && data.partialFallback === true),
|
|
482
|
+
{ message: "partialFallback=true is not allowed in optimistic mode" }
|
|
483
|
+
);
|
|
484
|
+
|
|
485
|
+
// src/schema.ts
|
|
486
|
+
var ConfigSchema = z7.discriminatedUnion("liquidationMode", [
|
|
487
|
+
FullLiquidatorSchema,
|
|
488
|
+
PartialLiquidatorSchema,
|
|
489
|
+
BatchLiquidatorSchema,
|
|
490
|
+
DeleverageLiquidatorSchema
|
|
491
|
+
]);
|
|
492
|
+
export {
|
|
493
|
+
ConfigImplementation,
|
|
494
|
+
ConfigSchema,
|
|
495
|
+
NotificationsConfig
|
|
496
|
+
};
|
|
497
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/config.ts","../src/notifications.ts","../src/schema.ts","../src/batch-liquidator.ts","../src/common.ts","../src/deleverage-liquidator.ts","../src/full-liquidator.ts","../src/partial-liquidator.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 { 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","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 {\n addressLike,\n boolLike,\n CensoredString,\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 * These accounts will not be liquidated\n */\n ignoreAccounts: optionalAddressArrayLike().register(zommandRegistry, {\n flags: \"--ignore-accounts <addresses...>\",\n description: \"These accounts will not be liquidated\",\n env: \"IGNORE_ACCOUNTS\",\n }),\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 * 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 */\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 .register(zommandRegistry, {\n flags: \"--private-key <key>\",\n description: \"Private key used to send liquidation transactions\",\n env: \"PRIVATE_KEY\",\n }),\n /**\n * If balance drops before this value - we should send notification\n */\n minBalance: z.coerce\n .bigint()\n .positive()\n .default(500000000000000000n)\n .register(zommandRegistry, {\n flags: \"--min-balance <balance>\",\n description: \"Minimum balance to liquidate\",\n env: \"MIN_BALANCE\",\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 /**\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 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 * Whether we should apply loss policy on full liquidation of accounts with bad debt\n */\n lossPolicy: z\n .enum([\"only\", \"never\", \"fallback\"])\n .default(\"never\")\n .register(zommandRegistry, {\n flags: \"--loss-policy <when>\",\n description:\n \"Whether we should apply loss policy on full liquidation of accounts with bad debt\",\n env: \"LOSS_POLICY\",\n }),\n })\n .refine(\n data => !(data.optimistic === true && data.lossPolicy === \"fallback\"),\n { message: \"lossPolicy=fallback is not allowed in optimistic mode\" },\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"],"mappings":";AAAA,SAAS,0BAA0C;AAc5C,IAAM,uBAAN,MAA2B;AAAA,EAChC;AAAA,EACA;AAAA,EAEA,YAAY,QAAsB;AAChC,WAAO,OAAO,MAAM,MAAM;AAAA,EAC5B;AAAA,EAEA,MAAa,WAAW,WAAqC;AAC3D,UAAM,SAAS,mBAAmB;AAAA,MAChC;AAAA,MACA,MAAM;AAAA,IACR,CAAC;AAED,UAAM,CAAC,YAAY,OAAO,IAAI,MAAM,QAAQ,IAAI;AAAA,MAC9C,OAAO,eAAe;AAAA,MACtB,OAAO,WAAW;AAAA,IACpB,CAAC;AAED,SAAK,cAAc;AACnB,SAAK,WAAW;AAAA,EAClB;AAAA,EAEA,IAAW,aAAqB;AAC9B,QAAI,KAAK,gBAAgB,QAAW;AAClC,YAAM,IAAI,MAAM,wBAAwB;AAAA,IAC1C;AACA,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAW,UAAkB;AAC3B,QAAI,KAAK,aAAa,QAAW;AAC/B,YAAM,IAAI,MAAM,wBAAwB;AAAA,IAC1C;AACA,WAAO,KAAK;AAAA,EACd;AACF;;;AClDA,SAAS,0BAA0B;AAEnC,SAAS,SAAS;AAElB,IAAM,kBAAkB,mBAAmB,QAAQ;AAAA,EAAI,OACrD,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA,IAIP,SAAS,EAAE,OAAgB,OAAK,OAAO,MAAM,QAAQ,EAAE,SAAS;AAAA,EAClE,CAAC;AACH;AAEO,IAAM,s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andRegistry","zommandRegistry","z","z","zommandRegistry","boolLike","optionalAddressArrayLike","zommandRegistry","z","z","zommandRegistry","boolLike","optionalAddressArrayLike","z"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gearbox-protocol/liquidator-v2-config",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Configuration schemas and optimistic result types for Gearbox liquidator v2",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.mjs"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
|
+
},
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@gearbox-protocol/cli-utils": "^6.9.0",
|
|
25
|
+
"zod": "^4.4.3"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"@gearbox-protocol/sdk": ">=14.8.1",
|
|
29
|
+
"viem": ">=2.48.8"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"tsup": "^8.5.0",
|
|
33
|
+
"typescript": "^6.0.3"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsup"
|
|
37
|
+
},
|
|
38
|
+
"main": "./dist/index.mjs",
|
|
39
|
+
"types": "./dist/index.d.ts"
|
|
40
|
+
}
|